Skip to content

Commit

Permalink
Wip
Browse files Browse the repository at this point in the history
Signed-off-by: Geoffroy Jamgotchian <[email protected]>
  • Loading branch information
geofjamg committed Nov 10, 2023
1 parent 649863b commit 10c97fc
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions docs/user_guide/sensitivity.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ as a result:
>>> analysis = pp.sensitivity.create_dc_analysis()
>>> analysis.add_branch_flow_factor_matrix(branches_ids=['NHV1_NHV2_1', 'NHV1_NHV2_2'], variables_ids=['LOAD'])
>>> result = analysis.run(network)
>>> result.get_reference_flows()
NHV1_NHV2_1 NHV1_NHV2_2
reference_flows 300.0 300.0
>>> result.get_branch_flows_sensitivity_matrix()
>>> result.get_reference_matrix()
NHV1_NHV2_1 NHV1_NHV2_2
reference_values 300.0 300.0
>>> result.get_sensitivity_matrix()
NHV1_NHV2_1 NHV1_NHV2_2
LOAD -0.5 -0.5

Expand All @@ -38,13 +38,13 @@ Several matrix of sensitivity factors can be specified, in that case you must na
>>> analysis.add_branch_flow_factor_matrix(branches_ids=['NHV1_NHV2_1', 'NHV1_NHV2_2'], variables_ids=['LOAD'], matrix_id='m1')
>>> analysis.add_branch_flow_factor_matrix(branches_ids=['NHV1_NHV2_1'], variables_ids=['GEN'], matrix_id='m2')
>>> result = analysis.run(network)
>>> result.get_reference_flows('m1')
NHV1_NHV2_1 NHV1_NHV2_2
reference_flows 300.0 300.0
>>> result.get_branch_flows_sensitivity_matrix('m1')
>>> result.get_reference_matrix('m1')
NHV1_NHV2_1 NHV1_NHV2_2
reference_values 300.0 300.0
>>> result.get_sensitivity_matrix('m1')
NHV1_NHV2_1 NHV1_NHV2_2
LOAD -0.5 -0.5
>>> result.get_branch_flows_sensitivity_matrix('m2')
>>> result.get_sensitivity_matrix('m2')
NHV1_NHV2_1
GEN -0.0

Expand All @@ -64,7 +64,7 @@ First, we create a zone containing all generators of DE network with a shift key
>>> sa.set_zones([zone_de])
>>> sa.add_branch_flow_factor_matrix(['BBE2AA1 FFR3AA1 1'], ['DE'], 'm')
>>> results = sa.run(n, params)
>>> m = results.get_branch_flows_sensitivity_matrix('m')
>>> m = results.get_sensitivity_matrix('m')
BBE2AA1 FFR3AA1 1
DE -0.45182
Expand All @@ -87,7 +87,7 @@ In the following example, we compute the sensitivity of a active power transfer
>>> sa.set_zones([zone_fr, zone_de])
>>> sa.add_branch_flow_factor_matrix(['BBE2AA1 FFR3AA1 1'], ['FR', 'DE'], 'm')
>>> results = sa.run(n, params)
>>> m = results.get_branch_flows_sensitivity_matrix('m')
>>> m = results.get_sensitivity_matrix('m')
BBE2AA1 FFR3AA1 1
FR -0.708461
DE -0.451820
Expand All @@ -107,7 +107,7 @@ Let's obtain that directly. In the following example, we create four zones based
>>> sa.set_zones([zone_fr, zone_de, zone_be, zone_nl])
>>> sa.add_branch_flow_factor_matrix(['BBE2AA1 FFR3AA1 1', 'FFR2AA1 DDE3AA1 1'], ['FR', ('FR', 'DE'), ('DE', 'FR'), 'NL'], 'm')
>>> result = sa.run(n, params)
>>> m = result.get_branch_flows_sensitivity_matrix('m')
>>> m = result.get_sensitivity_matrix('m')
BBE2AA1 FFR3AA1 1 FFR2AA1 DDE3AA1 1
FR -0.708461 0.291539
FR -> DE -0.256641 0.743359
Expand Down Expand Up @@ -138,7 +138,7 @@ To calculate to sensitivity of X-Node XXXXXX11 on tie line 'BBE2AA1 FFR3AA1 1'
>>> sa.set_zones([zone_x])
>>> sa.add_branch_flow_factor_matrix(['BBE2AA1 FFR3AA1 1'], ['X'], 'm')
>>> result = sa.run(n)
>>> result.get_branch_flows_sensitivity_matrix('m')
>>> result.get_sensitivity_matrix('m')
BBE2AA1 FFR3AA1 1
X 0.176618
Expand Down Expand Up @@ -273,7 +273,7 @@ the list of buses for which you want to compute the sensitivity, and a list of r
>>> analysis = pp.sensitivity.create_ac_analysis()
>>> analysis.add_bus_voltage_factor_matrix(bus_ids=['VLHV1_0', 'VLLOAD_0'], target_voltage_ids=['GEN'])
>>> result = analysis.run(network)
>>> result.get_bus_voltages_sensitivity_matrix()
>>> result.get_sensitivity_matrix()
VLHV1_0 VLLOAD_0
GEN 17.629602 7.89637

Expand All @@ -288,10 +288,10 @@ In previous paragraphs, sensitivities were only computed on pre-contingency situ
>>> analysis.add_branch_flow_factor_matrix(branches_ids=['NHV1_NHV2_1', 'NHV1_NHV2_2'], variables_ids=['LOAD'], matrix_id='m')
>>> analysis.add_single_element_contingency('NHV1_NHV2_1')
>>> result = analysis.run(network)
>>> result.get_reference_flows('m', 'NHV1_NHV2_1')
NHV1_NHV2_1 NHV1_NHV2_2
reference_flows NaN 600.0
>>> result.get_branch_flows_sensitivity_matrix('m', 'NHV1_NHV2_1')
>>> result.get_reference_matrix('m', 'NHV1_NHV2_1')
NHV1_NHV2_1 NHV1_NHV2_2
reference_values NaN 600.0
>>> result.get_sensitivity_matrix('m', 'NHV1_NHV2_1')
NHV1_NHV2_1 NHV1_NHV2_2
LOAD 0.0 -1.0

Expand All @@ -308,9 +308,9 @@ and postcontingency_branch_flow_factor_matrix methods.
>>> analysis.add_postcontingency_branch_flow_factor_matrix(branches_ids=['NHV1_NHV2_1', 'NHV1_NHV2_2'], variables_ids=['GEN'], contingencies_ids=['NHV1_NHV2_1'], matrix_id='postcontingency')
>>> analysis.add_single_element_contingency('NHV1_NHV2_1')
>>> result = analysis.run(network)
>>> result.get_branch_flows_sensitivity_matrix('precontingency')
>>> result.get_sensitivity_matrix('precontingency')
NHV1_NHV2_1 NHV1_NHV2_2
LOAD -0.5 -0.5
>>> result.get_branch_flows_sensitivity_matrix('postcontingency', 'NHV1_NHV2_1')
>>> result.get_sensitivity_matrix('postcontingency', 'NHV1_NHV2_1')
NHV1_NHV2_1 NHV1_NHV2_2
GEN 0.0 0.0

0 comments on commit 10c97fc

Please sign in to comment.