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.

write(self, Network net, filename)

Writes data to file.

Parameters:
net : Network
filename : string
class pfnet.Parser
class pfnet.ParserJSON

JSON parser class.

class pfnet.ParserMAT

MAT parser class.

class pfnet.PyParserMAT[source]

Parser for parsing Matpower .m files.

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}
P_mismatch

Bus active power mismatch (p.u. system base MVA) (float or ndarray).

Q_mismatch

Bus reactive power mismatch (p.u. system base MVA) (float or ndarray).

add_battery(self, bat)

Adds a battery connection to this bus.

Parameters:
bat : Battery
add_branch_k(self, branch)

Adds a “k” branch connection to this bus.

Parameters:
branch : Branch
add_branch_m(self, branch)

Adds an “m” branch connection to this bus.

Parameters:
branch : Branch
add_generator(self, gen)

Adds a generator connection to this bus.

Parameters:
gen : Generator
add_load(self, load)

Adds a load connection to this bus.

Parameters:
load : Load
add_reg_generator(self, reg_gen)

Adds a regulating generator connection to this bus.

Parameters:
reg_gen : Generator
add_reg_shunt(self, reg_shunt)

Adds a regulating shunt connection to this bus.

Parameters:
reg_shunt : Shunt
add_reg_tran(self, reg_tran_branch)

Adds a regulating transformer connection to this bus.

Parameters:
reg_tran_branch : Branch
add_shunt(self, shunt)

Adds a shunt connection to this bus.

Parameters:
shunt : Shunt
add_var_generator(self, vargen)

Adds a variable generator connection to this bus.

Parameters:
vargen : VarGenerator
area

Bus area (int).

batteries

List of Battery objects connected to this bus (list).

branches

List of Branch objects incident on this bus (list).

branches_from

Deprecated since version 1.2.5: Same as branches_k.

branches_k

List of Branch objects that have this bus on the “k” side (list).

branches_m

List of Branch objecs that have this bus on the “m” side (list).

branches_to

Deprecated since version 1.2.5: Same as branches_m.

csc_converters

List of ConverterCSC objects connected to this bus (list).

dP_index

Helper index for active power mismatches (int or ndarray).

dQ_index

Helper index for reactive power mismatches (int or ndarray).

degree

Bus degree (number of incident branches) (float).

facts

List of Facts objects incident on this bus (list).

facts_k

List of Facts objects that have this bus on the “k” side (list).

facts_m

List of Facts objects that have this bus on the “m” side (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).

generators

List of Generator objects connected to this bus (list).

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).

index_v_ang

Index of voltage angle variable (int or ndarray).

index_v_mag

Index of voltage magnitude variable (int or ndarray).

is_equal(self, other)

Determines whether the bus is equal to given bus.

Parameters:
other : Bus
Returns:
flag : {True, False}
is_in_service(self)

Determines whether the bus is in service.

Returns:
in_service : {True, False}
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}
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}
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}
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}
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}
is_slack(self)

Determines whether the bus is a slack bus.

Returns:
flag : {True, False}
is_star(self)

Determines whether the bus is a star bus.

Returns:
flag : {True, False}
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}
json_string

JSON string (string).

largest_mismatch

Bus largest power mismatch (p.u. system base MVA) (float or ndarray).

largest_sensitivity

Bus largest sensitivity (float or ndarray).

loads

List of Load objects connected to this bus (list).

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).

price

Bus energy price (float or ndarray) ($ / (hr p.u.)).

reg_facts

List of Facts objects regulating the voltage magnitude of this bus (list).

reg_generators

List of Generator objects regulating the voltage magnitude of this bus (list).

reg_shunts

List of Shunt objects regulating the voltage magnitude of this bus (list).

reg_trans

List of Branch objects regulating the voltage magnitude of this bus (list).

reg_vsc_converters

List of ConverterVSC objects regulating the voltage magnitude of this bus (list).

remove_all_connections(self)

Removes all connections to this bus.

remove_battery(self, bat)

Removes a battery connection to this bus.

Parameters:
bat : Battery
remove_branch_k(self, branch)

Removes a “k” branch connection to this bus.

Parameters:
branch : Branch
remove_branch_m(self, branch)

Removes an “m” branch connection to this bus.

Parameters:
branch : Branch
remove_generator(self, gen)

Removes a generator connection to this bus.

Parameters:
gen : Generator
remove_load(self, load)

Removes a load connection to this bus.

Parameters:
load : Load
remove_reg_generator(self, reg_gen)

Removes a regulating generator connection to this bus.

Parameters:
reg_gen : Generator
remove_reg_shunt(self, reg_shunt)

Removes a regulating shunt connection to this bus.

Parameters:
reg_shunt : Shunt
remove_reg_tran(self, reg_tran_branch)

Removes a regulating transformer connection to this bus.

Parameters:
reg_tran_branch : Branch
remove_shunt(self, shunt)

Removes a shunt connection to this bus.

Parameters:
shunt : Shunt
remove_var_generator(self, vargen)

Removes a variable generator connection to this bus.

Parameters:
vargen : VarGenerator
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}
set_star_flag(self, flag)

Sets the star flag.

Parameters:
bool : {True, False}
show(self, t=0)

Shows bus properties.

Parameters:
t : int (time period)
shunts

List of Shunt objects connected to this bus (list).

v_ang

Bus voltage angle (radians) (float or ndarray).

v_base

Bus base voltage (kilo-volts) (float).

v_mag

Bus volatge magnitude (p.u. bus base kv) (float or ndarray).

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).

v_set

Bus voltage set point (p.u. bus base kv) (float or ndarray).

var_generators

List of VarGenerator objects connected to this bus (list).

vsc_converters

List of ConverterVSC objects 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_k_shunt

Real power flow into the shunt element at bus “k” (p.u.) (float or ndarray).

P_km

Real power flow at bus “k” towards bus “m” (p.u.) (float or ndarray).

P_km_DC

Active power flow (DC approx.) from bus “k” to bus “m” (float or ndarray).

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_m_shunt

Real power flow into the shunt element at bus “m” (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

Real power flow at bus “m” towards bus “k” (p.u.) (float or ndarray).

P_mk_DC

Active power flow (DC approx.) from bus “m” to bus “k” (float or ndarray).

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_k_shunt

Reactive power flow into the shunt element bus “k” (p.u.) (float or ndarray).

Q_km

Reactive power flow at bus “k” towards bus “m” (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_m_shunt

Reactive power flow into the shunt element at bus “m” (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

Reactive power flow at bus “m” towards bus “k” (p.u.) (float or ndarray).

Q_mk_series

Reactive power flow at bus “m” towards bus “k” over the series impedance of the line (p.u.) (float or ndarray).

S_km_mag

Branch apparent power magnitude at bus “k” towards bus “m” (p.u.) (float or ndarray).

S_mk_mag

Branch apparent power magnitude at bus “m” towards bus “k” (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).

bus_k

Bus connected to the “k” side.

bus_m

Bus connected to the “m” side.

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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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}
has_y_correction(self)

Determines whether branch has y correction table.

Returns:
flag : {True, False}
i_km_mag

Branch current magnitude at bus “k” towards bus “m” (p.u.) (float or ndarray).

i_mk_mag

Branch current magnitude at bus “m” towards bus “k” (p.u.) (float or ndarray).

in_service

In service flag (boolean).

index

Branch index (int).

index_phase

Index of transformer phase shift variable (int or ndarray).

index_ratio

Index of transformer tap ratio variable (int or ndarray).

is_equal(self, other)

Determines whether branch is equal to given branch.

Parameters:
other : Branch
is_fixed_tran(self)

Determines whether branch is fixed transformer.

Returns:
flag : {True, False}
is_in_service(self)

Determines whther the branch is in service.

Returns:
in_service : {True, False}
is_line(self)

Determines whether branch is transmission line.

Returns:
flag : {True, False}
is_part_of_3_winding_transformer(self)

Determines whether branch is part of 3-winding transformer.

Returns:
flag : {True, False}
is_phase_shifter(self)

Determines whether branch is phase shifter.

Returns:
flag : {True, False}
is_tap_changer(self)

Determines whether branch is tap-changing transformer.

Returns:
flag : {True, False}
is_tap_changer_Q(self)

Determines whether branch is tap-changing transformer that regulates reactive power flow.

Returns:
flag : {True, False}
is_tap_changer_v(self)

Determines whether branch is tap-changing transformer that regulates bus voltage magnitude.

Returns:
flag : {True, False}
is_zero_impedance_line()

” Determines whether branch is a zero-impedance line.

Returns:
flag : {True, False}
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

Transformer phase shift (radians) (float or ndarray).

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

Transformer tap ratio (float or ndarray).

ratio_max

Transformer tap ratio upper limit (float).

ratio_min

Transformer tap ratio lower limit (float).

reg_bus

Bus whose voltage is regulated by this tap-changing transformer.

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}
y_correction

Y correction table (BranchYCorrection).

6.3.4. Branch Y Correction Class

class pfnet.BranchYCorrection

Branch Y correction class.

corrections

Branch addmittance scaling factors (ndarray).

is_based_on_phase_shift(self)

Determines whether the corrections are for changes in phase shift.

Returns:
flag : {True, False}
is_based_on_tap_ratio(self)

Determines whether the corrections are for changes in tap ratio.

Returns:
flag : {True, False}
max_num_values

Maximum number of correction values (int).

name

Name (string).

num_values

Number of correction values (int).

values

Phase shift or tap ratio values (ndarray).

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

Generator active power (p.u. system base MVA) (float or ndarray).

P_cost

Active power generation cost ($/hr) (float or ndarray).

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

Generator reactive power (p.u. system base MVA) (float or ndarray).

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).

bus

Bus to which generator is connected.

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).

index_P

Index of generator active power variable (int or ndarray).

index_Q

Index of generator reactive power variable (int or ndarray).

is_P_adjustable(self)

Determines whether generator has adjustable active power.

Returns:
flag : {True, False}
is_equal(self, other)

Determines whether generator is equal to given generator.

Parameters:
other : Generator
is_in_service(self)

Determines whether the generator is in service.

Returns:
in_service : {True, False}
is_regulator(self)

Determines whether generator provides voltage regulation.

Returns:
flag : {True, False}
is_slack(self)

Determines whether generator is slack.

Returns:
flag : {True, False}
json_string

JSON string (string).

name

Generator name (string).

num_periods

Number of time periods (int).

obj_type

Object type (string).

reg_bus

Bus whose voltage is regulated by this generator.

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).

sens_Q_l_bound

Objective function sensitivity with respect to reactive power lower bound (float or ndarray).

sens_Q_u_bound

Objective function sensitivity with respect to reactive 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

Shunt susceptance (p.u.) (float or ndarray).

b_max

Shunt susceptance upper limit (p.u.) (float).

b_min

Shunt susceptance lower limit (p.u.) (float).

b_values

Valid shunt susceptance values if switchable (p.u.) (ndarray).

bus

Bus to which the shunt devices is connected.

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).

index_b

Index of shunt susceptance variable (int or ndarray).

is_continuous(self)

Determines whether the shunt has continuous susceptance adjustments.

Returns:
flag : {True, False}
is_discrete(self)

Determines whether the shunt has discrete susceptance adjustments.

Returns:
flag : {True, False}
is_equal(self, other)

Determines whether shunt is equal to given shunt.

Parameters:
other : Shunt
is_fixed(self)

Determines whether the shunt device is fixed (as opposed to switching).

Returns:
flag : {True, False}
is_in_service(self)

Determines whether the shunt device is in service.

Returns:
in_service : {True, False}
is_part_of_transformer(self)

Determines whether the shunt is part of a transformer.

Returns:
flag : {True, False}
is_switched(self)

Determines whether the shunt is switchable.

Returns:
flag : {True, False}
is_switched_locked(self)

Determines whether the shunt is switchable but currently locked.

Returns:
flag : {True, False}
is_switched_v(self)

Determines whether the shunt is switchable and regulates bus voltage magnitude.

Returns:
flag : {True, False}
json_string

JSON string (string).

name

Shunt name (string).

num_periods

Number of time periods (int).

obj_type

Object type (string).

reg_bus

Bus whose voltage magnitude is regulated by this shunt device.

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.

set_b_values(self, values)

Sets the block susceptance values.

Parameters:
values : ndarray

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}
P

Load active power (p.u. system base MVA) (float or ndarray).

P_max

Load active power upper limit (p.u. system base MVA) (float or ndarray).

P_min

Load active power lower limit (p.u. system base MVA) (float or ndarray).

P_util

Active power load utility ($/hr) (float or ndarray).

Q

Load reactive power (p.u. system base MVA) (float or ndarray).

Q_max

Load reactive power upper limit (p.u. system base MVA) (float or ndarray).

Q_min

Load reactive power lower limit (p.u. system base MVA) (float or ndarray).

bus

Bus to which load is connected.

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).

index_P

Index of load active power variable (int or ndarray).

index_Q

Index of load reactive power variable (int or ndarray).

is_P_adjustable(self)

Determines whether the load has adjustable active power.

Returns:
flag : {True, False}
is_equal(self, other)

Determines whether load is equal to given load.

Parameters:
other : Load
is_in_service(self)

Determines whether load is in service.

Returns:
flag : {True, False}
is_voltage_dependent(self)

Determines whether the load is voltage dependent.

Returns:
flag : {True, False}
json_string

JSON string (string).

name

Load name (string).

num_periods

Number of time periods (int).

obj_type

Object type (string).

power_factor

Load power factor (float or ndarray).

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

Variable generator active power after curtailments (p.u. system base MVA) (float or ndarray).

P_ava

Variable generator available active power (p.u. system base MVA) (float or ndarray).

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

Variable generator reactive power (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).

bus

Bus to which variable generator is connected.

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).

index_P

Index of variable generator active power variable (int or ndarray).

index_Q

Index of variable generator reactive power variable (int or ndarray).

is_equal(self, other)

Determines whether the var generator is equal to given var generator.

Parameters:
other : VarGenerator
Returns:
flag : {True, False}
is_in_service(self)

Determines whether the variable generator is in service.

Returns:
in_service : {True, False}
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

Battery charging power (p.u. system base MVA) (float or ndarray).

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).

bus

Bus to which battery is connected.

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).

index_E

Index of battery energy level variable (int or ndarray).

index_Pc

Index of battery charging power variable (int or ndarray).

index_Pd

Index of battery discharging power variable (int or ndarray).

is_equal(self, other)

Determines whether the battery is equal to given battery.

Parameters:
other : Battery
Returns:
flag : {True, False}
is_in_service(self)

Determines whether the battery is in service.

Returns:
in_service : {True, False}
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_dc

DC power exchanged from shunt to series converter (p.u.) (float or ndarray).

P_k

Active power injected into the “k” bus (p.u.) (float or ndarray).

P_m

Active power injected into the “m” bus (p.u.) (float or ndarray).

P_max_dc

Maximum DC power transfer (p.u.) (float).

P_set

Active power set-point at the “m” bus (p.u.) (float or ndarray).

Q_k

Reactive power injected into the “k” bus (p.u.) (float or ndarray).

Q_m

Reactive power injected into the “m” bus (p.u.) (float or ndarray).

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).

Q_s

Reactive power provided by series converter (p.u.) (float or ndarray).

Q_set

Reactive power set-point at the “m” bus (p.u.) (float or ndarray).

Q_sh

Reactive power provided by shunt converter (p.u.) (float or ndarray).

b

Series susceptance set-point for constant impedance mode (p.u.) (float).

bus_k

Bus connected to the “k” side.

bus_m

Bus connected to the “m” side.

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).

index_P_dc

Index of DC power exchanged from shunt to series converter (int or ndarray).

index_P_k

Index of active power injection into “k” bus (int or ndarray).

index_P_m

Index of active power injection into “m” bus (int or ndarray).

index_Q_k

Index of reactive power injection into “k” bus (int or ndarray).

index_Q_m

Index of reactive power injection into “m” bus (int or ndarray).

index_Q_s

Index of reactive power provided by series converter (int or ndarray).

index_Q_sh

Index of reactive power provided by shunt converter (int or ndarray).

index_v_ang_s

Index of series voltage angle variable (int or ndarray).

index_v_mag_s

Index of series voltage magnitude variable (int or ndarray).

is_SSSC(self)

Determines whether device is SSSC.

Returns:
flag : {True, False}
is_STATCOM(self)

Determines whether device is STATCOM.

Returns:
flag : {True, False}
is_UPFC(self)

Determines whether device is UPFC.

Returns:
flag : {True, False}
is_equal(self, other)

Determines whether facts is equal to given facts.

Parameters:
other : Facts
Returns:
flag : {True, False}
is_in_constant_series_v_mode(self)

Determines whether series link operates in constant voltage mode.

Returns:
flag : {True, False}
is_in_constant_series_z_mode(self)

Determines whether series link operates in constant impedance mode.

Returns:
flag : {True, False}
is_in_normal_series_mode(self)

Determines whether series link operates in normal mode.

Returns:
flag : {True, False}
is_in_service(self)

Determines whether the FACTS device is in service.

Returns:
in_service : {True, False}
is_regulator(self)

Determines whether FACTS provides voltage set point regulation with shunt converter.

Returns:
flag : {True, False}

Determines whether series link is bypassed.

Returns:
flag : {True, False}

Determines whether series link is disabled.

Returns:
flag : {True, False}
json_string

JSON string (string).

name

Facts name (string).

num_periods

Number of time periods (int).

obj_type

Object type (string).

reg_bus

Bus whose voltage is regulated by this FACTS device.

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.

Sets series link to bypassed.

Sets series link to disabled.

v_ang_s

Series voltage angle (radians with respect to bus_k voltage angle) (float or ndarray).

v_mag_s

Series voltage magnitude (p.u.) (float or ndarray).

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

Active power injection into AC bus (p.u. system base MVA) (float or ndarray).

P_dc

DC power injection into DC bus (p.u. system base MVA) (float or ndarray).

P_dc_set

DC power set point (p.u. system base MVA) (float or ndarray).

P_max

Maximum active power injection into AC bus (float).

P_min

Minimum active power injection into AC bus (float).

Q

Reactive power injection into AC bus (p.u. system base MVA) (float or ndarray).

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).

ac_bus

Bus to which VSC converter is connected.

dc_bus

BusDC to which VSC converter is connected.

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}
i_dc

DC current injection into DC bus (p.u. system base MVA and DC bus v base) (float or ndarray).

in_service

In service flag (boolean).

index

VSC converter index (int).

index_P

Index of active power variable (int or ndarray).

index_P_dc

Index of DC power variable (int or ndarray).

index_Q

Index of reactive power variable (int or ndarray).

index_i_dc

Index of DC current variable (int or ndarray).

is_equal(self, other)

Determines whether VSC converter is equal to given VSC converter.

Parameters:
other : ConverterVSC
Returns:
flag : {True, False}
is_in_P_dc_mode(self)

Determines whether VSC converter is in constant DC power mode.

Returns:
flag : {True, False}
is_in_f_ac_mode(self)

Determines whether VSC converter is in constant AC power factor mode.

Returns:
flag : {True, False}
is_in_service(self)

Determines whether the VSC converter is in service.

Returns:
in_service : {True, False}
is_in_v_ac_mode(self)

Determines whether VSC converter is in constant AC voltage magnitude mode.

Returns:
flag : {True, False}
is_in_v_dc_mode(self)

Determines whether VSC converter is in constant DC voltage mode.

Returns:
flag : {True, False}
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).

reg_bus

Bus whose voltage is regulated by this generator.

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).

v_dc_set

DC voltage set point (p.u. DC base) (float or ndarray).

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}
P

Active power injection into AC bus (p.u. system base MVA) (float or ndarray).

P_dc

DC power injection into DC bus (p.u. system base MVA) (float or ndarray).

P_dc_set

DC power set point (p.u. system base MVA) (float or ndarray).

Q

Reactive power injection into AC bus (p.u. system base MVA) (float or ndarray).

ac_bus

Bus to which CSC converter is connected.

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).

dc_bus

BusDC to which CSC converter is connected.

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}
i_dc

DC current injection into DC bus (p.u. system base MVA) (float or ndarray).

i_dc_set

DC current set point (p.u. DC base) (float or ndarray).

in_service

In service flag (boolean).

index

CSC converter index (int).

index_P

Index of active power variable (int or ndarray).

index_P_dc

Index of DC power variable (int or ndarray).

index_Q

Index of reactive power variable (int or ndarray).

index_angle

Index of ignition delay angle if rectifier or extinction advance angle if inverter (int or ndarray).

index_i_dc

Index of DC current variable (int or ndarray).

index_ratio

Index of commutating transformer turns ratio variable (int or ndarray).

is_equal(self, other)

Determines whether CSC converter is equal to given CSC converter.

Parameters:
other : ConverterCSC
Returns:
flag : {True, False}
is_in_P_dc_mode(self)

Determines whether CSC converter is in constant DC power mode.

Returns:
flag : {True, False}
is_in_i_dc_mode(self)

Determines whether CSC converter is in constant DC current mode.

Returns:
flag : {True, False}
is_in_service(self)

Determines whether the CSC converter is in service.

Returns:
in_service : {True, False}
is_in_v_dc_mode(self)

Determines whether CSC converter is in constant DC voltage mode.

Returns:
flag : {True, False}
is_inverter(self)

Determines whether CSC converter is an inverter.

Returns:
flag : {True, False}
is_rectifier(self)

Determines whether CSC converter is a rectifier.

Returns:
flag : {True, False}
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).

v_dc_set

DC voltage set point (p.u. DC base) (float or ndarray).

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}
P_mismatch

DC bus power mismatch (p.u. system base MVA) (float or ndarray).

add_branch_k(self, branch)

Adds a “k” branch connection to this bus.

Parameters:
branch : BranchDC
add_branch_m(self, branch)

Adds an “m” branch connection to this bus.

Parameters:
branch : BranchDC
add_csc_converter(self, conv)

Adds a CSC converter connection to this bus.

Parameters:
conv : ConverterCSC
add_vsc_converter(self, conv)

Adds a VSC converter connection to this bus.

Parameters:
conv : ConverterVSC
branches

List of BranchDC objects incident on this bus (list).

branches_k

List of BranchDC objects that have this DC bus on the “k” side (list).

branches_m

List of BranchDC objects that have this bus on the “m” side (list).

csc_converters

List of ConverterCSC objects connected to this bus (list).

di_index

Helper index for current mismatches (int 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_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).

index_v

Index of voltage variable (int or ndarray).

is_equal(self, other)

Determines whether the DC bus is equal to given DC bus.

Parameters:
other : BusDC
Returns:
flag : {True, False}
is_in_service(self)

Determines whether the DC bus is in service.

Returns:
in_service : {True, False}
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
remove_branch_m(self, branch)

Removes an “m” branch connection to this bus.

Parameters:
branch : BranchDC
remove_csc_converter(self, conv)

Removes a CSC converter connection to this bus.

Parameters:
conv : ConverterCSC
remove_vsc_converter(self, conv)

Removes a VSC converter connection to this bus.

Parameters:
conv : ConverterVSC
set_v(self, v, t=0)

Sets DC bus voltage.

Parameters:
v : float
t : int
v

DC bus voltage (p.u. bus base kv) (float or ndarray).

v_base

DC bus base voltage (kilo-volts) (float).

vsc_converters

List of ConverterVSC objects 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}
P_km

DC power flow at bus “k” towards bus “m” (p.u.) (float or ndarray).

P_mk

DC power flow at bus “m” towards bus “k” (p.u.) (float or ndarray).

bus_k

BusDC connected to the “k” side.

bus_m

BusDC connected to the “m” side.

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
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
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
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
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}
i_km

DC branch current at bus “k” towards bus “m” (p.u.) (float or ndarray).

i_mk

DC branch current at bus “m” towards bus “k” (p.u.) (float or ndarray).

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
is_in_service(self)

Determines whether the DC branch is in service.

Returns:
in_service : {True, False}
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 Battery objects
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 Bus objects
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)
add_branches(self, branches)

Adds branches to the network. Flags are not preserved (for now).

Parameters:
branches : list of Branch objects
add_buses(self, buses)

Adds buses to the network. Flags are not preserved (for now).

Parameters:
buses : list of Bus objects
add_generators(self, generators)

Adds generators to the network. Flags are not preserved (for now).

Parameters:
generators : list of Generator objects
add_loads(self, loads)

Adds loads to the network. Flags are not preserved (for now).

Parameters:
loads : list of Load objects
add_shunts(self, shunts)

Adds shunts to the network. Flags are not preserved (for now).

Parameters:
shunts : list of Shunt objects
add_var_generators(self, var_generators)

Adds var generators to the network. Flags are not preserved (for now).

Parameters:
var_generators : list of VarGenerator objects
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 Bus objects
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)
base_power

System base power (MVA) (float).

batteries

List of Battery objects.

branches

List of Branch objects.

bus_P_mis

Largest bus active power mismatch in the network (MW) (float or ndarray).

bus_Q_mis

Largest bus reactive power mismatch in the network (MVAr) (float or ndarray).

bus_v_max

Maximum bus voltage magnitude (p.u.) (float or ndarray).

bus_v_min

Minimum bus voltage magnitude (p.u.) (float or ndarray).

bus_v_vio

Maximum bus voltage magnitude limit violation (p.u.) (float or ndarray).

buses

List of Bus objects.

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}
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 ConverterCSC objects.

dc_branches

List of BranchDC objects.

dc_buses

List of BusDC objects.

error_string

Error string (string).

extract_subnetwork(self, buses)

Extracts subnetwork containig the given buses.

Parameters:
buses : list of Bus objects
Returns:
net : Network
facts

List of Facts objects.

gen_P_cost

Total active power generation cost ($/hr) (float or ndarray).

gen_P_vio

Largest generator active power limit violation (MW) (float or ndarray).

gen_Q_vio

Largest generator reactive power limit violation (MVAr) (float or ndarray).

gen_v_dev

Largest voltage magnitude deviation from set point of bus regulated by generator (p.u.) (float or ndarray).

generators

List of Generator objects.

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(self, index)

Gets bus with the given index.

Parameters:
index : int
Returns:
bus : Bus
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}
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(self, index)

Gets FACTS device.

Parameters:
index : int
Returns
——-
conv : Facts
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 Bus objects
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(self, index)

Gets load with the given index.

Parameters:
index : int
Returns:
load : Load
get_load_buses(self)

Gets list of buses where loads are connected.

Returns:
buses : list of Bus objects
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}
has_same_ptr(self, Network other)

Checks whether network shares memory with another network.

Parameters:
other : Network
Returns:
flag : {True, False}
json_string

JSON string (string).

load_P_util

Total active power consumption utility ($/hr) (float or ndarray).

load_P_vio

Largest load active power limit violation (MW) (float or ndarray).

loads

List of Load objects.

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 Battery objects
remove_branches(self, branches)

Removes branches from the network. All network flags are cleared (for now).

Parameters:
branches : list of Branch objects
remove_buses(self, buses)

Removes buses from the network. All network flags are cleared (for now).

Parameters:
buses : list of Bus objects
remove_generators(self, generators)

Removes generators from the network. All network flags are cleared (for now).

Parameters:
generators : list of Generator objects
remove_loads(self, loads)

Removes loads from the network. All network flags are cleared (for now).

Parameters:
loads : list of Load objects
remove_shunts(self, shunts)

Removes shunts from the network. All network flags are cleared (for now).

Parameters:
shunts : list of Shunt objects
remove_var_generators(self, var_generators)

Removes var generators from the network. All network flags are cleared (for now).

Parameters:
var_generators : list of VarGenerator objects
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)
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_var_values(self, values)

Sets network variable values.

Parameters:
values : ndarray
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_b_vio

Largest switched shunt susceptance limit violation (p.u.) (float or ndarray).

shunt_v_vio

Largest voltage magnitude band violation of voltage regulated by switched shunt device (p.u.) (float or ndarray).

shunts

List of Shunt objects.

state_tag

State tag.

total_load_P

Total load active power (MW) (float or ndarray).

tran_p_vio

Largest transformer phase shift limit violation (float or ndarray).

tran_r_vio

Largest transformer tap ratio limit violation (float or ndarray).

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
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 VarGenerator objects.

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 ConverterVSC objects.

6.15. Contingency

class pfnet.Contingency(generators=None, branches=None, alloc=True)

Contingency class.

Parameters:
generators : list of Generator objects
branches : list of Branch objects
alloc : {True, False}
add_branch_outage(self, br)

Adds branch outage to contingency.

Parameters:
br : Branch
add_generator_outage(self, gen)

Adds generator outage to contingency.

Parameters:
gen : Generator
apply(self, network)

Applies outages that characterize contingency to given network.

Parameters:
network : Network
branch_outages

Array of outage branch indices (ndarray).

clear(self, network)

Clears outages that characterize contingency from given network.

Parameters:
network : Network
generator_outages

Array of outage generator indices (ndarray).

has_branch_outage(self, br)

Determines whether contingency specifies the given branch as being on outage.

Parameters:
branch : Branch
Returns:
result : {True, False}
has_generator_outage(self, gen)

Determines whether contingency specifies the given generator as being on outage.

Parameters:
gen : Generator
Returns:
result : {True, False}
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
gphi

Function gradient vector (ndarray).

name

Function name (string).

network

Network associated with function (Network).

phi

Function value (float).

set_Hphi(self, Hphi)

Sets Hessian matrix.

Parameters:
Hphi : coo_matrix (lower triangular)
set_gphi(self, gphi)

Sets gradient vector.

Parameters:
gphi : ndarray
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:
bus : Bus
busdc : BusDC
t : time period (int)
clear(self)

Clears counters and values.

count_step(self, bus, busdc, t)

Performs count step.

Parameters:
bus : Bus
busdc : BusDC
t : time period (int)
eval_step(self, bus, busdc, t, x)

Performs eval step.

Parameters:
bus : Bus
busdc : BusDC
t : time period (int)
x : ndarray
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.

b

Right-hand side vector of linear equality constraints (ndarray).

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}
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:
x : ndarray (values of variables)
y : ndarray (values of constraint extra or auxiliary variables)
f

Vector of nonlinear equality constraint violations (ndarray).

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
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
init_extra_vars

Vector of initial values for constraint extra variables (ndarray).

l

Lower bound vector of linear inequality constraints (ndarray).

l_extra_vars

Lower bound vector of constraint extra variables (ndarray).

name

Constraint name (string).

network

Network associated with constraint.

num_extra_vars

Number of extra variables (set during count) (int).

set_A(self, A)

Sets A matrix.

Parameters:
A : coo_matrix
set_G(self, G)

Sets G matrix.

Parameters:
G : coo_matrix
set_H_nnz(self, H_nnz)

Sets H_nnz array.

Parameters:
H_nnz : ndarray
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
set_b(self, b)

Sets b vector.

Parameters:
b : ndarray
set_f(self, f)

Sets f vector.

Parameters:
f : ndarray
set_l(self, l)

Sets l vector.

Parameters:
l : ndarray
set_parameter(self, key, value)

Sets constraint parameter.

Parameters:
key : string
value : object
set_u(self, u)

Sets u vector.

Parameters:
u : ndarray
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\)))
u

Upper bound vector of linear inequality constraints (ndarray).

u_extra_vars

Upper bound vector of constraint extra variables (ndarray).

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:
bus : Bus
busdc : BusDC
t : time period (int)
clear(self)

Clears counters and values.

count_step(self, bus, busdc, t)

Performs count step.

Parameters:
bus : Bus
busdc : BusDC
t : time period (int)
eval_step(self, bus, busdc, t, x, y=None)

Performs eval step.

Parameters:
bus : Bus
busdc : BusDC
t : time period (int)
x : ndarray
y : ndarray
init(self)

Performs constraint initialization.

store_sens_step(self, bus, busdc, t, sA, sf, sGu, sGl)

Performs step for storing sensitivities.

Parameters:
bus : Bus
busdc : BusDC
t : time period (int)
sA : ndarray
sf : ndarray
sGu : ndarray
sGl : ndarray

6.18. Heuristic

6.18.1. Heuristic Names

   
"PVPQ switching"  

6.18.2. Heuristic Classes

class pfnet.HeuristicBase

Base heuristic class.

apply(self, constraints, values)

Applies heuristic.

Parameters:
constraints : List of ConstraintBase objects
values : ndarray
clear_error(self)

Clears error flag and string.

name

Heuristic name (string).

network

Network associated with heuristic (Network).

class pfnet.Heuristic(name, Network net)

Heuristic class.

Parameters:
name : string
net : Network

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
add_function(self, FunctionBase func)

Adds function to optimization problem objective.

Parameters:
func : FunctionBase
add_heuristic(self, HeuristicBase heur)

Adds heuristic to optimization problem.

Parameters:
func : HeuristicBase
analyze(self)

Analyzes function and constraint structures and allocates required vectors and matrices.

apply_heuristics(self, var_values)

Applies heuristic.

Parameters:
var_values : ndarray
b

Right hand side vectors of the linear equality constraints (ndarray).

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}
constraints

List of ConstraintBase objects 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
f

Vector of nonlinear equality constraints violations (ndarray).

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 FunctionBase objects 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
get_lower_limits(self)

Gets vector of lower limits for the network and extra variables.

Returns:
limits : ndarray
get_network(self)

Gets the power network associated with this optimization problem.

Parameters:
net : Network
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
gphi

Objective function gradient vector (ndarray).

has_error(self)

Indicates whether the problem has the error flag set due to an invalid operation.

Returns:
flag : {True, False}
heuristics

List of HeuristicBase objects of this optimization problem (list).

l

Lower bound for linear inequality constraints (ndarray).

lam

Initial dual point (ndarray).

network

Power network associated with this optimization problem (Network).

nu

Initial dual point (ndarray).

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\))

u

Upper bound for linear inequality constraints (ndarray).

update_lin(self)

Updates linear equality constraints.

x

Initial primal point (ndarray).

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 Bus objects are similar.

Parameters:
test : unittest.TestCase
bus1 : Bus
bus2 : Bus
check_internals : {True, False}
check_indices : {True, False}
eps : float
pfnet.tests.utils.compare_generators(test, gen1, gen2, check_internals=False, eps=1e-10)[source]

Method for checking if two Generator objects are similar.

Parameters:
test : unittest.TestCase
gen1 : Generator
gen2 : Generator
check_internals : {True, False}
eps : float
pfnet.tests.utils.compare_loads(test, load1, load2, check_internals=False, eps=1e-10)[source]

Method for checking if two Load objects are similar.

Parameters:
test : unittest.TestCase
load1 : Load
load2 : Load
check_internals : {True, False}
eps : float
pfnet.tests.utils.compare_shunts(test, shunt1, shunt2, check_internals=False, eps=1e-10)[source]

Method for checking if two Shunt objects are similar.

Parameters:
test : unittest.TestCase
shunt1 : Shunt
shunt2 : Shunt
check_internals : {True, False}
eps : float
pfnet.tests.utils.compare_branches(test, branch1, branch2, check_internals=False, eps=1e-10)[source]

Method for checking if two Branch objects are similar.

Parameters:
test : unittest.TestCase
branch1 : Branch
branch2 : Branch
check_internals : {True, False}
eps : float
pfnet.tests.utils.compare_dc_buses(test, bus1, bus2, check_internals=False, check_indices=True, eps=1e-10)[source]

Method for checking if two BusDC objects are similar.

Parameters:
test : unittest.TestCase
bus1 : BusDC
bus2 : BusDC
check_internals : {True, False}
check_indices : {True, False}
eps : float
pfnet.tests.utils.compare_dc_branches(test, branch1, branch2, check_internals=False, eps=1e-10)[source]

Method for checking if two BranchDC objects are similar.

Parameters:
test : unittest.TestCase
branch1 : BranchDC
branch2 : BranchDC
check_internals : {True, False}
eps : float
pfnet.tests.utils.compare_csc_converters(test, conv1, conv2, check_internals=False, eps=1e-10)[source]

Method for checking if two ConverterCSC objects 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 ConverterVSC objects 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 Facts objects are similar.

Parameters:
test : unittest.TestCase
facts1 : Facts
facts2 : Facts
check_internals : {True, False}
eps : float
pfnet.tests.utils.compare_networks(test, net1, net2, check_internals=False, eps=1e-10, ignore_facts=False)[source]

Method for checking if two Network objects are held in different memory locations but are otherwise identical.

Parameters:
test : unittest.TestCase
net1 : Network
net2 : Network
check_internals : {True, False}
eps : float
ignore_facts : {True, False}
pfnet.tests.utils.check_network(test, net)[source]

Checks validity of network.

Parameters:
test : unittest.TestCase
net : Network