Radial AC power flows
SpineOpt includes single-phase equivalent AC optimal power flow (OPF) calculation. It is suitable for planning studies and simulating balanced power flow in different operational situations. The AC power flow calculation is suitable for radial networks typical in distribution networks.
Defining the problem for AC flow calculation
Power lines
In the following, it is described how to set up a connection in order to represent an overhead line or cable.
connection: A connection represents the electricity line being modelled. As usual, one has to define the relationships connection__to_node and connection__from_node : These relationships need to be introduced between the connection and each node. The connection should be unidirectional, in other words there should only be connection__from_node or connection__to_node relationship between a node and a connection. Also it is not recommended to define multiple routes for one connection object.
connection__node__node: This relationship should be defined so that the first node is the source bus and second node the destination bus. The connection_has_ac_flow should be set true for this relationship to enable AC flow and indicate positive direction. N.B. Do not manually fix an efficiency for the line (such as via a fix_ratio_out_in_connection_flow parameter).
A Π model with shunt susceptance is used for lines. The physical properties include the series reactance, represented by the parameter reactance, series resistance represented by the parameter resistance and shunt susceptance by the parameter line_shunt_susceptance. It is recommended that these parameters are given as per-unit values.
Buses
In a AC power flow model, node corresponds to a bus. To enable the AC flow calculation, one or more grid objects whose parameter physics_type is set to acflow_physics must be defined. The grid objects must be tied to nodes via node__grid relationships.
Limits on the bus voltage magnitude (stated as per-unit value) can be enforced through the max_voltage and min_voltage parameters. You cannot set limits on the voltage phase angle.
Loads
There is no specific load component. Loads are given as parameters for buses. As usual, you can define a demand value via the demand parameter. This refers to real power demand. Reactive power demand can be defined via the demand_reactive parameter. It is recommended that these parameters are given as per-unit values. However, you can also define power_base for the bus, which allows you to give demand values in absolute units and keep other parameters as per-unit values.
Generators
Generators are represented by SpineOpt units. In a AC power flow model, units can produce both active and reactive power. Units can also absorb reactive power. Reactive power capability is automatically triggered if the unit is connected via unit__to_node or node__to_unit relationship to an AC enabled bus.
It is recommended that the parameter vom_cost_reactive be set to a positive value. Otherwise the relaxed conic constraint may not become binding.
Transformers
There is no separate component for transformers. In the per-unit system you can model a transformer as a connection.
Investments
Power flow is governed by the impedance parameters given for a specific line. The model formulation does not allow adjusting the line sizing within the model. However, the model can include binary investment decisions (go/no-go). Thus investment_variable_type needs to be set to binary or integer. capacity_per_connection should be set to a value which is at least as large as the estimated power carrying capacity of the candidate line. Parameter investment_count_max_cumulative should be set to 1. See the chapter about investment optimization for the other parameters and relationships you need to set to activate investments.
Results
The variable node_voltage_squared tells the squared voltage magnitude in a bus. The variable connection_flow tells the real power flow in a power line, measured in the positive direction (from source to destination bus). Similarly, the variable connection_flow_reactive tells the reactive power flow in a power line. See Managing output about how to add outputs to the model.
Formulations
Currently, there are three formulations for the AC OPF. In decreasing order of accuracy these are:
- Second order cone programming (SOCP) relaxation of optimal power flow problem in rectangular coordinates.
- Linear approximation of the SOCP relaxation
- Linear distflow lossless formulation
The SOCP relaxation is the most accurate of these but in practise only very small models may be feasible. Solver with support for SOCP type models is needed, controlled by solver_mip. See JuMP documentation for available solvers. The Linear distflow formulation can be accurate when voltages remain close to 1 p.u. and is computationally very light. The Linear approximation of SOCP relaxation is between these.
Selection of the formulation takes place by the model-wide parameter ac_opf_model_formulation. The default is the linear approximation of the SOCP relaxation. All formulations are suitable only for radial networks, which are typically found in distribution grids. If loops are present in the network, solution will be returned but the results will not be correct.
Please note that none of the formulations track the voltage phase angle across the network and thus the results for looped networks will not be correct.
Creating an Example
If we have model that is not currently set up AC flow, we can take the following steps to create our first AC OPF model. This assumes that the basic necessities in the SpineOpt database template already exist.
- Create a grid object and set its physics_type parameter to
acflow_physics. - Create two bus (node) objects, call them A and B
- The nodes need to use the same temporal resolution. Assign them to the same temporal block via node__temporal_block relationship. For a more detailed description of how the temporal structure in SpineOpt can be created, see Temporal Framework.
- Make sure your model has a stochastic_structure and it is connected to the model object by model__default_stochastic_structure. See Stochastic Framework for details.
- Add the nodes to the grid by two node__grid relationships with nodes A and B as the nodes.
- Create a unit with unit__to_node relationship with bus A. For this relationship set
- vom_cost_reactive to 1.0
- vom_cost to 10.0
- Create a line (connection) object with the following relationships
- connection__from_node with node A
- connection__to_node with node B
- connection__node__node with node A as the first node and node B as the second node
- Set also parameter connection_has_ac_flow for this relationship to true
- Set for example the following parameters to the line itself:
- resistance to 0.1
- reactance to 0.05
- Add a load to bus B. Suppose $cos(\phi)$ = 0.8 and real power is 0.1 p.u. In other words set for node B
- demand to 0.1
- demand_reactive to 0.075
- Create a report object and connect it to your model.
- Add voltages as output via a report__output relationship with
node_voltage_squared - Run the model and observe the variable node_voltage_squared
Model reference
Parameters for AC flow calculation
| Parameter Name | Object Class List | Description |
|---|---|---|
| ac_opf_model_formulation | model | The type of model formulation used for AC flow simulation. |
| vom_cost_reactive | unit__to_node and node__to_unit | The cost of injecting or absorbing reactive power to the bus or from the bus. |
| vom_cost | unit__to_node and node__to_unit | The cost of injecting or absorbing real power to the bus or from the bus. |
| resistance | connection | The per-unit resistance of the line. |
| reactance | connection | The per-unit reactance of the line. |
| line_shunt_susceptance | connection | The per-unit shunt susceptance of the line. |
| demand | node | The real power demand (p.u. unless you have set power_base). |
| demand_reactive | node | The reactive power demand. |
| power_base | node | The base power used if calculating with absolute demand values. |