44# file, You can obtain one at http://mozilla.org/MPL/2.0/.
55# SPDX-License-Identifier: MPL-2.0
66#
7- from typing import Dict
7+ from typing import Dict , List
88
99from pypowsybl import _pypowsybl
1010from pypowsybl ._pypowsybl import ShortCircuitStudyType , InitialVoltageProfileMode
11+ from .voltage_range import VoltageRange
1112
1213ShortCircuitStudyType .__module__ = __name__
1314ShortCircuitStudyType .__name__ = 'ShortCircuitStudyType'
@@ -37,6 +38,7 @@ class Parameters: # pylint: disable=too-few-public-methods
3738 min_voltage_drop_proportional_threshold: specifies a threshold for filtering the voltage results.
3839 Only nodes where the voltage drop due to the short circuit is greater than this property are retained.
3940 study_type: specifies the type of short-circuit study. It can be SUB_TRANSIENT, TRANSIENT or STEADY_STATE.
41+ voltage_ranges:
4042 initial_voltage_profile_mode: specify how the computation is initialized. It can be NOMINAL, CONFIGURED or PREVIOUS_VALUE
4143 """
4244
@@ -48,7 +50,8 @@ def __init__(self,
4850 study_type : ShortCircuitStudyType = None ,
4951 provider_parameters : Dict [str , str ] = None ,
5052 with_fortescue_result : bool = None ,
51- initial_voltage_profile_mode : InitialVoltageProfileMode = None ):
53+ initial_voltage_profile_mode : InitialVoltageProfileMode = None ,
54+ voltage_ranges : List [VoltageRange ] = None ):
5255 self ._init_with_default_values ()
5356 if with_feeder_result is not None :
5457 self .with_feeder_result = with_feeder_result
@@ -66,6 +69,8 @@ def __init__(self,
6669 self .with_fortescue_result = with_fortescue_result
6770 if initial_voltage_profile_mode is not None :
6871 self .initial_voltage_profile_mode = initial_voltage_profile_mode
72+ if voltage_ranges is not None :
73+ self .voltage_ranges = voltage_ranges
6974
7075 def _init_from_c (self , c_parameters : _pypowsybl .ShortCircuitAnalysisParameters ) -> None :
7176 self .with_feeder_result = c_parameters .with_feeder_result
@@ -77,6 +82,7 @@ def _init_from_c(self, c_parameters: _pypowsybl.ShortCircuitAnalysisParameters)
7782 zip (c_parameters .provider_parameters_keys , c_parameters .provider_parameters_values ))
7883 self .with_fortescue_result = c_parameters .with_fortescue_result
7984 self .initial_voltage_profile_mode = c_parameters .initial_voltage_profile_mode
85+ self .voltage_ranges = [VoltageRange (vr .minimum_nominal_voltage , vr .maximum_nominal_voltage , vr .voltage , vr .range_coefficient ) for vr in c_parameters .voltage_ranges ]
8086
8187 def _init_with_default_values (self ) -> None :
8288 self ._init_from_c (_pypowsybl .ShortCircuitAnalysisParameters ())
@@ -87,6 +93,7 @@ def _init_with_default_values(self) -> None:
8793 self .study_type = ShortCircuitStudyType .TRANSIENT
8894 self .with_fortescue_result = False
8995 self .initial_voltage_profile_mode = InitialVoltageProfileMode .NOMINAL
96+ self .voltage_ranges = []
9097
9198 def _to_c_parameters (self ) -> _pypowsybl .ShortCircuitAnalysisParameters :
9299 c_parameters = _pypowsybl .ShortCircuitAnalysisParameters ()
@@ -97,6 +104,7 @@ def _to_c_parameters(self) -> _pypowsybl.ShortCircuitAnalysisParameters:
97104 c_parameters .with_fortescue_result = self .with_fortescue_result
98105 c_parameters .min_voltage_drop_proportional_threshold = self .min_voltage_drop_proportional_threshold
99106 c_parameters .initial_voltage_profile_mode = self .initial_voltage_profile_mode
107+ c_parameters .voltage_ranges = [_pypowsybl .VoltageRange (vr .minimum_nominal_voltage , vr .maximum_nominal_voltage , vr .voltage , vr .range_coefficient ) for vr in self .voltage_ranges ]
100108 c_parameters .provider_parameters_keys = []
101109 c_parameters .provider_parameters_values = []
102110 return c_parameters
@@ -110,4 +118,5 @@ def __repr__(self) -> str:
110118 f", study_type={ self .study_type !r} " \
111119 f", with_fortescue_result={ self .with_fortescue_result !r} " \
112120 f", initial_voltage_profile_mode={ self .initial_voltage_profile_mode !r} " \
121+ f", voltage_ranges={ self .voltage_ranges !r} " \
113122 f")"
0 commit comments