6. API Reference¶
6.1. Parser¶
-
class
pfnet.ParserBase¶ Base parser class.
-
parse(self, filename, num_periods=None)¶ Parsers data file.
Parameters: - filename : string
- num_periods : int
Returns: - net :
Network
-
set(self, key, value)¶ Sets parser parameter.
Parameters: - key : string
- value : float
-
show(self)¶ Shows parser information/data.
-
-
class
pfnet.Parser¶
-
class
pfnet.ParserJSON¶ JSON parser class.
-
class
pfnet.ParserMAT¶ MAT parser class.
6.2. Bus¶
6.2.1. Bus Properties¶
"any" |
|
"slack" |
|
"regulated by generator" |
|
"regulated by transformer" |
|
"regulated by shunt" |
|
"not slack" |
|
"not regulated by generator" |
6.2.2. Bus Quantities¶
"all" |
|
"voltage angle" |
|
"voltage magnitude" |
6.2.3. Bus Class¶
-
class
pfnet.Bus(num_periods=1, alloc=True)¶ Bus class.
Parameters: - num_periods : int
- alloc : {
True,False}
-
add_reg_generator(self, reg_gen)¶ Adds a regulating generator connection to this bus.
Parameters: - reg_gen :
Generator
- reg_gen :
-
add_reg_shunt(self, reg_shunt)¶ Adds a regulating shunt connection to this bus.
Parameters: - reg_shunt :
Shunt
- reg_shunt :
-
add_reg_tran(self, reg_tran_branch)¶ Adds a regulating transformer connection to this bus.
Parameters: - reg_tran_branch :
Branch
- reg_tran_branch :
-
add_var_generator(self, vargen)¶ Adds a variable generator connection to this bus.
Parameters: - vargen :
VarGenerator
- vargen :
-
area¶ Bus area (int).
-
branches_from¶ Deprecated since version 1.2.5: Same as
branches_k.
-
branches_to¶ Deprecated since version 1.2.5: Same as
branches_m.
-
csc_converters¶ List of
ConverterCSCobjects connected to this bus (list).
-
degree¶ Bus degree (number of incident branches) (float).
-
flags_bounded¶ Flags associated with bounded quantities (byte).
-
flags_fixed¶ Flags associated with fixed quantities (byte).
-
flags_sparse¶ Flags associated with sparse quantities (byte).
-
flags_vars¶ Flags associated with variable quantities (byte).
-
get_largest_mismatch(self, t=0)¶ Gets the bus power mismatch of largest absolute value.
Parameters: - t : int (time period)
Returns: - mis : float
-
get_largest_mismatch_type(self, t=0)¶ Gets the type of bus power mismatch of largest absolute value.
Parameters: - t : int (time period)
Returns: - type : string
-
get_largest_sensitivity(self, t=0)¶ Gets the bus sensitivity of largest absolute value.
Parameters: - t : int (time period)
Returns: - sens : float
-
get_largest_sensitivity_type(self, t=0)¶ Gets the type of bus sensitivity of largest absolute value.
Parameters: - t : int (time period)
Returns: - type : string
-
get_num_vars(self, q, t_start=0, t_end=None)¶ Gets number of variables associated with the given quantities.
Parameters: - q : string or list of strings (Bus Quantities)
- t_start : int
- t_end : int
Returns: - num : int
-
get_total_gen_P(self, t=0)¶ Gets the total active power injected by generators connected to this bus.
Parameters: - t : int (time period)
Returns: - P : float
-
get_total_gen_Q(self, t=0)¶ Gets the total reactive power injected by generators connected to this bus.
Parameters: - t : int (time period)
Returns: - Q : float
-
get_total_gen_Q_max(self)¶ Gets the largest total reactive power that can be injected by generators connected to this bus.
Returns: - Q_max : float
-
get_total_gen_Q_min(self)¶ Gets the smallest total reactive power that can be injected by generators connected to this bus.
Returns: - Q_min : float
-
get_total_load_P(self, t=0)¶ Gets the total active power consumed by loads connected to this bus.
Parameters: - t : int (time period)
Returns: - P : float
-
get_total_load_Q(self, t=0)¶ Gets the total reactive power consumed by loads connected to this bus.
Parameters: - t : int (time period)
Returns: - Q : float
-
get_total_reg_gen_Q(self, t=0)¶ Gets the total reactive power injected by generators regulating this bus.
Parameters: - t : int (time period)
Returns: - Q : float
-
get_total_reg_gen_Q_max(self)¶ Gets the maximum total reactive power injected by generators regulating this bus.
Returns: - Q_max : float
-
get_total_reg_gen_Q_min(self)¶ Gets the minimum total reactive power injected by generators regulating this bus.
Returns: - Q_min : float
-
get_total_shunt_b(self, t=0)¶ Gets the combined susceptance of shunt devices connected to this bus.
Parameters: - t : int (time period)
Returns: - b : float
-
get_total_shunt_g(self)¶ Gets the combined conductance of shunt devices connected to this bus.
Returns: - g : float
-
get_v_max(self, code='normal')¶ Gets bus voltage magnitude upper limit.
Parameters: - code : string (‘normal’, ‘emergency’, ‘regulation’)
Returns: - v_max : float
-
get_v_min(self, code='normal')¶ Gets bus voltage magnitude lower limit.
Parameters: - code : string (‘normal’, ‘emergency’, ‘regulation’)
Returns: - v_min : float
-
get_var_info_string(self, index)¶ Gets info string of variable associated with index.
Parameters: - index : int
Returns: - info : string
-
has_flags(self, flag_type, q)¶ Determines whether the bus has the flags associated with certain quantities set.
Parameters: - flag_type : string (Flag Types)
- q : string or list of strings (Bus Quantities)
Returns: - flag : {
True,False}
-
in_service¶ In service flag (boolean).
-
index¶ Bus index (int).
-
is_equal(self, other)¶ Determines whether the bus is equal to given bus.
Parameters: - other :
Bus
Returns: - flag : {
True,False}
- other :
-
is_in_service(self)¶ Determines whether the bus is in service.
Returns: - in_service : {
True,False}
- in_service : {
-
is_regulated_by_facts(self, only_in_service=False)¶ Determines whether the bus is regulated by a FACTS device.
Parameters: - only_in_service : {
True,False} (for considering only regulating devices that are in service)
Returns: - flag : {
True,False}
- only_in_service : {
-
is_regulated_by_gen(self, only_in_service=False)¶ Determines whether the bus is regulated by a generator.
Parameters: - only_in_service : {
True,False} (for considering only regulating devices that are in service)
Returns: - flag : {
True,False}
- only_in_service : {
-
is_regulated_by_shunt(self, only_in_service=False)¶ Determines whether the bus is regulated by a shunt device.
Parameters: - only_in_service : {
True,False} (for considering only regulating devices that are in service)
Returns: - flag : {
True,False}
- only_in_service : {
-
is_regulated_by_tran(self, only_in_service=False)¶ Determines whether the bus is regulated by a transformer.
Parameters: - only_in_service : {
True,False} (for considering only regulating devices that are in service)
Returns: - flag : {
True,False}
- only_in_service : {
-
is_regulated_by_vsc_converter(self, only_in_service=False)¶ Determines whether the bus is regulated by a VSC converter.
Parameters: - only_in_service : {
True,False} (for considering only regulating devices that are in service)
Returns: - flag : {
True,False}
- only_in_service : {
-
is_slack(self)¶ Determines whether the bus is a slack bus.
Returns: - flag : {
True,False}
- flag : {
-
is_star(self)¶ Determines whether the bus is a star bus.
Returns: - flag : {
True,False}
- flag : {
-
is_v_set_regulated(self, only_in_service=False)¶ Determines whether the bus has its voltage set point regulated.
Parameters: - only_in_service : {
True,False} (for considering only regulating devices that are in service)
Returns: - flag : {
True,False}
- only_in_service : {
-
json_string¶ JSON string (string).
-
name¶ Bus name (string).
-
num_periods¶ Number of time periods (int).
-
number¶ Bus number (int).
-
obj_type¶ Object type (string).
-
oindex¶ Index of bus in original network (before merging equivalent buses) (int).
-
reg_vsc_converters¶ List of
ConverterVSCobjects regulating the voltage magnitude of this bus (list).
-
remove_all_connections(self)¶ Removes all connections to this bus.
-
remove_branch_k(self, branch)¶ Removes a “k” branch connection to this bus.
Parameters: - branch :
Branch
- branch :
-
remove_branch_m(self, branch)¶ Removes an “m” branch connection to this bus.
Parameters: - branch :
Branch
- branch :
-
remove_generator(self, gen)¶ Removes a generator connection to this bus.
Parameters: - gen :
Generator
- gen :
-
remove_reg_generator(self, reg_gen)¶ Removes a regulating generator connection to this bus.
Parameters: - reg_gen :
Generator
- reg_gen :
-
remove_reg_shunt(self, reg_shunt)¶ Removes a regulating shunt connection to this bus.
Parameters: - reg_shunt :
Shunt
- reg_shunt :
-
remove_reg_tran(self, reg_tran_branch)¶ Removes a regulating transformer connection to this bus.
Parameters: - reg_tran_branch :
Branch
- reg_tran_branch :
-
remove_var_generator(self, vargen)¶ Removes a variable generator connection to this bus.
Parameters: - vargen :
VarGenerator
- vargen :
-
sens_P_balance¶ Objective function sensitivity with respect to bus active power balance (float or
ndarray).
-
sens_Q_balance¶ Objective function sensitivity with respect to bus reactive power balance (float or
ndarray).
-
sens_v_ang_l_bound¶ Objective function sensitivity with respect to voltage angle lower bound (float or
ndarray).
-
sens_v_ang_u_bound¶ Objective function sensitivity with respect to voltage angle upper bound (float or
ndarray).
-
sens_v_mag_l_bound¶ Objective function sensitivity with respect to voltage magnitude lower bound (float or
ndarray).
-
sens_v_mag_u_bound¶ Objective function sensitivity with respect to voltage magnitude upper bound (float or
ndarray).
-
sens_v_reg_by_shunt¶ Objective function sensitivity with respect to bus voltage regulation by shunts (float or
ndarray).
-
sens_v_reg_by_tran¶ Objective function sensitivity with respect to bus voltage regulation by transformers (float or
ndarray).
-
sens_v_set_reg¶ Objective function sensitivity with respect to bus voltage set point regulation (float or
ndarray).
-
set_dP_index(self, idx, t)¶ Sets helper index for active power mismatches.
Parameters: - idx : int
- t : int
-
set_dQ_index(self, idx, t)¶ Sets helper index for reactive power mismatches.
Parameters: - idx : int
- t : int
-
set_slack_flag(self, flag)¶ Sets the slack flag.
Parameters: - bool : {
True,False}
- bool : {
-
set_star_flag(self, flag)¶ Sets the star flag.
Parameters: - bool : {
True,False}
- bool : {
-
show(self, t=0)¶ Shows bus properties.
Parameters: - t : int (time period)
-
v_base¶ Bus base voltage (kilo-volts) (float).
-
v_max¶ Same as
v_max_norm.
-
v_max_emer¶ Bus emergency maximum voltage magnitude (p.u. bus base kv) (float).
-
v_max_norm¶ Bus normal maximum voltage magnitude (p.u. bus base kv) (float).
-
v_max_reg¶ Bus regulation maximum voltage magnitude (p.u. bus base kv) (float).
-
v_min¶ Same as
v_min_norm.
-
v_min_emer¶ Bus emergency minimum voltage magnitude (p.u. bus base kv) (float).
-
v_min_norm¶ Bus normal minimum voltage magnitude (p.u. bus base kv) (float).
-
v_min_reg¶ Bus regulation minimum voltage magnitude (p.u. bus base kv) (float).
-
var_generators¶ List of
VarGeneratorobjects connected to this bus (list).
-
vsc_converters¶ List of
ConverterVSCobjects connected to this bus (list).
-
zone¶ Bus zone (int).
6.3. Branch¶
6.3.1. Branch Properties¶
"any" |
|
"tap changer" |
|
"tap changer - v" |
Controls voltage magnitude |
"tap changer - Q" |
Controls reactive flow |
"phase shifter" |
|
"not on outage" |
6.3.2. Branch Quantities¶
"all" |
|
"phase shift" |
|
"tap ratio" |
6.3.3. Branch Class¶
-
class
pfnet.Branch(num_periods=1, alloc=True)¶ Branch class.
Parameters: - num_periods : int
- alloc : {
True,False}
-
P_km_series¶ Real power flow at bus “k” towards bus “m” over the series impedance of the line (p.u.) (float or
ndarray).
-
P_max¶ Maximum active power flow (p.u.) (float).
-
P_min¶ Minimum active power flow (p.u.) (float).
-
P_mk_series¶ Real power flow at bus “m” towards bus “k” over the series impedance of the line (p.u.) (float or
ndarray).
-
Q_km_series¶ Reactive power flow at bus “k” towards bus “m” over the series impedance of the line (p.u.) (float or
ndarray).
-
Q_max¶ Maximum reactive power flow (p.u.) (float).
-
Q_min¶ Minimum reactive power flow (p.u.) (float).
-
Q_mk_series¶ Reactive power flow at bus “m” towards bus “k” over the series impedance of the line (p.u.) (float or
ndarray).
-
b¶ Branch series susceptance (p.u.) (float).
-
b_k¶ Branch shunt susceptance at the “k” side (p.u.) (float).
-
b_m¶ Branch shunt susceptance at the “m” side (p.u.) (float).
-
flags_bounded¶ Flags associated with bounded quantities (byte).
-
flags_fixed¶ Flags associated with fixed quantities (byte).
-
flags_sparse¶ Flags associated with sparse quantities (byte).
-
flags_vars¶ Flags associated with variable quantities (byte).
-
g¶ Branch series conductance (p.u.) (float).
-
g_k¶ Branch shunt conductance at the “k” side (p.u.) (float).
-
g_m¶ Branch shunt conductance at the “m” side (p.u.) (float).
-
get_P_k_shunt(self, var_values=None)¶ Gets the real power flow into the shunt element at bus “k” (p.u.).
Parameters: - var_values :
ndarray
Returns: - P_k_shunt : float or
ndarray
- var_values :
-
get_P_km(self, var_values=None)¶ Gets the real power flow at bus “k” towards bus “m” (p.u.)
Parameters: - var_values :
ndarray
Returns: - P_km : float or
ndarray
- var_values :
-
get_P_km_series(self, var_values=None)¶ Gets the real power flow at bus “k” towards bus “m” over the series impedance of the line (p.u.).
Parameters: - var_values :
ndarray
Returns: - P_km_series : float or
ndarray
- var_values :
-
get_P_m_shunt(self, var_values=None)¶ Gets the real power flow into the shunt element at bus “m” (p.u.).
Parameters: - var_values :
ndarray
Returns: - P_m_shunt : float or
ndarray
- var_values :
-
get_P_mk(self, var_values=None)¶ Gets the real power flow at bus “m” towards bus “k” (p.u.).
Parameters: - var_values : :
ndarray
Returns: - P_mk : float or
ndarray
- var_values : :
-
get_P_mk_series(self, var_values=None)¶ Gets the real power flow at bus “m” towards bus “k” over the series impedance of the line (p.u.).
Parameters: - var_values :
ndarray
Returns: - P_mk_series : float or
ndarray
- var_values :
-
get_Q_k_shunt(self, var_values=None)¶ Gets the reactive power flow into the shunt element bus “k” (p.u.).
Parameters: - var_values :
ndarray
Returns: - Q_k_shunt : float or
ndarray
- var_values :
-
get_Q_km(self, var_values=None)¶ Gets the reactive power flow at bus “k” towards bus “m” (p.u.).
Parameters: - var_values :
ndarray
Returns: - Q_km : float or
ndarray
- var_values :
-
get_Q_km_series(self, var_values=None)¶ Gets the reactive power flow at bus “k” towards bus “m” over the series impedance of the line (p.u.).
Parameters: - var_values :
ndarray
Returns: - Q_km_series : float or
ndarray
- var_values :
-
get_Q_m_shunt(self, var_values=None)¶ Gets the reactive power flow into the shunt element at bus “m” (p.u.).
Parameters: - var_values :
ndarray
Returns: - Q_m_shunt : float or
ndarray
- var_values :
-
get_Q_mk(self, var_values=None)¶ Gets the reactive power flow at bus “m” towards bus “k” (p.u.).
Parameters: - var_values :
ndarray
Returns: - Q_mk : float or
ndarray
- var_values :
-
get_Q_mk_series(self, var_values=None)¶ Gets the reactive power flow at bus “m” towards bus “k” over the series impedance of the line (p.u.).
Parameters: - var_values :
ndarray
Returns: - Q_mk_series : float or
ndarray
- var_values :
-
get_S_km_mag(self, var_values=None)¶ Gets the branch apparent power magnitude at bus “k” torwards bus “m” (p.u.).
Parameters: - var_values :
ndarray
Returns: - S_mag : float or
ndarray
- var_values :
-
get_S_mk_mag(self, var_values=None)¶ Gets the branch apparent power magnitude at bus “m” torwards bus “k” (p.u.).
Parameters: - var_values :
ndarray
Returns: - S_mag : float or
ndarray
- var_values :
-
get_i_km_mag(self, var_values=None, eps=0.)¶ Gets the branch current magnitude at bus “k” torwards bus “m” (p.u.).
Parameters: - var_values :
ndarray - eps : float
Returns: - i_mag : float or
ndarray
- var_values :
-
get_i_mk_mag(self, var_values=None, eps=0.)¶ Gets the branch current magnitude at bus “m” torwards bus “k” (p.u.).
Parameters: - var_values :
ndarray - eps : float
Returns: - i_mag : float or
ndarray
- var_values :
-
get_rating(self, code)¶ Gets branch thermal rating.
Parameters: - code : string (‘A’, ‘B’, ‘C’)
Returns: - rating : float
-
get_var_info_string(self, index)¶ Gets info string of variable associated with index.
Parameters: - index : int
Returns: - info : string
-
has_flags(self, flag_type, q)¶ Determines whether the branch has the flags associated with specific quantities set.
Parameters: - flag_type : string (Flag Types)
- q : string or list of strings (Branch Quantities)
Returns: - flag : {
True,False}
-
has_pos_ratio_v_sens(self)¶ Determines whether tap-changing transformer has positive sensitivity between tap ratio and controlled bus voltage magnitude.
Returns: - flag : {
True,False}
- flag : {
-
has_y_correction(self)¶ Determines whether branch has y correction table.
Returns: - flag : {
True,False}
- flag : {
-
in_service¶ In service flag (boolean).
-
index¶ Branch index (int).
-
is_equal(self, other)¶ Determines whether branch is equal to given branch.
Parameters: - other :
Branch
- other :
-
is_fixed_tran(self)¶ Determines whether branch is fixed transformer.
Returns: - flag : {
True,False}
- flag : {
-
is_in_service(self)¶ Determines whther the branch is in service.
Returns: - in_service : {
True,False}
- in_service : {
-
is_line(self)¶ Determines whether branch is transmission line.
Returns: - flag : {
True,False}
- flag : {
-
is_part_of_3_winding_transformer(self)¶ Determines whether branch is part of 3-winding transformer.
Returns: - flag : {
True,False}
- flag : {
-
is_phase_shifter(self)¶ Determines whether branch is phase shifter.
Returns: - flag : {
True,False}
- flag : {
-
is_tap_changer(self)¶ Determines whether branch is tap-changing transformer.
Returns: - flag : {
True,False}
- flag : {
-
is_tap_changer_Q(self)¶ Determines whether branch is tap-changing transformer that regulates reactive power flow.
Returns: - flag : {
True,False}
- flag : {
-
is_tap_changer_v(self)¶ Determines whether branch is tap-changing transformer that regulates bus voltage magnitude.
Returns: - flag : {
True,False}
- flag : {
-
is_zero_impedance_line()¶ ” Determines whether branch is a zero-impedance line.
Returns: - flag : {
True,False}
- flag : {
-
json_string¶ JSON string (string).
-
name¶ Branch name (string).
-
num_periods¶ Number of time periods (int).
-
num_ratios¶ Number of transformer tap ratio positions (int).
-
obj_type¶ Object type (string).
-
oindex¶ Index of branch in original network (before removing zero impedance lines) (int).
-
phase_max¶ Transformer phase shift upper limit (radians) (float).
-
phase_min¶ Transformer phase shift lower limit (radians) (float).
-
power_flow_Jacobian_km(self, var_values, t=0)¶ Constructs Jacobian of (Pkm, Qkm) at the given point and time.
Parameters: - var_values :
ndarray - t : int
Returns: - J :
coo_matrix
- var_values :
-
power_flow_Jacobian_mk(self, var_values, t=0)¶ Constructs Jacobian of (Pmk, Qmk) at the given point and time.
Parameters: - var_values :
ndarray - t : int
Returns: - J :
coo_matrix
- var_values :
-
ratingA¶ Branch thermal rating A (p.u. system base power) (float).
-
ratingB¶ Branch thermal rating B (p.u. system base power) (float).
-
ratingC¶ Branch thermal rating C (p.u. system base power) (float).
-
ratio_max¶ Transformer tap ratio upper limit (float).
-
ratio_min¶ Transformer tap ratio lower limit (float).
-
sens_P_l_bound¶ Objective function sensitivity with respect to active power flow lower bound (float or
ndarray).
-
sens_P_u_bound¶ Objective function sensitivity with respect to active power flow upper bound (float or
ndarray).
-
sens_i_mag_u_bound¶ Objective function sensitivity with respect to current magnitude upper bound (float or
ndarray).
-
sens_phase_l_bound¶ Objective function sensitivity with respect to phase shift lower bound (float or
ndarray).
-
sens_phase_u_bound¶ Objective function sensitivity with respect to phase shift upper bound (float or
ndarray).
-
sens_ratio_l_bound¶ Objective function sensitivity with respect to tap ratio lower bound (float or
ndarray).
-
sens_ratio_u_bound¶ Objective function sensitivity with respect to tap ratio upper bound (float or
ndarray).
-
set_as_fixed_tran(self)¶ Sets branch as a fixed transformer.
-
set_as_line(self)¶ Sets branch as a line.
-
set_as_phase_shifter(self)¶ Sets branch as a phase shifter.
-
set_as_tap_changer_Q(self)¶ Sets branch as a tap changer regulating reactive power.
-
set_as_tap_changer_v(self)¶ Sets branch as a tap changer regulating voltage.
-
set_pos_ratio_v_sens(self, flag)¶ Sets the flag for positive ratio-voltage sensitivity.
Parameters: - flag : {
True,False}
- flag : {
-
y_correction¶ Y correction table (
BranchYCorrection).
6.3.4. Branch Y Correction Class¶
-
class
pfnet.BranchYCorrection¶ Branch Y correction class.
-
is_based_on_phase_shift(self)¶ Determines whether the corrections are for changes in phase shift.
Returns: - flag : {
True,False}
- flag : {
-
is_based_on_tap_ratio(self)¶ Determines whether the corrections are for changes in tap ratio.
Returns: - flag : {
True,False}
- flag : {
-
max_num_values¶ Maximum number of correction values (int).
-
name¶ Name (string).
-
num_values¶ Number of correction values (int).
-
6.4. Generator¶
6.4.1. Generator Properties¶
"any" |
|
"slack" |
|
"regulator" |
|
"not slack" |
|
"not regulator" |
|
"not on outage" |
|
"adjustable active power" |
\(P_{\min} < P_{\max}\) |
6.4.2. Generator Quantities¶
"all" |
|
"active power" |
|
"reactive power" |
6.4.3. Generator Class¶
-
class
pfnet.Generator(num_periods=1, alloc=True)¶ Generator class.
Parameters: - num_periods : int
- alloc : {
True,False}
-
P_max¶ Generator active power upper limit (p.u. system base MVA) (float).
-
P_min¶ Generator active power lower limit (p.u. system base MVA) (float).
-
P_prev¶ Generator active power during the previous time period (p.u. system base MVA) (float).
-
Q_max¶ Generator reactive power upper limit (p.u. system base MVA) (float).
-
Q_min¶ Generator reactive power lower limit (p.u. system base MVA) (float).
-
Q_par¶ Generator reactive power participating factor (unitless) (float).
-
cost_coeff_Q0¶ Coefficient for genertion cost function (constant term, units of $/hr) (float).
-
cost_coeff_Q1¶ Coefficient for genertion cost function (linear term, units of $/(hr p.u.)) (float).
-
cost_coeff_Q2¶ Coefficient for genertion cost function (quadratic term, units of $/(hr p.u.^2)) (float).
-
dP_max¶ Generator active power ramping limit (p.u. system base MVA) (float).
-
flags_bounded¶ Flags associated with bounded quantities (byte).
-
flags_fixed¶ Flags associated with fixed quantities (byte).
-
flags_sparse¶ Flags associated with sparse quantities (byte).
-
flags_vars¶ Flags associated with variable quantities (byte).
-
get_var_info_string(self, index)¶ Gets info string of variable associated with index.
Parameters: - index : int
Returns: - info : string
-
has_flags(self, flag_type, q)¶ Determines whether the generator has the flags associated with certain quantities set.
Parameters: - flag_type : string (Flag Types)
- q : string or list of strings (Generator Quantities)
Returns: - flag : {
True,False}
-
in_service¶ In service flag (boolean).
-
index¶ Generator index (int).
-
is_P_adjustable(self)¶ Determines whether generator has adjustable active power.
Returns: - flag : {
True,False}
- flag : {
-
is_equal(self, other)¶ Determines whether generator is equal to given generator.
Parameters: - other :
Generator
- other :
-
is_in_service(self)¶ Determines whether the generator is in service.
Returns: - in_service : {
True,False}
- in_service : {
-
is_regulator(self)¶ Determines whether generator provides voltage regulation.
Returns: - flag : {
True,False}
- flag : {
-
is_slack(self)¶ Determines whether generator is slack.
Returns: - flag : {
True,False}
- flag : {
-
json_string¶ JSON string (string).
-
name¶ Generator name (string).
-
num_periods¶ Number of time periods (int).
-
obj_type¶ Object type (string).
-
sens_P_l_bound¶ Objective function sensitivity with respect to active power lower bound (float or
ndarray).
-
sens_P_u_bound¶ Objective function sensitivity with respect to active power upper bound (float or
ndarray).
6.5. Shunt¶
6.5.1. Shunt Properties¶
"any" |
|
"switching - v" |
Controls voltage magnitude |
6.5.2. Shunt Quantities¶
"all" |
|
"susceptance" |
6.5.3. Shunt Class¶
-
class
pfnet.Shunt(num_periods=1, alloc=True)¶ Shunt class.
Parameters: - num_periods : int
- alloc : {
True,False}
-
b_max¶ Shunt susceptance upper limit (p.u.) (float).
-
b_min¶ Shunt susceptance lower limit (p.u.) (float).
-
flags_bounded¶ Flags associated with bounded quantities (byte).
-
flags_fixed¶ Flags associated with fixed quantities (byte).
-
flags_sparse¶ Flags associated with sparse quantities (byte).
-
flags_vars¶ Flags associated with variable quantities (byte).
-
g¶ Shunt conductance (p.u.) (float).
-
get_var_info_string(self, index)¶ Gets info string of variable associated with index.
Parameters: - index : int
Returns: - info : string
-
has_flags(self, flag_type, q)¶ Determines whether the shunt devices has flags associated with certain quantities set.
Parameters: - flag_type : string (Flag Types)
- q : string or list of strings (Shunt Quantities)
Returns: - flag : {
True,False}
-
in_service¶ In service flag (boolean).
-
index¶ Shunt index (int).
-
is_continuous(self)¶ Determines whether the shunt has continuous susceptance adjustments.
Returns: - flag : {
True,False}
- flag : {
-
is_discrete(self)¶ Determines whether the shunt has discrete susceptance adjustments.
Returns: - flag : {
True,False}
- flag : {
-
is_fixed(self)¶ Determines whether the shunt device is fixed (as opposed to switching).
Returns: - flag : {
True,False}
- flag : {
-
is_in_service(self)¶ Determines whether the shunt device is in service.
Returns: - in_service : {
True,False}
- in_service : {
-
is_part_of_transformer(self)¶ Determines whether the shunt is part of a transformer.
Returns: - flag : {
True,False}
- flag : {
-
is_switched(self)¶ Determines whether the shunt is switchable.
Returns: - flag : {
True,False}
- flag : {
-
is_switched_locked(self)¶ Determines whether the shunt is switchable but currently locked.
Returns: - flag : {
True,False}
- flag : {
-
is_switched_v(self)¶ Determines whether the shunt is switchable and regulates bus voltage magnitude.
Returns: - flag : {
True,False}
- flag : {
-
json_string¶ JSON string (string).
-
name¶ Shunt name (string).
-
num_periods¶ Number of time periods (int).
-
obj_type¶ Object type (string).
-
round_b(self, t=None)¶ Rounds susceptance to nearest valid discrete value.
Parameters: - t : int (None for all)
Returns: - num : int (number of significant changes)
-
sens_b_l_bound¶ Objective function sensitivity with respect to susceptance lower bound (float or
ndarray).
-
sens_b_u_bound¶ Objective function sensitivity with respect to susceptance upper bound (float or
ndarray).
-
set_as_continuous(self)¶ Sets shunt as having continuous susceptance adjustments.
-
set_as_discrete(self)¶ Sets shunt as having discrete susceptance adjustments.
-
set_as_fixed(self)¶ Sets shunt as fixed.
-
set_as_switched(self)¶ Sets shunt as switched.
-
set_as_switched_v(self)¶ Sets shunt as switched proviging voltage regulation.
6.6. Load¶
6.6.1. Load Properties¶
"any" |
|
"adjustable active power" |
\(P_{\min} < P_{\max}\) |
6.6.2. Load Quantities¶
"all" |
|
"active power" |
|
"reactive power" |
6.6.3. Load Class¶
-
class
pfnet.Load(num_periods=1, alloc=True)¶ Load class.
Parameters: - num_periods : int
- alloc : {
True,False}
-
comp_cb¶ Reactive power part of constant admittance component of load (S = v^2*comp_cg - j*v^2*comp_cb) (p.u. base admittance) (float).
-
comp_cg¶ Active power part of constant admittance component of load (S = v^2*comp_cg - j*v^2*comp_cb) (p.u. base admittance) (float).
-
comp_ci¶ Active power part of constant current component of load (S = v*comp_ci + j*v*comp_cj) (p.u. base current). (float or
ndarray).
-
comp_cj¶ Rective power part of constant current component of load (S = v*comp_ci + j*v*comp_cj) (p.u. base current). (float or
ndarray).
-
comp_cp¶ Active power part of constant power component of load (S = comp_cp + j*comp_cq) (p.u. system base power) (float or
ndarray).
-
comp_cq¶ Rective power part of constant power component of load (S = comp_cp + j*comp_cq) (p.u. system base power) (float or
ndarray).
-
flags_bounded¶ Flags associated with bounded quantities (byte).
-
flags_fixed¶ Flags associated with fixed quantities (byte).
-
flags_sparse¶ Flags associated with sparse quantities (byte).
-
flags_vars¶ Flags associated with variable quantities (byte).
-
get_var_info_string(self, index)¶ Gets info string of variable associated with index.
Parameters: - index : int
Returns: - info : string
-
has_flags(self, flag_type, q)¶ Determines whether the load has the flags associated with certain quantities set.
Parameters: - flag_type : string (Flag Types)
- q : string or list of strings (Load Quantities)
Returns: - flag : {
True,False}
-
in_service¶ In service flag (boolean).
-
index¶ Load index (int).
-
is_P_adjustable(self)¶ Determines whether the load has adjustable active power.
Returns: - flag : {
True,False}
- flag : {
-
is_in_service(self)¶ Determines whether load is in service.
Returns: - flag : {
True,False}
- flag : {
-
is_voltage_dependent(self)¶ Determines whether the load is voltage dependent.
Returns: - flag : {
True,False}
- flag : {
-
json_string¶ JSON string (string).
-
name¶ Load name (string).
-
num_periods¶ Number of time periods (int).
-
obj_type¶ Object type (string).
-
sens_P_l_bound¶ Objective function sensitivity with respect to active power lower bound (float or
ndarray).
-
sens_P_u_bound¶ Objective function sensitivity with respect to active power upper bound (float or
ndarray).
-
target_power_factor¶ Target load power factor in (0,1] (float).
-
update_P_components(self, weight_cp, weight_ci, weight_cg, t=0)¶ Updates load active power components according to given weights.
Parameters: - weight_cp : float
- weigth_ci : float
- weight_cg : float
- t : int
-
update_Q_components(self, weight_cq, weight_cj, weight_cb, t=0)¶ Updates load reactive power components according to given weights.
Parameters: - weight_cq : float
- weigth_cj : float
- weight_cb : float
- t : int
-
util_coeff_Q0¶ Coefficient for consumption utility function (constant term, units of $/hr) (float).
-
util_coeff_Q1¶ Coefficient for consumption utility function (linear term, units of $/(hr p.u.)) (float).
-
util_coeff_Q2¶ Coefficient for consumption utility function (quadratic term, units of $/(hr p.u.^2)) (float).
6.7. Variable Generator¶
6.7.1. Variable Generator Properties¶
"any" |
6.7.2. Variable Generator Quantities¶
"all" |
|
"active power" |
|
"reactive power" |
6.7.3. Variable Generator Class¶
-
class
pfnet.VarGenerator(num_periods=1, alloc=True)¶ Variable generator class.
Parameters: - num_periods : int
- alloc : {
True,False}
-
P_max¶ Variable generator active power upper limit (p.u. system base MVA) (float).
-
P_min¶ Variable generator active power lower limit (p.u. system base MVA) (float).
-
P_std¶ Variable generator active power standard deviation (p.u. system base MVA) (float or
ndarray).
-
Q_max¶ Variable generator maximum reactive power (p.u. system base MVA) (float).
-
Q_min¶ Variable generator minimum reactive power (p.u. system base MVA) (float).
-
flags_bounded¶ Flags associated with bounded quantities (byte).
-
flags_fixed¶ Flags associated with fixed quantities (byte).
-
flags_sparse¶ Flags associated with sparse quantities (byte).
-
flags_vars¶ Flags associated with variable quantities (byte).
-
get_var_info_string(self, index)¶ Gets info string of variable associated with index.
Parameters: - index : int
Returns: - info : string
-
has_flags(self, flag_type, q)¶ Determines whether the variable generator has the flags associated with certain quantities set.
Parameters: - flag_type : string (Flag Types)
- q : string or list of strings (Variable Generator Quantities)
Returns: - flag : {
True,False}
-
in_service¶ In service flag (boolean).
-
index¶ Variable generator index (int).
-
is_equal(self, other)¶ Determines whether the var generator is equal to given var generator.
Parameters: - other :
VarGenerator
Returns: - flag : {
True,False}
- other :
-
is_in_service(self)¶ Determines whether the variable generator is in service.
Returns: - in_service : {
True,False}
- in_service : {
-
json_string¶ JSON string (string).
-
name¶ Variable generator name (string).
-
num_periods¶ Number of time periods (int).
-
obj_type¶ Object type (string).
6.8. Battery¶
6.8.1. Battery Properties¶
"any" |
6.8.2. Battery Quantities¶
"all" |
|
"charging power" |
|
"energy level" |
6.8.3. Battery Class¶
-
class
pfnet.Battery(num_periods=1, alloc=True)¶ Battery class.
Parameters: - num_periods : int
- alloc : {
True,False}
-
E¶ Battery energy level at the beginning of a time period (p.u. system base MVA times time unit) (float or
ndarray).
-
E_final¶ Battery energy level at the end of the last time period (p.u. system base MVA times time unit) (float).
-
E_init¶ Initial battery energy level (p.u. system base MVA times time unit) (float).
-
E_max¶ Battery energy level upper limit (p.u. system base MVA times time unit) (float).
-
P_max¶ Battery charging power upper limit (p.u. system base MVA) (float).
-
P_min¶ Battery charging power lower limit (p.u. system base MVA) (float).
-
eta_c¶ Battery charging efficiency (unitless) (float).
-
eta_d¶ Battery discharging efficiency (unitless) (float).
-
flags_bounded¶ Flags associated with bounded quantities (byte).
-
flags_fixed¶ Flags associated with fixed quantities (byte).
-
flags_sparse¶ Flags associated with sparse quantities (byte).
-
flags_vars¶ Flags associated with variable quantities (byte).
-
get_var_info_string(self, index)¶ Gets info string of variable associated with index.
Parameters: - index : int
Returns: - info : string
-
has_flags(self, flag_type, q)¶ Determines whether the battery has the flags associated with certain quantities set.
Parameters: - flag_type : string (Flag Types)
- q : string or list of strings (Battery Quantities)
Returns: - flag : {
True,False}
-
in_service¶ In service flag (boolean).
-
index¶ Battery index (int).
-
is_equal(self, other)¶ Determines whether the battery is equal to given battery.
Parameters: - other :
Battery
Returns: - flag : {
True,False}
- other :
-
is_in_service(self)¶ Determines whether the battery is in service.
Returns: - in_service : {
True,False}
- in_service : {
-
json_string¶ JSON string (string).
-
name¶ Battery name (string).
-
num_periods¶ Number of time periods (int).
-
obj_type¶ Object type (string).
6.9. FACTS¶
6.9.1. FACTS Properties¶
"any" |
6.9.2. FACTS Quantities¶
"all" |
6.9.3. FACTS Class¶
-
class
pfnet.Facts(num_periods=1, alloc=True)¶ Facts class.
Parameters: - num_periods : int
- alloc : {
True,False}
-
P_max_dc¶ Maximum DC power transfer (p.u.) (float).
-
Q_max_s¶ Maximum series converter reactive power (p.u.) (float).
-
Q_max_sh¶ Maximum shunt converter reactive power (p.u.) (float).
-
Q_min_s¶ Minimum series converter reactive power (p.u.) (float).
-
Q_min_sh¶ Minimum shunt converter reactive power (p.u.) (float).
-
Q_par¶ Reactive power participation factor of shunt converter for regulating bus voltage magnitude (unitless) (float).
-
b¶ Series susceptance set-point for constant impedance mode (p.u.) (float).
-
flags_bounded¶ Flags associated with bounded quantities (byte).
-
flags_fixed¶ Flags associated with fixed quantities (byte).
-
flags_sparse¶ Flags associated with sparse quantities (byte).
-
flags_vars¶ Flags associated with variable quantities (byte).
-
g¶ Series conductance set-point for constant impedance mode (p.u.) (float).
-
get_var_info_string(self, index)¶ Gets info string of variable associated with index.
Parameters: - index : int
Returns: - info : string
-
has_flags(self, flag_type, q)¶ Determines whether the facts has the flags associated with specific quantities set.
Parameters: - flag_type : string (Flag Types)
- q : string or list of strings (FACTS Quantities)
Returns: - flag : {
True,False}
-
i_max_s¶ Maximum series converter current (p.u.) (float).
-
i_max_sh¶ Maximum shunt converter current (p.u.) (float).
-
in_service¶ In service flag (boolean).
-
index¶ Facts index (int).
-
is_SSSC(self)¶ Determines whether device is SSSC.
Returns: - flag : {
True,False}
- flag : {
-
is_STATCOM(self)¶ Determines whether device is STATCOM.
Returns: - flag : {
True,False}
- flag : {
-
is_UPFC(self)¶ Determines whether device is UPFC.
Returns: - flag : {
True,False}
- flag : {
-
is_equal(self, other)¶ Determines whether facts is equal to given facts.
Parameters: - other :
Facts
Returns: - flag : {
True,False}
- other :
-
is_in_constant_series_v_mode(self)¶ Determines whether series link operates in constant voltage mode.
Returns: - flag : {
True,False}
- flag : {
-
is_in_constant_series_z_mode(self)¶ Determines whether series link operates in constant impedance mode.
Returns: - flag : {
True,False}
- flag : {
-
is_in_normal_series_mode(self)¶ Determines whether series link operates in normal mode.
Returns: - flag : {
True,False}
- flag : {
-
is_in_service(self)¶ Determines whether the FACTS device is in service.
Returns: - in_service : {
True,False}
- in_service : {
-
is_regulator(self)¶ Determines whether FACTS provides voltage set point regulation with shunt converter.
Returns: - flag : {
True,False}
- flag : {
-
is_series_link_bypassed(self)¶ Determines whether series link is bypassed.
Returns: - flag : {
True,False}
- flag : {
-
is_series_link_disabled(self)¶ Determines whether series link is disabled.
Returns: - flag : {
True,False}
- flag : {
-
json_string¶ JSON string (string).
-
name¶ Facts name (string).
-
num_periods¶ Number of time periods (int).
-
obj_type¶ Object type (string).
-
set_in_constant_series_v_mode(self)¶ Sets FACTS to normal series v mode.
-
set_in_constant_series_z_mode(self)¶ Sets FACTS to constant series z mode.
-
set_in_normal_series_mode(self)¶ Sets FACTS to normal series mode.
-
set_series_link_bypassed(self)¶ Sets series link to bypassed.
-
set_series_link_disabled(self)¶ Sets series link to disabled.
-
v_max_m¶ Maximum voltage magnitude for bus “m” (p.u.) (float).
-
v_max_s¶ Maximum series voltage magnitude (p.u.) (float).
-
v_min_m¶ Minimum voltage magnitude for bus “m” (p.u.) (float).
6.10. HVDC VSC¶
6.10.1. HVDC VSC Properties¶
"any" |
6.10.2. HVDC VSC Quantities¶
"all" |
6.10.3. HVDC VSC Class¶
-
class
pfnet.ConverterVSC(num_periods=1, alloc=True)¶ VSC converter class.
Parameters: - num_periods : int
- alloc : {
True,False}
-
P_max¶ Maximum active power injection into AC bus (float).
-
P_min¶ Minimum active power injection into AC bus (float).
-
Q_max¶ Maximum reactive power injection into AC bus (float).
-
Q_min¶ Minimum reactive power injection into AC bus (float).
-
Q_par¶ Reactive power participation (unitless) (float).
-
flags_bounded¶ Flags associated with bounded quantities (byte).
-
flags_fixed¶ Flags associated with fixed quantities (byte).
-
flags_sparse¶ Flags associated with sparse quantities (byte).
-
flags_vars¶ Flags associated with variable quantities (byte).
-
get_var_info_string(self, index)¶ Gets info string of variable associated with index.
Parameters: - index : int
Returns: - info : string
-
has_flags(self, flag_type, q)¶ Determines whether the VSC converter has the flags associated with certain quantities set.
Parameters: - flag_type : string (Flag Types)
- q : string or list of strings (HVDC VSC Quantities)
Returns: - flag : {
True,False}
-
in_service¶ In service flag (boolean).
-
index¶ VSC converter index (int).
-
is_equal(self, other)¶ Determines whether VSC converter is equal to given VSC converter.
Parameters: - other :
ConverterVSC
Returns: - flag : {
True,False}
- other :
-
is_in_P_dc_mode(self)¶ Determines whether VSC converter is in constant DC power mode.
Returns: - flag : {
True,False}
- flag : {
-
is_in_f_ac_mode(self)¶ Determines whether VSC converter is in constant AC power factor mode.
Returns: - flag : {
True,False}
- flag : {
-
is_in_service(self)¶ Determines whether the VSC converter is in service.
Returns: - in_service : {
True,False}
- in_service : {
-
is_in_v_ac_mode(self)¶ Determines whether VSC converter is in constant AC voltage magnitude mode.
Returns: - flag : {
True,False}
- flag : {
-
is_in_v_dc_mode(self)¶ Determines whether VSC converter is in constant DC voltage mode.
Returns: - flag : {
True,False}
- flag : {
-
json_string¶ JSON string (string).
-
loss_coeff_A¶ Loss coefficient for constant term (p.u. system base power) (float).
-
loss_coeff_B¶ Loss coefficient for linear term (p.u. system base power over DC current in p.u.) (float).
-
name¶ VSC converter name (string).
-
num_periods¶ Number of time periods (int).
-
obj_type¶ Object type (string).
-
set_in_P_dc_mode(self)¶ Sets VSC converter to be in constant DC power mode.
-
set_in_f_ac_mode(self)¶ Sets VSC converter to be in constant AC power factor mode.
-
set_in_v_ac_mode(self)¶ Sets VSC converter to be in constant AC voltage mode.
-
set_in_v_dc_mode(self)¶ Sets VSC converter to be in constant DC voltage mode.
-
target_power_factor¶ Target AC power factor (float).
6.11. HVDC CSC¶
6.11.1. HVDC CSC Properties¶
"any" |
6.11.2. HVDC CSC Quantities¶
"all" |
6.11.3. HVDC CSC Class¶
-
class
pfnet.ConverterCSC(num_periods=1, alloc=True)¶ CSC converter class.
Parameters: - num_periods : int
- alloc : {
True,False}
-
angle¶ Ignition delay angle if rectifier or extinction advance angle if inverter (radians) (float or
ndarray).
-
angle_max¶ Maximum angle (float).
-
angle_min¶ Minimum angle (float).
-
flags_bounded¶ Flags associated with bounded quantities (byte).
-
flags_fixed¶ Flags associated with fixed quantities (byte).
-
flags_sparse¶ Flags associated with sparse quantities (byte).
-
flags_vars¶ Flags associated with variable quantities (byte).
-
get_var_info_string(self, index)¶ Gets info string of variable associated with index.
Parameters: - index : int
Returns: - info : string
-
has_flags(self, flag_type, q)¶ Determines whether the CSC converter has the flags associated with certain quantities set.
Parameters: - flag_type : string (Flag Types)
- q : string or list of strings (HVDC CSC Quantities)
Returns: - flag : {
True,False}
-
in_service¶ In service flag (boolean).
-
index¶ CSC converter index (int).
-
index_angle¶ Index of ignition delay angle if rectifier or extinction advance angle if inverter (int or
ndarray).
-
is_equal(self, other)¶ Determines whether CSC converter is equal to given CSC converter.
Parameters: - other :
ConverterCSC
Returns: - flag : {
True,False}
- other :
-
is_in_P_dc_mode(self)¶ Determines whether CSC converter is in constant DC power mode.
Returns: - flag : {
True,False}
- flag : {
-
is_in_i_dc_mode(self)¶ Determines whether CSC converter is in constant DC current mode.
Returns: - flag : {
True,False}
- flag : {
-
is_in_service(self)¶ Determines whether the CSC converter is in service.
Returns: - in_service : {
True,False}
- in_service : {
-
is_in_v_dc_mode(self)¶ Determines whether CSC converter is in constant DC voltage mode.
Returns: - flag : {
True,False}
- flag : {
-
is_inverter(self)¶ Determines whether CSC converter is an inverter.
Returns: - flag : {
True,False}
- flag : {
-
is_rectifier(self)¶ Determines whether CSC converter is a rectifier.
Returns: - flag : {
True,False}
- flag : {
-
json_string¶ JSON string (string).
-
name¶ CSC converter name (string).
-
num_bridges¶ Number of bridges in series (int).
-
num_periods¶ Number of time periods (int).
-
obj_type¶ Object type (string).
-
r¶ Commutating transformer resistance as seen by each individual bridge (p.u. DC base) (float).
-
ratio¶ Commutating transformer turns ratio (AC bus base voltage / DC bus base voltage) (float or
ndarray).
-
ratio_max¶ Maximum turns ratio (float).
-
ratio_min¶ Minimum ratio (float).
-
set_as_inverter(self)¶ Sets CSC converter to be inverter.
-
set_as_rectifier(self)¶ Sets CSC converter to be rectifier.
-
set_in_P_dc_mode(self)¶ Sets CSC converter to be in constant DC power mode.
-
set_in_i_dc_mode(self)¶ Sets CSC converter to be in constant DC current mode.
-
set_in_v_dc_mode(self)¶ Sets CSC converter to be in constant DC voltage mode.
-
v_base_p¶ Primary side bus base AC voltage (kv) (float).
-
v_base_s¶ Secondary side bus base AC voltage (kv) (float).
-
x¶ Commutating transformer reactance as seen by each individual bridge (p.u. DC base) (float).
-
x_cap¶ Commutating capacitor reactance as seen by each individual bridge (p.u. DC base) (float).
6.12. HVDC Bus¶
6.12.1. HVDC Bus Properties¶
"any" |
6.12.2. HVDC Bus Quantities¶
"all" |
6.12.3. HVDC Bus Class¶
-
class
pfnet.BusDC(num_periods=1, alloc=True)¶ DC bus class.
Parameters: - num_periods : int
- alloc : {
True,False}
-
add_branch_m(self, branch)¶ Adds an “m” branch connection to this bus.
Parameters: - branch :
BranchDC
- branch :
-
add_csc_converter(self, conv)¶ Adds a CSC converter connection to this bus.
Parameters: - conv :
ConverterCSC
- conv :
-
add_vsc_converter(self, conv)¶ Adds a VSC converter connection to this bus.
Parameters: - conv :
ConverterVSC
- conv :
-
csc_converters¶ List of
ConverterCSCobjects connected to this bus (list).
-
flags_bounded¶ Flags associated with bounded quantities (byte).
-
flags_fixed¶ Flags associated with fixed quantities (byte).
-
flags_sparse¶ Flags associated with sparse quantities (byte).
-
flags_vars¶ Flags associated with variable quantities (byte).
-
get_num_vars(self, q, t_start=0, t_end=None)¶ Gets number of variables associated with the given quantities.
Parameters: - q : string or list of strings (HVDC Bus Quantities)
- t_start : int
- t_end : int
Returns: - num : int
-
get_var_info_string(self, index)¶ Gets info string of variable associated with index.
Parameters: - index : int
Returns: - info : string
-
has_flags(self, flag_type, q)¶ Determines whether the DC bus has the flags associated with certain quantities set.
Parameters: - flag_type : string (Flag Types)
- q : string or list of strings (HVDC Bus Quantities)
Returns: - flag : {
True,False}
-
in_service¶ In service flag (boolean).
-
index¶ Bus index (int).
-
is_equal(self, other)¶ Determines whether the DC bus is equal to given DC bus.
Parameters: - other :
BusDC
Returns: - flag : {
True,False}
- other :
-
is_in_service(self)¶ Determines whether the DC bus is in service.
Returns: - in_service : {
True,False}
- in_service : {
-
json_string¶ JSON string (string).
-
name¶ Bus name (string).
-
num_periods¶ Number of time periods (int).
-
number¶ Bus number (int).
-
obj_type¶ Object type (string).
-
remove_all_connections(self)¶ Removes all connections to this DC bus.
-
remove_branch_k(self, branch)¶ Removes a “k” branch connection to this bus.
Parameters: - branch :
BranchDC
- branch :
-
remove_branch_m(self, branch)¶ Removes an “m” branch connection to this bus.
Parameters: - branch :
BranchDC
- branch :
-
remove_csc_converter(self, conv)¶ Removes a CSC converter connection to this bus.
Parameters: - conv :
ConverterCSC
- conv :
-
remove_vsc_converter(self, conv)¶ Removes a VSC converter connection to this bus.
Parameters: - conv :
ConverterVSC
- conv :
-
set_v(self, v, t=0)¶ Sets DC bus voltage.
Parameters: - v : float
- t : int
-
v_base¶ DC bus base voltage (kilo-volts) (float).
-
vsc_converters¶ List of
ConverterVSCobjects connected to this bus (list).
6.13. HVDC Branch¶
6.13.1. HVDC Branch Properties¶
"any" |
6.13.2. HVDC Branch Quantities¶
"all" |
6.13.3. HVDC Branch Class¶
-
class
pfnet.BranchDC(num_periods=1, alloc=True)¶ DC branch class.
Parameters: - num_periods : int
- alloc : {
True,False}
-
flags_bounded¶ Flags associated with bounded quantities (byte).
-
flags_fixed¶ Flags associated with fixed quantities (byte).
-
flags_sparse¶ Flags associated with sparse quantities (byte).
-
flags_vars¶ Flags associated with variable quantities (byte).
-
get_P_km(self, var_values=None)¶ Gets the DC power flow at bus “k” towards bus “m” (p.u.)
Parameters: - var_values :
ndarray
Returns: - P_km : float or
ndarray
- var_values :
-
get_P_mk(self, var_values=None)¶ Gets the DC power flow at bus “m” towards bus “k” (p.u.).
Parameters: - var_values : :
ndarray
Returns: - P_mk : float or
ndarray
- var_values : :
-
get_i_km(self, var_values=None)¶ Gets the DC branch current at bus “k” torwards bus “m” (p.u.).
Parameters: - var_values :
ndarray
Returns: - i : float or
ndarray
- var_values :
-
get_i_mk(self, var_values=None)¶ Gets the DC branch current magnitude at bus “m” torwards bus “k” (p.u.).
Parameters: - var_values :
ndarray
Returns: - i : float or
ndarray
- var_values :
-
get_var_info_string(self, index)¶ Gets info string of variable associated with index.
Parameters: - index : int
Returns: - info : string
-
has_flags(self, flag_type, q)¶ Determines whether the DC branch has the flags associated with specific quantities set.
Parameters: - flag_type : string (Flag Types)
- q : string or list of strings (HVDC Branch Quantities)
Returns: - flag : {
True,False}
-
in_service¶ In service flag (boolean).
-
index¶ DC branch index (int).
-
is_equal(self, other)¶ Determines whether DC branch is equal to given DC branch.
Parameters: - other :
BranchDC
- other :
-
is_in_service(self)¶ Determines whether the DC branch is in service.
Returns: - in_service : {
True,False}
- in_service : {
-
json_string¶ JSON string (string).
-
name¶ DC branch name (string).
-
num_periods¶ Number of time periods (int).
-
obj_type¶ Object type (string).
-
r¶ DC branch resistance (p.u.) (float).
6.14. Network¶
6.14.1. Component Types¶
"all" |
|
"bus" |
|
"battery" |
|
"branch" |
|
"generator" |
|
"load" |
|
"shunt" |
|
"variable generator" |
|
"csc converter" |
|
"vsc converter" |
|
"dc bus" |
|
"dc branch" |
|
"facts" |
6.14.2. Flag Types¶
"variable" |
For selecting quantities to be variables |
"fixed" |
For selecting variables to be fixed |
"bounded" |
For selecting variables to be bounded. |
"sparse" |
For selecting control adjustments to be sparse |
6.14.3. Variable Value Options¶
"current" |
|
"upper limits" |
|
"lower limits" |
6.14.4. Network Class¶
-
class
pfnet.Network(num_periods=1, alloc=True)¶ Network class.
Parameters: - num_periods : int
- alloc : {
True,False}
-
add_batteries(self, batteries)¶ Adds batteries to the network. Flags are not preserved (for now).
Parameters: - batteries : list of
Batteryobjects
- batteries : list of
-
add_batteries_from_parameters(self, buses, power_capacity, energy_capacity, eta_c=1., etc_d=1.)¶ Adds batteries to the network using the given parameters. The power and energy capacities of the batteries are divided evenly.
Parameters: - buses : list of
Busobjects - power_capacity : percentage of max total load power (float)
- energy_capacity : percentage of max total load energy during one time period (float)
- eta_c : charging efficiency in (0,1] (float)
- eta_d : discharging efficiency in (0,1] (float)
- buses : list of
-
add_branches(self, branches)¶ Adds branches to the network. Flags are not preserved (for now).
Parameters: - branches : list of
Branchobjects
- branches : list of
-
add_buses(self, buses)¶ Adds buses to the network. Flags are not preserved (for now).
Parameters: - buses : list of
Busobjects
- buses : list of
-
add_generators(self, generators)¶ Adds generators to the network. Flags are not preserved (for now).
Parameters: - generators : list of
Generatorobjects
- generators : list of
-
add_loads(self, loads)¶ Adds loads to the network. Flags are not preserved (for now).
Parameters: - loads : list of
Loadobjects
- loads : list of
-
add_shunts(self, shunts)¶ Adds shunts to the network. Flags are not preserved (for now).
Parameters: - shunts : list of
Shuntobjects
- shunts : list of
-
add_var_generators(self, var_generators)¶ Adds var generators to the network. Flags are not preserved (for now).
Parameters: - var_generators : list of
VarGeneratorobjects
- var_generators : list of
-
add_var_generators_from_parameters(self, buses, power_capacity, power_base, power_std=0., corr_radius=0, corr_value=0.)¶ Adds variable generators to the network using the given parameters. The capacities of the generators are divided evenly.
Parameters: - buses : list of
Busobjects - power_capacity : percentage of max total load power (float)
- power_base : percentage of power capacity (float)
- power_std : percentage of power capacity (float)
- corr_radius : number of branches for correlation radius (int)
- corr_value : correlation coefficient for correlated generators (float)
- buses : list of
-
base_power¶ System base power (MVA) (float).
-
clear_error(self)¶ Clears error flag and message string.
-
clear_flags(self)¶ Clears all the flags of all the network components.
-
clear_properties(self)¶ Clears all the network properties.
-
clear_sensitivities(self)¶ Clears all sensitivity information.
-
clip_switched_shunts_b(self, t=None)¶ Clips susceptances of all switched shunt devices to be within limits.
Parameters: - t : int (None for all)
-
copy_from_network(self, net, merged=False)¶ Copies data from another network.
Parameters: - net :
Network - merged : {
True,False}
- net :
-
create_var_generators_P_sigma(self, spread, corr)¶ Creates covariance matrix (lower triangular part) for active powers of variable generators.
Parameters: - spead : correlation neighborhood in terms of number of edges (int)
- corr : correlation coefficient for neighboring generators (float)
Returns: - sigma :
coo_matrix
-
csc_converters¶ List of
ConverterCSCobjects.
-
error_string¶ Error string (string).
-
extract_subnetwork(self, buses)¶ Extracts subnetwork containig the given buses.
Parameters: - buses : list of
Busobjects
Returns: - net :
Network
- buses : list of
-
gen_v_dev¶ Largest voltage magnitude deviation from set point of bus regulated by generator (p.u.) (float or
ndarray).
-
get_battery(self, index)¶ Gets battery with the given index.
Parameters: - index : int
Returns: - bat :
Battery
-
get_battery_from_name_and_bus_number(self, name, number)¶ Gets battery of given name connected to the bus of the given number.
Parameters: - name : string
- number : integer
Returns: - bat :
Battery
-
get_branch(self, index)¶ Gets branch with the given index.
Parameters: - index : int
Returns: - branch :
Branch
-
get_branch_from_name_and_bus_numbers(self, name, number1, number2)¶ Gets branch of given name connected across buss of the given numbers.
Parameters: - name : string
- number1 : integer
- number2 : integer
Returns: - branch :
Branch
-
get_bus_from_name(self, name)¶ Gets bus with the given name.
Parameters: - name : string
Returns: - bus :
Bus
-
get_bus_from_number(self, number)¶ Gets bus with the given number.
Parameters: - number : int
Returns: - bus :
Bus
-
get_component_from_key(self, key)¶ Gets network component from key, where key is of the form (‘obj_type’, bus_num) or (‘obj_type’, equi_id, bus_num) or (‘obj_type, equip_id, bus_k_num, bus_m_num).
Parameters: - key : tuple
Returns: - obj : object
-
get_copy(self, merge_buses=False)¶ Gets deep copy of network.
Returns: - net :
Network - merge_buses : {
True,False}
- net :
-
get_csc_converter(self, index)¶ Gets CSC converter with the given index.
Parameters: - index : int
- Returns
- ——-
- conv :
ConverterCSC
-
get_csc_converter_from_name_and_ac_bus_number(self, name, number)¶ Gets CSC converter of given name connected to the AC bus of the given number. Parameters ———- name : string number : integer Returns ——- conv :
ConverterCSC
-
get_csc_converter_from_name_and_dc_bus_name(self, name, bus_name)¶ Gets CSC converter of given name connected to the DC bus of the given name. Parameters ———- name : string bus_name : string Returns ——- conv :
ConverterCSC
-
get_dc_branch(self, index)¶ Gets DC branch with the given index.
Parameters: - index : int
- Returns
- ——-
- bus :
BranchDC
-
get_dc_branch_from_name_and_dc_bus_names(self, name, bus1_name, bus2_name)¶ Gets DC branch of given name connected across buses of the given names. Parameters ———- name : string bus1_name : string bus2_name : string Returns ——- branch :
BranchDC
-
get_dc_bus(self, index)¶ Gets DC bus with the given index.
Parameters: - index : int
- Returns
- ——-
- bus :
BusDC
-
get_dc_bus_from_name(self, name)¶ Gets DC bus with the given name. Parameters ———- name : string Returns ——- bus :
BusDC
-
get_dc_bus_from_number(self, number)¶ Gets DC bus with the given number. Parameters ———- number : int Returns ——- bus :
BusDC
-
get_facts_from_name_and_bus_numbers(self, name, number1, number2)¶ Gets FACTS device of given name connected across buses of the given numbers. Parameters ———- name : string number1 : integer number2 : integer Returns ——- facts :
Facts
-
get_fixed_shunt_from_name_and_bus_number(self, name, number)¶ Gets fixed shunt of given name connected to the bus of the given number.
Parameters: - name : string
- number : integer
Returns: - shunt :
Shunt
-
get_generator(self, index)¶ Gets generator with the given index.
Parameters: - index : int
Returns: - gen :
Generator
-
get_generator_buses(self)¶ Gets list of buses where generators are connected.
Returns: - buses : list of
Busobjects
- buses : list of
-
get_generator_from_name_and_bus_number(self, name, number)¶ Gets generator of given name connected to the bus of the given number.
Parameters: - name : string
- number : integer
Returns: - gen :
Generator
-
get_load_buses(self)¶ Gets list of buses where loads are connected.
Returns: - buses : list of
Busobjects
- buses : list of
-
get_load_from_name_and_bus_number(self, name, number)¶ Gets load of given name connected to the bus of the given number.
Parameters: - name : string
- number : integer
Returns: - load :
Load
-
get_num_P_adjust_gens(self, only_in_service=False)¶ Gets number of generators in the network that have adjustable active powers.
Parameters: - only_in_service: |TrueFalse|
Returns: - num : int
-
get_num_P_adjust_loads(self, only_in_service=False)¶ Gets number of loads in the network that have adjustable active powers.
Parameters: - only_in_service: |TrueFalse|
Returns: - num : int
-
get_num_ZI_lines(self, only_in_service=False)¶ Gets number of zero impedance lines in the network.
Parameters: - only_in_service: |TrueFalse|
Returns: - num : int
-
get_num_batteries(self, only_in_service=False)¶ Gets number of batteries in the network.
Parameters: - only_in_service: |TrueFalse|
Returns: - num : int
-
get_num_batteries_out_of_service(self)¶ Gets number of batteries in the network that are out of service.
Returns: - num : int
-
get_num_branches(self, only_in_service=False)¶ Gets number of branches in the network.
Parameters: - only_in_service: |TrueFalse|
Returns: - num : int
-
get_num_branches_out_of_service(self)¶ Gets number of branches in the network that are out of service.
Returns: - num : int
-
get_num_buses(self, only_in_service=False)¶ Gets number of buses in the network.
Parameters: - only_in_service: |TrueFalse|
Returns: - num : int
-
get_num_buses_out_of_service(self)¶ Gets number of buses in the network that are out of service.
Returns: - num : int
-
get_num_buses_reg_by_facts(self, only_in_service=False)¶ Gets number of buses whose voltage magnitudes are regulated by FACTS devices.
Parameters: - only_in_service: |TrueFalse|
Returns: - num : int
-
get_num_buses_reg_by_gen(self, only_in_service=False)¶ Gets number of buses whose voltage magnitudes are regulated by generators.
Parameters: - only_in_service: |TrueFalse|
Returns: - num : int
-
get_num_buses_reg_by_shunt(self, only_in_service=False)¶ Gets number of buses whose voltage magnitudes are regulated by switched shunt devices.
Parameters: - only_in_service: |TrueFalse|
Returns: - num : int
-
get_num_buses_reg_by_tran(self, only_in_service=False)¶ Gets number of buses whose voltage magnitudes are regulated by tap-changing transformers.
Parameters: - only_in_service: |TrueFalse|
Returns: - num : int
-
get_num_buses_reg_by_vsc_converter(self, only_in_service=False)¶ Gets number of buses whose voltage magnitudes are regulated by VSC converters.
Parameters: - only_in_service: |TrueFalse|
Returns: - num : int
-
get_num_csc_converters(self, only_in_service=False)¶ Gets number of CSC converters in the network.
Parameters: - only_in_service: |TrueFalse|
Returns: - num : int
-
get_num_csc_converters_out_of_service(self)¶ Gets number of CSC converters in the network that are out of service.
Returns: - num : int
-
get_num_dc_branches(self, only_in_service=False)¶ Gets number of DC branches in the network.
Parameters: - only_in_service: |TrueFalse|
Returns: - num : int
-
get_num_dc_branches_out_of_service(self)¶ Gets number of DC branches in the network that are out of service.
Returns: - num : int
-
get_num_dc_buses(self, only_in_service=False)¶ Gets number of DC buses in the network.
Parameters: - only_in_service: |TrueFalse|
Returns: - num : int
-
get_num_dc_buses_out_of_service(self)¶ Gets number of DC buses in the network that are out of service.
Returns: - num : int
-
get_num_facts(self, only_in_service=False)¶ Gets number of FACTS devices in the network.
Parameters: - only_in_service: |TrueFalse|
Returns: - num : int
-
get_num_facts_in_normal_series_mode(self, only_in_service=False)¶ Gets number of FACTS devices in the network that are operating in normal series mode.
Parameters: - only_in_service: |TrueFalse|
Returns: - num : int
-
get_num_facts_out_of_service(self)¶ Gets number of FACTS in the network that are out of service.
Returns: - num : int
-
get_num_fixed_shunts(self, only_in_service=False)¶ Gets number of fixed shunts in the network.
Parameters: - only_in_service: |TrueFalse|
Returns: - num : int
-
get_num_fixed_trans(self, only_in_service=False)¶ Gets number of fixed transformers in the network.
Parameters: - only_in_service: |TrueFalse|
Returns: - num : int
-
get_num_generators(self, only_in_service=False)¶ Gets number of generators in the network.
Parameters: - only_in_service: |TrueFalse|
Returns: - num : int
-
get_num_generators_out_of_service(self)¶ Gets number of generators in the network that are out of service.
Returns: - num : int
-
get_num_lines(self, only_in_service=False)¶ Gets number of transmission lines in the network.
Parameters: - only_in_service: |TrueFalse|
Returns: - num : int
-
get_num_loads(self, only_in_service=False)¶ Gets number of loads in the network.
Parameters: - only_in_service: |TrueFalse|
Returns: - num : int
-
get_num_loads_out_of_service(self)¶ Gets number of loads in the network that are out of service.
Returns: - num : int
-
get_num_phase_shifters(self, only_in_service=False)¶ Gets number of phase-shifting transformers in the network.
Parameters: - only_in_service: |TrueFalse|
Returns: - num : int
-
get_num_redundant_buses(self)¶ Gets number internal redundant buses in the network (ones that have been merged with other buses).
Returns: - num : int
-
get_num_reg_facts(self, only_in_service=False)¶ Gets number of FACTS in the network that provide voltage regulation.
Parameters: - only_in_service: |TrueFalse|
Returns: - num : int
-
get_num_reg_gens(self, only_in_service=False)¶ Gets number generators in the network that provide voltage regulation.
Parameters: - only_in_service: |TrueFalse|
Returns: - num : int
-
get_num_shunts(self, only_in_service=False)¶ Gets number of shunts in the network.
Parameters: - only_in_service: |TrueFalse|
Returns: - num : int
-
get_num_shunts_out_of_service(self)¶ Gets number of shunts in the network that are out of service.
Returns: - num : int
-
get_num_slack_buses(self, only_in_service=False)¶ Gets number of slack buses in the network.
Parameters: - only_in_service: |TrueFalse|
Returns: - num : int
-
get_num_slack_gens(self, only_in_service=False)¶ Gets number of slack generators in the network.
Parameters: - only_in_service: |TrueFalse|
Returns: - num : int
-
get_num_star_buses(self, only_in_service=False)¶ Gets number of star buses in the network.
Parameters: - only_in_service: |TrueFalse|
Returns: - num : int
-
get_num_switched_shunts(self, only_in_service=False)¶ Gets number of switched shunts in the network.
Parameters: - only_in_service: |TrueFalse|
Returns: - num : int
-
get_num_switched_v_shunts(self, only_in_service=False)¶ Gets number of switched shunts in the network that provide voltage regulation.
Parameters: - only_in_service: |TrueFalse|
Returns: - num : int
-
get_num_tap_changers(self, only_in_service=False)¶ Gets number of tap-changing transformers in the network.
Parameters: - only_in_service: |TrueFalse|
Returns: - num : int
-
get_num_tap_changers_Q(self, only_in_service=False)¶ Gets number of tap-changing transformers in the network that regulate reactive flows.
Parameters: - only_in_service: |TrueFalse|
Returns: - num : int
-
get_num_tap_changers_v(self, only_in_service=False)¶ Gets number of tap-changing transformers in the network that regulate voltage magnitudes.
Parameters: - only_in_service: |TrueFalse|
Returns: - num : int
-
get_num_var_generators(self, only_in_service=False)¶ Gets number of variable generators in the network.
Parameters: - only_in_service: |TrueFalse|
Returns: - num : int
-
get_num_var_generators_out_of_service(self)¶ Gets number of var generators in the network that are out of service.
Returns: - num : int
-
get_num_vdep_loads(self, only_in_service=False)¶ Gets number of loads in the network that are voltage dependent.
Parameters: - only_in_service: |TrueFalse|
Returns: - num : int
-
get_num_vsc_converters(self, only_in_service=False)¶ Gets number of VSC converters in the network.
Parameters: - only_in_service: |TrueFalse|
Returns: - num : int
-
get_num_vsc_converters_in_P_dc_mode(self, only_in_service=False)¶ Gets number of VSC converters in the network that are operating in DC power control mode.
Parameters: - only_in_service: |TrueFalse|
Returns: - num : int
-
get_num_vsc_converters_in_f_ac_mode(self, only_in_service=False)¶ Gets number of VSC converters in the network that are operating in AC power factor control mode.
Parameters: - only_in_service: |TrueFalse|
Returns: - num : int
-
get_num_vsc_converters_in_v_ac_mode(self, only_in_service=False)¶ Gets number of VSC converters in the network that are operating in AC voltage control mode.
Parameters: - only_in_service: |TrueFalse|
Returns: - num : int
-
get_num_vsc_converters_in_v_dc_mode(self, only_in_service=False)¶ Gets number of VSC converters in the network that are operating in DC voltage control mode.
Parameters: - only_in_service: |TrueFalse|
Returns: - num : int
-
get_num_vsc_converters_out_of_service(self)¶ Gets number of VSC converters in the network that are out of service.
Returns: - num : int
-
get_num_zero_impedance_lines(self, only_in_service=False)¶ Gets number of zero impedance lines in the network.
Parameters: - only_in_service: |TrueFalse|
Returns: - num : int
-
get_properties(self)¶ Gets network properties.
Returns: - properties : dict
-
get_shunt(self, index)¶ Gets shunt with the given index.
Parameters: - index : int
Returns: - shunt :
Shunt
-
get_shunt_from_name_and_bus_number(self, name, number)¶ Gets shunt of given name connected to the bus of the given number.
Parameters: - name : string
- number : integer
Returns: - shunt :
Shunt
-
get_switched_shunt_from_name_and_bus_number(self, name, number)¶ Gets switched shunt of given name connected to the bus of the given number.
Parameters: - name : string
- number : integer
Returns: - shunt :
Shunt
-
get_var_generator(self, index)¶ Gets variable generator with the given index.
Parameters: - index : int
Returns: - vargen :
VarGenerator
-
get_var_generator_from_name_and_bus_number(self, name, number)¶ Gets variable generator of given name connected to the bus of the given number.
Parameters: - name : string
- number : integer
Returns: - vargen :
VarGenerator
-
get_var_info_string(self, index)¶ Gets info string of variable associated with index. The info string has format
obj_type:obj_index:quantity:time.Parameters: - index : int
Returns: - info : string
-
get_var_projection(self, obj_type, props, q, t_start=0, t_end=None)¶ Gets projection matrix for specific object variables.
Parameters: - obj_type : string (Component Types)
- props : string or list of strings (Bus Properties, Branch Properties, Generator Properties, Shunt Properties, Load Properties, Variable Generator Properties, Battery Properties, FACTS Properties, HVDC VSC Properties, HVDC CSC Properties, HVDC Bus Properties, HVDC Branch Properties)
- q : string or list of strings (Bus Quantities, Branch Quantities, Generator Quantities, Shunt Quantities, Load Quantities, Variable Generator Quantities, Battery Quantities, FACTS Quantities, HVDC VSC Quantities, HVDC CSC Quantities, HVDC Bus Quantities, HVDC Branch Quantities)
- t_start : int
- t_end : int (inclusive)
Returns: - P :
coo_matrix
-
get_var_values(self, option='current')¶ Gets network variable values.
Parameters: - option : string (Variable Value Options)
Returns: - values :
ndarray
-
get_vsc_converter(self, index)¶ Gets VSC converter with the given index.
Parameters: - index : int
- Returns
- ——-
- conv :
ConverterVSC
-
get_vsc_converter_from_name_and_ac_bus_number(self, name, number)¶ Gets VSC converter of given name connected to the AC bus of the given number. Parameters ———- name : string number : integer Returns ——- conv :
ConverterVSC
-
get_vsc_converter_from_name_and_dc_bus_name(self, name, bus_name)¶ Gets VSC converter of given name connected to the DC bus of the given name. Parameters ———- name : string bus_name : string Returns ——- conv :
ConverterVSC
-
has_error(self)¶ Indicates whether the network has the error flag set due to an invalid operation.
Returns: - flag : {
True,False}
- flag : {
-
has_same_ptr(self, Network other)¶ Checks whether network shares memory with another network.
Parameters: - other :
Network
Returns: - flag : {
True,False}
- other :
-
json_string¶ JSON string (string).
-
localize_gen_regulation(self, max_dist)¶ Makes generators whose regualted bus is a distance greater than max_dist away from their buses regulate their own buses.
-
make_all_in_service(self)¶ Changes all components to be in service.
-
num_batteries¶ Number of batteries in the network (int).
-
num_bounded¶ Number of network quantities that have been set to bounded (int).
-
num_branches¶ Number of branches in the network (int).
-
num_buses¶ Number of buses in the network (int).
-
num_csc_converters¶ Number of CSC converters in the network (int).
-
num_dc_branches¶ Number of DC branches in the network (int).
-
num_dc_buses¶ Number of DC buses in the network (int).
-
num_facts¶ Number of FACTS devices in the network (int).
-
num_fixed¶ Number of network quantities that have been set to fixed (int).
-
num_generators¶ Number of generators in the network (int).
-
num_loads¶ Number of loads in the network (int).
-
num_periods¶ Number of time periods (int).
-
num_shunts¶ Number of shunt devices in the network (int).
-
num_sparse¶ Number of network control quantities that have been set to sparse (int).
-
num_var_generators¶ Number of variable generators in the network (int).
-
num_vars¶ Number of network quantities that have been set to variable (int).
-
num_vsc_converters¶ Number of VSC converters in the network (int).
-
propogate_data_in_time(self, start, end)¶ Propogates data from the first period through time.
Parameters: - start : int
- end : int
-
remove_batteries(self, batteries)¶ Removes batteries from the network. All network flags are cleared (for now).
Parameters: - batteries : list of
Batteryobjects
- batteries : list of
-
remove_branches(self, branches)¶ Removes branches from the network. All network flags are cleared (for now).
Parameters: - branches : list of
Branchobjects
- branches : list of
-
remove_buses(self, buses)¶ Removes buses from the network. All network flags are cleared (for now).
Parameters: - buses : list of
Busobjects
- buses : list of
-
remove_generators(self, generators)¶ Removes generators from the network. All network flags are cleared (for now).
Parameters: - generators : list of
Generatorobjects
- generators : list of
-
remove_loads(self, loads)¶ Removes loads from the network. All network flags are cleared (for now).
Parameters: - loads : list of
Loadobjects
- loads : list of
-
remove_shunts(self, shunts)¶ Removes shunts from the network. All network flags are cleared (for now).
Parameters: - shunts : list of
Shuntobjects
- shunts : list of
-
remove_var_generators(self, var_generators)¶ Removes var generators from the network. All network flags are cleared (for now).
Parameters: - var_generators : list of
VarGeneratorobjects
- var_generators : list of
-
round_discrete_switched_shunts_b(self, t=None)¶ Rounds susceptances of all discrete switched shunt devices.
Parameters: - t : int (None for all)
Returns: - num : int (number of significant changes)
-
set_battery_array(self, size)¶ Allocates and sets battery array.
Parameters: - size : int
-
set_branch_array(self, size)¶ Allocates and sets branch array.
Parameters: - size : int
-
set_bus_array(self, size)¶ Allocates and sets bus array.
Parameters: - size : int
-
set_csc_converter_array(self, size)¶ Allocates and sets csc converter array.
Parameters: - size : int
-
set_dc_branch_array(self, size)¶ Allocates and sets DC branch array.
Parameters: - size : int
-
set_dc_bus_array(self, size)¶ Allocates and sets DC bus array.
Parameters: - size : int
-
set_facts_array(self, size)¶ Allocates and sets FACTS array.
Parameters: - size : int
-
set_flags(self, obj_type, flags, props, q)¶ Sets flags of network components with specific properties.
Parameters: - obj_type : string (Component Types)
- flags : string or list of strings (Flag Types)
- props : string or list of strings (Bus Properties, Branch Properties, Generator Properties, Shunt Properties, Load Properties, Variable Generator Properties, Battery Properties, FACTS Properties, HVDC VSC Properties, HVDC CSC Properties, HVDC Bus Properties, HVDC Branch Properties)
- q : string or list of strings (Bus Quantities, Branch Quantities, Generator Quantities, Shunt Quantities, Load Quantities, Variable Generator Quantities, Battery Quantities, FACTS Quantities, HVDC VSC Quantities, HVDC CSC Quantities, HVDC Bus Quantities, HVDC Branch Quantities)
-
set_flags_of_component(self, obj, flags, q)¶ Sets flags of network components with specific properties.
Parameters: - obj :
Bus,Branch,Generator,Load,Shunt,VarGenerator,Battery,Facts,ConverterVSC,ConverterCSC,BusDC,BranchDC - flags : string or list of strings (Flag Types)
- q : string or list of strings (Bus Quantities, Branch Quantities, Generator Quantities, Shunt Quantities, Load Quantities, Variable Generator Quantities, Battery Quantities, FACTS Quantities, HVDC VSC Quantities, HVDC CSC Quantities, HVDC Bus Quantities, HVDC Branch Quantities)
- obj :
-
set_gen_array(self, size)¶ Allocates and sets generator array.
Parameters: - size : int
-
set_load_array(self, size)¶ Allocates and sets load array.
Parameters: - size : int
-
set_shunt_array(self, size)¶ Allocates and sets shunt array.
Parameters: - size : int
-
set_vargen_array(self, size)¶ Allocates and sets variable generator array.
Parameters: - size : int
-
set_vsc_converter_array(self, size)¶ Allocates and sets vsc converter array.
Parameters: - size : int
-
show_components(self, output_level=0)¶ Shows information about the number of network components of each type.
Parameters: - output_level : integer
-
show_components_str¶ String with information about network components.
-
show_equivalent_buses(self)¶ Shows equivalent buses (buses connected by zero impedance lines).
-
show_properties(self, t=0)¶ Shows information about the state of the network component quantities.
Parameters: - t : time period (int)
-
show_properties_str¶ String with information about network properties.
-
show_redundant_buses(self)¶ Shows redundant buses.
-
shunt_v_vio¶ Largest voltage magnitude band violation of voltage regulated by switched shunt device (p.u.) (float or
ndarray).
-
state_tag¶ State tag.
-
tran_v_vio¶ Largest voltage magnitude band violation of voltage regulated by transformer (p.u.) (float or
ndarray).
-
update_hash_tables(self)¶ Updates internal hash tables for looking up AC and DC buses.
-
update_properties(self, values=None)¶ Re-computes the network properties using the given values of the network variables. If no values are given, then the current values of the network variables are used.
Parameters: - values :
ndarray
- values :
-
update_reg_Q_participations(self, t=0)¶ Updates reg Q participation factors.
-
update_set_points(self)¶ Updates voltage magnitude set points of gen-regulated buses to be equal to the bus voltage magnitudes.
-
var_generators¶ List of
VarGeneratorobjects.
-
var_generators_corr_radius¶ Correlation radius of variable generators (number of edges).
-
var_generators_corr_value¶ Correlation value (coefficient) of variable generators.
-
vsc_converters¶ List of
ConverterVSCobjects.
6.15. Contingency¶
-
class
pfnet.Contingency(generators=None, branches=None, alloc=True)¶ Contingency class.
Parameters: -
apply(self, network)¶ Applies outages that characterize contingency to given network.
Parameters: - network :
Network
- network :
-
clear(self, network)¶ Clears outages that characterize contingency from given network.
Parameters: - network :
Network
- network :
-
has_branch_outage(self, br)¶ Determines whether contingency specifies the given branch as being on outage.
Parameters: - branch :
Branch
Returns: - result : {
True,False}
- branch :
-
has_generator_outage(self, gen)¶ Determines whether contingency specifies the given generator as being on outage.
Parameters: - gen :
Generator
Returns: - result : {
True,False}
- gen :
-
json_string¶ JSON string (string).
-
name¶ Contingency name (string).
-
num_branch_outages¶ Number of branch outages (int).
-
num_generator_outages¶ Number of generator outages (int).
-
outages¶ List of network component outages in the form of pairs of component type (see Component Types) and index.
-
show(self)¶ Shows contingency information.
-
6.16. Function¶
6.16.1. Function Names¶
"consumption utility" |
|
"generation cost" |
|
"generator powers regularization" |
|
"net consumption cost" |
|
"phase shift regularization" |
|
"susceptance regularization" |
|
"tap ratio regularization" |
|
"soft voltage magnitude limits" |
|
"sparse controls penalty" |
|
"voltage magnitude regularization" |
|
"voltage angle regularization" |
6.16.2. Function Classes¶
-
class
pfnet.FunctionBase¶ Base function class.
-
Hphi¶ Function Hessian matrix (only the lower triangular part) (
coo_matrix).
-
Hphi_nnz¶ Counter of nonzero entries in Hessian matrix (int).
-
analyze(self)¶ Analyzes the structure of the function and allocates required vectors and matrices.
-
clear_error(self)¶ Clears error flag and string.
-
del_matvec(self)¶ Deletes matrices and vectors associated with this function.
-
eval(self, values)¶ Evaluates function value, gradient, and Hessian using the given variable values.
Parameters: - values :
ndarray
- values :
-
name¶ Function name (string).
-
phi¶ Function value (float).
-
set_Hphi(self, Hphi)¶ Sets Hessian matrix.
Parameters: - Hphi :
coo_matrix(lower triangular)
- Hphi :
-
set_parameter(self, key, value)¶ Sets function parameter.
Parameters: - key : string
- value : object
-
state_tag¶ Network state tag during function allocation.
-
weight¶ Function weight (float).
-
-
class
pfnet.Function(name, weight, Network net)¶ Function class.
Parameters: - name : string
- weight : float
- net :
Network
-
class
pfnet.CustomFunction(weight, Network net)¶ Custom function class.
Parameters: - weight : float
- net :
Network
-
allocate(self)¶ Allocates matrices and vectors.
-
analyze_step(self, bus, busdc, t)¶ Performs analyze step.
Parameters:
-
clear(self)¶ Clears counters and values.
-
count_step(self, bus, busdc, t)¶ Performs count step.
Parameters:
-
eval_step(self, bus, busdc, t, x)¶ Performs eval step.
Parameters:
-
init(self)¶ Performs function initialization.
6.17. Constraint¶
6.17.1. Constraint Names¶
"AC power balance" |
|
"DC power balance" |
|
"linearized AC power balance" |
|
"variable fixing" |
|
"variable bounds" |
|
"variable nonlinear bounds" |
|
"generator active power participation" |
|
"generator reactive power participation" |
|
"generator ramp limits" |
|
"voltage regulation by generators" |
|
"voltage regulation by transformers" |
|
"voltage regulation by shunts" |
|
"AC branch flow limits" |
|
"DC branch flow limits" |
|
"linearized AC branch flow limits" |
|
"battery dynamics" |
|
"load constant power factor" |
6.17.2. Constraint Classes¶
-
class
pfnet.ConstraintBase¶ Base constraint class.
-
A¶ Matrix for linear equality constraints (
coo_matrix).
-
A_nnz¶ Counter of nonzero entries in the matrix of linear equality constraints (int).
-
A_row¶ Counter of linear equality constraints (int).
-
G¶ Matrix for linear inequality constraints (
coo_matrix).
-
G_nnz¶ Counter of nonzero entries in the matrix of linear inequality constraints (int).
-
G_row¶ Counter of linear ineqquality constraint (int).
-
H_array_size¶ Size of array of constraint Hessians (int).
-
H_combined¶ Linear combination of Hessian matrices of individual nonlinear equality constraints (only the lower triangular part) (
coo_matrix).
-
H_nnz¶ Integer array of counters of nonzero elements of constraint Hessians.
-
J¶ Jacobian matrix of nonlinear equality constraints (
coo_matrix).
-
J_nnz¶ Counter of nonzero entries in the Jacobian matrix of the nonlinear equality constraints (int).
-
J_row¶ Counter of nonlinear equality constraint (int).
-
allocate_H_array(self, size)¶ Allocates internal array of constraint Hessians.
Parameters: - size : int
-
analyze(self)¶ Analyzes constraint structure and allocates required vectors and matrices.
-
clear_error(self)¶ Clears error flag and string.
-
combine_H(self, coeff, ensure_psd=False)¶ Forms and saves a linear combination of the individual constraint Hessians.
Parameters: - coeff :
ndarray - ensure_psd : {
True,False}
- coeff :
-
del_matvec(self)¶ Deletes matrices and vectors associated with this constraint.
-
eval(self, x, y=None)¶ Evaluates constraint violations, Jacobian, and individual Hessian matrices.
Parameters:
-
get_A_row_info_string(self, index)¶ Gets info string associated with row of A matrix. The info string has the format
constr_name:obj_type:obj_index:constr_info:time.Parameters: - index : int
Returns: - info : string
-
get_G_row_info_string(self, index)¶ Gets info string associated with row of G matrix. The info string has the format
constr_name:obj_type:obj_index:constr_info:time.Parameters: - index : int
Returns: - info : string
-
get_H_single(self, i)¶ Gets the Hessian matrix (only lower triangular part) of an individual constraint.
Parameters: - i : int
Returns: - H :
coo_matrix
-
get_J_row_info_string(self, index)¶ Gets info string associated with row of J matrix. The info string has the format
constr_name:obj_type:obj_index:constr_info:time.Parameters: - index : int
Returns: - info : string
-
get_extra_var_projection(self)¶ Gets projection matrix \(P\) for getting \(y = P \, [x \, y]^T\), where \(x\) are network variablas and \(y\) are extra variables.
Returns: - P :
coo_matrix
- P :
-
get_var_projection(self)¶ Gets projection matrix \(P\) for getting \(x = P \, [x \, y]^T\), where \(x\) are network variablas and \(y\) are extra variables.
Returns: - P :
coo_matrix
- P :
-
name¶ Constraint name (string).
-
num_extra_vars¶ Number of extra variables (set during count) (int).
-
set_A(self, A)¶ Sets A matrix.
Parameters: - A :
coo_matrix
- A :
-
set_G(self, G)¶ Sets G matrix.
Parameters: - G :
coo_matrix
- G :
-
set_H_single(self, i, H)¶ Sets Hessian matrix of an individual constraint.
Parameters: - i : int
- H :
coo_matrix
-
set_J(self, J)¶ Sets J matrix.
Parameters: - J :
coo_matrix
- J :
-
set_parameter(self, key, value)¶ Sets constraint parameter.
Parameters: - key : string
- value : object
-
state_tag¶ Network state tag during constraint allocation.
-
store_sensitivities(self, sA, sf, sGu, sGl)¶ Stores Lagrange multiplier estimates of the constraints in the power network components.
Parameters: - sA :
ndarray(sensitivities for linear equality constraints (\(Ax = b\))) - sf :
ndarray(sensitivities for nonlinear equality constraints (\(f(x) = 0\))) - sGu :
ndarray(sensitivities for linear inequality constraints (\(Gx \le u\))) - sGl :
ndarray(sensitivities for linear inequality constraints (\(l \le Gx\)))
- sA :
-
-
class
pfnet.Constraint(name, Network net)¶ Constraint class.
Parameters: - name : string
- net :
Network
-
class
pfnet.CustomConstraint(Network net)¶ Custom constraint class.
Parameters: - net :
Network
-
allocate(self)¶ Allocates matrices and vectors.
-
analyze_step(self, bus, busdc, t)¶ Performs analyze step.
Parameters:
-
clear(self)¶ Clears counters and values.
-
count_step(self, bus, busdc, t)¶ Performs count step.
Parameters:
-
eval_step(self, bus, busdc, t, x, y=None)¶ Performs eval step.
Parameters:
-
init(self)¶ Performs constraint initialization.
- net :
6.18. Heuristic¶
6.18.1. Heuristic Names¶
"PVPQ switching" |
6.19. Optimization Problem¶
6.19.1. Problem Class¶
-
class
pfnet.Problem(Network net)¶ Optimization problem class.
Parameters: - net :
Network
-
A¶ Constraint matrix of linear equality constraints (
coo_matrix).
-
G¶ Constraint matrix of linear inequality constraints (
coo_matrix).
-
H_combined¶ Linear combination of Hessian matrices of individual nonlinear equality constraints (only the lower triangular part) (
coo_matrix).
-
Hphi¶ Objective function Hessian matrix (only the lower triangular part) (
coo_matrix).
-
J¶ Jacobian matrix of the nonlinear equality constraints (
coo_matrix).
-
add_constraint(self, ConstraintBase constr)¶ Adds constraint to optimization problem.
Parameters: - constr :
ConstraintBase
- constr :
-
add_function(self, FunctionBase func)¶ Adds function to optimization problem objective.
Parameters: - func :
FunctionBase
- func :
-
add_heuristic(self, HeuristicBase heur)¶ Adds heuristic to optimization problem.
Parameters: - func :
HeuristicBase
- func :
-
analyze(self)¶ Analyzes function and constraint structures and allocates required vectors and matrices.
-
clear(self)¶ Resets optimization problem data.
-
clear_error(self)¶ Clears error flag and string.
-
combine_H(self, coeff, ensure_psd=False)¶ Forms and saves a linear combination of the individual constraint Hessians.
Parameters: - coeff :
ndarray - ensure_psd : {
True,False}
- coeff :
-
constraints¶ List of
ConstraintBaseobjects of this optimization problem (list).
-
eval(self, var_values)¶ Evaluates objective function and constraints as well as their first and second derivatives using the given variable values.
Parameters: - var_values :
ndarray
- var_values :
-
find_constraint(self, name)¶ Finds constraint of given name among the constraints of this optimization problem.
Parameters: - name : string
Returns: - constr :
ConstraintBase
-
functions¶ List of
FunctionBaseobjects that form the objective function of this optimization problem (list).
-
get_init_point(self)¶ Gets initial solution estimate from the current values of the network variables.
Returns: - point :
ndarray
- point :
-
get_lower_limits(self)¶ Gets vector of lower limits for the network and extra variables.
Returns: - limits :
ndarray
- limits :
-
get_network(self)¶ Gets the power network associated with this optimization problem.
Parameters: - net :
Network
- net :
-
get_num_linear_equality_constraints(self)¶ Gets number of linear equality constraints.
Returns: - num : int
-
get_num_linear_inequality_constraints(self)¶ Gets number of linear inequality constraints.
Returns: - num : int
-
get_num_nonlinear_equality_constraints(self)¶ Number of nonlinear equality constraints.
Returns: - num : int
-
get_num_primal_variables(self)¶ Gets number of primal variables.
Returns: - num : int
-
get_upper_limits(self)¶ Gets vector of upper limits for the network and extra variables.
Returns: - limits :
ndarray
- limits :
-
has_error(self)¶ Indicates whether the problem has the error flag set due to an invalid operation.
Returns: - flag : {
True,False}
- flag : {
-
heuristics¶ List of
HeuristicBaseobjects of this optimization problem (list).
-
num_extra_vars¶ Number of extra varaibles (set during analyze) (int).
-
num_linear_equality_constraints¶ Number of linear equality constraints (int).
-
num_linear_inequality_constraints¶ Number of linear inequality constraints (int).
-
num_nonlinear_equality_constraints¶ Number of nonlinear equality constraints (int).
-
num_primal_variables¶ Number of primal variables (int).
-
phi¶ Objective function value (float).
-
show(self)¶ Shows information about this optimization problem.
-
store_sensitivities(self, sA, sf, sGu, sGl)¶ Stores Lagrange multiplier estimates of the constraints in the power network components.
Parameters: - sA :
ndarray sensitivities for linear equality constraints (\(Ax = b\))
- sf :
ndarray sensitivities for nonlinear equality constraints (\(f(x) = 0\))
- sGu :
ndarray sensitivities for linear inequality constraints (\(Gx \le u\))
- sGl :
ndarray sensitivities for linear inequality constraints (\(l \le Gx\))
- sA :
-
update_lin(self)¶ Updates linear equality constraints.
- net :
6.20. Test Utilities¶
-
pfnet.tests.utils.check_constraint_combined_Hessian(test, constr, x0, y0, num, tol, eps, h, quiet=True)[source]¶ Checks combined constraint Hessian by using finite differences.
Parameters: - test: unittest.TestCase
- func :
ConstraintBase - x0 :
ndarray - num : integer
- tol : float
- eps : float (percentage)
- quiet : {
True,False}
-
pfnet.tests.utils.check_constraint_single_Hessian(test, constr, x0, y0, num, tol, eps, h, quiet=True)[source]¶ Checks single constraint Hessian by using finite differences.
Parameters: - test: unittest.TestCase
- func :
ConstraintBase - x0 :
ndarray - num : integer
- tol : float
- eps : float (percentage)
- quiet : {
True,False}
-
pfnet.tests.utils.check_constraint_Jacobian(test, constr, x0, y0, num, tol, eps, h, quiet=True)[source]¶ Checks constraint Jacobian by using finite differences.
Parameters: - test: unittest.TestCase
- func :
ConstraintBase - x0 :
ndarray - num : integer
- tol : float
- eps : float (percentage)
- quiet : {
True,False}
-
pfnet.tests.utils.check_function_Hessian(test, func, x0, num, tol, eps, h, quiet=True)[source]¶ Checks function Hessian by using finite differences.
Parameters: - test: unittest.TestCase
- func :
FunctionBase - x0 :
ndarray - num : integer
- tol : float
- eps : float (percentage)
- quiet : {
True,False}
-
pfnet.tests.utils.check_function_gradient(test, func, x0, num, tol, eps, h, quiet=True)[source]¶ Checks function gradient by using finite differences.
Parameters: - test: unittest.TestCase
- func :
FunctionBase - x0 :
ndarray - num : integer
- tol : float
- eps : float (percentage)
- quiet : {
True,False}
-
pfnet.tests.utils.compare_buses(test, bus1, bus2, check_internals=False, check_indices=True, eps=1e-10)[source]¶ Method for checking if two
Busobjects are similar.Parameters:
-
pfnet.tests.utils.compare_generators(test, gen1, gen2, check_internals=False, eps=1e-10)[source]¶ Method for checking if two
Generatorobjects are similar.Parameters:
-
pfnet.tests.utils.compare_loads(test, load1, load2, check_internals=False, eps=1e-10)[source]¶ Method for checking if two
Loadobjects are similar.Parameters:
-
pfnet.tests.utils.compare_shunts(test, shunt1, shunt2, check_internals=False, eps=1e-10)[source]¶ Method for checking if two
Shuntobjects are similar.Parameters:
-
pfnet.tests.utils.compare_branches(test, branch1, branch2, check_internals=False, eps=1e-10)[source]¶ Method for checking if two
Branchobjects are similar.Parameters:
-
pfnet.tests.utils.compare_dc_buses(test, bus1, bus2, check_internals=False, check_indices=True, eps=1e-10)[source]¶ Method for checking if two
BusDCobjects are similar.Parameters:
-
pfnet.tests.utils.compare_dc_branches(test, branch1, branch2, check_internals=False, eps=1e-10)[source]¶ Method for checking if two
BranchDCobjects are similar.Parameters:
-
pfnet.tests.utils.compare_csc_converters(test, conv1, conv2, check_internals=False, eps=1e-10)[source]¶ Method for checking if two
ConverterCSCobjects are similar.Parameters: - test : unittest.TestCase
- conv1 :
ConverterCSC - conv2 :
ConverterCSC - check_internals : {
True,False} - eps : float
-
pfnet.tests.utils.compare_vsc_converters(test, conv1, conv2, check_internals=False, eps=1e-10)[source]¶ Method for checking if two
ConverterVSCobjects are similar.Parameters: - test : unittest.TestCase
- conv1 :
ConverterVSC - conv2 :
ConverterVSC - check_internals : {
True,False} - eps : float
-
pfnet.tests.utils.compare_facts(test, facts1, facts2, check_internals=False, eps=1e-10)[source]¶ Method for checking if two
Factsobjects are similar.Parameters: