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_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.
- Parameters:
created (**net** - The net within this generator should be)
**bus** (int)
**p_mw** (float) - The active power of the generator (positive for generation!)
**vm_pu** (float, default 0)
**sn_mva** (float, NaN)
**name** (string, None)
**index** (int, None)
**scaling** (float, 1.0)
**type** (string, None)
**slack** (bool, False)
**reactive_capability_curve** (bool, False)
**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** (string, None) - The curve style of the generator represents the relationship between active power (P) and reactive power (Q)
**controllable** (bool, NaN) – 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)
**xdss_pu** (float, NaN)
**rdss_ohm** (float, NaN)
**cos_phi** (float, NaN)
**pg_percent** (float, NaN) - Rated pg (voltage control range)
**power_station_trafo** (int, None)
**in_service** (bool, True)
**max_p_mw** (float, default NaN)
**min_p_mw** (float, default NaN)
**max_q_mvar** (float, default NaN)
**min_q_mvar** (float, default NaN)
**min_vm_pu** (float, default NaN)
**max_vm_pu** (float, default NaN)
net (pandapowerNet)
bus (int | integer)
p_mw (float)
vm_pu (float)
sn_mva (float)
name (str | None)
index (int | integer | None)
max_q_mvar (float)
min_q_mvar (float)
min_p_mw (float)
max_p_mw (float)
min_vm_pu (float)
max_vm_pu (float)
scaling (float)
type (str | None)
slack (bool)
id_q_capability_characteristic (int | None)
reactive_capability_curve (bool)
curve_style (str | None)
controllable (bool | float)
vn_kv (float)
xdss_pu (float)
rdss_ohm (float)
cos_phi (float)
pg_percent (float)
power_station_trafo (int | float)
in_service (bool)
slack_weight (float)
- Returns:
index (int) - The unique ID of the created generator
- Return type:
int | integer
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 |
\(\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_characteristic |
integer |
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
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_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:
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.