Power Flow
PowerSystems.jl
provides the capability to run a power flow with the intention of providing a valid initial AC operating point to the system.
The power flow tool is not meant for analytics where the principal goal is to determine if the system has settings that produce a feasible AC solution. This power flow routine does not check for reactive power limits or other limiting mechanisms in the grid, and can therefore be used to check for solver convergence - making no guarantees of the solution feasibility.
The power flow solver uses NLsolve.jl under the hood and takes any keyword argument accepted by NLsolve. The solver uses the current operating point in the buses to provide the initial guess.
Limitations: The PowerFlow solver doesn't support systems with HVDC lines or Phase Shifting transformers yet. The power flow solver can't handle systems with islands.
Check section Power Flow for detailed usage instructions
using PowerSystems
const PSY = PowerSystems
system_data = System(joinpath(DATA_DIR, "matpower/case14.m"))
System
Base Power: 100.0
Components
Num components: 73
ConcreteType | SuperTypes | Count | |
---|---|---|---|
String | String | Int64 | |
1 | Arc | Topology <: Component <: InfrastructureSystemsComponent <: InfrastructureSystemsType <: Any | 20 |
2 | Area | AggregationTopology <: Topology <: Component <: InfrastructureSystemsComponent <: InfrastructureSystemsType <: Any | 1 |
3 | Bus | Topology <: Component <: InfrastructureSystemsComponent <: InfrastructureSystemsType <: Any | 14 |
4 | FixedAdmittance | ElectricLoad <: StaticInjection <: Device <: Component <: InfrastructureSystemsComponent <: InfrastructureSystemsType <: Any | 1 |
5 | Line | ACBranch <: Branch <: Device <: Component <: InfrastructureSystemsComponent <: InfrastructureSystemsType <: Any | 17 |
6 | LoadZone | AggregationTopology <: Topology <: Component <: InfrastructureSystemsComponent <: InfrastructureSystemsType <: Any | 1 |
7 | PowerLoad | StaticLoad <: ElectricLoad <: StaticInjection <: Device <: Component <: InfrastructureSystemsComponent <: InfrastructureSystemsType <: Any | 11 |
8 | TapTransformer | ACBranch <: Branch <: Device <: Component <: InfrastructureSystemsComponent <: InfrastructureSystemsType <: Any | 3 |
9 | ThermalStandard | ThermalGen <: Generator <: StaticInjection <: Device <: Component <: InfrastructureSystemsComponent <: InfrastructureSystemsType <: Any | 5 |
TimeSeriesContainer
Components with time series data: 0
Total StaticTimeSeries: 0
Total Forecasts: 0
Resolution: 0 seconds
PowerSystems.jl
has two modes of using the power flow solver.
Solving the power flow for the current operating point in the system. Takes the data in the buses, the
active_power
andreactive_power
fields in the static injection devices. Returns a dictionary with results in a DataFrame that can be exported or manipulated as needed.Solves the power flow and updated the devices in the system to the operating condition. This model will update the values of magnitudes and angles in the system's buses. It also updates the active and reactive power flows in the branches and devices connected to PV buses. This utility is useful to initialize systems before serializing or checking the addition of new devices is still AC feasible.
Solving the power flow with mode 1:
results = solve_powerflow(system_data)
results["bus_results"]
Solving the power flow with mode 2:
Before running the power flow command these are the values of the voltages:
for b in get_components(Bus, system_data)
println("$(get_name(b)) - Magnitude $(get_magnitude(b)) - Angle (rad) $(get_angle(b))")
end
solve_powerflow!
return true or false to signal the successful result of the power flow. This enables the integration of a power flow into functions and use the return as check. For instance, initializing dynamic simulations. Also, because solve_powerflow!
uses NLsolve.jl all the parameters used for NLsolve are also available for solve_powerflow!
solve_powerflow!(system_data; finite_diff = true, method = :newton)
After running the power flow command this are the values of the voltages:
for b in get_components(Bus, system_data)
println("$(get_name(b)) - Magnitude $(get_magnitude(b)) - Angle (rad) $(get_angle(b))")
end