Single Phase Models
BranchFlowModel.jl provides methods to build many different variations of the Branch Flow Model, including single phase and multiphase models. Each of the model types supported are documented below.
AngleRelaxation
The AngleRelaxation single phase model is built by passing a JuMP.Model, Network{SinglePhase}, and the AngleRelaxation type to build_bfm!.
net = CommonOPF.Network_IEEE13_SinglePhase()
m = JuMP.Model()
build_bfm!(m, net, AngleRelaxation)
println("Variable information:")
CommonOPF.print_var_info(net)
println("Constraint information:")
CommonOPF.print_constraint_info(net)Variable information:
┌────────┬────────────────────────────────────────────┬───────────────────┬──────────────┐
│ symbol │ description │ units │ dimensions │
├────────┼────────────────────────────────────────────┼───────────────────┼──────────────┤
│ lij │ current magnitude squared on edge i-j │ AmpSquaredUnit │ (Edge, Time) │
├────────┼────────────────────────────────────────────┼───────────────────┼──────────────┤
│ pij │ sending end real power from bus i to j │ RealPowerUnit │ (Edge, Time) │
├────────┼────────────────────────────────────────────┼───────────────────┼──────────────┤
│ qij │ sending end reactive power from bus i to j │ ReactivePowerUnit │ (Edge, Time) │
├────────┼────────────────────────────────────────────┼───────────────────┼──────────────┤
│ vsqrd │ voltage magnitude squared │ VoltSquaredUnit │ (Bus, Time) │
└────────┴────────────────────────────────────────────┴───────────────────┴──────────────┘
Constraint information:
┌────────────────────────────────┬──────────────────────────────────────────────────────────────────────────────────┬───────────────────────────────────┬───────────────────────────┐
│ symbol │ description │ set_type │ dimensions │
├────────────────────────────────┼──────────────────────────────────────────────────────────────────────────────────┼───────────────────────────────────┼───────────────────────────┤
│ bilinear_constraints │ Bilinear constraints │ MathOptInterface.EqualTo{Float64} │ (Edge, Time) │
├────────────────────────────────┼──────────────────────────────────────────────────────────────────────────────────┼───────────────────────────────────┼───────────────────────────┤
│ kvl_constraints │ Kirchoff's Voltage Law squared (using V^2 and I^2) │ MathOptInterface.EqualTo{Float64} │ (Edge, Time) │
├────────────────────────────────┼──────────────────────────────────────────────────────────────────────────────────┼───────────────────────────────────┼───────────────────────────┤
│ power_balance_constraints │ Real and reactive power balance at each bus │ MathOptInterface.EqualTo{Float64} │ (Bus, RealReactive, Time) │
├────────────────────────────────┼──────────────────────────────────────────────────────────────────────────────────┼───────────────────────────────────┼───────────────────────────┤
│ substation_voltage_constraints │ Set m[:vsqrd][net.substation_bus][t] == net.v0[t]^2 for all t = 1:net.Ntimesteps │ MathOptInterface.EqualTo{Float64} │ (Time, ) │
└────────────────────────────────┴──────────────────────────────────────────────────────────────────────────────────┴───────────────────────────────────┴───────────────────────────┘The `build_bfm! method uses:
BranchFlowModel.add_linear_variablesBranchFlowModel.add_vsqrd_variablesBranchFlowModel.add_isqrd_variablesBranchFlowModel.constrain_power_balance_with_isqrd_lossesBranchFlowModel.constrain_KVLBranchFlowModel.constrain_bilinear
The math underlying the model is as follows [Farivar and Low]:
\[\begin{aligned} &\sum_{i : i \rightarrow j} ( p_{ij} - r_{ij} \ell_{ij} ) + p_j = \sum_{k : j \rightarrow k} p_{jk} \quad \forall j \in \mathcal{N} \\ &\sum_{i : i \rightarrow j} ( q_{ij} - x_{ij} \ell_{ij} ) + q_j = \sum_{k : j \rightarrow k} q_{jk} \quad \forall j \in \mathcal{N} \\ &w_{j} = w_{i} - 2 (p_{ij} r_{ij} + q_{ij} x_{ij}) + (r_{ij}^2 + x_{ij}^2) \ell_{ij} \quad \forall (i, j) \in \mathcal{E} \\ & \ell_{ij} w_i = p_{ij}^2 + q_{ij}^2 \quad \forall (i, j) \in \mathcal{E} \end{aligned}\]
SOC models
The SOC (second order cone) single phase model is built by passing a JuMP.Model, Network{SinglePhase}, and the SOC type to build_bfm!.
net = CommonOPF.Network_IEEE13_SinglePhase()
m = JuMP.Model()
build_bfm!(m, net, SOC)
println("Variable information:")
CommonOPF.print_var_info(net)
println("Constraint information:")
CommonOPF.print_constraint_info(net)Variable information:
┌────────┬────────────────────────────────────────────┬───────────────────┬──────────────┐
│ symbol │ description │ units │ dimensions │
├────────┼────────────────────────────────────────────┼───────────────────┼──────────────┤
│ lij │ current magnitude squared on edge i-j │ AmpSquaredUnit │ (Edge, Time) │
├────────┼────────────────────────────────────────────┼───────────────────┼──────────────┤
│ pij │ sending end real power from bus i to j │ RealPowerUnit │ (Edge, Time) │
├────────┼────────────────────────────────────────────┼───────────────────┼──────────────┤
│ qij │ sending end reactive power from bus i to j │ ReactivePowerUnit │ (Edge, Time) │
├────────┼────────────────────────────────────────────┼───────────────────┼──────────────┤
│ vsqrd │ voltage magnitude squared │ VoltSquaredUnit │ (Bus, Time) │
└────────┴────────────────────────────────────────────┴───────────────────┴──────────────┘
Constraint information:
┌────────────────────────────────┬──────────────────────────────────────────────────────────────────────────────────┬─────────────────────────────────────────┬───────────────────────────┐
│ symbol │ description │ set_type │ dimensions │
├────────────────────────────────┼──────────────────────────────────────────────────────────────────────────────────┼─────────────────────────────────────────┼───────────────────────────┤
│ kvl_constraints │ Kirchoff's Voltage Law squared (using V^2 and I^2) │ MathOptInterface.EqualTo{Float64} │ (Edge, Time) │
├────────────────────────────────┼──────────────────────────────────────────────────────────────────────────────────┼─────────────────────────────────────────┼───────────────────────────┤
│ power_balance_constraints │ Real and reactive power balance at each bus │ MathOptInterface.EqualTo{Float64} │ (Bus, RealReactive, Time) │
├────────────────────────────────┼──────────────────────────────────────────────────────────────────────────────────┼─────────────────────────────────────────┼───────────────────────────┤
│ soc_constraints │ Second order cone constraints │ MathOptInterface.RotatedSecondOrderCone │ (Edge, Time) │
├────────────────────────────────┼──────────────────────────────────────────────────────────────────────────────────┼─────────────────────────────────────────┼───────────────────────────┤
│ substation_voltage_constraints │ Set m[:vsqrd][net.substation_bus][t] == net.v0[t]^2 for all t = 1:net.Ntimesteps │ MathOptInterface.EqualTo{Float64} │ (Time, ) │
└────────────────────────────────┴──────────────────────────────────────────────────────────────────────────────────┴─────────────────────────────────────────┴───────────────────────────┘The `build_bfm! method uses:
BranchFlowModel.add_linear_variables(m, net)BranchFlowModel.add_vsqrd_variables(m, net)BranchFlowModel.add_isqrd_variables(m, net)BranchFlowModel.constrain_power_balance_with_isqrd_losses(m, net)BranchFlowModel.constrain_substation_voltage(m, net)BranchFlowModel.constrain_KVL(m, net)BranchFlowModel.constrain_cone(m, net)
The math underlying the model is as follows [Farivar and Low]:
\[\begin{aligned} &\sum_{i : i \rightarrow j} ( p_{ij} - r_{ij} \ell_{ij} ) + p_j = \sum_{k : j \rightarrow k} p_{jk} \quad \forall j \in \mathcal{N} \\ &\sum_{i : i \rightarrow j} ( q_{ij} - x_{ij} \ell_{ij} ) + q_j = \sum_{k : j \rightarrow k} q_{jk} \quad \forall j \in \mathcal{N} \\ &w_{j} = w_{i} - 2 (p_{ij} r_{ij} + q_{ij} x_{ij}) + (r_{ij}^2 + x_{ij}^2) \ell_{ij} \quad \forall (i, j) \in \mathcal{E} \\ & \ell_{ij} \geq \frac{p_{ij}^2 + q_{ij}^2}{w_i} \quad \forall (i, j) \in \mathcal{E} \end{aligned}\]
Linear models
The single phase "LinDistFlow" model from [Baran and Wu]. The Linear single phase model is built by passing a JuMP.Model, Network{SinglePhase}, and the Linear type to build_bfm!.
net = CommonOPF.Network_IEEE13_SinglePhase()
m = JuMP.Model()
build_bfm!(m, net, Linear)
println("Variable information:")
CommonOPF.print_var_info(net)
println("Constraint information:")
CommonOPF.print_constraint_info(net)Variable information:
┌────────┬────────────────────────────────────────────┬───────────────────┬──────────────┐
│ symbol │ description │ units │ dimensions │
├────────┼────────────────────────────────────────────┼───────────────────┼──────────────┤
│ pij │ sending end real power from bus i to j │ RealPowerUnit │ (Edge, Time) │
├────────┼────────────────────────────────────────────┼───────────────────┼──────────────┤
│ qij │ sending end reactive power from bus i to j │ ReactivePowerUnit │ (Edge, Time) │
├────────┼────────────────────────────────────────────┼───────────────────┼──────────────┤
│ vsqrd │ voltage magnitude squared │ VoltSquaredUnit │ (Bus, Time) │
└────────┴────────────────────────────────────────────┴───────────────────┴──────────────┘
Constraint information:
┌────────────────────────────────┬──────────────────────────────────────────────────────────────────────────────────┬───────────────────────────────────┬───────────────────────────┐
│ symbol │ description │ set_type │ dimensions │
├────────────────────────────────┼──────────────────────────────────────────────────────────────────────────────────┼───────────────────────────────────┼───────────────────────────┤
│ kvl_constraints │ Kirchoff's Voltage Law squared w/o I^2 term │ MathOptInterface.EqualTo{Float64} │ (Edge, Time) │
├────────────────────────────────┼──────────────────────────────────────────────────────────────────────────────────┼───────────────────────────────────┼───────────────────────────┤
│ power_balance_constraints │ Real and reactive power balance at each bus │ MathOptInterface.EqualTo{Float64} │ (Bus, RealReactive, Time) │
├────────────────────────────────┼──────────────────────────────────────────────────────────────────────────────────┼───────────────────────────────────┼───────────────────────────┤
│ substation_voltage_constraints │ Set m[:vsqrd][net.substation_bus][t] == net.v0[t]^2 for all t = 1:net.Ntimesteps │ MathOptInterface.EqualTo{Float64} │ (Time, ) │
└────────────────────────────────┴──────────────────────────────────────────────────────────────────────────────────┴───────────────────────────────────┴───────────────────────────┘The math underlying the model is as follows:
Notation:
- $P_{ij}$ real power flow from node $i$ to node $j$
- $p_j$ real power injection on node $j$
- $\mathcal{N}^+$ set of all nodes in network except the source
- $w_j$ voltage magnitude squared on node $j$
\[\begin{aligned} P_{ij} + p_j = \sum_{k:j\rightarrow k} P_{jk} \ \forall j \in \mathcal{N}^+ \\ Q_{ij} + q_j = \sum_{k:j\rightarrow k} Q_{jk} \ \forall j \in \mathcal{N}^+ \\ w_j = w_i - 2 r_{ij} P_{ij} - 2 x_{ij} Q_{ij} \ \forall j \in \mathcal{N}^+ \\ (v_{j,\min})^2 \le w_j \le (v_{j,\max})^2 \ \forall j \in \mathcal{N}^+ \end{aligned}\]
References
[Baran and Wu]
Baran, Mesut E., and Felix F. Wu. "Optimal capacitor placement on radial distribution systems." IEEE Transactions on power Delivery 4.1 (1989): 725-734. Chicago
[Farivar and Low]
Farivar, Masoud, and Steven H. Low. "Branch flow model: Relaxations and convexification—Part I." IEEE Transactions on Power Systems 28.3 (2013): 2554-2564.