pypowsybl.network.Network.create_shunt_compensators#

Network.create_shunt_compensators(shunt_df, linear_model_df=None, non_linear_model_df=None)[source]#

Create shunt compensators.

Shunt compensator sections can be described in 1 of 2 ways: either with a linear model, with a maximum section count and a per-section values, or with a non linear model, where each section is described individually.

For this reason, 2 or 3 dataframes need to be provided: one for shunt compensators data, optionally one for linear models, and optionally one for non linear models.

Parameters:
  • shunt_df (DataFrame) – dataframe for shunt compensators data

  • linear_model_df (Optional[DataFrame]) – dataframe for linear model sections data

  • non_linear_model_df (Optional[DataFrame]) – dataframe for sections data

Return type:

None

Notes

Valid attributes for the shunt compensators dataframe are:

  • id: the identifier of the new shunt

  • voltage_level_id: the voltage level where the new shunt will be created. The voltage level must already exist.

  • bus_id: the bus where the new shunt will be connected, if the voltage level has a bus-breaker topology kind.

  • connectable_bus_id: the bus where the new shunt will be connectable, if the voltage level has a bus-breaker topology kind.

  • node: the node where the new shunt will be connected, if the voltage level has a node-breaker topology kind.

  • name: an optional human-readable name

  • model_type: either LINEAR or NON_LINEAR

  • section_count: the current count of connected sections

  • target_v: an optional target voltage in kV

  • target_v: an optional deadband for the target voltage, in kV

Valid attributes for the linear sections models are:

  • id: the identifier of the new shunt

  • g_per_section: the conductance, in Ohm, for each section

  • b_per_section: the susceptance, in Ohm, for each section

  • max_section_count: the maximum number of connectable sections

This dataframe must have only one row for each shunt compensator.

Valid attributes for the non linear sections models are:

  • id: the identifier of the new shunt

  • g: the conductance, in Ohm, for this section

  • b: the susceptance, in Ohm, for this section

This dataframe will have multiple rows for each shunt compensator: one by section.

Examples

For example, to create linear model shunts, we need 1 dataframe for the shunts and 1 dataframe for the linear model of sections:

shunt_df = pd.DataFrame.from_records(
    index='id',
    columns=['id', 'name', 'model_type', 'section_count', 'target_v',
             'target_deadband', 'voltage_level_id', 'node'],
    data=[('SHUNT-1', '', 'LINEAR', 1, 400, 2, 'S1VL2', 2)])
model_df = pd.DataFrame.from_records(
    index='id',
    columns=['id', 'g_per_section', 'b_per_section', 'max_section_count'],
    data=[('SHUNT-1', 0.14, -0.01, 2)])
n.create_shunt_compensators(shunt_df, model_df)

For non linear model shunts, we need 1 dataframe for the shunts and 1 dataframe for the sections:

shunt_df = pd.DataFrame.from_records(
    index='id',
    columns=['id', 'name', 'model_type', 'section_count', 'target_v',
             'target_deadband', 'voltage_level_id', 'node'],
    data=[('SHUNT1', '', 'NON_LINEAR', 1, 400, 2, 'S1VL2', 2),
          ('SHUNT2', '', 'NON_LINEAR', 1, 400, 2, 'S1VL2', 10)])
model_df = pd.DataFrame.from_records(
    index='id',
    columns=['id', 'g', 'b'],
    data=[('SHUNT1', 1, 2),
          ('SHUNT1', 3, 4),
          ('SHUNT2', 5, 6),
          ('SHUNT2', 7, 8)])
n.create_shunt_compensators(shunt_df, non_linear_model_df=model_df)