Skip to content

Commit

Permalink
Documentation fixes and additions (#711)
Browse files Browse the repository at this point in the history
* fix docs warnings and operator strategy docs

Signed-off-by: Damien Jeandemange <[email protected]>

* add operator strategy methods docs

Signed-off-by: Damien Jeandemange <[email protected]>

---------

Signed-off-by: Damien Jeandemange <[email protected]>
  • Loading branch information
jeandemanged authored Feb 16, 2024
1 parent 774b402 commit 2470fbf
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 12 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
2 changes: 1 addition & 1 deletion docs/user_guide/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ The User Guide is meant to help the user on specific topics,
relying as much as possible on practical examples.

.. toctree::
:maxdepth: 2
:maxdepth: 2

network
network_visualization
Expand Down
4 changes: 0 additions & 4 deletions docs/user_guide/security.rst
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,6 @@ Information can be obtained on buses, branches and three windings transformers.
NHV1_NHV2_2 301.06 0.00 302.80 -300.19 -116.60 326.75 NaN
NHV1_NHV2_1 NHV1_NHV2_2 610.56 334.06 1,008.93 -601.00 -285.38 1,047.83 NaN



.. testcleanup:: security.monitored_elements

It also possible to get flow transfer on monitored branches in case of N-1 branch contingencies:

.. doctest::
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 2470fbf

Please sign in to comment.