Skip to content

Commit

Permalink
Add a test for generator actions.
Browse files Browse the repository at this point in the history
Signed-off-by: Bertrand Rix <bertrand.rix@artelys.com>
  • Loading branch information
obrix committed Jan 26, 2024
1 parent ceb8265 commit d95c0f7
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/test_security_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,19 @@ def test_load_action_with_all_violation_condition():
assert len(sa_result.find_operator_strategy_results('OperatorStrategy1').limit_violations) == 3
assert 'OperatorStrategy2' not in sa_result.operator_strategy_results.keys()

def test_generator_action():
n = pp.network.create_eurostag_tutorial_example1_network()
sa = pp.security.create_analysis()
sa.add_single_element_contingency('NHV1_NHV2_1', 'Line contingency')
sa.add_generator_active_power_action(action_id='GeneratorActionAbsolute', generator_id='GEN', is_relative=False, active_power=750.0)
sa.add_generator_active_power_action(action_id='GeneratorActionRelative', generator_id='GEN', is_relative=True, active_power=150.0)
sa.add_operator_strategy('OperatorStrategy1', 'Line contingency', ['GeneratorActionAbsolute'])
sa.add_operator_strategy('OperatorStrategy2', 'Line contingency', ['GeneratorActionRelative'])
sa_result = sa.run_ac(n)
assert 'Line contingency' in sa_result.post_contingency_results.keys()
assert 'OperatorStrategy1' in sa_result.operator_strategy_results.keys()
assert 'OperatorStrategy2' in sa_result.operator_strategy_results.keys()

def test_switch_action():
n = pp.network.create_four_substations_node_breaker_network()
sa = pp.security.create_analysis()
Expand Down

0 comments on commit d95c0f7

Please sign in to comment.