DC Power Flow
DC power flow provides an approximate solution relative to AC power flow. Using the same power system model as in the AC power flow example, shown in Figure 1, we perform several DC power flow simulations. The scenarios represent quasi-steady-state operation with parameter and topology changes.
Figure 1: The 4-bus power system.
Users can download a Julia script containing the scenarios from this section using the following link.
We begin by defining the unit system. For DC power flow, only active power and voltage angle units are needed:
@power(MW, pu)
@voltage(pu, deg)Next, we define the bus parameters for DC power flow analysis, including the slack bus (type = 3), connected active power loads, and shunt conductance values. The slack bus voltage angle is fixed to the specified value. With these definitions, we can build the power system model:
system = powerSystem()
addBus!(system; label = "Bus 1", type = 3, angle = 0.0)
addBus!(system; label = "Bus 2", active = 20.2)
addBus!(system; label = "Bus 3", conductance = 0.1)
addBus!(system; label = "Bus 4", active = 50.8)Next, we define branch reactance values. For phase-shifting transformers, we use the shiftAngle keyword:
@branch(reactance = 0.22)
addBranch!(system; label = "Branch 1", from = "Bus 1", to = "Bus 3")
addBranch!(system; label = "Branch 2", from = "Bus 1", to = "Bus 2")
addBranch!(system; label = "Branch 3", from = "Bus 2", to = "Bus 3")
addBranch!(system; label = "Branch 4", from = "Bus 3", to = "Bus 4", shiftAngle = -2.3)Finally, we define the active power outputs of the generators:
addGenerator!(system; label = "Generator 1", bus = "Bus 1", active = 60.1)
addGenerator!(system; label = "Generator 2", bus = "Bus 2", active = 18.2)Once the power system data are defined, we generate a DC model with the vectors and matrices required for analysis, including the nodal admittance matrix. This model is automatically updated when the data changes and can be reused across analyses:
dcModel!(system)Display Data Settings
Before running simulations, we set verbose to basic output (1):
@config(verbose = 1)Base Case Analysis
At the start, we create a DC power flow model and compute bus voltage angles and active powers:
analysis = dcPowerFlow(system)
powerFlow!(analysis; power = true)EXIT: The solution of the DC power flow was found.Once the DC power flow is solved, we can inspect the bus results:
printBusData(analysis)|---------------------------------------------------------------------|
| Bus Data |
|---------------------------------------------------------------------|
| Label | Voltage | Power Generation | Power Demand | Power Injection |
| | | | | |
| Bus | Angle | Active | Active | Active |
| | [deg] | [MW] | [MW] | [MW] |
|-------|---------|------------------|--------------|-----------------|
| Bus 1 | 0.0000 | 52.9000 | 0.0000 | 52.9000 |
| Bus 2 | -2.3067 | 18.2000 | 20.2000 | -2.0000 |
| Bus 3 | -4.3614 | 0.0000 | 0.0000 | 0.0000 |
| Bus 4 | -8.4647 | 0.0000 | 50.8000 | -50.8000 |
|---------------------------------------------------------------------|Similarly, we can inspect the branch results:
printBranchData(analysis)|-----------------------------------------------------------------------|
| Branch Data |
|-----------------------------------------------------------------------|
| Label | From-Bus Power | To-Bus Power | Status |
| | | | |
| Branch | From-Bus | To-Bus | Active | Active | |
| | | | [MW] | [MW] | |
|----------|----------|--------|----------------|--------------|--------|
| Branch 1 | Bus 1 | Bus 3 | 34.6000 | -34.6000 | 1 |
| Branch 2 | Bus 1 | Bus 2 | 18.3000 | -18.3000 | 1 |
| Branch 3 | Bus 2 | Bus 3 | 16.3000 | -16.3000 | 1 |
| Branch 4 | Bus 3 | Bus 4 | 50.8000 | -50.8000 | 1 |
|-----------------------------------------------------------------------|The resulting active power flows are shown in Figure 2.
Figure 2: Active power flows in the 4-bus power system for the base case scenario.
Because the DC power flow model neglects losses, the active power at the from-bus and to-bus ends of each branch is the same.
Modifying Supplies and Demands
We now modify the active power outputs of the generators and the active power demands. Rather than creating a new model, we update the power system and DC power flow models simultaneously:
updateBus!(analysis; label = "Bus 2", active = 25.5)
updateBus!(analysis; label = "Bus 4", active = 42.0)
updateGenerator!(analysis; label = "Generator 1", active = 58.0)
updateGenerator!(analysis; label = "Generator 2", active = 23.0)Next, we run the DC power flow again without recreating the DC power flow model:
powerFlow!(analysis; power = true)EXIT: The solution of the DC power flow was found.Since these changes do not affect the nodal admittance matrix, JuliaGrid reuses its factorization from the base case and reduces the computational cost.
Finally, we display the updated branch data:
printBranchData(analysis)|-----------------------------------------------------------------------|
| Branch Data |
|-----------------------------------------------------------------------|
| Label | From-Bus Power | To-Bus Power | Status |
| | | | |
| Branch | From-Bus | To-Bus | Active | Active | |
| | | | [MW] | [MW] | |
|----------|----------|--------|----------------|--------------|--------|
| Branch 1 | Bus 1 | Bus 3 | 28.9000 | -28.9000 | 1 |
| Branch 2 | Bus 1 | Bus 2 | 15.7000 | -15.7000 | 1 |
| Branch 3 | Bus 2 | Bus 3 | 13.2000 | -13.2000 | 1 |
| Branch 4 | Bus 3 | Bus 4 | 42.0000 | -42.0000 | 1 |
|-----------------------------------------------------------------------|Compared with the base case, the active power flow directions remain unchanged, but their magnitudes differ, as shown in Figure 3.
Figure 3: Active power flows in the 4-bus power system with modified supplies and demands.
Modifying Network Topology
Next, we take Branch 3 out-of-service while updating both the power system and DC power flow models:
updateBranch!(analysis; label = "Branch 3", status = 0)We then solve the DC power flow for the outage scenario:
powerFlow!(analysis; power = true)EXIT: The solution of the DC power flow was found.To inspect how active power flows redistribute after the outage, we print the branch data:
printBranchData(analysis)|-----------------------------------------------------------------------|
| Branch Data |
|-----------------------------------------------------------------------|
| Label | From-Bus Power | To-Bus Power | Status |
| | | | |
| Branch | From-Bus | To-Bus | Active | Active | |
| | | | [MW] | [MW] | |
|----------|----------|--------|----------------|--------------|--------|
| Branch 1 | Bus 1 | Bus 3 | 42.1000 | -42.1000 | 1 |
| Branch 2 | Bus 1 | Bus 2 | 2.5000 | -2.5000 | 1 |
| Branch 3 | Bus 2 | Bus 3 | 0.0000 | -0.0000 | 0 |
| Branch 4 | Bus 3 | Bus 4 | 42.0000 | -42.0000 | 1 |
|-----------------------------------------------------------------------|Figure 4 shows the active power flows after the Branch 3 outage.
Figure 4: Active power flows in the 4-bus power system with modified network topology.