Fehlerbehebung EpizentrumRechnung

This commit is contained in:
Jan Gabriel Kunze 2021-06-26 16:24:58 +02:00
parent 9f1f243f50
commit ba9e3d5aa7
5 changed files with 143 additions and 8 deletions

View File

@ -32,7 +32,9 @@ import com.google.firebase.database.FirebaseDatabase;
import de.edotzlaff.detection.detektion.Detektionssignal; import de.edotzlaff.detection.detektion.Detektionssignal;
import de.edotzlaff.detection.detektion.Epizentrum; import de.edotzlaff.detection.detektion.Epizentrum;
import de.edotzlaff.detection.detektion.Erdbeben; import de.edotzlaff.detection.detektion.Erdbeben;
import de.edotzlaff.detection.detektion.berechnung.mathObjekte.Deg2UTM;
import de.edotzlaff.detection.detektion.berechnung.mathObjekte.Koordinaten; import de.edotzlaff.detection.detektion.berechnung.mathObjekte.Koordinaten;
import de.edotzlaff.detection.detektion.berechnung.mathObjekte.UTM2Deg;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
@ -140,6 +142,9 @@ public class EarthquakeLocation extends FragmentActivity implements OnMapReadyCa
} }
else else
{ {
UTM2Deg utm2Deg = new UTM2Deg();
utm2Deg.convertToDeg(32,'U',epizentrum.getKoordinaten().getX(),epizentrum.getKoordinaten().getY());
epizentrum.getKoordinaten().setLocation(utm2Deg.getLatitude(), utm2Deg.getLongitude());
Log.i(TAGEPIZENTRUM, "Epizentrum konnte ermittelt werden, Koordinaten: " + epizentrum.getKoordinaten().getX() + " " + epizentrum.getKoordinaten().getY()); Log.i(TAGEPIZENTRUM, "Epizentrum konnte ermittelt werden, Koordinaten: " + epizentrum.getKoordinaten().getX() + " " + epizentrum.getKoordinaten().getY());
Log.i(TAGEPIZENTRUM, "Enstehungszeitpunkt: " + epizentrum.getEntstehungsZeitpunkt()); Log.i(TAGEPIZENTRUM, "Enstehungszeitpunkt: " + epizentrum.getEntstehungsZeitpunkt());
} }
@ -171,7 +176,10 @@ public class EarthquakeLocation extends FragmentActivity implements OnMapReadyCa
String laengengradString = data.child("IDG" + i).child("e_laengengrad").getValue().toString(); String laengengradString = data.child("IDG" + i).child("e_laengengrad").getValue().toString();
double breitengrad = Double.parseDouble(breitengradString); double breitengrad = Double.parseDouble(breitengradString);
double laengengrad = Double.parseDouble(laengengradString); double laengengrad = Double.parseDouble(laengengradString);
Koordinaten koordinaten = new Koordinaten(breitengrad, laengengrad);
Deg2UTM deg2UTM = new Deg2UTM(breitengrad, laengengrad);
Koordinaten koordinaten = new Koordinaten(deg2UTM.getEasting(), deg2UTM.getNorthing());
detektionssignal.setKoordinaten(koordinaten); detektionssignal.setKoordinaten(koordinaten);
//Welle in m/s //Welle in m/s

View File

@ -17,7 +17,7 @@ import java.util.Objects;
public class Erdbeben { public class Erdbeben {
//ToDO anpassen an Szenario umso mehr umso wahrscheinlich ein Ergebnis, oder Abbruchbedingung mit do while //ToDO anpassen an Szenario umso mehr umso wahrscheinlich ein Ergebnis, oder Abbruchbedingung mit do while
public static final Integer SCHLEIFENDURCHLAUFTE = 8000; public static final Integer SCHLEIFENDURCHLAUFTE = 2000;
private static final String TAG = "ERDBEBEN"; private static final String TAG = "ERDBEBEN";
private Epizentrum epizentrum; private Epizentrum epizentrum;

View File

@ -26,9 +26,9 @@ import java.util.Set;
public class EpizentrumRechnung { public class EpizentrumRechnung {
//ToDo Schrittweite und Abstand auf Szenario anpassen //ToDo Schrittweite und Abstand auf Szenario anpassen
private static final double SCHRITTWEITE = 0.000050; private static final double SCHRITTWEITE = 20;
private static final double MAX_ABSTAND = 0.000058; private static final double MAX_ABSTAND = 5;
private static final int DOUBLESTELLEN = 24; private static final int DOUBLESTELLEN = 15;
private static final int SCHLEIFENDURCHLAUFTE = 5000; private static final int SCHLEIFENDURCHLAUFTE = 5000;
private static final String TAG = "EPIZENTRUMRECHNUNG"; private static final String TAG = "EPIZENTRUMRECHNUNG";
@ -41,7 +41,7 @@ public class EpizentrumRechnung {
int zeitunterschied = aufzeichnung.getAnkunftsZeit().getHour() * 3600 + aufzeichnung.getAnkunftsZeit().getMinute() * 60 + aufzeichnung.getAnkunftsZeit().getSecond() int zeitunterschied = aufzeichnung.getAnkunftsZeit().getHour() * 3600 + aufzeichnung.getAnkunftsZeit().getMinute() * 60 + aufzeichnung.getAnkunftsZeit().getSecond()
- ersteMessung.getAnkunftsZeit().getHour() * 3600 - ersteMessung.getAnkunftsZeit().getMinute() * 60 - ersteMessung.getAnkunftsZeit().getSecond(); - ersteMessung.getAnkunftsZeit().getHour() * 3600 - ersteMessung.getAnkunftsZeit().getMinute() * 60 - ersteMessung.getAnkunftsZeit().getSecond();
double startradius = zeitunterschied * aufzeichnung.getGeschwErdbeben()*0.0000114130224932113000000; double startradius = zeitunterschied * aufzeichnung.getGeschwErdbeben();
Log.i(TAG, "Init Daten: " + aufzeichnung.getDeviceId() + "Startradius: " + startradius); Log.i(TAG, "Init Daten: " + aufzeichnung.getDeviceId() + "Startradius: " + startradius);
Endpunkt tempEndpunkt = new Endpunkt(aufzeichnung.getDeviceId()); Endpunkt tempEndpunkt = new Endpunkt(aufzeichnung.getDeviceId());
@ -154,11 +154,12 @@ public class EpizentrumRechnung {
double x = 0; double x = 0;
double y = 0; double y = 0;
for (Schnittpunkt s : schnittpunkte) { for (Schnittpunkt s : schnittpunkte) {
Log.i(TAG, "Koordinaten der Schnittpunkte: "+ s.getKoordinaten().getX() + " " + s.getKoordinaten().getY());
x+= s.getKoordinaten().getX(); x+= s.getKoordinaten().getX();
y+= s.getKoordinaten().getY(); y+= s.getKoordinaten().getY();
} }
x = new BigDecimal(x/schnittpunkte.size()).setScale(DOUBLESTELLEN, RoundingMode.HALF_UP).doubleValue()*0.999308681; x = new BigDecimal(x/schnittpunkte.size()).setScale(DOUBLESTELLEN, RoundingMode.HALF_UP).doubleValue();
y = new BigDecimal(y/schnittpunkte.size()).setScale(DOUBLESTELLEN, RoundingMode.HALF_UP).doubleValue()*1.000831381; y = new BigDecimal(y/schnittpunkte.size()).setScale(DOUBLESTELLEN, RoundingMode.HALF_UP).doubleValue();
return new Koordinaten(x,y); return new Koordinaten(x,y);
} }

View File

@ -0,0 +1,76 @@
package de.edotzlaff.detection.detektion.berechnung.mathObjekte;
public class Deg2UTM {
double Easting;
double Northing;
int Zone;
char Letter;
public Deg2UTM(double Lat, double Lon) {
Zone = (int) Math.floor(Lon / 6 + 31);
if (Lat < -72)
Letter = 'C';
else if (Lat < -64)
Letter = 'D';
else if (Lat < -56)
Letter = 'E';
else if (Lat < -48)
Letter = 'F';
else if (Lat < -40)
Letter = 'G';
else if (Lat < -32)
Letter = 'H';
else if (Lat < -24)
Letter = 'J';
else if (Lat < -16)
Letter = 'K';
else if (Lat < -8)
Letter = 'L';
else if (Lat < 0)
Letter = 'M';
else if (Lat < 8)
Letter = 'N';
else if (Lat < 16)
Letter = 'P';
else if (Lat < 24)
Letter = 'Q';
else if (Lat < 32)
Letter = 'R';
else if (Lat < 40)
Letter = 'S';
else if (Lat < 48)
Letter = 'T';
else if (Lat < 56)
Letter = 'U';
else if (Lat < 64)
Letter = 'V';
else if (Lat < 72)
Letter = 'W';
else
Letter = 'X';
Easting = 0.5 * Math.log((1 + Math.cos(Lat * Math.PI / 180) * Math.sin(Lon * Math.PI / 180 - (6 * Zone - 183) * Math.PI / 180)) / (1 - Math.cos(Lat * Math.PI / 180) * Math.sin(Lon * Math.PI / 180 - (6 * Zone - 183) * Math.PI / 180))) * 0.9996 * 6399593.62 / Math.pow((1 + Math.pow(0.0820944379, 2) * Math.pow(Math.cos(Lat * Math.PI / 180), 2)), 0.5) * (1 + Math.pow(0.0820944379, 2) / 2 * Math.pow((0.5 * Math.log((1 + Math.cos(Lat * Math.PI / 180) * Math.sin(Lon * Math.PI / 180 - (6 * Zone - 183) * Math.PI / 180)) / (1 - Math.cos(Lat * Math.PI / 180) * Math.sin(Lon * Math.PI / 180 - (6 * Zone - 183) * Math.PI / 180)))), 2) * Math.pow(Math.cos(Lat * Math.PI / 180), 2) / 3) + 500000;
Easting = Math.round(Easting * 100) * 0.01;
Northing = (Math.atan(Math.tan(Lat * Math.PI / 180) / Math.cos((Lon * Math.PI / 180 - (6 * Zone - 183) * Math.PI / 180))) - Lat * Math.PI / 180) * 0.9996 * 6399593.625 / Math.sqrt(1 + 0.006739496742 * Math.pow(Math.cos(Lat * Math.PI / 180), 2)) * (1 + 0.006739496742 / 2 * Math.pow(0.5 * Math.log((1 + Math.cos(Lat * Math.PI / 180) * Math.sin((Lon * Math.PI / 180 - (6 * Zone - 183) * Math.PI / 180))) / (1 - Math.cos(Lat * Math.PI / 180) * Math.sin((Lon * Math.PI / 180 - (6 * Zone - 183) * Math.PI / 180)))), 2) * Math.pow(Math.cos(Lat * Math.PI / 180), 2)) + 0.9996 * 6399593.625 * (Lat * Math.PI / 180 - 0.005054622556 * (Lat * Math.PI / 180 + Math.sin(2 * Lat * Math.PI / 180) / 2) + 4.258201531e-05 * (3 * (Lat * Math.PI / 180 + Math.sin(2 * Lat * Math.PI / 180) / 2) + Math.sin(2 * Lat * Math.PI / 180) * Math.pow(Math.cos(Lat * Math.PI / 180), 2)) / 4 - 1.674057895e-07 * (5 * (3 * (Lat * Math.PI / 180 + Math.sin(2 * Lat * Math.PI / 180) / 2) + Math.sin(2 * Lat * Math.PI / 180) * Math.pow(Math.cos(Lat * Math.PI / 180), 2)) / 4 + Math.sin(2 * Lat * Math.PI / 180) * Math.pow(Math.cos(Lat * Math.PI / 180), 2) * Math.pow(Math.cos(Lat * Math.PI / 180), 2)) / 3);
if (Letter < 'M')
Northing = Northing + 10000000;
Northing = Math.round(Northing * 100) * 0.01;
}
public double getEasting() {
return Easting;
}
public void setEasting(double easting) {
Easting = easting;
}
public double getNorthing() {
return Northing;
}
public void setNorthing(double northing) {
Northing = northing;
}
}

File diff suppressed because one or more lines are too long