DC Power Flow
DC power flow provides an approximate solution compared to AC power flow. We use the same power system model as in the AC power flow analysis, shown in Figure 1, to perform several DC power flow simulations. These simulations represent quasi-steady-state conditions where the system undergoes 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 relevant:
@power(MW, pu)
@voltage(pu, deg)
Next, we define the bus parameters for DC power flow analysis. This includes specifying the slack bus as type = 3
, the connected active
power loads, and shunt elements with conductance
values. The voltage angle
at the slack bus 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 the transmission line parameters by specifying reactance
values. For phase-shifting transformers, we include the shift angle using 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 is defined, we generate a DC model that includes key vectors and matrices for analysis, such as the nodal admittance matrix. This model is automatically updated when data changes and can be shared across different analyses:
dcModel!(system)
Base Case Analysis
At the start, we create a DC power flow model, then compute bus voltage angles and active powers:
analysis = dcPowerFlow(system)
solve!(system, analysis)
power!(system, analysis)
Once the DC power flow is solved, we can analyze the bus-related results:
printBusData(system, 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, the results for the branches are:
printBranchData(system, 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 |
|-----------------------------------------------------------------------|
Thus, using bus and branch data, we obtained the active power flows, as illustrated in Figure 2.
Figure 2: Active power flows in the 4-bus power system for the base case scenario.
Note that the active power at the from-bus and to-bus ends of a branch is the same because the DC power flow model neglects losses.
Modifying Supplies and Demands
We will adjust the active power outputs of generators and the active power demands of consumers. Instead of creating a new power system model or simply updating the existing one, we update both the power system and DC power flow models simultaneously:
updateBus!(system, analysis; label = "Bus 2", active = 25.5)
updateBus!(system, analysis; label = "Bus 4", active = 42.0)
updateGenerator!(system, analysis; label = "Generator 1", active = 58.0)
updateGenerator!(system, analysis; label = "Generator 2", active = 23.0)
Next, we solve the DC power flow again to compute the new state of the power system without recreating the DC power flow model:
solve!(system, analysis)
power!(system, analysis)
Since no modifications were made that affect the nodal admittance matrix, JuliaGrid reuses its factorization from the base case analysis, significantly reducing computational complexity.
Finally, we display the updated branch data:
printBranchData(system, 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 to the base case, the directions of power flows remain unchanged, but the amounts of active power 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
Now, we take Branch 3
out-of-service while updating both the power system and DC power flow models:
updateBranch!(system, analysis; label = "Branch 3", status = 0)
We then solve the DC power flow for this scenario:
solve!(system, analysis)
power!(system, analysis)
To analyze how active power flows redistribute when a branch is out of service, we use:
printBranchData(system, 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 |
|-----------------------------------------------------------------------|
Finally, Figure 4 illustrates the active power flows in the case of a Branch 3
outage.
Figure 4: Active power flows in the 4-bus power system with modified network topology.