Optimal Power Flow

For further information on this topic, please see the AC Optimal Power Flow or DC Optimal Power Flow sections of the Manual. Below, we have provided a list of functions that can be utilized for optimal power flow analysis.


AC Optimal Power Flow
DC Optimal Power Flow

To load optimal power flow API functionalities into the current scope, one can employ the following command:

using JuliaGrid, Ipopt, HiGHS

AC Optimal Power Flow

JuliaGrid.acOptimalPowerFlowFunction
acOptimalPowerFlow(system::PowerSystem, optimizer; bridge, name)

The function sets up the optimization model for solving the AC optimal power flow problem.

Arguments

The function requires the PowerSystem composite type to establish the framework. Next, the optimizer argument is also required to create and solve the optimization problem. Specifically, JuliaGrid constructs the AC optimal power flow using the JuMP package and provides support for commonly employed solvers. For more detailed information, please consult the JuMP documenatation.

Updates

If the AC model has not been created, the function automatically initiates an update within the ac field of the PowerSystem type.

Keywords

JuliaGrid offers the ability to manipulate the jump model based on the guidelines providedin the JuMP documentation. However, certain configurations may require different method calls, such as:

  • bridge: used to manage the bridging mechanism;
  • name: used to manage the creation of string names.

By default, these keyword settings are configured as true.

Returns

The function returns an instance of the ACOptimalPowerFlow type, which includes the following fields:

  • voltage: the bus voltage magnitudes and angles;
  • power: the variable allocated to store the active and reactive powers;
  • current: the variable allocated to store the currents;
  • method: the JuMP model, references to the variables, constraints, and objective.

Examples

system = powerSystem("case14.h5")
acModel!(system)

analysis = acOptimalPowerFlow(system, Ipopt.Optimizer)
source
JuliaGrid.solve!Method
solve!(system::PowerSystem, analysis::ACOptimalPowerFlow)

The function solves the AC optimal power flow model, computing the active and reactive power outputs of the generators, as well as the bus voltage magnitudes and angles.

Updates

The calculated active and reactive powers, as well as voltage magnitudes and angles, are stored in the voltage and power.generator fields of the ACOptimalPowerFlow type.

Example

system = powerSystem("case14.h5")
acModel!(system)

analysis = acOptimalPowerFlow(system, Ipopt.Optimizer)
solve!(system, analysis)
source
JuliaGrid.startingPrimal!Method
startingPrimal!(system::PowerSystem, analysis::ACOptimalPowerFlow)

The function retrieves the active and reactive power outputs of the generators, as well as the voltage magnitudes and angles from the PowerSystem composite type. It then assigns these values to the ACOptimalPowerFlow type, allowing users to initialize starting primal values as needed.

Updates

This function only updates the voltage and generator fields of the ACOptimalPowerFlow type.

Example

system = powerSystem("case14.h5")
acModel!(system)

analysis = acOptimalPowerFlow(system, Ipopt.Optimizer)
solve!(system, analysis)

updateBus!(system, analysis; label = 14, reactive = 0.13, magnitude = 1.2, angle = -0.17)

startingPrimal!(system, analysis)
solve!(system, analysis)
source

DC Optimal Power Flow

JuliaGrid.dcOptimalPowerFlowFunction
dcOptimalPowerFlow(system::PowerSystem, optimizer; bridge, name)

The function sets up the optimization model for solving the DC optimal power flow problem.

Arguments

The function requires the PowerSystem composite type to establish the framework. Next, the optimizer argument is also required to create and solve the optimization problem. Specifically, JuliaGrid constructs the AC optimal power flow using the JuMP package and provides support for commonly employed solvers. For more detailed information, please consult the JuMP documenatation.

Updates

If the DC model has not been created, the function automatically initiates an update within the dc field of the PowerSystem type.

Keywords

JuliaGrid offers the ability to manipulate the jump model based on the guidelines providedin the JuMP documentation. However, certain configurations may require different method calls, such as:

  • bridge: used to manage the bridging mechanism;
  • name: used to manage the creation of string names.

By default, these keyword settings are configured as true.

Returns

The function returns an instance of the DCOptimalPowerFlow type, which includes the following fields:

  • voltage: the variable allocated to store the bus voltage angle;
  • power: the variable allocated to store the active powers;
  • method: the JuMP model, references to the variables, constraints, and objective.

Examples

system = powerSystem("case14.h5")
dcModel!(system)

analysis = dcOptimalPowerFlow(system, HiGHS.Optimizer)
source
JuliaGrid.solve!Method
solve!(system::PowerSystem, analysis::DCOptimalPowerFlow)

The function solves the DC optimal power flow model, computing the active power outputs of the generators, as well as the bus voltage angles.

Updates

The calculated active powers, as well as voltage angles, are stored in the voltage and power.generator fields of the DCOptimalPowerFlow type.

Example

system = powerSystem("case14.h5")
dcModel!(system)

analysis = dcOptimalPowerFlow(system, HiGHS.Optimizer)
solve!(system, analysis)
source
JuliaGrid.startingPrimal!Method
startingPrimal!(system::PowerSystem, analysis::DCOptimalPowerFlow)

The function retrieves the active power outputs of the generators and the bus voltage angles from the PowerSystem composite type. These values are then assigned to the DCOptimalPowerFlow type, enabling users to initialize starting primal values according to their requirements.

Updates

This function only updates the voltage and generator fields of the DCOptimalPowerFlow type.

Example

system = powerSystem("case14.h5")
dcModel!(system)

analysis = dcOptimalPowerFlow(system, Ipopt.Optimizer)
solve!(system, analysis)

updateBus!(system, analysis; label = 14, active = 0.1, angle = -0.17)

startingPrimal!(system, analysis)
solve!(system, analysis)
source