Fehlerbehebung EpizentrumRechnung
This commit is contained in:
1 parent
9f1f243f50
commit
ba9e3d5aa7
5 files changed
+143
-8
No files matched your search
@@ -32,7 +32,9 @@ import com.google.firebase.database.FirebaseDatabase;
|
||||
import de.edotzlaff.detection.detektion.Detektionssignal;
|
||||
import de.edotzlaff.detection.detektion.Epizentrum;
|
||||
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.UTM2Deg;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
@@ -140,6 +142,9 @@ public class EarthquakeLocation extends FragmentActivity implements OnMapReadyCa
|
||||
}
|
||||
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, "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();
|
||||
double breitengrad = Double.parseDouble(breitengradString);
|
||||
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);
|
||||
|
||||
//Welle in m/s
|
||||
|
||||
@@ -17,7 +17,7 @@ import java.util.Objects;
|
||||
public class Erdbeben {
|
||||
|
||||
//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 Epizentrum epizentrum;
|
||||
|
||||
+7
-6
@@ -26,9 +26,9 @@ import java.util.Set;
|
||||
public class EpizentrumRechnung {
|
||||
|
||||
//ToDo Schrittweite und Abstand auf Szenario anpassen
|
||||
private static final double SCHRITTWEITE = 0.000050;
|
||||
private static final double MAX_ABSTAND = 0.000058;
|
||||
private static final int DOUBLESTELLEN = 24;
|
||||
private static final double SCHRITTWEITE = 20;
|
||||
private static final double MAX_ABSTAND = 5;
|
||||
private static final int DOUBLESTELLEN = 15;
|
||||
private static final int SCHLEIFENDURCHLAUFTE = 5000;
|
||||
|
||||
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()
|
||||
- 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);
|
||||
Endpunkt tempEndpunkt = new Endpunkt(aufzeichnung.getDeviceId());
|
||||
@@ -154,11 +154,12 @@ public class EpizentrumRechnung {
|
||||
double x = 0;
|
||||
double y = 0;
|
||||
for (Schnittpunkt s : schnittpunkte) {
|
||||
Log.i(TAG, "Koordinaten der Schnittpunkte: "+ s.getKoordinaten().getX() + " " + s.getKoordinaten().getY());
|
||||
x+= s.getKoordinaten().getX();
|
||||
y+= s.getKoordinaten().getY();
|
||||
}
|
||||
x = new BigDecimal(x/schnittpunkte.size()).setScale(DOUBLESTELLEN, RoundingMode.HALF_UP).doubleValue()*0.999308681;
|
||||
y = new BigDecimal(y/schnittpunkte.size()).setScale(DOUBLESTELLEN, RoundingMode.HALF_UP).doubleValue()*1.000831381;
|
||||
x = new BigDecimal(x/schnittpunkte.size()).setScale(DOUBLESTELLEN, RoundingMode.HALF_UP).doubleValue();
|
||||
y = new BigDecimal(y/schnittpunkte.size()).setScale(DOUBLESTELLEN, RoundingMode.HALF_UP).doubleValue();
|
||||
return new Koordinaten(x,y);
|
||||
}
|
||||
|
||||
|
||||
+76
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
package de.edotzlaff.detection.detektion.berechnung.mathObjekte;
|
||||
|
||||
public class UTM2Deg {
|
||||
|
||||
double latitude;
|
||||
double longitude;
|
||||
|
||||
|
||||
public void convertToDeg(int zone, char letter, double easting, double northing)
|
||||
{
|
||||
int Zone=zone;
|
||||
char Letter=letter;
|
||||
double Easting=easting;
|
||||
double Northing=northing;
|
||||
double Hem;
|
||||
if (Letter>'M')
|
||||
Hem='N';
|
||||
else
|
||||
Hem='S';
|
||||
double north;
|
||||
if (Hem == 'S')
|
||||
north = Northing - 10000000;
|
||||
else
|
||||
north = Northing;
|
||||
latitude = (north/6366197.724/0.9996+(1+0.006739496742*Math.pow(Math.cos(north/6366197.724/0.9996),2)-0.006739496742*Math.sin(north/6366197.724/0.9996)*Math.cos(north/6366197.724/0.9996)*(Math.atan(Math.cos(Math.atan(( Math.exp((Easting - 500000) / (0.9996*6399593.625/Math.sqrt((1+0.006739496742*Math.pow(Math.cos(north/6366197.724/0.9996),2))))*(1-0.006739496742*Math.pow((Easting - 500000) / (0.9996*6399593.625/Math.sqrt((1+0.006739496742*Math.pow(Math.cos(north/6366197.724/0.9996),2)))),2)/2*Math.pow(Math.cos(north/6366197.724/0.9996),2)/3))-Math.exp(-(Easting-500000)/(0.9996*6399593.625/Math.sqrt((1+0.006739496742*Math.pow(Math.cos(north/6366197.724/0.9996),2))))*( 1 - 0.006739496742*Math.pow((Easting - 500000) / (0.9996*6399593.625/Math.sqrt((1+0.006739496742*Math.pow(Math.cos(north/6366197.724/0.9996),2)))),2)/2*Math.pow(Math.cos(north/6366197.724/0.9996),2)/3)))/2/Math.cos((north-0.9996*6399593.625*(north/6366197.724/0.9996-0.006739496742*3/4*(north/6366197.724/0.9996+Math.sin(2*north/6366197.724/0.9996)/2)+Math.pow(0.006739496742*3/4,2)*5/3*(3*(north/6366197.724/0.9996+Math.sin(2*north/6366197.724/0.9996 )/2)+Math.sin(2*north/6366197.724/0.9996)*Math.pow(Math.cos(north/6366197.724/0.9996),2))/4-Math.pow(0.006739496742*3/4,3)*35/27*(5*(3*(north/6366197.724/0.9996+Math.sin(2*north/6366197.724/0.9996)/2)+Math.sin(2*north/6366197.724/0.9996)*Math.pow(Math.cos(north/6366197.724/0.9996),2))/4+Math.sin(2*north/6366197.724/0.9996)*Math.pow(Math.cos(north/6366197.724/0.9996),2)*Math.pow(Math.cos(north/6366197.724/0.9996),2))/3))/(0.9996*6399593.625/Math.sqrt((1+0.006739496742*Math.pow(Math.cos(north/6366197.724/0.9996),2))))*(1-0.006739496742*Math.pow((Easting-500000)/(0.9996*6399593.625/Math.sqrt((1+0.006739496742*Math.pow(Math.cos(north/6366197.724/0.9996),2)))),2)/2*Math.pow(Math.cos(north/6366197.724/0.9996),2))+north/6366197.724/0.9996)))*Math.tan((north-0.9996*6399593.625*(north/6366197.724/0.9996 - 0.006739496742*3/4*(north/6366197.724/0.9996+Math.sin(2*north/6366197.724/0.9996)/2)+Math.pow(0.006739496742*3/4,2)*5/3*(3*(north/6366197.724/0.9996+Math.sin(2*north/6366197.724/0.9996)/2)+Math.sin(2*north/6366197.724/0.9996 )*Math.pow(Math.cos(north/6366197.724/0.9996),2))/4-Math.pow(0.006739496742*3/4,3)*35/27*(5*(3*(north/6366197.724/0.9996+Math.sin(2*north/6366197.724/0.9996)/2)+Math.sin(2*north/6366197.724/0.9996)*Math.pow(Math.cos(north/6366197.724/0.9996),2))/4+Math.sin(2*north/6366197.724/0.9996)*Math.pow(Math.cos(north/6366197.724/0.9996),2)*Math.pow(Math.cos(north/6366197.724/0.9996),2))/3))/(0.9996*6399593.625/Math.sqrt((1+0.006739496742*Math.pow(Math.cos(north/6366197.724/0.9996),2))))*(1-0.006739496742*Math.pow((Easting-500000)/(0.9996*6399593.625/Math.sqrt((1+0.006739496742*Math.pow(Math.cos(north/6366197.724/0.9996),2)))),2)/2*Math.pow(Math.cos(north/6366197.724/0.9996),2))+north/6366197.724/0.9996))-north/6366197.724/0.9996)*3/2)*(Math.atan(Math.cos(Math.atan((Math.exp((Easting-500000)/(0.9996*6399593.625/Math.sqrt((1+0.006739496742*Math.pow(Math.cos(north/6366197.724/0.9996),2))))*(1-0.006739496742*Math.pow((Easting-500000)/(0.9996*6399593.625/Math.sqrt((1+0.006739496742*Math.pow(Math.cos(north/6366197.724/0.9996),2)))),2)/2*Math.pow(Math.cos(north/6366197.724/0.9996),2)/3))-Math.exp(-(Easting-500000)/(0.9996*6399593.625/Math.sqrt((1+0.006739496742*Math.pow(Math.cos(north/6366197.724/0.9996),2))))*(1-0.006739496742*Math.pow((Easting-500000)/(0.9996*6399593.625/Math.sqrt((1+0.006739496742*Math.pow(Math.cos(north/6366197.724/0.9996),2)))),2)/2*Math.pow(Math.cos(north/6366197.724/0.9996),2)/3)))/2/Math.cos((north-0.9996*6399593.625*(north/6366197.724/0.9996-0.006739496742*3/4*(north/6366197.724/0.9996+Math.sin(2*north/6366197.724/0.9996)/2)+Math.pow(0.006739496742*3/4,2)*5/3*(3*(north/6366197.724/0.9996+Math.sin(2*north/6366197.724/0.9996)/2)+Math.sin(2*north/6366197.724/0.9996)*Math.pow(Math.cos(north/6366197.724/0.9996),2))/4-Math.pow(0.006739496742*3/4,3)*35/27*(5*(3*(north/6366197.724/0.9996+Math.sin(2*north/6366197.724/0.9996)/2)+Math.sin(2*north/6366197.724/0.9996)*Math.pow(Math.cos(north/6366197.724/0.9996),2))/4+Math.sin(2*north/6366197.724/0.9996)*Math.pow(Math.cos(north/6366197.724/0.9996),2)*Math.pow(Math.cos(north/6366197.724/0.9996),2))/3))/(0.9996*6399593.625/Math.sqrt((1+0.006739496742*Math.pow(Math.cos(north/6366197.724/0.9996),2))))*(1-0.006739496742*Math.pow((Easting-500000)/(0.9996*6399593.625/Math.sqrt((1+0.006739496742*Math.pow(Math.cos(north/6366197.724/0.9996),2)))),2)/2*Math.pow(Math.cos(north/6366197.724/0.9996),2))+north/6366197.724/0.9996)))*Math.tan((north-0.9996*6399593.625*(north/6366197.724/0.9996-0.006739496742*3/4*(north/6366197.724/0.9996+Math.sin(2*north/6366197.724/0.9996)/2)+Math.pow(0.006739496742*3/4,2)*5/3*(3*(north/6366197.724/0.9996+Math.sin(2*north/6366197.724/0.9996)/2)+Math.sin(2*north/6366197.724/0.9996)*Math.pow(Math.cos(north/6366197.724/0.9996),2))/4-Math.pow(0.006739496742*3/4,3)*35/27*(5*(3*(north/6366197.724/0.9996+Math.sin(2*north/63Line truncated
|
||||
latitude=Math.round(latitude*10000000);
|
||||
latitude=latitude/10000000;
|
||||
longitude =Math.atan((Math.exp((Easting-500000)/(0.9996*6399593.625/Math.sqrt((1+0.006739496742*Math.pow(Math.cos(north/6366197.724/0.9996),2))))*(1-0.006739496742*Math.pow((Easting-500000)/(0.9996*6399593.625/Math.sqrt((1+0.006739496742*Math.pow(Math.cos(north/6366197.724/0.9996),2)))),2)/2*Math.pow(Math.cos(north/6366197.724/0.9996),2)/3))-Math.exp(-(Easting-500000)/(0.9996*6399593.625/Math.sqrt((1+0.006739496742*Math.pow(Math.cos(north/6366197.724/0.9996),2))))*(1-0.006739496742*Math.pow((Easting-500000)/(0.9996*6399593.625/Math.sqrt((1+0.006739496742*Math.pow(Math.cos(north/6366197.724/0.9996),2)))),2)/2*Math.pow(Math.cos(north/6366197.724/0.9996),2)/3)))/2/Math.cos((north-0.9996*6399593.625*( north/6366197.724/0.9996-0.006739496742*3/4*(north/6366197.724/0.9996+Math.sin(2*north/6366197.724/0.9996)/2)+Math.pow(0.006739496742*3/4,2)*5/3*(3*(north/6366197.724/0.9996+Math.sin(2*north/6366197.724/0.9996)/2)+Math.sin(2* north/6366197.724/0.9996)*Math.pow(Math.cos(north/6366197.724/0.9996),2))/4-Math.pow(0.006739496742*3/4,3)*35/27*(5*(3*(north/6366197.724/0.9996+Math.sin(2*north/6366197.724/0.9996)/2)+Math.sin(2*north/6366197.724/0.9996)*Math.pow(Math.cos(north/6366197.724/0.9996),2))/4+Math.sin(2*north/6366197.724/0.9996)*Math.pow(Math.cos(north/6366197.724/0.9996),2)*Math.pow(Math.cos(north/6366197.724/0.9996),2))/3)) / (0.9996*6399593.625/Math.sqrt((1+0.006739496742*Math.pow(Math.cos(north/6366197.724/0.9996),2))))*(1-0.006739496742*Math.pow((Easting-500000)/(0.9996*6399593.625/Math.sqrt((1+0.006739496742*Math.pow(Math.cos(north/6366197.724/0.9996),2)))),2)/2*Math.pow(Math.cos(north/6366197.724/0.9996),2))+north/6366197.724/0.9996))*180/Math.PI+Zone*6-183;
|
||||
longitude=Math.round(longitude*10000000);
|
||||
longitude=longitude/10000000;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public double getLatitude() {
|
||||
return latitude;
|
||||
}
|
||||
|
||||
public void setLatitude(double latitude) {
|
||||
this.latitude = latitude;
|
||||
}
|
||||
|
||||
public double getLongitude() {
|
||||
return longitude;
|
||||
}
|
||||
|
||||
public void setLongitude(double longitude) {
|
||||
this.longitude = longitude;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user