Skip to content

Commit

Permalink
Merge branch 'main' into loadflow_api_updates
Browse files Browse the repository at this point in the history
  • Loading branch information
jeandemanged authored Feb 16, 2024
2 parents 99fb838 + 2470fbf commit 172685d
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 7 deletions.
3 changes: 1 addition & 2 deletions docs/reference/dynamic.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ EventMapping

EventMapping
EventMapping.get_possible_events
EventMapping.add_branch_disconnection
EventMapping.add_injection_disconnection
EventMapping.add_disconnection

CurveMapping
------------
Expand Down
17 changes: 17 additions & 0 deletions docs/reference/security.rst
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,21 @@ with the following methods:
SecurityAnalysis.add_precontingency_monitored_elements
SecurityAnalysis.add_postcontingency_monitored_elements

Define operator strategies and remedial actions
------------------------------------------------

You can define operator strategies and remedial actions with the following methods:

.. autosummary::
:nosignatures:
:toctree: api/

SecurityAnalysis.add_load_active_power_action
SecurityAnalysis.add_load_reactive_power_action
SecurityAnalysis.add_generator_active_power_action
SecurityAnalysis.add_switch_action
SecurityAnalysis.add_operator_strategy

Results
-------

Expand All @@ -66,7 +81,9 @@ When the security analysis is completed, you can inspect its results:
SecurityAnalysisResult.limit_violations
SecurityAnalysisResult.pre_contingency_result
SecurityAnalysisResult.post_contingency_results
SecurityAnalysisResult.operator_strategy_results
SecurityAnalysisResult.find_post_contingency_result
SecurityAnalysisResult.find_operator_strategy_results
SecurityAnalysisResult.branch_results
SecurityAnalysisResult.bus_results
SecurityAnalysisResult.three_windings_transformer_results
Expand Down
45 changes: 40 additions & 5 deletions pypowsybl/security/impl/security.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,29 +137,64 @@ def add_postcontingency_monitored_elements(self, contingency_ids: Union[List[str
branch_ids, voltage_level_ids, three_windings_transformer_ids)

def add_load_active_power_action(self, action_id: str, load_id: str, is_relative: bool, active_power: float) -> None:
"""
""" Add a load action, modifying the load active power
Args:
action_id: unique ID for the action
load_id: load identifier
is_relative: whether the active power change specified is absolute, or relative to current load active power
active_power: the active power change
"""
_pypowsybl.add_load_active_power_action(self._handle, action_id, load_id, is_relative, active_power)

def add_load_reactive_power_action(self, action_id: str, load_id: str, is_relative: bool, reactive_power: float) -> None:
"""
""" Add a load action, modifying the load reactive power
Args:
action_id: unique ID for the action
load_id: load identifier
is_relative: whether the reactive power change specified is absolute, or relative to current load reactive power
reactive_power: the reactive power change
"""
_pypowsybl.add_load_reactive_power_action(self._handle, action_id, load_id, is_relative, reactive_power)

def add_generator_active_power_action(self, action_id: str, generator_id: str, is_relative: bool, active_power: float) -> None:
"""
""" Add a generator action, modifying the generator active power
Args:
action_id: unique ID for the action
generator_id: generator identifier
is_relative: whether the active power change specified is absolute, or relative to current generator active power
active_power: the active power change
"""
_pypowsybl.add_generator_active_power_action(self._handle, action_id, generator_id, is_relative, active_power)

def add_switch_action(self, action_id: str, switch_id: str, open: bool) -> None:
"""
""" Add a switch action, modifying the switch open/close status
Args:
action_id: unique ID for the action
switch_id: switch identifier
open: True to open the switch, False to close
"""
_pypowsybl.add_switch_action(self._handle, action_id, switch_id, open)

def add_operator_strategy(self, operator_strategy_id: str, contingency_id: str, action_ids: List[str],
condition_type: ConditionType = ConditionType.TRUE_CONDITION, violation_subject_ids: List[str] = None,
violation_types: List[ViolationType] = None) -> None:
"""
""" Add an operator strategy to the specified contingency
Args:
operator_strategy_id: unique ID for the operator strategy
contingency_id: the contingency on which the operator strategy applies
action_ids: the list of actions to be applied as part of the strategy
condition_type: the type of condition
violation_subject_ids: identifiers of network elements monitored to apply the operator strategy
violation_types: type of violations to consider to apply the operator strategy
"""
if violation_types is None:
violation_types = []
Expand Down

0 comments on commit 172685d

Please sign in to comment.