Predefined Controllers

Basic Controller

The basic controller is the base controller class that should be subclassed when implementing custom controllers.

class pandapower.control.basic_controller.Controller(net, name=None, in_service=True, order=0, level=0, index=None, recycle=False, drop_same_existing_ctrl=False, initial_run=True, overwrite=False, matching_params=None)

Bases: BasicCtrl

Base-Class of all controllable elements within a network. Extension of BasicCtrl

add_controller_to_net(net, name, in_service, initial_run, order, level, index, recycle, drop_same_existing_ctrl, overwrite, **kwargs)

adds the controller to net[‘controller’] dataframe.

Parameters:
  • in_service (bool) – in service status

  • order – order

  • index – index

  • recycle – if controller needs a new bbm (ppc, Ybus…) or if it can be used with prestored values. This is mostly needed for time series calculations

control_step(container)

If the is_converged method returns false, the control_step will be called. In other words: if the controller did not converge yet, this method should implement actions that promote convergence e.g. adapting actuating variables and writing them back to the data structure.

finalize_control(container)

Some controller require extended finalization. This method is being called at the end of a loadflow. It is a separate method from restore_init_state because it is possible that control finalization does not only restore the init state but also something in addition to that, that would require the results in net

finalize_step(container, time)

Note

This method is ONLY being called during time-series simulation!

After each time step, this method is being called to clean things up or similar. The OutputWriter is a class specifically designed to store results of the loadflow. If the ControlHandler.output_writer got an instance of this class, it will be called before the finalize step.

initialize_control(container)

Some controller require extended initialization in respect to the current state of the net (or their view of it). This method is being called after an initial loadflow but BEFORE any control strategies are being applied.

This method may be interesting if you are aiming for a global controller or if it has to be aware of its initial state.

is_converged(container)

This method calculated whether or not the controller converged. This is where any target values are being calculated and compared to the actual measurements. Returns convergence of the controller.

repair_control(container)

Some controllers can cause net to not converge. In this case, they can implement a method to try and catch the load flow error by altering some values in net, for example load scaling. This method is being called in the except block in run_control. Either implement this in a controller that is likely to cause the error, or define a special “load flow police” controller for your use case

restore_init_state(container)

Some controllers manipulate values in net and then restore them back to initial values, e.g. DistributedSlack. This method should be used for such a purpose because it is executed in the except block of run_control to make sure that the net condition is restored even if load flow calculation doesn’t converge

set_active(container, in_service)

Sets the controller in or out of service

set_recycle(net)

Checks the recyclability of this controller and changes the recyclability of the control handler if necessary. With this a faster time series calculation can be achieved since not everything must be recalculated.

Beware: Setting recycle wrong can mess up your results. Set it to False in init if in doubt!

time_step(container, time)

It is the first call in each time step, thus suited for things like reading profiles or prepare the controller for the next control step.

Note

This method is ONLY being called during time-series simulation!

to_json()

Each controller should have this method implemented. The resulting json string should be readable by the controller’s from_json function and by the function add_ctrl_from_json in control_handler.

ConstControl

This controller is made for the use with the time series module to read data from a DataSource and write it to the net. The controller can write the values either to a column of an element table (e.g. net.load.p_mw) or an attribute of another object that is stored in an element table (e.g. another controller, net.controller.object). To change a controller attribute, the variable must be defined in the format “object.attribute” (e.g. “object.set_vm_pu”). Note that ConstControl writes values to net in time_step, in order to set the values of the time step before the initial power flow. If ConstControl is used without a data_source, it will reset the controlled values to the initial values, preserving the initial net state.

class pandapower.control.controller.const_control.ConstControl(net, element, variable, element_index, profile_name=None, data_source=None, scale_factor=1.0, in_service=True, recycle=True, order=-1, level=-1, drop_same_existing_ctrl=False, matching_params=None, initial_run=False, **kwargs)

Class representing a generic time series controller for a specified element and variable. Control strategy: “No Control” -> updates values of specified elements according to timeseries input data. If ConstControl is used without timeseries input data, it will reset the controlled values to the initial values, preserving the initial net state. The timeseries values are written to net during time_step before the initial powerflow run and before other controllers’ control_step. It is possible to set attributes of objects that are contained in a net table, e.g. attributes of other controllers. This can be helpful e.g. if a voltage setpoint of a transformer tap changer depends on the time step. An attribute of an object in the “object” column of a table (e.g. net.controller[“object”] -> net.controller.object.at[0, “vm_set_pu”] can be set if the attribute is specified as “object.attribute” (e.g. “object.vm_set_pu”).

Parameters:
  • net (ADict) – The net in which the controller resides

  • element – element table (‘sgen’, ‘load’ etc.)

  • variable – variable (‘p_mw’, ‘q_mvar’, ‘vm_pu’, ‘tap_pos’ etc.)

  • element_index (int[]) – IDs of the controlled elements

  • data_source (obj) – The data source that provides profile data

  • profile_name (str[]) – The profile names of the elements in the data source

  • scale_factor (real, 1.0) – Scaling factor for time series input values

  • in_service (bool, True) – Indicates if the controller is currently in_service

  • recycle (bool, True) – Re-use of internal-data in a time series loop.

  • drop_same_existing_ctrl (bool, False) – Indicates if already existing controllers of the same type and with the same matching parameters (e.g. at same element) should be dropped

Note

If multiple elements are represented with one controller, the data source must have integer columns. At the moment, only the DFData format is tested for the multiple const control.

control_step(net)

Set applied to True, which means that the values set in time_step have been included in the load flow calculation.

is_converged(net)

Actual implementation of the convergence criteria: If controller is applied, it can stop

set_recycle(net)

Checks the recyclability of this controller and changes the recyclability of the control handler if necessary. With this a faster time series calculation can be achieved since not everything must be recalculated.

Beware: Setting recycle wrong can mess up your results. Set it to False in init if in doubt!

time_step(net, time)

Get the values of the element from data source Write to pandapower net by calling write_to_net() If ConstControl is used without a data_source, it will reset the controlled values to the initial values, preserving the initial net state.

TrafoController

The following controllers to control tap changers are predefined within the pandapower control module.

Continuous Tap Control

class pandapower.control.controller.trafo.ContinuousTapControl.ContinuousTapControl(net, element_index, vm_set_pu, tol=1e-3, side='lv', element='trafo', in_service=True, check_tap_bounds=True, level=0, order=0, drop_same_existing_ctrl=False, matching_params=None, **kwargs)

Trafo Controller with local tap changer voltage control.

Parameters:
  • net (ADict) – Pandapower struct

  • element_index (int) – ID of the trafo that is controlled

  • vm_set_pu (float) – Maximum OLTC target voltage at bus in pu

  • tol (float, 0.001) – Voltage tolerance band at bus in percent (default: 1% = 0.01pu)

  • side (string, "lv") – Side of the transformer where the voltage is controlled

  • element (string, "trafo") – Trafo type (“trafo” or “trafo3w”)

  • in_service (bool, True) – Indicates if the controller is currently in_service

  • check_tap_bounds (bool, True) – In case of true the tap_bounds will be considered

  • drop_same_existing_ctrl (bool, False) – Indicates if already existing controllers of the same type and with the same matching parameters (e.g. at same element) should be dropped

control_step(net)

Implements one step of the ContinuousTapControl

initialize_control(net)

Some controller require extended initialization in respect to the current state of the net (or their view of it). This method is being called after an initial loadflow but BEFORE any control strategies are being applied.

This method may be interesting if you are aiming for a global controller or if it has to be aware of its initial state.

is_converged(net)

The ContinuousTapControl is converged, when the difference of the voltage between control steps is smaller than the Tolerance (tol).


Discrete Tap Control

class pandapower.control.controller.trafo.DiscreteTapControl.DiscreteTapControl(net, element_index, vm_lower_pu, vm_upper_pu, side='lv', element='trafo', tol=1e-3, in_service=True, hunting_limit=None, level=0, order=0, drop_same_existing_ctrl=False, matching_params=None, **kwargs)

Trafo Controller with local tap changer voltage control.

Parameters:
  • net (ADict) – Pandapower struct

  • element_index (int) – ID of the trafo that is controlled

  • vm_lower_pu (float) – Lower voltage limit in pu

  • vm_upper_pu (float) – Upper voltage limit in pu

  • side (string, "lv") – Side of the transformer where the voltage is controlled (hv or lv)

  • element (string, "trafo") – Trafo type (“trafo” or “trafo3w”)

  • tol (float, 0.001) – Voltage tolerance band at bus in Percent (default: 1% = 0.01pu)

  • in_service (bool, True) – Indicates if the controller is currently in_service

  • drop_same_existing_ctrl (bool, False) – Indicates if already existing controllers of the same type and with the same matching parameters (e.g. at same element) should be dropped

control_step(net)

Implements one step of the Discrete controller, always stepping only one tap position up or down

classmethod from_tap_step_percent(net, element_index, vm_set_pu, side='lv', element='trafo', tol=1e-3, in_service=True, hunting_limit=None, level=0, order=0, drop_same_existing_ctrl=False, matching_params=None, **kwargs)

Alternative mode of the controller, which uses a set point for voltage and the value of net.trafo.tap_step_percent to calculate vm_upper_pu and vm_lower_pu. To this end, the parameter vm_set_pu should be provided, instead of vm_lower_pu and vm_upper_pu. To use this mode of the controller, the controller can be initialized as following:

>>> c = DiscreteTapControl.from_tap_step_percent(net, element_index, vm_set_pu)
Parameters:
  • net (ADict) – Pandapower struct

  • element_index (int) – ID of the trafo that is controlled

  • vm_set_pu (float) – Voltage setpoint in pu

initialize_control(net)

Some controller require extended initialization in respect to the current state of the net (or their view of it). This method is being called after an initial loadflow but BEFORE any control strategies are being applied.

This method may be interesting if you are aiming for a global controller or if it has to be aware of its initial state.

is_converged(net)

Checks if the voltage is within the desired voltage band, then returns True

DER Controller

class pandapower.control.controller.DERController.der_control.DERController(net, element_index, element='sgen', q_model=None, pqv_area=None, saturate_sn_mva=np.nan, q_prio=True, damping_coef=2, max_p_error=1e-6, max_q_error=1e-6, pq_simultaneity_factor=1., f_sizing=1., data_source=None, p_profile=None, profile_from_name=False, profile_scale=1.0, in_service=True, ts_absolute=True, order=0, level=0, drop_same_existing_ctrl=False, matching_params=None, **kwargs)

Flexible controller to model plenty types of distributed energy resource (DER) control characteristics, such as

  • const Q

  • cosphi fixed (different types)

  • cosphi(P) curve

  • Q(V)

and restrict the behavior to defined PQV areas, such as

  • PQVArea4130V1, PQVArea4130V2, PQVArea4130V3

  • PQVArea4120V1, PQVArea4120V2, PQVArea4120V3

  • PQVArea4110

  • PQVArea4105

  • PQAreaSTATCOM

  • PQVAreaPOLYGON (PQAreaPOLYGON, QVAreaPOLYGON)

Note

sn_mva of the controlled elements is expected to be the rated power (generation) of the elements (called P_{b,installed} in the VDE AR N standards). Scalings and limits are usually relative to that (sn_mva) values.

Parameters:
  • net (pandapowerNet) – The pandapower network

  • element_index (list[int]) – IDs of the controlled elements

  • element (Optional[str]) – element type which is controlled (default: “sgen”)

  • q_model (Optional) – an q_model, such as provided in this file, should be passed to model how the q value should be determined. (default: None)

  • pqv_area (Optional) – an pqv_area, such as provided in this file, should be passed to model q values are allowed. (default: None)

  • saturate_sn_mva (Optional[float]) – Maximum apparent power of the inverter. If given, the p or q values (depending on q_prio) are reduced to this maximum apparent power. Usually, it is not necessary to pass this values since the inverter needs to be dimensioned to provide the standardized reactive power requirements. (default: NaN)

  • q_prio (Optional[bool]) – If True, the active power is reduced first in case of power reduction due to saturate_sn_mva. Otherwise, the reactive power is reduced first. (default: True)

  • damping_coef (Optional[float]) – damping coefficient to influence the power updating process of the control loop. A higher value mean slower changes of p and q towards the latest target values (default: 2.0)

  • max_p_error (Optional[float]) – Maximum absolute error of active power in MW (default: 0.0001)

  • max_q_error (Optional[float]) – Maximum absolute error of reactive power in Mvar (default: 0.0001)

  • pq_simultaneity_factor (Optional[float]) – Simultaneity factor applied to P and Q (default: 1.0)

  • data_source (Optional) – A DataSource that contains profiles (default: None)

  • p_profile (Optional[list[str]]) – The profile names of the controlled elements in the data source for active power time series values (default: None)

  • profile_from_name (Optional[bool]) – If True, the profile names of the controlled elements in the data source for active power time series values will be set be the name of the controlled elements, e.g. for controlled sgen “SGEN_1”, the active power profile “P_SGEN_1” is applied (default: False)

  • profile_scale (Optional[float]) – A scaling factor applied to the values of profiles (default: 1.0)

  • in_service (Optional[bool]) – Indicates if the controller is currently in_service (default: True)

  • ts_absolute (Optional[bool]) – Whether the time step values are absolute power values or scaling factors (default: True)

Example:
>>> from pandapower.networks.cigre_networks import create_cigre_network_mv
>>> from pandapower.control.controller.DERController import DERController, QModelCosphiP, PQVArea4120V2
>>> from pandapower.run import runpp
>>> net = create_cigre_network_mv(with_der=True)
>>> controlled_sgens = DERController(
...     net, net.sgen.index,
...     q_model=QModelCosphiP(cosphi=-0.95),
...     pqv_area=PQVArea4120V2()
... )
>>> runpp(net, run_control=True)
control_step(net)

Set applied to True, which means that the values set in time_step have been included in the load flow calculation.

is_converged(net)

Actual implementation of the convergence criteria: If controller is applied, it can stop

time_step(net, time)

Get the values of the element from data source Write to pandapower net by calling write_to_net() If ConstControl is used without a data_source, it will reset the controlled values to the initial values, preserving the initial net state.

CharacteristicControl

The following controllers that use characteristics are predefined within the pandapower control module.

CharacteristicControl

class pandapower.control.controller.characteristic_control.CharacteristicControl(net, output_element, output_variable, output_element_index, input_element, input_variable, input_element_index, characteristic_index, tol=1e-3, in_service=True, order=0, level=0, drop_same_existing_ctrl=False, matching_params=None, **kwargs)

Controller that adjusts a certain parameter of an element in pandapower net based on a specified input parameter in pandapower net, according to a provided characteristic. The characteristic is specified by the index in the net.characteristic table. Example: change the tap position of the transformers (net.trafo.tap_pos) based on transformer loading (net.res_trafo.loading_percent) according to a specified linear relationship. To this end, the input element is res_trafo, the input variable is loading_percent, the output element is trafo and the output variable is tap_pos. The relationship between the values of the input and output variables is specified using the Characteristic class (or a scipy interpolator, e.g. scipy.interpolate.interp1d).

Parameters:
  • net (ADict) – Pandapower net

  • output_element (str) – name of the element table in pandapower net where the values are adjusted by the controller

  • output_variable (str) – variable in the output element table, values of which are adjusted by the controller. Can also be an attribute of an object (e.g. parameter of a controller object), for this case it must start with “object.” (e.g. “object.vm_set_pu”)

  • output_element_index (int or list or numpy array) – index of the elements, values from which are adjusted

  • input_element (str) – name of the element table or the element result table in pandapower net that provides input values for the controller

  • input_variable (str) – name of the input variable in the input element table. Can also be an attribute of an object, similarly to output_variable

  • input_element_index (int or list or numpy array) – index of elements in the input element table

  • characteristic_index (int) – index of the characteristic curve that describes the relationship between the input and output values

  • tol (float) – tolerance for convergence

  • in_service (bool, True) – Indicates if the controller is currently in_service

  • drop_same_existing_ctrl (bool, False) – Indicates if already existing controllers of the same type and with the same matching parameters (e.g. at same element) should be dropped

control_step(net)

Set applied to true to make sure it runs at least once

initialize_control(net)

At the beginning of each run_control call reset applied-flag

is_converged(net)

Actual implementation of the convergence criteria: If controller is applied, it can stop


VmSetTapControl

class pandapower.control.controller.trafo.VmSetTapControl.VmSetTapControl(net, controller_index, characteristic_index, variable='p_hv_mw', tol=1e-3, in_service=True, order=0, level=0, drop_same_existing_ctrl=False, matching_params=None, **kwargs)

Controller that adjusts the setpoint of a local tap changer voltage control based on a load flow result (e.g. p_lv_mw, i_lv_ka etc.) according to a defined characteristic.

Parameters:
  • net (ADict) – Pandapower net

  • cid (int) – ID of the tap changer controller, an attribute of which is controlled

  • variable (float) – Variable from the result table that is used for the characteristic

  • in_service (bool, True) – Indicates if the controller is currently in_service

  • drop_same_existing_ctrl (bool, False) – Indicates if already existing controllers of the same type and with the same matching parameters (e.g. at same element) should be dropped


TapDependentImpedance

class pandapower.control.controller.trafo.TapDependentImpedance.TapDependentImpedance(net, element_index, characteristic_index, element='trafo', output_variable='vk_percent', tol=1e-3, restore=True, in_service=True, order=0, level=0, drop_same_existing_ctrl=False, matching_params=None, **kwargs)

Controller that adjusts the impedance of a transformer (or multiple transformers) depending to the actual tap position and according to a defined characteristic.

Parameters:
  • net (ADict) – Pandapower net

  • element_index (int or list or numpy array) – ID of the transformer or multiple transformers

  • characteristic (object of class Characteristic) – Characteristic that describes the relationship between transformer tap position and transformer impedance

  • in_service (bool, True) – Indicates if the controller is currently in_service

  • drop_same_existing_ctrl (bool, False) – Indicates if already existing controllers of the same type and with the same matching parameters (e.g. at same element) should be dropped

finalize_control(net)

Some controller require extended finalization. This method is being called at the end of a loadflow. It is a separate method from restore_init_state because it is possible that control finalization does not only restore the init state but also something in addition to that, that would require the results in net

initialize_control(net)

At the beginning of each run_control call reset applied-flag

Characteristic

The following classes enable the definition of characteristics for the controllers.

Characteristic

class pandapower.control.util.characteristic.Characteristic(net, x_values, y_values, table='characteristic', **kwargs)

This class represents a characteristics curve. The curve is described as a piecewise linear function.

Parameters:
  • pts – Expects two (or more) points of the function (i.e. kneepoints)

  • eps – An epsilon to compare the difference to

The class has an implementation of the __call__ method, which allows using it interchangeably with other interpolator objects, e.g. scipy.interpolate.interp1d, scipy.interpolate.CubicSpline, scipy.interpolate.PPoly, etc.

Example

Create a simple function from two points and ask for the target y-value for a given x-value. Assume a characteristics curve in which for voltages < 0.95pu a power of 10kW is desired, linear rising to a max. of 20 kW at 1.05 pu

You can give points by lists of x/y-values
>>> c = Characteristic(net, x_values=[0.95, 1.05],y_values=[10, 20])
>>> c(x=1.0)
15.0

or pass a list of points (x,y)
>>> c = Characteristic.from_points(net,points=[(0.95, 10), (1.05, 20)])
>>> c(x=1.0)
15.0

or in a simple case from a gradient, its zero crossing and the maximal values for y
>>> c = Characteristic.from_gradient(net,zero_crossing=-85,gradient=100,y_min=10,y_max=20)
>>> c(x=1.0)
15.0

Values are constant beyond the first and last defined points
>>> c(x=42)
20.0
>>> c(x=-42)
10.0

Create a curve with many points and ask for the difference between the y-value being measured
and the expected y-value for a given x-value
>>> c = Characteristic.from_points(net,points=[(1,2),(2,4),(3,2),(42,24)])
>>> c.diff(x=2.5, measured=3)
0.0

You can also ask if a y-values satisfies the curve at a certain x-value. Note how the use of
an epsilon behaves (for x=2.5 we expect 3.0):
>>> c.satisfies(x=2.5, measured=3.099999999, epsilon=0.1)
True
>>> c.satisfies(x=2.5, measured=3.1, epsilon=0.1)
False
diff(x, measured)
Parameters:
  • x – The x-value at which the current y-value is measured

  • actual – The actual y-value being measured.

Returns:

The difference between actual and expected value.

satisfies(x, measured, epsilon)
Parameters:
  • x – The x-value at which the current y-value is measured

  • measured – The actual y-value being measured.

Returns:

Whether or not the point satisfies the characteristics curve with respect to the epsilon being set


SplineCharacteristic

class pandapower.control.util.characteristic.SplineCharacteristic(net, x_values, y_values, interpolator_kind='interp1d', table='characteristic', **kwargs)

SplineCharacteristic interpolates the y-value(s) for the given x-value(s) according to a non-linear function. Internally the interpolator object interp1d from scipy.interpolate is used. By default, the function is quadratic, but the user can specify other methods (refer to the documentation of interp1d). The fill_value can be specified as “extrapolate” so that even x-values outside of the specified range can be used and yield y-values outside the specified y range. Alternatively, the behavior of Characteristic can be followed by providing a tuple for the fill value for x outside the specified range, refer to the documentation of interp1d for more details. We set the parameter bounds_error to False.

Station Controller

The following controllers are used for the representation of station controllers as used in PowerFactory. The Vdroop is a new controller class used for the local droop voltage control.

Binary Search Control

class pandapower.control.controller.station_control.BinarySearchControl(net, ctrl_in_service, output_element, output_variable, output_element_index, output_element_in_service, output_values_distribution, input_element, input_variable, input_element_index, set_point, voltage_ctrl, name='', input_inverted=[], bus_idx=None, tol=0.001, in_service=True, order=0, level=0, drop_same_existing_ctrl=False, matching_params=None, **kwargs)

The Binary search control is a controller that adjusts output values in order to reach a given set point. It can be used for reactive power control or voltage control. For voltage control, the parameter voltage_ctrl must be set to True. Input and output elements and indexes can be lists. Input elements can be transformers, switches, lines or buses (only in voltage control). For voltage control, bus_idx must be present as the measurement location. Output elements are sgens, where active and reactive power can be set. The output_values_distribution describes the distribution of reactive power provision between multiple output_elements and must sum to 1.

Parameters:
  • self (BinarySearchControl)

  • net (pandapowerNet) – A pandapower grid.

  • ctrl_in_service (bool) – Whether the controller is in service.

  • output_element (str) – Output element type: "gen" or "sgen". For reactive power control, currently only "sgen" is supported.

  • output_variable (str) – Output variable of the element (e.g., "q_mvar").

  • output_element_index (int or list of int) – Index or list of indices of the output elements.

  • output_element_in_service (list of bool) – Indicates whether each output element is in service.

  • output_values_distribution (list of float) – Distribution of reactive power provision among output elements (must sum to 1).

  • input_element (str) – Measurement location: "res_trafo", "res_switch", "res_line", or "res_bus". For "res_switch", an additional small impedance is introduced.

  • input_variable (str) – Variable used for the measurement (string).

  • input_inverted (list of bool) – Indicates whether the measurement of each input element must be inverted. Required when importing from PowerFactory.

  • input_element_index (int or list of int) – Index or list of indices of the input elements.

  • set_point (float) – Set point of the controller. For voltage control, voltage_ctrl must be True, bus_idx must be the measurement bus, and input_element must be "res_bus". Can be overwritten by a chained droop controller.

  • gen_Q_response (list of int) – List of +1 or -1 indicating the Q-response direction of the measurement location.

  • voltage_ctrl (bool) – Whether voltage control mode is activated.

  • output_min_q_mvar (list of float) – Minimum Q limits for each output element. Considered when runpp is executed with enforce_q_lims=True.

  • output_max_q_mvar (list of float) – Maximum Q limits for each output element. Considered when runpp is executed with enforce_q_lims=True.

  • bus_idx (int, optional) – Bus index used for voltage control.

  • tol (float, optional) – Tolerance for controller convergence. Default is 0.001.

  • in_service (bool, optional) – Whether the controller is in service. Default is True.

  • order (int, optional) – Execution order of the controller.

  • level (int, optional) – Execution level of the controller.

  • drop_same_existing_ctrl (bool, optional) – Whether to drop existing controllers with the same parameters.

  • matching_params (dict, optional) – Parameters used to match controllers.

  • name (str, optional) – Name of the controller.

  • kwargs (dict, optional) – Additional keyword arguments.

control_step(net)

If the is_converged method returns false, the control_step will be called. In other words: if the controller did not converge yet, this method should implement actions that promote convergence e.g. adapting actuating variables and writing them back to the data structure.

initialize_control(net)

Some controller require extended initialization in respect to the current state of the net (or their view of it). This method is being called after an initial loadflow but BEFORE any control strategies are being applied.

This method may be interesting if you are aiming for a global controller or if it has to be aware of its initial state.

is_converged(net)

Actual implementation of the convergence criteria: If controller is applied, it can stop

Droop Control

class pandapower.control.controller.station_control.DroopControl(net, q_droop_mvar, bus_idx, controller_idx, voltage_ctrl, tol=1e-6, q_set_mvar_bsc=None, in_service=True, order=-1, level=0, name='', drop_same_existing_ctrl=False, matching_params=None, vm_set_pu_bsc=None, vm_set_lb=None, vm_set_ub=None, **kwargs)

The droop controller is used in case of a droop based control. It can operate either as a Q(U) controller or as a U(Q) controller and is used in addition to a binary search controller (bsc). The linked binary search controller is specified using the controller index, which refers to the linked bsc. The droop controller behaves in a similar way to the station controllers presented in the Power Factory Tech Ref, although not all possible settings from Power Factory are yet available.

Parameters:
  • net – A pandapower grid.

  • q_droop_var – Droop Value in Mvar/p.u.

  • bus_idx – Bus index in case of voltage control.

  • vm_set_pu_bsc – Initial voltage set point in case of voltage control.

  • controller_idx – Index of linked Binary< search control (if present).

  • voltage_ctrl – Whether the controller is used for voltage control or not.

  • bus_idx – Bus index which is used for voltage control.

  • q_set_mvar_bsc – Initial voltage set point in case of no voltage control.

  • tol – Tolerance criteria of controller convergence.

  • vm_set_lb – Lower band border of dead band

  • vm_set_ub – Upper band border of dead band

control_step(net)

If the is_converged method returns false, the control_step will be called. In other words: if the controller did not converge yet, this method should implement actions that promote convergence e.g. adapting actuating variables and writing them back to the data structure.

is_converged(net)

This method calculated whether or not the controller converged. This is where any target values are being calculated and compared to the actual measurements. Returns convergence of the controller.

Local VDroop Control

class pandapower.control.controller.station_control.VDroopControl_local(net, q_droop_mvar, controller_idx, bus_idx, tol=1e-6, in_service=True, order=-1, level=0, name='', drop_same_existing_ctrl=False, matching_params=None, q_set_mvar=None, vm_set_pu_bsc=None, vm_set_lb=None, vm_set_ub=None, **kwargs)

The VDroopControl_local is used in case of a local droop based voltage control. It is used in addition to a binary search controller (bsc). The linked binary search controller is specified using the controller index, which refers to the linked bsc.

Parameters:
  • net – A pandapower grid.

  • q_droop_var – Droop Value in Mvar/p.u.

  • vm_set_pu_bsc – Initial voltage set point.

  • controller_idx – Index of linked Binary< search control (if present).

  • tol – Tolerance criteria of controller convergence.

  • vm_set_lb – Lower band border of dead band

  • vm_set_ub – Upper band border of dead band

control_step(net)

If the is_converged method returns false, the control_step will be called. In other words: if the controller did not converge yet, this method should implement actions that promote convergence e.g. adapting actuating variables and writing them back to the data structure.

is_converged(net)

This method calculated whether or not the controller converged. This is where any target values are being calculated and compared to the actual measurements. Returns convergence of the controller.

Shunt Controller

Discrete Shunt Control

class pandapower.control.controller.shunt_control.DiscreteShuntController(net, shunt_index, vm_set_pu, bus_index=None, tol=1e-3, increment=1, reset_at_init=False, in_service=True, check_step_bounds=True, order=0, level=0, matching_params=None, **kwargs)

Discrete Shunt Controller that controls the shunt steps in a discrete manner to regulate the voltage at a specific bus. This controller adjusts the active and reactive power of a shunt in steps based on the voltage deviation from a setpoint.

Parameters:
  • net (ADict) – pandapower network object

  • shunt_index (int) – The index of the shunt in the pandapower network to be controlled.

  • vm_set_pu (float) – The voltage setpoint in per-unit (pu) for controlling the bus voltage.

  • bus_index (int, None) – The index of the bus where voltage control is applied. If None, the bus connected to the shunt is used by default.

  • tol (float, 0.001) – Voltage tolerance band in per-unit (pu) for control action (default is 1% or 0.01 pu).

  • increment (int, 1) – Step increment size for controlling the shunt. The controller adjusts the shunt steps by this increment based on the voltage deviation.

  • reset_at_init (bool, False) – If True, the shunt steps will be reset to 0 during the initialization of the controller.

  • in_service (bool, True) – Boolean flag to indicate whether the controller is active or not.

  • check_step_bounds (bool, True) – If True, the controller will check and enforce the step boundaries (minimum and maximum) for the shunt.

  • order (int, 0) – Execution order of the controller. Controllers with lower order are executed first.

  • level (int, 0) – Controller level.

  • matching_params (dict, None) – Dictionary of parameters used to match this controller with the appropriate elements in the network. Defaults to shunt_index and bus_index.

control_step(net)

If the is_converged method returns false, the control_step will be called. In other words: if the controller did not converge yet, this method should implement actions that promote convergence e.g. adapting actuating variables and writing them back to the data structure.

initialize_control(net)

Some controller require extended initialization in respect to the current state of the net (or their view of it). This method is being called after an initial loadflow but BEFORE any control strategies are being applied.

This method may be interesting if you are aiming for a global controller or if it has to be aware of its initial state.

is_converged(net)

This method calculated whether or not the controller converged. This is where any target values are being calculated and compared to the actual measurements. Returns convergence of the controller.