Generator

Note

A generator with positive active power represents a voltage controlled generator. If you want to model constant generation without voltage control, use the Static Generator element.

Create Function

pandapower.create.create_gen(net, bus, p_mw, vm_pu=get_default_value('gen', 'vm_pu'), sn_mva=nan, name=pd.NA, index=None, max_q_mvar=nan, min_q_mvar=nan, min_p_mw=nan, max_p_mw=nan, min_vm_pu=nan, max_vm_pu=nan, scaling=get_default_value('gen', 'scaling'), type=pd.NA, slack=get_default_value('gen', 'slack'), id_q_capability_characteristic=pd.NA, reactive_capability_curve=None, curve_style=pd.NA, controllable=pd.NA, vn_kv=nan, xdss_pu=nan, rdss_ohm=nan, cos_phi=nan, pg_percent=nan, power_station_trafo=pd.NA, in_service=get_default_value('gen', 'in_service'), slack_weight=nan, **kwargs)

Adds a generator to the network.

Generators are always modelled as voltage controlled PV nodes, which is why the input parameter is active power and a voltage set point. If you want to model a generator as PQ load with fixed reactive power and variable voltage, please use a static generator instead.

Parameters:
  • net (pandapowerNet) – The net within this generator should be created

  • bus (int | integer) – The bus id to which the generator is connected

  • p_mw (float) – The active power of the generator (positive for generation!)

  • vm_pu (float) – The voltage set point of the generator.

  • sn_mva (float) – Nominal power of the generator

  • name (str | NAType) – The name for this generator

  • index (int | integer | None) – Force a specified ID if it is available. If None, the index one higher than the highest already existing index is selected.

  • scaling (float) – scaling factor applying to the active power of the generator

  • type (str | NAType) – type variable to classify generators

  • slack (bool) – flag that sets the generator as slack if True

  • reactive_capability_curve (bool | None) – True if both the id_q_capability_characteristic and the curve style are present in the generator

  • id_q_capability_characteristic (int | NAType) – references the index of the characteristic from the net.q_capability_characteristic table (id_q_capability_curve column)

  • curve_style (str | NAType) – The curve style of the generator represents the relationship between active power (P) and reactive power (Q). It indicates whether the reactive power remains constant as the active power changes or varies dynamically in response to it, e.g. “straightLineYValues” and “constantYValue”.

  • controllable (bool | Iterable[bool] | NAType) – True: p_mw, q_mvar and vm_pu limits are enforced for this generator in OPF; False: p_mw and vm_pu set points are enforced and limits are ignored. Defaults to True if “controllable” column exists in DataFrame.

  • slack_weight (float) – Contribution factor for distributed slack power flow calculation (active power balancing)

  • vn_kv (float) – Rated voltage of the generator for shortcircuit calculation

  • xdss_pu (float) – Subtransient generator reactance for shortcircuit calculation

  • rdss_ohm (float) – Subtransient generator resistance for shortcircuit calculation

  • cos_phi (float) – Rated cosine phi of the generator for shortcircuit calculation

  • pg_percent (float) – Rated pg (voltage control range) of the generator for shortcircuit calculation

  • power_station_trafo (int | NAType) – Index of the power station transformer for shortcircuit calculation

  • in_service (bool) – True for in_service or False for out of service

  • max_p_mw (float) –

    Maximum active power injection

    • necessary for OPF

  • min_p_mw (float) –

    Minimum active power injection

    • necessary for OPF

  • max_q_mvar (float) –

    Maximum reactive power injection

    • necessary for OPF

  • min_q_mvar (float) –

    Minimum reactive power injection

    • necessary for OPF

  • min_vm_pu (float) – Minimum voltage magnitude. If not set, the bus voltage limit is taken - necessary for OPF.

  • max_vm_pu (float) – Maximum voltage magnitude. If not set, the bus voltage limit is taken - necessary for OPF.

Returns:

The ID of the created generator

Return type:

int | integer

Example

>>> create_gen(net, 1, p_mw=120, vm_pu=1.02)
pandapower.create.create_gens(net, buses, p_mw, vm_pu=get_default_value('gen', 'vm_pu'), sn_mva=nan, name=None, index=None, max_q_mvar=nan, min_q_mvar=nan, min_p_mw=nan, max_p_mw=nan, min_vm_pu=nan, max_vm_pu=nan, scaling=get_default_value('gen', 'scaling'), type=pd.NA, slack=get_default_value('gen', 'slack'), id_q_capability_characteristic=pd.NA, reactive_capability_curve=None, curve_style=pd.NA, controllable=None, vn_kv=nan, xdss_pu=nan, rdss_ohm=nan, cos_phi=nan, pg_percent=nan, power_station_trafo=pd.NA, in_service=get_default_value('gen', 'in_service'), slack_weight=nan, **kwargs)

Adds generators to the specified buses network.

Generators are always modelled as voltage controlled PV nodes, which is why the input parameter is active power and a voltage set point. If you want to model a generator as PQ load with fixed reactive power and variable voltage, please use a static generator instead.

Parameters:
  • net (pandapowerNet) – The net within this generator should be created

  • buses (Sequence) – The bus ids to which the generators are connected

  • p_mw (float | Iterable[float]) – The active power of the generator (positive for generation!)

  • vm_pu (float | Iterable[float]) – The voltage set point of the generator.

  • sn_mva (float | Iterable[float]) – Nominal power of the generator

  • name (Iterable[str] | None) – The name for this generator

  • index (int | integer | Iterable[int | integer] | None) – Force a specified ID if it is available. If None, the index one higher than the highest already existing index is selected.

  • scaling (float | Iterable[float]) – scaling factor which for the active power of the generator

  • type (str | Iterable[str] | NAType) – type variable to classify generators

  • reactive_capability_curve (bool | Iterable[bool] | None) – True if both the id_q_capability_characteristic and the curve style are present in the generator.

  • id_q_capability_characteristic (int | integer | Iterable[int | integer] | NAType) – references the index of the characteristic from the lookup table net.q_capability_characteristic e.g. 0, 1, 2, 3

  • curve_style (str | Iterable[str] | NAType) – The curve style of the generator represents the relationship between active power (P) and reactive power (Q). It indicates whether the reactive power remains constant as the active power changes or varies dynamically in response to it. e.g. “straightLineYValues” and “constantYValue”

  • controllable (bool | float | Iterable[bool | float] | None) –

    • True: p_mw, q_mvar and vm_pu limits are enforced for this generator in OPF

    • False: p_mw and vm_pu set points are enforced and limits are ignored.

    defaults to True if “controllable” column exists in DataFrame

  • vn_kv (float | Iterable[float]) – Rated voltage of the generator for shortcircuit calculation

  • xdss_pu (float | Iterable[float]) – Subtransient generator reactance for shortcircuit calculation

  • rdss_ohm (float | Iterable[float]) – Subtransient generator resistance for shortcircuit calculation

  • cos_phi (float | Iterable[float]) – Rated cosine phi of the generator for shortcircuit calculation

  • pg_percent (float) – Rated pg (voltage control range) of the generator for shortcircuit calculation

  • power_station_trafo (int | integer | NAType) – Index of the power station transformer for shortcircuit calculation

  • in_service (bool) – True for in_service or False for out of service

  • slack_weight (float) – Contribution factor for distributed slack power flow calculation (active power balancing)

  • max_p_mw (float | Iterable[float]) –

    Maximum active power injection

    • necessary for OPF

  • min_p_mw (float | Iterable[float]) –

    Minimum active power injection

    • necessary for OPF

  • max_q_mvar (float | Iterable[float]) –

    Maximum reactive power injection

    • necessary for OPF

  • min_q_mvar (float | Iterable[float]) –

    Minimum reactive power injection

    • necessary for OPF

  • min_vm_pu (float | Iterable[float]) –

    Minimum voltage magnitude. If not set the bus voltage limit is taken.

    • necessary for OPF.

  • max_vm_pu (float | Iterable[float]) –

    Maximum voltage magnitude. If not set the bus voltage limit is taken.

    • necessary for OPF

  • slack (bool | Iterable[bool])

Returns:

The ID of the created generator

Return type:

ndarray[tuple[Any, …], dtype[int | integer]]

Example

>>> create_gens(net, [1, 2], p_mw=[120, 100], vm_pu=[1.02, 0.99])

Table Structure

net.gen

Parameter

Datatype

Value Range

Explanation

nullable

required

optimal power flow

short circuit

name

name of the generator

✓

type

type variable to classify generators naming conventions: “sync” - synchronous generator “async” - asynchronous generator

✓

bus

int

>=0

index of connected bus

✓

p_mw

float

active power of the generator [MW]

✓

vm_pu

float

>0

voltage set point of the generator [p.u.]

✓

sn_mva

float

>0

nominal power of the generator [MVA]

✓

max_q_mvar

float

maximum reactive power of the generator [MVAr]

✓

min_q_mvar

float

minimum reactive power of the generator [MVAr]

✓

scaling

float

>=0

scaling factor for the active power

✓

max_p_mw

float

maximum active power

✓

min_p_mw

float

minimum active power

✓

vn_kv

float

rated voltage of the generator

✓

✓

xdss_pu

float

>0

subtransient generator reactance in per unit

✓

✓

rdss_ohm

float

>0

subtransient generator resistence in ohm

✓

✓

cos_phi

float

[0, 1]

rated generator cosine phi

✓

✓

in_service

bool

specifies if the generator is in service

✓

power_station_trafo

int

index of the power station trafo (short-circuit relevant)

✓

✓

id_q_capability_characteristic

int

references the index of the characteristic from the q_capability_characteristic

✓

curve_style

[‘straightLineYValues’, ‘constantYValue’]

the style of the generator reactive power capability curve

✓

reactive_capability_curve

bool

True if generator has dependency on q characteristic

slack_weight

float

weight of the slack when using multiple slacks

✓

slack

bool

use the gen as slack

✓

controllable

bool

allow control for opf

✓

pg_percent

float

Rated pg (voltage control range) of the generator for short-circuit calculation

✓

✓

min_vm_pu

float

>=0

Minimum voltage magnitude. If not set, the bus voltage limit is taken - necessary for OPF.

✓

max_vm_pu

float

>0

Maximum voltage magnitude. If not set, the bus voltage limit is taken - necessary for OPF

✓

Generator Reactive Power Capability Curve Characteristics

The generator reactive power capability curve characteristics serve as a reference for determining the reactive power limits of a generator (Qmin and Qmax) as a function of its active power output. The reactive power capability curve data can be imported into pandapower in a tabular format, populating net.q_capability_curve_table. This table can either be automatically generated via the CIM CGMES to pandapower converter and the PowerFactory to pandapower converter, provided the information is available in the Equipment (EQ) profile and the “Capability curve” section, respectively, or it can be manually defined by the user.

Q capability curve characteristic objects are then generated from net.q_capability_curve_table, populating net.q_capability_characteristic. The characteristics can either be automatically generated via the CIM CGMES to pandapower converter or the PowerFactory to pandapower converter, or they can be created by the user using the pandapower.control.util.create_q_capability_characteristics_object function, provided that the q_capability_curve_table is previously defined in the network case.

If the variable reactive_capability_curve in net.gen is set to True, it indicates that pairs of P vs Qmin/Qmax values and the corresponding characteristic are defined in net.q_capability_curve_table and net.q_capability_characteristic respectively. This overrides the default reactive power limits of the generator when i) a power flow is executed and the enforce_q_lims option is enabled; or ii) an optimal power flow is executed for generators that have their controllable flag set to True. The variable id_q_capability_characteristic in net.gen establishes a link to the id_q_capability_curve column in both net.q_capability_curve_table and net.q_capability_characteristic, associating each generator with its respective capability curve.

Below is an example of a q_capability_curve_table, populated for two sample generators.

id_q_capability_curve

p_mw

q_min_mvar

q_max_mvar

0

0

-20.01000023

-360.0100098

310.0100098

1

0

0

-360.0100098

307.9073181

2

0

389

-360.0100098

267.0100098

3

0

555

-251.0099945

251.0099945

4

0

574

-181.0099945

181.0099945

5

0

583.0100098

-128.0099945

128.0099945

6

1

-331.0100098

-0.01

0.01

7

1

-298

-134.0099945

134.0099945

8

1

-198

-265.0100098

228.0099945

9

1

-66.19999695

-323.0100098

257.0100098

10

1

-0.100000002

-323.0100098

261.0100098

11

1

0

-323.0100098

261.0100098

12

1

0.100000002

-323.0100098

261.0100098

13

1

66.19999695

-323.0100098

257.0100098

14

1

198

-265.0100098

228.0099945

15

1

298

-134.0099945

134.0099945

16

1

331.0100098

-0.01

0.01

The table below illustrates an example of a q_capability_characteristic table populated for two generators.

id_q_capability_curve

q_max_characteristic

q_min_characteristic

0

0

Characteristic

Characteristic

1

1

Characteristic

Characteristic

Note

  • reactive_capability_curve has to be set to True, and id_q_capability_characteristic and curve_style variables need to be populated in order to consider the reactive power limits of the corresponding characteristic.

  • Each generator supports only a single reactive power capability curve.

  • In this version, only two types of generator reactive power capability characteristics are supported: 1. constantYValue: The reactive power values are assumed constant until the next curve point and prior to the first curve point. 2. straightLineYValues: The reactive power values are assumed to be a straight line between values.

  • Linear interpolation is employed to determine Qmin and Qmax based on the given active power dispatch for the above two curve types.

The function pandapower.control.util.q_capability_curve_table_diagnostic is available to perform sanity checks on the generator reactive power capability curve table.

net.q_capability_characteristic

Parameter

Datatype

Explanation

id_q_capability_curve

int

ID in gen or sgen table column id_q_capability_characteristic

q_max_characteristic

Characteristic

corresponding Q max characteristic

q_min_characteristic

Characteristic

corresponding Q min characteristic

net.q_capability_curve_table

Parameter

Datatype

Explanation

id_q_capability_curve

int

ID in gen or sgen table column id_q_capability_characteristic

p_mw

float

discrete P value for the Q min and max values [MW]

q_min_mvar

float

corresponding Q min value [MVAr]

q_max_mvar

float

corresponding Q max value [MVAr]

Electric Model

Generators are modelled as PV-nodes in the power flow:

alternate Text

Voltage magnitude and active power are defined by the input parameters in the generator table:

\begin{align*} P_{gen} &= p\_mw * scaling \\ v_{bus} &= vm\_pu \end{align*}

Result Tables

net.res_gen

Parameter

Datatype

Explanation

nullable

required

p_mw

float

resulting active power production after scaling [MW]

✓

✓

q_mvar

float

resulting reactive power production after scaling [MVar]

✓

✓

va_degree

float

generator voltage angle [degree]

✓

✓

vm_pu

float

voltage at the generator [p.u.]

✓

✓

The power flow returns reactive generator power and generator voltage angle:

\begin{align*} p\_mw &= P_{gen} \\ q\_mvar &= Q_{gen} \\ va\_degree &= \angle \underline{v}_{bus} \\ vm\_degree &= |\underline{v}_{bus}| \end{align*}

Note

If the power flow is run with the enforce_q_lims option and the generator reactive power output is outside the reactive power limits, the generator is converted to a static generator with the maximum / minimum reactive power as constant reactive power generation. The voltage at the generator bus is then no longer equal to the voltage set point defined in the parameter table.