diff --git a/rieter_ekalk.py b/rieter_ekalk.py index 6e7f5c7..782a84c 100644 --- a/rieter_ekalk.py +++ b/rieter_ekalk.py @@ -1,9 +1,31 @@ import math import json import configparser +import os.path JSON_IDENT = 5 + +class cfg(): + def __init__(self, path="Daten_cfg.txt"): + self._hasConfig = True + if os.path.exists(path): + self._cfg = configparser.ConfigParser(inline_comment_prefixes="#") + self._cfg.read_file(open(path)) + else: + self._hasConfig = False + self._cfg = None + + def exists(self): + return self._hasConfig + + def getDictAsFloat(self, section): + res = dict() + for key, val in self._cfg.items(section): + res[key] = float(val) + return res +RieterConfig = cfg() + class MG(): def __init__(self, deckblatt:dict, **kwargs): """ @@ -1445,6 +1467,9 @@ class HW(): "profinetkabel": 42, # 726001xxx "schnittstellen_8x1mm2_30m": 35.4, # 725000019 } + + if RieterConfig.exists(): + ep.update(RieterConfig.getDictAsFloat("HW_Einzelpreise")) # Zeit pro Einheit in min zpe_dienstl_hardwareplanung = { "schaltschrankgehaeuse_b1x1200_zubehoer": 4200, @@ -1486,6 +1511,9 @@ class HW(): "busverteiler_6_rsm_direct":600, "busverteiler_8_rsm_direct":960 } + + if RieterConfig.exists(): + zpe_dienstl_hardwareplanung.update(RieterConfig.getDictAsFloat("HW_Zeiten Hardwareplanung")) zpe_e_werkstatt = { "schaltschrankgehaeuse_b1x1200_zubehoer": 2400, "schaltschrankgehaeuse_b2x800_zubehoer": 4800, @@ -1545,6 +1573,9 @@ class HW(): "drucktaster_automatische_umfahrung":15, "halter_fuer_drucktaster":0, } + + if RieterConfig.exists(): + zpe_e_werkstatt.update(RieterConfig.getDictAsFloat("HW_Zeiten Elektro-Werkstatt")) Keys_of_Vor_Ort = [ "movimot_fu_mit_anschaltung", "sensor_optisch_traverse", @@ -2331,6 +2362,9 @@ class EMO(): "Weiche_Stopper_anschliessen": 0.35, #(h/St) "Erdung": 0.5, #(h) } + + if RieterConfig.exists(): + montagezeiten.update(RieterConfig.getDictAsFloat("Elektro-Montagezeiten")) def __init__(self, ea: type[EA], hw: type[HW], mg: type[MG]): #für jede Zeile (Eintrag im dict 'mengen') muss ein Wert übergeben werden, der aus den Klassen HW(), MG() oder EA() stammt self._mehraufwand = 0.1 @@ -2414,7 +2448,11 @@ class EMO(): def dauer_emo_h_incl_mehrauwand(self): return (self.dauer_emo_h() * (1 + self._mehraufwand)) -class Anschlussl(): +class Anschlussl(): + """ + Errechnung der notwendigen Anschlussleistung der Anlage. + Generelle Information, wird jedoch nicht zur Preisbestimmung verwendet. + """ antrieb_cos_phi = { 0.09:0.77, 0.12:0.77, @@ -2424,6 +2462,9 @@ class Anschlussl(): 0.75:0.73, 1.1:0.81 } + + if RieterConfig.exists(): + antrieb_cos_phi.update(RieterConfig.getDictAsFloat("cos phi")) antrieb_strom = { 0.09:0.4, 0.12:0.55, @@ -2433,6 +2474,9 @@ class Anschlussl(): 0.75:1.75, 1.1:2.55 } + + if RieterConfig.exists(): + antrieb_strom.update(RieterConfig.getDictAsFloat("Antriebsstrom")) mengen = { #auskommentiert, was später berechnet wird #"Anschlussspannung":400, #Volt @@ -2501,6 +2545,7 @@ class Anschlussl(): if PS > 1 or PS < 0: raise Exception("Falsche Spanne") self._Res_Faktor = PS + class Ergebnis(): preis_kostenart_h = { "E_Werkstatt": 32, @@ -2522,6 +2567,9 @@ class Ergebnis(): "PC_Anlagenbetreuung": 60, "Anlagenbetreuung_durch_Montage": 36 } + + if RieterConfig.exists(): + preis_kostenart_h.update(RieterConfig.getDictAsFloat("Kosten pro h")) eingaben_h = { "Pflichtenheft":0, "SPS_Programmierung":150, @@ -2640,3 +2688,4 @@ class Ergebnis(): summary.update({"GESAMT": round(self.get_sum_of_costs(hw), 2)}) return summary +