66from helpermodules .timecheck import create_timestamp
77from modules .common .abstract_device import DeviceDescriptor
88from modules .common .abstract_io import AbstractIoAction
9+ from modules .common .utils .component_parser import get_component_name_by_id , get_io_name_by_id
910from modules .io_actions .generator_systems .stepwise_control .config import StepwiseControlSetup
1011
1112control_command_log = logging .getLogger ("steuve_control_command" )
@@ -19,11 +20,24 @@ def __init__(self, config: StepwiseControlSetup):
1920 for key in pattern ["input_matrix" ].keys ():
2021 if key not in self .__unique_inputs :
2122 self .__unique_inputs .append (key )
22- assigned_devices = [io_device ["id" ] for io_device in self .config .configuration .devices ]
23+ assigned_inverters = [
24+ f"{ device ['id' ]} "
25+ for device in self .config .configuration .devices
26+ if device ["type" ] == "inverter"
27+ ]
28+ assigned_outputs = [
29+ f"{ device ['id' ]} /{ device ['digital_output' ]} "
30+ for device in self .config .configuration .devices
31+ if device ["type" ] == "io"
32+ ]
33+ # Log the configuration details
34+ # We cannot use configured names here, as the devices are not yet initialized
35+ # and thus the names are not available.
2336 control_command_log .info (
2437 f"Stufenweise Steuerung von EZA: I/O-Gerät: { self .config .configuration .io_device } , "
2538 f"Überwachte digitale Eingänge: { self .__unique_inputs } , "
26- f"zugeordnete Erzeugungsanlagen: { assigned_devices } "
39+ f"zugeordnete Erzeugungsanlagen: { assigned_inverters } "
40+ f"zugeordnete IO-Ausgänge: { assigned_outputs } "
2741 "Die Begrenzung muss in den EZA vorgenommen werden!"
2842 )
2943 super ().__init__ ()
@@ -52,6 +66,18 @@ def setup(self) -> None:
5266 if changed :
5367 Pub ().pub (f"openWB/set/io/action/{ self .config .id } /timestamp" , create_timestamp ())
5468 control_command_log .info (f"EZA-Begrenzung mit Wert { int (pattern ['value' ]* 100 )} % aktiviert." )
69+ for device in self .config .configuration .devices :
70+ if device ["type" ] == "inverter" :
71+ control_command_log .info (
72+ f"Erzeugungsanlage { get_component_name_by_id (device ['id' ])} "
73+ f"auf { int (pattern ['value' ]* 100 )} % begrenzt."
74+ )
75+ elif device ["type" ] == "io" :
76+ control_command_log .info (
77+ f"IO-Gerät { get_io_name_by_id (device ['id' ])} Ausgang "
78+ f"{ device ['digital_output' ]} "
79+ f"{ 'aktiviert' if device ['value' ] == pattern ['value' ] else 'deaktiviert' } ."
80+ )
5581 break
5682 else :
5783 if changed :
0 commit comments