AC System Modelling

AC node

AC node model

AC node equivalent circuit with voltage source and impedance

AC node model

AC node equivalent circuit with voltage source and impedance

The active and reactive power injections at the AC node are given by [1]:

(1)\[\begin{split}\begin{align} P_{net}^{ac} &= P_{flow}^{ac} \\ P_{net}^{ac} &= \sum P_{g_i} + \sum \gamma_{rg_i}P_{rg_i} - P_{l_i} + \sum P_{cn_i} \\ P_{flow}^{ac} &= \sum_{k \in \mathcal{N}_{ac}} |V_i||V_k| [ G_{ik} \cos(\theta_i-\theta_k) + B_{ik} \sin(\theta_i-\theta_k) ] \qquad \forall i \in \mathcal{N}_{ac} \end{align}\end{split}\]
(2)\[\begin{split}\begin{align} Q_{net}^{ac} &= Q_{flow}^{ac} \\ Q_{net}^{ac} &= \sum Q_{g_i} + \sum Q_{rg_i} -Q_{l_i}+\sum Q_{cn_{i}} \\ Q_{flow}^{ac} &= \sum_{k \in \mathcal{N}_{ac}} |V_i||V_k|[G_{ik} \sin(\theta_i-\theta_k)-B_{ik} \cos(\theta_i-\theta_{k})] \qquad \forall i \in \mathcal{N}_{ac} \end{align}\end{split}\]
(3)\[\begin{split}\begin{align} V_{min} \leq V_{i} \leq V_{max} & \qquad \forall i \in \mathcal{N}_{ac} \\ \theta_{min} \leq \theta_i \leq \theta_{max} & \qquad \forall i \in \mathcal{N}_{ac} \end{align}\end{split}\]

The AC node is modeled using a complex voltage phasor \(V_i = V_i \angle \theta_i\) where:

  • \(V_i\) is the voltage magnitude in pu

  • \(\theta_i\) is the voltage angle

  • \(P_{rg}\) is the active power injection of renewable generation in pu

  • \(Q_{rg}\) is the reactive power injection of renewable generation in pu

  • \(P_{cn}\) is the active power injection of converter in pu

  • \(Q_{cn}\) is the reactive power injection of converter in pu

  • \(P_g\) is the active power injection of generator in pu

  • \(S_l\) is the complex power demand in pu

Class Reference: pyflow_acdc.Classes.Node_AC

class Node_AC(node_type, Voltage_0, theta_0, kV_base, Power_Gained=0, Reactive_Gained=0, Power_load=0, Reactive_load=0, name=None, Umin=0.9, Umax=1.1, Gs=0, Bs=0, x_coord=None, y_coord=None, S_base=100)

AC bus in the network.

Parameters:
  • node_type (str) – Bus type: 'Slack', 'PQ', or 'PV' (stored as type).

  • Voltage_0 (float) – Initial voltage magnitude in pu (stored as V_ini).

  • theta_0 (float) – Initial voltage angle in radians (stored as theta_ini).

  • kV_base (float) – Base voltage in kV.

  • Power_Gained (float, optional) – Active power injection in pu (stored as PGi).

  • Reactive_Gained (float, optional) – Reactive power injection in pu (stored as QGi).

  • Power_load (float, optional) – Active power demand in pu (stored as PLi via load factors).

  • Reactive_load (float, optional) – Reactive power demand in pu (stored as QLi).

  • name (str, optional) – Bus identifier.

  • Umin (float, optional) – Minimum voltage magnitude in p.u.

  • Umax (float, optional) – Maximum voltage magnitude in p.u.

  • Gs (float, optional) – Shunt conductance in p.u.

  • Bs (float, optional) – Shunt susceptance in p.u.

  • x_coord (float, optional) – x-coordinate, preferably in longitude decimal format.

  • y_coord (float, optional) – y-coordinate, preferably in latitude decimal format.

  • S_base (float)

price

Nodal energy price when the bus belongs to a price zone.

Type:

float

PLi_factor

Time-series/scenario load scaling factor.

Type:

float

PLi_inv_factor

Investment-period load scaling factor.

Type:

float

Example Usage:

import pyflow_acdc as pyf
# Create an AC node
pyf.initialize_pyflowacdc()
node = pyf.Node_AC('PQ', 1, 0,66, Power_Gained=0, Reactive_Gained=0, Power_load=100, Reactive_load=50, name='Bus1', Umin=0.9, Umax=1.1,Gs=0,Bs=0)

AC branch

AC line model

AC line π-model

AC line model

AC line π-model

The AC branch is modeled with pi model from [1], [2] :

(4)\[\begin{split}Y_{bus-{branch}} = \begin{bmatrix} Y_{ff} & Y_{ft} \\ Y_{tf} & Y_{tt} \end{bmatrix} = \begin{bmatrix} \frac{Y_s+Y_{sh}}{\mu^2} & -\frac{Y_s}{\mu e^{-j\tau}} \\ -\frac{Y_s}{\mu e^{j\tau}} & Y_{s}+Y_{sh} \end{bmatrix}\end{split}\]
(5)\[\begin{split}\begin{align} Y_{bus_{AC}}[i,i]&+= Y_{ff} + G_{r_i}+jB_{r_i}\\ Y_{bus_{AC}}[i,k]&+= Y_{ft}\\ Y_{bus_{AC}}[k,i]&+= Y_{tf}\\ Y_{bus_{AC}}[k,k]&+= Y_{tt} +G_{r_k}+ jB_{r_k} \end{align}\end{split}\]
(6)\[\begin{split}\begin{align} P_{j,to}^2+Q_{j,to}^2 &\leq S_{j,rating}^2 \qquad \forall j \in \mathcal{B}_{ac}\\ P_{j,from}^2+Q_{j,from}^2 &\leq S_{j,rating}^2 \qquad \forall j \in \mathcal{B}_{ac} \end{align}\end{split}\]

Class Reference: pyflow_acdc.Classes.Line_AC

class Line_AC(fromNode, toNode, r=0.001, x=0.001, g=0, b=0, MVA_rating=9999, Length_km=1.0, m=1, shift=0, N_cables=1, name=None, geometry=None, isTf=False, S_base=100, Cable_type=CableType.CUSTOM)

AC transmission line or cable (optionally a tap-changing transformer).

Parameters:
  • fromNode (Node_AC) – Starting bus of the line.

  • toNode (Node_AC) – Ending bus of the line.

  • r (float, optional) – Resistance in pu.

  • x (float, optional) – Reactance in pu.

  • g (float, optional) – Conductance in pu.

  • b (float, optional) – Susceptance in pu.

  • MVA_rating (float, optional) – MVA rating of the line.

  • Length_km (float, optional) – Length of the line in km.

  • m (float, optional) – Tap magnitude (transformer lines).

  • shift (float, optional) – Phase shift in radians.

  • N_cables (int, optional) – Number of parallel cables (TEP: stored as np_line).

  • name (str, optional) – Line identifier.

  • geometry (str, optional) – Line geometry metadata for plotting.

  • isTf (bool, optional) – True if the branch is a transformer.

  • S_base (float, optional) – Per-unit power base in MVA.

  • Cable_type (str, optional) – Cable type from the built-in database, or 'Custom'.

Example Usage:

import pyflow_acdc as pyf
# Create an AC node
pyf.initialize_pyflowacdc()
node1 = pyf.Node_AC('PQ', 1, 0,66, Power_Gained=0.5, name='Bus1')
node2 = pyf.Node_AC('Slack', 1, 0,66,name='Bus2')
# In pu
line_1 = pyf.Line_AC(node1, node2, r=0.01, x=0.1, g=0, b=0, MVA_rating=100, N_cables=1, name='Line1')
# Or by cable type in database
line_2 = pyf.Line_AC(node1, node2, S_base=100, Length_km=100, Cable_type='NREL_66kV_630mm2')

Transmission Expansion Planning Modelling

In transmision expansion planning, each branch subject to modification is modeled independently in their power flow equations. The standard \(\pi\)-model is used to represent branch through its corresponding branch admittance \(Y_{\text{bus-branch}}\).

(7)\[\begin{split}\begin{align} S_{ik}& = P_{ik} + \text{j} Q_{ik} \\ P_{ik} &= |V_i|^2 G_{ff} + |V_i||V_k| \left[ G_{ft} \cos(\theta_i - \theta_k) + B_{ft} \sin(\theta_i - \theta_k) \right] \\ Q_{ik}&=-|V_i|^2 B_{ff}+|V_i||V_k|[G_{ft} \sin(\theta_i-\theta_k)-B_{ft} \cos(\theta_i-\theta_{k}) \end{align}\end{split}\]

AC expandable branch

AC expandable branch model

AC expandable branch model

AC expandable branch model

AC expandable branch model

The AC expandable branch \(h\) is modeled with in admittance matrix model from [4]:

(8)\[\begin{split}\begin{align} S_{h_\text{ik}\text{-eq}} &= n_h \cdot S_{h_\text{ik}} \\ S_{h_\text{ki}\text{-eq}} &= n_h \cdot S_{h_\text{ki}} \end{align}\end{split}\]
(9)\[\begin{split}\begin{align} P_{flow}^{ac} += \sum n_{h} P_{h_\text{ik}} \\ Q_{flow}^{ac} += \sum n_{h} Q_{h_\text{ik}} \end{align}\end{split}\]

Class Reference: pyflow_acdc.Classes.Exp_Line_AC

Inherits from Line_AC with the following additional attributes:

Attribute

Type

Description

base_cost

float

Base cost of the line

life_time

float

Lifetime of the line

np_line_b

float

Base number of lines

np_line_max

float

Maximum number of lines

Where \(n_b \leq n_{max}\).

Note:

  • The previous np_line_i attribute (used as a solver initialization / first guess) has been removed from the element classes.

  • Solver initial values are now computed in the modelling layer (see get_TEP_variables) and passed to Pyomo variables via the *_model_first_guess data structures.

AC reconducting branch

AC expandable branch model

AC reconducting branch model

AC expandable branch model

AC reconducting branch model

The AC reconducting branch \(u\) is modeled with in admittance matrix model from [4]:

(10)\[\begin{split}\begin{align} S_{u_\text{ik}\text{-eq}} &= (1-\xi_u)\cdot S_{u_\text{ik}} + \xi_u \cdot S_{u_\text{ik}}' \\ S_{u_\text{ki}\text{-eq}} &=(1-\xi_u)\cdot S_{u_\text{ki}} + \xi_u \cdot S_{u_\text{ki}}' \end{align}\end{split}\]
(11)\[\begin{split}\begin{align} P_{flow}^{ac} += \sum P_{u_\text{ik}\text{-eq}} \\ Q_{flow}^{ac} += \sum Q_{u_\text{ik}\text{-eq}} \end{align}\end{split}\]

Class Reference: pyflow_acdc.Classes.rec_Line_AC

Inherits from Line_AC with the following additional attributes:

Attribute

Type

Description

r_new

float

Resistance of the new conductor in pu

x_new

float

Reactance of the new conductor in pu

g_new

float

Conductance of the new conductor in pu

b_new

float

Susceptance of the new conductor in pu

MVA_rating_new

float

MVA rating of the new conductor

Life_time

float

Lifetime of the conductor

base_cost

float

Base cost of the conductor

AC conductor size selection

AC expandable branch model

AC conductor size selection model

AC expandable branch model

AC conductor size selection model

The AC conductor size selection \(a\) is modeled with in admittance matrix model from [4]:

(12)\[\begin{split}\begin{align} S_{a_\text{ik}\text{-eq}} &= \sum_{ \iota \in \mathcal{CT}} \left(\xi_{a,\iota}\cdot S_{a,\iota_\text{ik}} \right) \\ S_{a_\text{ki}\text{-eq}} &=\sum_{ \iota \in \mathcal{CT}} \left( \xi_{a,\iota}\cdot S_{a,\iota_\text{ki}} \right) \end{align}\end{split}\]
(13)\[\begin{split}\begin{align} P_{flow}^{ac} += \sum P_{a_\text{ik}\text{-eq}} \\ Q_{flow}^{ac} += \sum Q_{a_\text{ik}\text{-eq}} \end{align}\end{split}\]

For the branches $a$ an additional equality constraint is introduced to keep one type of branch per connection, such that :

(14)\[\sum_{n \in\mathcal{CT}} \xi_{a, n} = 1 \qquad \forall a \in \mathcal{E}_a\]
(15)\[\begin{split}S_{from_n-eq} = \xi_{a,n} \cdot S_{from_n} \\ S_{to_n-eq} = \xi_{a,n} \cdot S_{to_n}\end{split}\]

Additionally, to limit the number of branch types in the evaluated system, inequality constraints are included such that:

(16)\[\begin{split}\begin{align} &\sum_{a\in\mathcal{E}_a} \xi_{a, n} \leq |\mathcal{E}_a| \cdot \nu_n \qquad \forall n \in \mathcal{CT} \\ &\nu_n \leq \sum_{a\in\mathcal{E}_a} \xi_{a, n} \qquad\qquad\; \forall n \in \mathcal{CT} \\ &\sum_{n\in \mathcal{CT}} \nu_n \leq \mathfrak{N} \end{align}\end{split}\]

Class Reference: pyflow_acdc.Classes.Size_selection

Inherits from Line_AC with the following additional attributes:

Attribute

Type

Description

fromNode

Node_AC

The starting node of the line

toNode

Node_AC

The ending node of the line

cable_types

list

List of possible cable types for sizing

active_config

int

Index of the currently active cable configuration

Length_km

float

Length of the line in kilometers

S_base

float

Base power in MVA

name

str

Name of the line

geometry

str

Geometry of the line

Important to note that this class only takes in the cable types and not the line parameters. The parameters for these have to be uploaded as yalm files in the Cable_database folder.

References