ScriptControllerApp#
- class wattson.apps.script_controller.script_controller.ScriptControllerApp(host_ip: str, mtu_ip: str, wattson_client_query_socket: str, wattson_client_publish_socket: str, datapoints: dict, scripts: list | None = None, scenario_path: Path | None = None, export_config: dict | None = None, statistics_config: dict | None = None)#
Bases:
object
This app interfaces with the MTU and provides various interaction possibilities for logic scripts. - Measurement Export (Exports all arrived measurements per RTU as JSON-Line file (.jsonl) - State Estimation (TODO) - Delay monitoring (Logs and exports detected delayed measurements) - TimedScripts (supplied by config) - Script queues actions that should be executed at certain points in time - SoloScripts (supplied by config) - Script that is started along with the controller, but runs individually
Methods
Returns the current timestamp of the simulation in simulated time
Receive a data point's value via a dedicated IEC104 request.
Returns the GridValue object of the specified element
Returns the GridValue's value of the specified element
get_pandapower
Returns the start timestamp of the simulation in simulated time
send_control
Sets the addressed data point value via IEC104
Updates the grid value of the specified element
set_pandapower
set_simulated_start_time
start
stop
- __init__(host_ip: str, mtu_ip: str, wattson_client_query_socket: str, wattson_client_publish_socket: str, datapoints: dict, scripts: list | None = None, scenario_path: Path | None = None, export_config: dict | None = None, statistics_config: dict | None = None)#
- get_current_simulated_time()#
Returns the current timestamp of the simulation in simulated time
- get_data_point(coa: int, ioa: int, timeout: float | None = 5, block: bool = True) Any #
Receive a data point’s value via a dedicated IEC104 request.
- Parameters:
coa (int) – The common address of the data point
ioa (int) – The information object address of the data point
timeout (Optional[float], optional) – A timeout when blocking for a response (Default value = 5)
block (bool, optional) – Whether to block for the response (Default value = True)
- Returns:
If blocking and the timeout is not exceeded, the received value is returned. Otherwise, None is returned.
- Return type:
Any
- get_grid_value(element_type: str, element_index: int, value_context: GridValueContext, value_name: str) GridValue | None #
Returns the GridValue object of the specified element
- Parameters:
element_type (str) – The element type, e.g., bus
element_index (int) – The element index
value_context (GridValueContext) – The grid value context
value_name (str) – The grid value’s name
- Returns:
The GridValue object or None, if the value cannot be found
- Return type:
Optional[GridValue]
- get_grid_value_value(element_type: str, element_index: int, value_context: GridValueContext, value_name: str) Any #
Returns the GridValue’s value of the specified element
- Parameters:
element_type (str) – The element type, e.g., bus
element_index (int) – The element index
value_context (GridValueContext) – The grid value context
value_name (str) – The grid value’s name
- Returns:
The GridValue’s value object or None, if the value cannot be found
- Return type:
Any
- get_simulated_start_time()#
Returns the start timestamp of the simulation in simulated time
- set_data_point(coa: int, ioa: int, value: Any, type_id: int | None = None, cot: int | None = None, timeout: int | None = 0, block: bool = True) bool | str | None #
Sets the addressed data point value via IEC104
- Parameters:
coa (int) – The common address of the data point
ioa (int) – The information object address of the data point
value (Any) – The value to set
type_id (Optional[int], optional) – The IEC104 type ID of the value (Default value = None)
cot (Optional[int], optional) – The cause of transmission to use (Default value = None)
timeout (Optional[int], optional) – A timeout in seconds to wait when blocking. Use None to wait indefinitely. (Default value = 0)
block (bool, optional) – Whether to block until a response is received (Default value = True)
- set_grid_value(element_type: str, element_index: int, value_context: GridValueContext, value_name: str, value: Any) bool #
Updates the grid value of the specified element
- Parameters:
element_type (str) – The element type, e.g., bus
element_index (int) – The element index
value_context (GridValueContext) – The grid value context
value_name (str) – The grid value’s name
value (Any) – The value to set
- Returns:
Whether the value has been set
- Return type:
bool