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=1.0, 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=1.0, type=None, slack=False, id_q_capability_characteristic=None, reactive_capability_curve=False, curve_style=None, controllable=None, vn_kv=nan, xdss_pu=nan, rdss_ohm=nan, cos_phi=nan, pg_percent=nan, power_station_trafo=nan, in_service=True, slack_weight=0.0, **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 | None) – 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 | None) – type variable to classify generators

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

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

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

  • curve_style (str | None) – 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 | 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.

  • 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 | float) – 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=1.0, 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=1.0, type=None, slack=False, id_q_capability_characteristic=None, reactive_capability_curve=False, curve_style=None, controllable=None, vn_kv=nan, xdss_pu=nan, rdss_ohm=nan, cos_phi=nan, pg_percent=nan, power_station_trafo=nan, in_service=True, slack_weight=0.0, **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] | None) – type variable to classify generators

  • reactive_capability_curve (bool | Iterable[bool]) – 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] | None) – 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] | None) – 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] | 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 | float) – 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])

Input Parameters

net.gen

Parameter

Datatype

Value Range

Explanation

name

string

name of the generator

type

string

naming conventions:
“sync” - synchronous generator
“async” - asynchronous generator

type variable to classify generators

bus*

integer

\(\geq\) 0

index of connected bus

p_mw*

float

\(\geq\) 0

the real 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

\(\geq\) 0

scaling factor for the active power

max_p_mw**^^

float

maximum active power

min_p_mw**^^

float

minimum active power

vn_kv***

float

\(>\) 0

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

\(\leq\) 1

rated generator cosine phi

in_service*

boolean

True / False

specifies if the generator is in service

power_station_trafo***

integer

\(\geq\) 0

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

id_q_capability_characteristic

integer

\(\geq\) 0

references the index of the characteristic from the q_capability_characteristic

curve_style

string

either “straightLineYValues” or “constantYValue”

the style of the generator reactive power capability curve

reactive_capability_curve

boolean

True / False

True if generator has dependency on q characteristic

*necessary for executing a power flow calculation
**optimal power flow parameter
***short-circuit calculation parameter
^relevant for power flow calculation when enforce_q_lims optional parameter is set to True
^^relevant for power flow calculation when enforce_p_lims optional parameter is set to True

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 Parameters

net.res_gen

Parameter

Datatype

Explanation

p_mw

float

resulting active power demand after scaling [MW]

q_mvar

float

resulting reactive power demand 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.