Zusammentragen
This commit is contained in:
2
.idea/Masterprojekt-Campusnetz.iml
generated
2
.idea/Masterprojekt-Campusnetz.iml
generated
@@ -4,7 +4,7 @@
|
|||||||
<content url="file://$MODULE_DIR$">
|
<content url="file://$MODULE_DIR$">
|
||||||
<excludeFolder url="file://$MODULE_DIR$/.venv" />
|
<excludeFolder url="file://$MODULE_DIR$/.venv" />
|
||||||
</content>
|
</content>
|
||||||
<orderEntry type="jdk" jdkName="Python 3.14" jdkType="Python SDK" />
|
<orderEntry type="jdk" jdkName="Python 3.14 (Masterprojekt)" jdkType="Python SDK" />
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
</component>
|
</component>
|
||||||
</module>
|
</module>
|
||||||
2
.idea/misc.xml
generated
2
.idea/misc.xml
generated
@@ -3,5 +3,5 @@
|
|||||||
<component name="Black">
|
<component name="Black">
|
||||||
<option name="sdkName" value="Python 3.14" />
|
<option name="sdkName" value="Python 3.14" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.14" project-jdk-type="Python SDK" />
|
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.14 (Masterprojekt)" project-jdk-type="Python SDK" />
|
||||||
</project>
|
</project>
|
||||||
2568
Campusnetz.ipynb
2568
Campusnetz.ipynb
File diff suppressed because one or more lines are too long
37
Export.py
37
Export.py
@@ -23,4 +23,39 @@ class Export:
|
|||||||
except Exception:
|
except Exception:
|
||||||
eintrag_text = str(eintrag)
|
eintrag_text = str(eintrag)
|
||||||
zeile_als_text.append(eintrag_text)
|
zeile_als_text.append(eintrag_text)
|
||||||
writer.writerow(zeile_als_text)
|
writer.writerow(zeile_als_text)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def ausgleichung_to_datei(dateiname, dict_ausgleichung):
|
||||||
|
with open(dateiname, "w", newline="", encoding="utf-8") as csvfile:
|
||||||
|
writer = csv.writer(csvfile, delimiter=";")
|
||||||
|
|
||||||
|
writer.writerow(["Parameter", "Wert"])
|
||||||
|
|
||||||
|
for key, value in dict_ausgleichung.items():
|
||||||
|
|
||||||
|
if hasattr(value, "tolist"):
|
||||||
|
rows = value.rows
|
||||||
|
cols = value.cols
|
||||||
|
|
||||||
|
writer.writerow([key, f"Matrix {rows}x{cols}"])
|
||||||
|
|
||||||
|
for i, zeile in enumerate(value.tolist()):
|
||||||
|
zeile_als_text = [f"{key}_zeile_{i+1}"]
|
||||||
|
for eintrag in zeile:
|
||||||
|
try:
|
||||||
|
eintrag_float = float(eintrag)
|
||||||
|
eintrag_text = f"{eintrag_float}".replace(".", ",")
|
||||||
|
except Exception:
|
||||||
|
eintrag_text = str(eintrag)
|
||||||
|
zeile_als_text.append(eintrag_text)
|
||||||
|
writer.writerow(zeile_als_text)
|
||||||
|
|
||||||
|
else:
|
||||||
|
try:
|
||||||
|
value_float = float(value)
|
||||||
|
value_text = f"{value_float}".replace(".", ",")
|
||||||
|
except Exception:
|
||||||
|
value_text = str(value)
|
||||||
|
|
||||||
|
writer.writerow([key, value_text])
|
||||||
@@ -200,7 +200,7 @@ class FunktionalesModell:
|
|||||||
else:
|
else:
|
||||||
print("Koordinaten noch nicht implementiert!")
|
print("Koordinaten noch nicht implementiert!")
|
||||||
|
|
||||||
def beobachtungsvektor(self, liste_beobachtungsvektor_symbolisch):
|
def beobachtungsvektor_numerisch(self, liste_beobachtungsvektor_symbolisch):
|
||||||
liste_beobachtungsvektor_numerisch = []
|
liste_beobachtungsvektor_numerisch = []
|
||||||
for beobachtung_symbolisch in liste_beobachtungsvektor_symbolisch:
|
for beobachtung_symbolisch in liste_beobachtungsvektor_symbolisch:
|
||||||
liste_beobachtungsvektor_numerisch.append(self.substitutionen_dict[sp.Symbol(beobachtung_symbolisch)])
|
liste_beobachtungsvektor_numerisch.append(self.substitutionen_dict[sp.Symbol(beobachtung_symbolisch)])
|
||||||
@@ -264,6 +264,10 @@ class FunktionalesModell:
|
|||||||
|
|
||||||
return beobachtungsvektor_naeherung_numerisch_iteration0
|
return beobachtungsvektor_naeherung_numerisch_iteration0
|
||||||
|
|
||||||
|
def berechnung_dl(self, beobachtungsvektor_numerisch, beobachtungsvektor_naeherung_numerisch):
|
||||||
|
dl = beobachtungsvektor_numerisch - beobachtungsvektor_naeherung_numerisch
|
||||||
|
return dl
|
||||||
|
|
||||||
def dict_substitutionen_naeherungen_us(self):
|
def dict_substitutionen_naeherungen_us(self):
|
||||||
db_zugriff = Datenbankzugriff(self.pfad_datenbank)
|
db_zugriff = Datenbankzugriff(self.pfad_datenbank)
|
||||||
dict_koordinaten_B_L = self.berechnungen.geometrische_breite_laenge(db_zugriff.get_koordinaten("naeherung_us"))
|
dict_koordinaten_B_L = self.berechnungen.geometrische_breite_laenge(db_zugriff.get_koordinaten("naeherung_us"))
|
||||||
|
|||||||
@@ -2,15 +2,19 @@ from dataclasses import dataclass
|
|||||||
from typing import Sequence, List, Dict
|
from typing import Sequence, List, Dict
|
||||||
import sympy as sp
|
import sympy as sp
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import decimal as dec
|
from decimal import Decimal
|
||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class Genauigkeitsmaße:
|
class Genauigkeitsmaße:
|
||||||
|
def __init__(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
def s0apost(v, P, r):
|
def s0apost(v, P, r):
|
||||||
s0apost = (dec((v.T * P * v)[0, 0]) / r) ** 0.5
|
vv = (v.T * P * v)[0, 0]
|
||||||
|
s0apost = (Decimal(str(vv)) / Decimal(r)) ** Decimal("0.5")
|
||||||
return s0apost
|
return s0apost
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,12 @@
|
|||||||
from Stochastisches_Modell import StochastischesModell
|
from Stochastisches_Modell import StochastischesModell
|
||||||
|
import sympy as sp
|
||||||
|
import Export
|
||||||
|
import Netzqualität_Genauigkeit
|
||||||
|
|
||||||
def ausgleichung(A, dl, stoch_modell: StochastischesModell):
|
def ausgleichung(A, dl, stoch_modell: StochastischesModell):
|
||||||
|
|
||||||
Q_ll, P = stoch_modell.berechne_Qll_P() #Kofaktormatrix und P-Matrix
|
#Q_ll, P = stoch_modell.berechne_Qll_P() #Kofaktormatrix und P-Matrix
|
||||||
|
P = sp.eye(A.shape[0])
|
||||||
N = A.T * P * A #Normalgleichungsmatrix N
|
N = A.T * P * A #Normalgleichungsmatrix N
|
||||||
Q_xx = N.inv() #Kofaktormatrix der Unbekannten Qxx
|
Q_xx = N.inv() #Kofaktormatrix der Unbekannten Qxx
|
||||||
n = A.T * P * dl #Absolutgliedvektor n
|
n = A.T * P * dl #Absolutgliedvektor n
|
||||||
@@ -15,8 +19,10 @@ def ausgleichung(A, dl, stoch_modell: StochastischesModell):
|
|||||||
Q_vv = stoch_modell.berechne_Qvv(A, P, Q_xx) #Kofaktormatrix der Verbesserungen Qvv
|
Q_vv = stoch_modell.berechne_Qvv(A, P, Q_xx) #Kofaktormatrix der Verbesserungen Qvv
|
||||||
R = stoch_modell.berechne_R(Q_vv, P) #Redundanzmatrix R
|
R = stoch_modell.berechne_R(Q_vv, P) #Redundanzmatrix R
|
||||||
r = stoch_modell.berechne_r(R) #Redundanzanteile als Vektor r
|
r = stoch_modell.berechne_r(R) #Redundanzanteile als Vektor r
|
||||||
|
redundanzanteile = A.shape[0] - A.shape[1] #n-u+d
|
||||||
|
soaposteriori = Netzqualität_Genauigkeit.Genauigkeitsmaße.s0apost(v, P, redundanzanteile)
|
||||||
|
|
||||||
return {
|
dict_ausgleichung = {
|
||||||
"dx": dx,
|
"dx": dx,
|
||||||
"v": v,
|
"v": v,
|
||||||
"P": P,
|
"P": P,
|
||||||
@@ -26,4 +32,9 @@ def ausgleichung(A, dl, stoch_modell: StochastischesModell):
|
|||||||
"Q_vv": Q_vv,
|
"Q_vv": Q_vv,
|
||||||
"R": R,
|
"R": R,
|
||||||
"r": r,
|
"r": r,
|
||||||
}
|
"soaposteriori": soaposteriori,
|
||||||
|
}
|
||||||
|
|
||||||
|
Export.Export.ausgleichung_to_datei(r"Zwischenergebnisse\Ausgleichung_Iteration0.csv", dict_ausgleichung)
|
||||||
|
|
||||||
|
return dict_ausgleichung
|
||||||
@@ -4,29 +4,38 @@ from typing import Dict, Tuple, Iterable
|
|||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class StochastischesModell:
|
class StochastischesModell:
|
||||||
sigma_beob: Iterable[float] #σ a priori der einzelnen Beobachtung
|
n_beob: int
|
||||||
gruppe_beob: Iterable[int] #Gruppenzugehörigkeit jeder Beobachtung (Distanz, Richtung, GNSS, Nivellement,...,)
|
sigma_beob: Iterable[float] =None #σ a priori der einzelnen Beobachtung
|
||||||
|
gruppe_beob: Iterable[int] =None #Gruppenzugehörigkeit jeder Beobachtung (Distanz, Richtung, GNSS, Nivellement,...,)
|
||||||
sigma0_gruppe: Dict[int, float] = field(default_factory=dict) #σ0² für jede Gruppe
|
sigma0_gruppe: Dict[int, float] = field(default_factory=dict) #σ0² für jede Gruppe
|
||||||
|
|
||||||
|
|
||||||
def __post_init__(self):
|
def __post_init__(self):
|
||||||
self.sigma_beob = sp.Matrix(list(self.sigma_beob)) #Spaltenvektor
|
# Defaults setzen
|
||||||
self.gruppe_beob = sp.Matrix(list(self.gruppe_beob)) #Spaltenvektor
|
if self.sigma_beob is None:
|
||||||
|
self.sigma_beob = [1.0] * int(self.n_beob)
|
||||||
|
|
||||||
|
if self.gruppe_beob is None:
|
||||||
|
self.gruppe_beob = [1] * int(self.n_beob)
|
||||||
|
|
||||||
|
# In SymPy-Spaltenvektoren umwandeln
|
||||||
|
self.sigma_beob = sp.Matrix(list(self.sigma_beob))
|
||||||
|
self.gruppe_beob = sp.Matrix(list(self.gruppe_beob))
|
||||||
|
|
||||||
|
# Dimension prüfen
|
||||||
if self.sigma_beob.rows != self.gruppe_beob.rows:
|
if self.sigma_beob.rows != self.gruppe_beob.rows:
|
||||||
raise ValueError("sigma_obs und group_ids müssen gleich viele Einträge haben.")
|
raise ValueError("sigma_beob und gruppe_beob müssen gleich viele Einträge haben.")
|
||||||
|
|
||||||
unique_groups = sorted({int(g) for g in self.gruppe_beob}) #jede Beobachtungsgruppe wird genau einmal berücksichtigt
|
if self.sigma_beob.rows != int(self.n_beob):
|
||||||
|
raise ValueError("n_beob passt nicht zur Länge von sigma_beob / gruppe_beob.")
|
||||||
|
|
||||||
|
# Fehlende Gruppen mit sigma0_sq = 1.0 ergänzen
|
||||||
|
unique_groups = sorted({int(g) for g in self.gruppe_beob})
|
||||||
for g in unique_groups:
|
for g in unique_groups:
|
||||||
if g not in self.sigma0_gruppe: #Fehlende Gruppen mit σ_0j^2 = 1.0
|
if g not in self.sigma0_gruppe:
|
||||||
self.sigma0_gruppe[g] = 1.0
|
self.sigma0_gruppe[g] = 1.0
|
||||||
|
|
||||||
|
|
||||||
@property
|
|
||||||
def n_beob(self) -> int:
|
|
||||||
return int(self.sigma_beob.rows)
|
|
||||||
|
|
||||||
|
|
||||||
def berechne_Qll_P(self) -> Tuple[sp.Matrix, sp.Matrix]:
|
def berechne_Qll_P(self) -> Tuple[sp.Matrix, sp.Matrix]:
|
||||||
n = self.n_beob
|
n = self.n_beob
|
||||||
Q_ll = sp.zeros(n, n)
|
Q_ll = sp.zeros(n, n)
|
||||||
|
|||||||
5798
Zwischenergebnisse/Ausgleichung_Iteration0.csv
Normal file
5798
Zwischenergebnisse/Ausgleichung_Iteration0.csv
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user