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.
See also
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_curve_characteristic=None, reactive_capability_curve=False, curve_style=None, controllable=nan, 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.
- INPUT:
net - The net within this generator should be created
bus (int) - The bus id to which the generator is connected
p_mw (float, default 0) - The active power of the generator (positive for generation!)
- OPTIONAL:
vm_pu (float, default 0) - The voltage set point of the generator.
sn_mva (float, NaN) - Nominal power of the generator
name (string, None) - The name for this generator
index (int, 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, 1.0) - scaling factor applying to the active power of the generator
type (string, None) - type variable to classify generators
reactive_capability_curve (bool, False) - True if both the id_q_capability_curve_characteristic and the curve style are present in the generator
id_q_capability_curve_characteristic (int, None) - references the index of the characteristic from the net.q_capability_curve_characteristic table (id_q_capability_curve column)
curve_style (string, 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, NaN) - 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, default 0.0) - Contribution factor for distributed slack power flow calculation (active power balancing)
vn_kv (float, NaN) - Rated voltage of the generator for short-circuit calculation
xdss_pu (float, NaN) - Subtransient generator reactance for short-circuit calculation
rdss_ohm (float, NaN) - Subtransient generator resistance for short-circuit calculation
cos_phi (float, NaN) - Rated cosine phi of the generator for short-circuit calculation
pg_percent (float, NaN) - Rated pg (voltage control range) of the generator for short-circuit calculation
power_station_trafo (int, None) - Index of the power station transformer for short-circuit calculation
in_service (bool, True) - True for in_service or False for out of service
max_p_mw (float, default NaN) - Maximum active power injection - necessary for OPF
min_p_mw (float, default NaN) - Minimum active power injection - necessary for OPF
max_q_mvar (float, default NaN) - Maximum reactive power injection - necessary for OPF
min_q_mvar (float, default NaN) - Minimum reactive power injection - necessary for OPF
min_vm_pu (float, default NaN) - Minimum voltage magnitude. If not set, the bus voltage limit is taken - necessary for OPF.
max_vm_pu (float, default NaN) - Maximum voltage magnitude. If not set, the bus voltage limit is taken - necessary for OPF
- OUTPUT:
index (int) - The unique ID of the created generator
- EXAMPLE:
create_gen(net, 1, p_mw=120, vm_pu=1.02)
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 |
index of connected bus |
|
p_mw* |
float |
\(\leq\) 0 |
the real power of the generator [MW] |
vm_pu* |
float |
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 |
\(\leq\) 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 |
:math:0 leq 1 |
rated generator cosine phi |
in_service* |
boolean |
True / False |
specifies if the generator is in service |
power_station_trafo*** |
integer |
index of the power station trafo (short-circuit relevant) |
|
id_q_capability_curve_characteristic |
integer |
references the index of the characteristic from the q_capability_curve_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
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_curve_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_curve_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_curve_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_curve_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_curve_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_curve_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_curve_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_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.
Electric Model
Generators are modelled as PV-nodes in the power flow:

Voltage magnitude and active power are defined by the input parameters in the generator table:
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:
Note
If the power flow is run with the enforce_q_lims option and the generator reactive power exceeds / falls short of the maximum / minimum reactive power limit, 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.