SIIP Tutorial

Selective flow constraints with PowerSimulations.jl

Originally Contributed by: Clayton Barrows and Sourabh Dalvi

Introduction

The Operations Problems example shows the basic building blocks of building optimization problems with PowerSimulations.jl. This example shows how to customize the enforcement of branch flow constraints as is common when trying to build large scale simulations.

Dependencies

Modeling Packages

using PowerSystems
using PowerSimulations
using PowerSystemCaseBuilder

Optimization packages

For this simple example, we can use the HiGHS solver with a relatively relaxed tolerance.

using HiGHS # mip solver
solver = optimizer_with_attributes(HiGHS.Optimizer, "mip_rel_gap" => 0.5)
MathOptInterface.OptimizerWithAttributes(HiGHS.Optimizer, Pair{MathOptInterface.AbstractOptimizerAttribute, Any}[MathOptInterface.RawOptimizerAttribute("mip_rel_gap") => 0.5])

Create a System from RTS-GMLC data

sys = build_system(PSITestSystems, "modified_RTS_GMLC_DA_sys")
System
Property Value
System Units Base SYSTEM_BASE
Base Power 100.0
Base Frequency 60.0
Num Components 500
Static Components
Type Count Has Static Time Series Has Forecasts
Arc 109 false false
Area 3 true true
Bus 73 false false
FixedAdmittance 3 true true
HydroDispatch 1 true true
Line 105 false false
LoadZone 21 false false
PowerLoad 51 true true
RenewableDispatch 29 true true
RenewableFix 31 true true
TapTransformer 15 false false
ThermalStandard 54 false false
VariableReserve{PowerSystems.ReserveDown} 1 true true
VariableReserve{PowerSystems.ReserveUp} 4 true true
Time Series Summary
Property Value
Components with time series data 123
Total StaticTimeSeries 124
Total Forecasts 124
Resolution 60 minutes
First initial time 2020-01-01T00:00:00
Last initial time 2020-12-30T00:00:00
Horizon 48
Interval 1440 minutes
Forecast window count 365

Selecting flow limited lines

Since PowerSimulations will apply constraints by component type (e.g. Line), we need to change the component type of the lines on which we want to enforce flow limits. So, let's change the device type of certain branches from Line to MonitoredLine differentiate treatment when we build the model. Here, we can select inter-regional lines, or lines above a voltage threshold.

for line in get_components(Line, sys)
    if (get_base_voltage(get_from(get_arc(line))) >= 230.0) &&
       (get_base_voltage(get_to(get_arc(line))) >= 230.0)
        # if get_area(get_from(get_arc(line))) != get_area(get_to(get_arc(line)))
        @info "Changing $(get_name(line)) to MonitoredLine"
        convert_component!(MonitoredLine, line, sys)
    end
end

Let's start with a standard unit commitment template using the PTDFPowerModel network formulation which only constructs the admittance matrix rows corresponding to "bounded" lines:

template = template_unit_commitment(network=PTDFPowerModel)
Network Model
Network Model PowerSimulations.PTDFPowerModel
Slacks false
PTDF false
Duals
Device Models ┌───────────────────────────────────┬─────────────────────────────────────────────┬────────┐ │ Device Type │ Formulation │ Slacks │ ├───────────────────────────────────┼─────────────────────────────────────────────┼────────┤ │ PowerSystems.ThermalStandard │ PowerSimulations.ThermalBasicUnitCommitment │ false │ │ PowerSystems.HydroEnergyReservoir │ PowerSimulations.HydroDispatchRunOfRiver │ false │ │ PowerSystems.RenewableDispatch │ PowerSimulations.RenewableFullDispatch │ false │ │ PowerSystems.PowerLoad │ PowerSimulations.StaticPowerLoad │ false │ │ PowerSystems.InterruptibleLoad │ PowerSimulations.InterruptiblePowerLoad │ false │ │ PowerSystems.RenewableFix │ PowerSimulations.FixedOutput │ false │ │ PowerSystems.HydroDispatch │ PowerSimulations.HydroDispatchRunOfRiver │ false │ └───────────────────────────────────┴─────────────────────────────────────────────┴────────┘
Branch Models
Branch Type Formulation Slacks
PowerSystems.Transformer2W PowerSimulations.StaticBranch false
PowerSystems.Line PowerSimulations.StaticBranch false
PowerSystems.HVDCLine PowerSimulations.HVDCDispatch false
PowerSystems.TapTransformer PowerSimulations.StaticBranch false
Service Models
Service Type Formulation Slacks Aggregated Model
PowerSystems.VariableReserve{PowerSystems.ReserveUp} PowerSimulations.RangeReserve false true
PowerSystems.VariableReserve{PowerSystems.ReserveDown} PowerSimulations.RangeReserve false true

Notice that there is no entry for MonitoredLine, so we can add one:

set_device_model!(template, MonitoredLine, StaticBranch)

We can also relax the formulation applied to the Line components to an unbounded flow formulation. This formulation still enforces Kirchoff's laws, but does not apply flow constraints.

set_device_model!(template, Line, StaticBranchUnbounded)

Build an OperationsProblem

uc_prob = DecisionModel(template, sys, horizon=24, optimizer=solver)
build!(uc_prob, output_dir=mktempdir())
PowerSimulations.BuildStatusModule.BuildStatus.BUILT = 0

Solve the relaxed problem

solve!(uc_prob)
PowerSimulations.RunStatusModule.RunStatus.SUCCESSFUL = 0
CC BY-SA 4.0 "Dheepak Krishnamurthy". Last modified: August 26, 2022. Website built with Franklin.jl and the Julia programming language.