RemoteGridValue#
- class wattson.powergrid.remote.remote_grid_value.RemoteGridValue(remote_power_grid_model: RemotePowerGridModel, wattson_client: WattsonClient, grid_element: GridElement | None, name: str = None, value_context: GridValueContext = GridValueContext.GENERIC, grid_value_data: Dict | None = None)#
Bases:
GridValue
,WattsonRemoteObject
Methods
Activates freezing mode for this GridValue.
Handler for received grid value changes by the WattsonClient, handled by the associated RemotePowerGridModel
Handler for received grid value state changes by the WattsonClient.
Activates lock mode for this GridValue.
Updates the wrapped value :param value: The new value to set :param timestamp: The timestamp corresponding to the value.
Synchronize this object with its instance in the simulation
Deactivates freezing mode.
unlock
- __init__(remote_power_grid_model: RemotePowerGridModel, wattson_client: WattsonClient, grid_element: GridElement | None, name: str = None, value_context: GridValueContext = GridValueContext.GENERIC, grid_value_data: Dict | None = None)#
- freeze(frozen_value)#
Activates freezing mode for this GridValue. If frozen, all subsequent readings of this grid value will return the given frozen value. The get_value and get_raw_value methods allow to temporarily override the freeze
- grid_value_changed(value: Any, timestamp: float | None = None)#
Handler for received grid value changes by the WattsonClient, handled by the associated RemotePowerGridModel
- Parameters:
value (Any) – The new value of this GridValue
timestamp (Optional[float], optional) – The timestamp of the update (Default value = None)
- grid_value_state_changed(data: dict)#
Handler for received grid value state changes by the WattsonClient.
- Parameters:
data (dict) – The dict representation of this grid value, including the new state
- lock()#
Activates lock mode for this GridValue. If locked, all subsequent writings to this grid value will be blocked. The set_value and set_raw_value methods allow to temporarily override the lock.
- set_value(value, timestamp: float | None = None, value_scale: Scale | None = None, override_lock: bool = False, set_targets: bool = True) bool #
Updates the wrapped value :param value: The new value to set :param timestamp: The timestamp corresponding to the value. Automatically resolves to the current time. :param value_scale: An optional scale of the given value. :param override_lock: Whether to override a potential active value lock :param raise_on_out_of_bounds: Whether to raise an exception if value limits exist and the new value exceeds this limit :param set_targets: Whether to set grid values referenced by the targets attribute :return: True iff the new value differs from the formerly set one.
- synchronize(force: bool = False, block: bool = True)#
Synchronize this object with its instance in the simulation
- Parameters:
force (bool, optional) – Whether to force an update (Default value = False)
block (bool, optional) – Whether to block during the update (Default value = True)
- unfreeze()#
Deactivates freezing mode.