zusammenfügen
This commit is contained in:
121
Berechnungen.py
121
Berechnungen.py
@@ -1,6 +1,8 @@
|
||||
import sympy as sp
|
||||
from decimal import Decimal
|
||||
import math
|
||||
import numpy as np
|
||||
import Datenbank
|
||||
|
||||
class Berechnungen:
|
||||
def __init__(self, a, b):
|
||||
@@ -16,31 +18,130 @@ class Berechnungen:
|
||||
return (self.a_wert**2 - self.b_wert**2) / self.b_wert **2
|
||||
|
||||
def P(self, x, y):
|
||||
return sp.sqrt(x**2 + y**2)
|
||||
return np.sqrt(x**2 + y**2)
|
||||
|
||||
def hilfswinkel(self, z, x, y):
|
||||
hw = sp.atan2(z * self.a_wert, self.P(x, y) * self.b_wert)
|
||||
def hilfswinkel(self, x, y, z):
|
||||
hw = np.atan2(z * self.a_wert, self.P(x, y) * self.b_wert)
|
||||
return hw
|
||||
|
||||
def B(self, z, x, y):
|
||||
hilfswinkel = self.hilfswinkel(z, x, y)
|
||||
B = sp.atan2((z + self.e_strich_quadrat_wert * self.b_wert * sp.sin(hilfswinkel) ** 3), (self.P(x, y) - self.e_quadrat_wert * self.a_wert * sp.cos(hilfswinkel) ** 3))
|
||||
def B(self, x, y, z):
|
||||
hilfswinkel = self.hilfswinkel(x, y, z)
|
||||
B = np.atan2((z + self.e_strich_quadrat_wert * self.b_wert * np.sin(hilfswinkel) ** 3), (self.P(x, y) - self.e_quadrat_wert * self.a_wert * np.cos(hilfswinkel) ** 3))
|
||||
return B
|
||||
|
||||
def L(self, x, y):
|
||||
return sp.atan2(y, x)
|
||||
return np.atan2(y, x)
|
||||
|
||||
def H(self, x, y, z):
|
||||
B = self.B(z, x, y)
|
||||
H = (self.P(x, y) / sp.cos(B)) - self.a_wert / (sp.sqrt(1 - self.e_quadrat_wert * sp.sin(B) ** 2))
|
||||
B = self.B(x, y, z)
|
||||
H = (self.P(x, y) / np.cos(B)) - self.a_wert / (np.sqrt(1 - self.e_quadrat_wert * np.sin(B) ** 2))
|
||||
return H
|
||||
|
||||
def E(self, L, dX, dY):
|
||||
E = -np.sin(L) * dX + np.cos(L) * dY
|
||||
return E
|
||||
|
||||
def N(self, B, L, dX, dY, dZ):
|
||||
N = -np.sin(B) * np.cos(L) * dX - np.sin(B) * np.sin(L) * dY + np.cos(B) * dZ
|
||||
return N
|
||||
|
||||
def U(self, B, L, dX, dY, dZ):
|
||||
U = np.cos(B) * np.cos(L) * dX + np.cos(B) * np.sin(L) *dY + np.sin(B) * dZ
|
||||
return U
|
||||
|
||||
def horizontalstrecke_ENU(self, E, N):
|
||||
s = np.sqrt(E**2 + N**2)
|
||||
return s
|
||||
|
||||
def Zenitwinkel(self, horizontalstrecke_ENU, U):
|
||||
zw = np.atan2(horizontalstrecke_ENU, U)
|
||||
return zw
|
||||
|
||||
def Azimut(self, E, N):
|
||||
Azimut = np.atan2(E, N)
|
||||
if Azimut < 0:
|
||||
Azimut += 2 * np.pi
|
||||
if Azimut > 2 * np.pi:
|
||||
Azimut -= 2 * np.pi
|
||||
return Azimut
|
||||
|
||||
def Richtung(self, Azimut, Orientierung):
|
||||
Richtung = Azimut - Orientierung
|
||||
if Richtung < 0:
|
||||
Richtung += 2 * np.pi
|
||||
if Richtung > 2 * np.pi:
|
||||
Richtung -= 2 * np.pi
|
||||
return Richtung
|
||||
|
||||
def geometrische_breite_laenge(self, dict_koordinaten):
|
||||
for punktnummer, matrix in dict_koordinaten.items():
|
||||
|
||||
dict_koordinaten[punktnummer] = [matrix, self.B(matrix[2], matrix[0], matrix[1]), self.L(matrix[0], matrix[1])]
|
||||
dict_koordinaten[punktnummer] = [matrix, self.B(matrix[0], matrix[1], matrix[2]), self.L(matrix[0], matrix[1])]
|
||||
return dict_koordinaten
|
||||
|
||||
def berechnung_richtung_azimut_zenitwinkel(self, pfad_datenbank, dict_koordinaten):
|
||||
dict_koordinaten_erweitert = {}
|
||||
dict_orientierungen = {}
|
||||
liste_azimut_richtungen = []
|
||||
db_zugriff = Datenbank.Datenbankzugriff(pfad_datenbank)
|
||||
liste_beobachtungen_tachymeter = db_zugriff.get_beobachtungen_from_beobachtungenid()
|
||||
|
||||
for punktnummer, koordinaten in dict_koordinaten.items():
|
||||
X = float(koordinaten[0])
|
||||
Y = float(koordinaten[1])
|
||||
Z = float(koordinaten[2])
|
||||
|
||||
P = self.P(X, Y)
|
||||
hilfwinkel = self.hilfswinkel(X, Y, Z)
|
||||
B = self.B(X, Y, Z)
|
||||
L = self.L(X, Y)
|
||||
H = self.H(X, Y, Z)
|
||||
|
||||
dict_koordinaten_erweitert[punktnummer] = koordinaten, P, hilfwinkel, B, L, H
|
||||
|
||||
beobachtsgruppeID_vorher = None
|
||||
for beobachtung_tachymeter in liste_beobachtungen_tachymeter:
|
||||
standpunkt = beobachtung_tachymeter[0]
|
||||
zielpunkt = beobachtung_tachymeter[1]
|
||||
|
||||
X1 = dict_koordinaten[beobachtung_tachymeter[0]][0]
|
||||
X2 = dict_koordinaten[beobachtung_tachymeter[1]][0]
|
||||
Y1 = dict_koordinaten[beobachtung_tachymeter[0]][1]
|
||||
Y2 = dict_koordinaten[beobachtung_tachymeter[1]][1]
|
||||
Z1 = dict_koordinaten[beobachtung_tachymeter[0]][2]
|
||||
Z2 = dict_koordinaten[beobachtung_tachymeter[1]][2]
|
||||
|
||||
dX = float(X2 - X1)
|
||||
dY = float(Y2 - Y1)
|
||||
dZ = float(Z2 - Z1)
|
||||
|
||||
B = float(dict_koordinaten_erweitert[beobachtung_tachymeter[0]][3])
|
||||
L = float(dict_koordinaten_erweitert[beobachtung_tachymeter[0]][4])
|
||||
|
||||
E = self.E(L, dX, dY)
|
||||
N = self.N(B, L, dX, dY, dZ)
|
||||
U = self.U(B, L, dX, dY, dZ)
|
||||
|
||||
horizontalstrecke_ENU = self.horizontalstrecke_ENU(E, N)
|
||||
Azimut = float(self.Azimut(E, N))
|
||||
Zenitwinkel = float(self.Zenitwinkel(horizontalstrecke_ENU, U))
|
||||
|
||||
beobachtsgruppeID_aktuell = beobachtung_tachymeter[3]
|
||||
if beobachtsgruppeID_aktuell == beobachtsgruppeID_vorher:
|
||||
richtung = float(self.Richtung(Azimut, orientierung))
|
||||
liste_azimut_richtungen.append((standpunkt, zielpunkt, Azimut, richtung, Zenitwinkel))
|
||||
|
||||
else:
|
||||
orientierung = Azimut
|
||||
dict_orientierungen[beobachtsgruppeID_aktuell] = orientierung
|
||||
|
||||
richtung = float(self.Richtung(Azimut, orientierung))
|
||||
liste_azimut_richtungen.append((standpunkt, zielpunkt, Azimut, richtung, Zenitwinkel))
|
||||
|
||||
beobachtsgruppeID_vorher = beobachtsgruppeID_aktuell
|
||||
return liste_azimut_richtungen, dict_orientierungen
|
||||
|
||||
|
||||
class Einheitenumrechnung:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user