Compare commits
2
Commits
149e98c543
...
4cb9cfa8fa
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4cb9cfa8fa | ||
|
|
ca498db3bc |
+16
-7
@@ -41,12 +41,12 @@ class ThermalCapWrapper:
|
||||
clock = get_component("clock")
|
||||
default_threshold = 0.98
|
||||
|
||||
def __init__(self, cap: ThermalCap | str, threshold: float = 0.99, outposts: list[OutpostComponent] | OutpostComponent | OutpostRef | str | None = None):
|
||||
def __init__(self, cap: ThermalCap | str, threshold: float = 0.98, outposts: list[OutpostComponent] | OutpostComponent | OutpostRef | str | None = None):
|
||||
"""init wrapper for `ThermalCap`
|
||||
|
||||
Args:
|
||||
cap (`ThermalCap`): thermal cap component. usally self.
|
||||
threshold (`float`, optional): percent level what thermal cap hold this pressure level. (0-1). default 0.99.
|
||||
threshold (`float`, optional): percent level what thermal cap hold this pressure level. (0-1). default 0.98.
|
||||
outpost (`OutpostComposnent` | `OutpostRef` | `str` | `None`, optional): outpost for steam out. None = nearest. default None.
|
||||
"""
|
||||
self.cap = cap
|
||||
@@ -177,6 +177,7 @@ class SteamTurbineWrapper:
|
||||
"""wrapper class wor `SteamTurbine`"""
|
||||
default_threshold = 25
|
||||
notify_threshold = 10
|
||||
notify_timeout = 100
|
||||
|
||||
def __init__(self, turbine: SteamTurbine, threshold: int = 25, storages: list[GasTank] = None):
|
||||
"""init wrapper for `SteamTurbine`
|
||||
@@ -191,6 +192,7 @@ class SteamTurbineWrapper:
|
||||
self.storages = storages
|
||||
self.pcontrol = get_component("power_control")
|
||||
self.steam_in = turbine.steam_in
|
||||
self.__notify_timeout = 0
|
||||
|
||||
def run(self):
|
||||
"""run loop for `SteamTurbine`"""
|
||||
@@ -201,11 +203,19 @@ class SteamTurbineWrapper:
|
||||
|
||||
def check_health(self):
|
||||
"""check own function and notify if not in expected parameters"""
|
||||
if self.steam_in.level() < self.notify_threshold:
|
||||
notify(f"{self.turbine.id}: steam level under {self.notify_threshold}", "warn", 30)
|
||||
if self.__notify_timeout:
|
||||
self.__notify_timeout -= 1
|
||||
return
|
||||
if self.turbine.is_stalled() or self.steam_in.level() == 0:
|
||||
notify(f"{self.turbine.id}: stopped working or has low efficency ({self.turbine.efficiency()*100}%)", "error", 30)
|
||||
sleep(30)
|
||||
return
|
||||
if self.turbine.power_output() == 108 and get_component("power_control").grid(self.turbine.id).net < self.notify_threshold * -1:
|
||||
notify(f"{self.turbine.id}: insufficient energy supply", "error", 30)
|
||||
return
|
||||
if self.steam_in.level() < self.notify_threshold:
|
||||
notify(f"{self.turbine.id}: steam level under {self.notify_threshold}", "warn", 30)
|
||||
return
|
||||
self.notify_timeout = 100
|
||||
|
||||
def fill_steam(self):
|
||||
"""fills steam if own steam under threshold"""
|
||||
@@ -248,8 +258,7 @@ class SteamTurbineWrapper:
|
||||
`list[GasTank]`
|
||||
"""
|
||||
gastanks = [ get_component(s.id) for s in get_component(self.turbine.outpost.id).buildings("gas_tank") ]
|
||||
if prefiled:
|
||||
return [ s for s in gastanks if s.fluid() == "steam" ]
|
||||
if prefiled: return [ s for s in gastanks if s.fluid() == "steam" ]
|
||||
else: return gastanks
|
||||
|
||||
@property
|
||||
|
||||
Reference in New Issue
Block a user