Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jd/area balance network models #1110

Merged
merged 88 commits into from
Jun 24, 2024
Merged
Show file tree
Hide file tree
Changes from 87 commits
Commits
Show all changes
88 commits
Select commit Hold shift + click to select a range
e17b6b9
add area balance
jd-lara May 20, 2024
aba3fbf
add constructor methods
jd-lara May 20, 2024
b4e1cfa
add missing returns
jd-lara May 20, 2024
b05a9de
add add_to_expression code
jd-lara May 20, 2024
84d7c44
formatter
jd-lara May 20, 2024
c7e1383
add new compact pwl constraints
rodrigomha May 20, 2024
3025453
remove unused constraints
jd-lara May 21, 2024
05fdceb
fix docs headers
jd-lara May 21, 2024
b7433eb
add additional network model
jd-lara May 21, 2024
7b6999b
implemen area PTDF model
jd-lara May 21, 2024
9ee63aa
add new make systems expressions
jd-lara May 21, 2024
49f6ae4
implement new ptdf methods
jd-lara May 21, 2024
4c99c5e
add new tests
jd-lara May 21, 2024
50b8c06
fix typo
jd-lara May 21, 2024
f931460
fix test
jd-lara May 21, 2024
78ce840
add method to avoid ambiguity
jd-lara May 21, 2024
d2693ac
fix storage name
jd-lara May 21, 2024
6321f1d
disable test
jd-lara May 21, 2024
c256f2d
disable services tests
jd-lara May 21, 2024
8fb4482
fix resolution checker
jd-lara May 28, 2024
ad18465
Merge pull request #1109 from NREL-Sienna/rh/add_pwl_for_compact_form
jd-lara May 28, 2024
7faed2b
Merge branch 'jd/misc_fixes' of https://github.com/NREL-SIIP/PowerSim…
jd-lara May 28, 2024
562c4f7
delete stale code
jd-lara May 28, 2024
4a9b225
made validate time series a single method
jd-lara May 28, 2024
f7fdf49
fix subtype
jd-lara May 28, 2024
55da658
Merge pull request #1111 from NREL-Sienna/jd/misc_fixes
jd-lara May 29, 2024
c6d558d
fix service initialization template
jd-lara May 29, 2024
0b768b9
add Area models slacks
jd-lara Jun 3, 2024
883bf3c
use model in container init
jd-lara Jun 3, 2024
abaa0a6
use get_available_components
jd-lara Jun 3, 2024
0c83355
change arguments
jd-lara Jun 3, 2024
075188d
remove duplicate code
jd-lara Jun 4, 2024
edc888a
implement methods for AreaPTDF
jd-lara Jun 4, 2024
26c9a7c
remove unused code
jd-lara Jun 4, 2024
afa0875
change loops
jd-lara Jun 4, 2024
58ac585
add new constraints
jd-lara Jun 10, 2024
84a6795
new container
jd-lara Jun 10, 2024
88af2b2
PTDF area interchange implementation
jd-lara Jun 10, 2024
4e597ef
add time probing
jd-lara Jun 11, 2024
b71335e
fix constraints for Interchange
jd-lara Jun 11, 2024
dec4ee4
improve logging
jd-lara Jun 11, 2024
249ac4f
add new probing for branch building
jd-lara Jun 12, 2024
831514d
test using spawn
jd-lara Jun 12, 2024
71f3880
use abstract vector
jd-lara Jun 12, 2024
948626b
change print to debug
jd-lara Jun 12, 2024
d6bf777
formatter
jd-lara Jun 12, 2024
8973fa2
implement serial for benchmark
jd-lara Jun 12, 2024
8924838
add modeled branches field
jd-lara Jun 12, 2024
09b8002
add warning
jd-lara Jun 12, 2024
48649d7
fix mistake
jd-lara Jun 12, 2024
297fa88
use modeled branches in constructor
jd-lara Jun 12, 2024
724056d
enable use of spawn
jd-lara Jun 12, 2024
136f4a7
fix return
jd-lara Jun 12, 2024
3450a2b
refactor branch map
jd-lara Jun 13, 2024
3f67db8
fix branch map for interchange
jd-lara Jun 13, 2024
bcedc2f
update renewablefix and staticreserve
rodrigomha Jun 13, 2024
b065928
remove regulation device
rodrigomha Jun 13, 2024
df0756f
update docs
rodrigomha Jun 13, 2024
55e0035
improve the checker
jd-lara Jun 13, 2024
fc44e66
remove agc template export
rodrigomha Jun 13, 2024
3ff29a7
remove AGC tests
rodrigomha Jun 13, 2024
f8a63c4
fix ambiguities
jd-lara Jun 13, 2024
20dc798
move set resolution
rodrigomha Jun 13, 2024
91b127d
revert set resolution
rodrigomha Jun 13, 2024
45fd8e7
Merge branch 'jd/area_balance_network_models' into rh/psy4_renaming
rodrigomha Jun 13, 2024
7383ea1
formatter
rodrigomha Jun 13, 2024
8f26910
update get_rate to rating
rodrigomha Jun 14, 2024
f612772
update set rating
rodrigomha Jun 14, 2024
b1053b3
update rating docs
rodrigomha Jun 14, 2024
c276cb1
comment timing for PTDF build
rodrigomha Jun 14, 2024
79c4789
fix typo
rodrigomha Jun 14, 2024
08f9944
update tests
rodrigomha Jun 14, 2024
d674201
formatter
rodrigomha Jun 14, 2024
0c927e5
fix emulation tests
jd-lara Jun 14, 2024
ef1d8f2
comment AGC test
rodrigomha Jun 15, 2024
a530304
Merge pull request #1114 from NREL-Sienna/rh/psy4_renaming
jd-lara Jun 17, 2024
759357c
add meta for ORDC and comment AGC
rodrigomha Jun 17, 2024
917b9cb
add model for ORDC
rodrigomha Jun 17, 2024
86f3f06
formatter
rodrigomha Jun 17, 2024
51a4685
update ambiguity for ORDC
rodrigomha Jun 17, 2024
68af098
update test numbers after ORDC update
rodrigomha Jun 17, 2024
95a77ac
Ignore known-benign extraneous files in simulation results
GabrielKS Jun 21, 2024
f6e1966
Make minimal tweaks for backwards compatibility
GabrielKS Jun 21, 2024
accd5b3
Merge pull request #1118 from NREL-Sienna/gks/bit_of_backwards_compat…
jd-lara Jun 24, 2024
d2db0bf
Merge pull request #1117 from NREL-Sienna/gks/ignore_extraneous
jd-lara Jun 24, 2024
4cca4b8
make suggested change
rodrigomha Jun 24, 2024
57db2b5
Merge pull request #1115 from NREL-Sienna/rh/update_ordc_model
jd-lara Jun 24, 2024
28c80ac
address PR comments
jd-lara Jun 24, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions docs/src/api/PowerSimulations.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ end

# API Reference

### Table of Contents
## Table of Contents

* [Device Models](#Device-Models)
* [Formulations](#Formulations)
Expand Down Expand Up @@ -42,7 +42,7 @@ end
 
```

# Device Models
## Device Models

List of structures and methods for Device models

Expand All @@ -66,7 +66,7 @@ Refer to the [Problem Templates Page](@ref op_problem_template) for available `P

---

# Decision Models
## Decision Models

```@docs
DecisionModel
Expand All @@ -83,7 +83,7 @@ solve!(::DecisionModel)

---

# Emulation Models
## Emulation Models

```@docs
EmulationModel
Expand All @@ -100,7 +100,7 @@ run!(::EmulationModel)

---

# Service Models
## Service Models

List of structures and methods for Service models

Expand All @@ -115,7 +115,7 @@ ServiceModel

---

# Simulation Models
## Simulation Models

Refer to the [Simulations Page](@ref running_a_simulation) to explanations on how to setup a Simulation, with Sequencing and Feedforwards.

Expand Down Expand Up @@ -210,7 +210,7 @@ LowerBoundFeedForwardSlack

---

# Constraints
## Constraints

### Common Constraints

Expand All @@ -222,7 +222,6 @@ PieceWiseLinearCostConstraint
### Network Constraints

```@docs
AreaDispatchBalanceConstraint
CopperPlateBalanceConstraint
NodalBalanceActiveConstraint
NodalBalanceReactiveConstraint
Expand Down Expand Up @@ -292,7 +291,7 @@ FeedforwardLowerBoundConstraint

---

# Parameters
## Parameters

### Time Series Parameters

Expand Down
6 changes: 3 additions & 3 deletions docs/src/formulation_library/Branch.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ If Slack variables are enabled:

**Static Parameters**

- ``R^\text{max}`` = `PowerSystems.get_rate(branch)`
- ``R^\text{max}`` = `PowerSystems.get_rating(branch)`

**Objective:**

Expand Down Expand Up @@ -80,7 +80,7 @@ StaticBranchBounds

**Static Parameters**

- ``R^\text{max}`` = `PowerSystems.get_rate(branch)`
- ``R^\text{max}`` = `PowerSystems.get_rating(branch)`

**Objective:**

Expand Down Expand Up @@ -308,7 +308,7 @@ PhaseAngleControl

**Static Parameters**

- ``R^\text{max}`` = `PowerSystems.get_rate(branch)`
- ``R^\text{max}`` = `PowerSystems.get_rating(branch)`
- ``\Theta^\text{min}`` = `PowerSystems.get_phase_angle_limits(branch).min`
- ``\Theta^\text{max}`` = `PowerSystems.get_phase_angle_limits(branch).max`
- ``X`` = `PowerSystems.get_x(branch)` (series reactance)
Expand Down
27 changes: 20 additions & 7 deletions docs/src/formulation_library/Network.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ Network formulations are used to describe how the network and buses are handled
| `CopperPlatePowerModel` | Copper plate connection between all components, i.e. infinite transmission capacity |
| `AreaBalancePowerModel` | Network model approximation to represent inter-area flow with each area represented as a single node |
| `PTDFPowerModel` | Uses the PTDF factor matrix to compute the fraction of power transferred in the network across the branches |
| `AreaPTDFPowerModel` | Uses the PTDF factor matrix to compute the fraction of power transferred in the network across the branches and balances power by Area instead of system-wide |

[`PowerModels.jl`](https://github.com/lanl-ansi/PowerModels.jl) available formulations:

- Exact non-convex models: `ACPPowerModel`, `ACRPowerModel`, `ACTPowerModel`.
- Linear approximations: `DCPPowerModel`, `NFAPowerModel`.
- Quadratic approximations: `DCPLLPowerModel`, `LPACCPowerModel`
Expand All @@ -28,10 +30,11 @@ CopperPlatePowerModel
**Variables:**

If Slack variables are enabled:

- [`SystemBalanceSlackUp`](@ref):
- Bounds: [0.0, ]
- Default initial value: 0.0
- Default proportional cost: 1e6
- Default proportional cost: 1e6
- Symbol: ``p^\text{sl,up}``
- [`SystemBalanceSlackDown`](@ref):
- Bounds: [0.0, ]
Expand Down Expand Up @@ -66,20 +69,30 @@ AreaBalancePowerModel
```

**Variables:**
If Slack variables are enabled:

Slack variables are not supported for `AreaBalancePowerModel`
- [`SystemBalanceSlackUp`](@ref) by area:
- Bounds: [0.0, ]
- Default initial value: 0.0
- Default proportional cost: 1e6
- Symbol: ``p^\text{sl,up}``
- [`SystemBalanceSlackDown`](@ref) by area:
- Bounds: [0.0, ]
- Default initial value: 0.0
- Default proportional cost: 1e6
- Symbol: ``p^\text{sl,dn}``

**Objective:**

No changes to the objective function.
Adds ``p^\text{sl,up}`` and ``p^\text{sl,dn}`` terms to the respective active power balance expressions `ActivePowerBalance` per area.

**Expressions:**

Creates `ActivePowerBalance` expressions for each bus that then are used to balance active power for all buses within a single area.
Creates `ActivePowerBalance` expressions for each area that then are used to balance active power for all buses within a single area.

**Constraints:**

Adds the `AreaDispatchBalanceConstraint` to balance the active power of all components available in an area.
Adds the `CopperPlateBalanceConstraint` to balance the active power of all components available in an area.

```math
\begin{align}
Expand All @@ -98,10 +111,11 @@ PTDFPowerModel
**Variables:**

If Slack variables are enabled:

- [`SystemBalanceSlackUp`](@ref):
- Bounds: [0.0, ]
- Default initial value: 0.0
- Default proportional cost: 1e6
- Default proportional cost: 1e6
- Symbol: ``p^\text{sl,up}``
- [`SystemBalanceSlackDown`](@ref):
- Bounds: [0.0, ]
Expand All @@ -128,4 +142,3 @@ Adds the `CopperPlateBalanceConstraint` to balance the active power of all compo
```

In addition creates `NodalBalanceActiveConstraint` for HVDC buses balance, if DC components are connected to an HVDC network.

8 changes: 4 additions & 4 deletions docs/src/formulation_library/Service.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Depending on the `PowerSystems.jl` type associated to the `RangeReserve` formula

- ``\text{PF}`` = `PowerSystems.get_max_participation_factor(service)`

For a `StaticReserve` `PowerSystems` type:
For a `ConstantReserve` `PowerSystems` type:
- ``\text{Req}`` = `PowerSystems.get_requirement(service)`

**Time Series Parameters**
Expand Down Expand Up @@ -94,14 +94,14 @@ similarly if ``s_3`` is a `ReserveDown` service (e.g. Reg-Down):
A RangeReserve implements two fundamental constraints. The first is that the sum of all reserves of contributing devices must be larger than the `RangeReserve` requirement. Thus, for a service ``s``:

```math
\sum_{d\in\mathcal{D}_s} r_{d,t} + r_t^\text{sl} \ge \text{Req},\quad \forall t\in \{1,\dots, T\} \quad \text{(for a StaticReserve)} \\
\sum_{d\in\mathcal{D}_s} r_{d,t} + r_t^\text{sl} \ge \text{Req},\quad \forall t\in \{1,\dots, T\} \quad \text{(for a ConstantReserve)} \\
\sum_{d\in\mathcal{D}_s} r_{d,t} + r_t^\text{sl} \ge \text{RequirementTimeSeriesParameter}_{t},\quad \forall t\in \{1,\dots, T\} \quad \text{(for a VariableReserve)}
```

In addition, there is a restriction on how much each contributing device ``d`` can contribute to the requirement, based on the max participation factor allowed.

```math
r_{d,t} \le \text{Req} \cdot \text{PF} ,\quad \forall d\in \mathcal{D}_s, \forall t\in \{1,\dots, T\} \quad \text{(for a StaticReserve)} \\
r_{d,t} \le \text{Req} \cdot \text{PF} ,\quad \forall d\in \mathcal{D}_s, \forall t\in \{1,\dots, T\} \quad \text{(for a ConstantReserve)} \\
r_{d,t} \le \text{RequirementTimeSeriesParameter}_{t} \cdot \text{PF}\quad \forall d\in \mathcal{D}_s, \forall t\in \{1,\dots, T\}, \quad \text{(for a VariableReserve)}
```

Expand Down Expand Up @@ -176,7 +176,7 @@ A `StepwiseCostReserve` implements a single constraint, such that the sum of all

## `GroupReserve`

Service must be used with `StaticReserveGroup` `PowerSystems.jl` type. This service model is used to model an aggregation of services.
Service must be used with `ConstantReserveGroup` `PowerSystems.jl` type. This service model is used to model an aggregation of services.

```@docs
GroupReserve
Expand Down
6 changes: 3 additions & 3 deletions docs/src/modeler_guide/read_results.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ Once a `DecisionModel` is solved via `solve!(model)` or a Simulation is executed

## Read results of a Decision Problem

Once a `DecisionModel` is solved, results are accessed using `ProblemResults(model)` as follows:
Once a `DecisionModel` is solved, results are accessed using `OptimizationProblemResults(model)` as follows:

```julia
# The DecisionModel is already constructed
build!(model, output_dir = mktempdir())
solve!(model)

results = ProblemResults(model)
results = OptimizationProblemResults(model)
```

The output will showcase the available expressions, parameters and variables to read. For example it will look like:
Expand Down Expand Up @@ -40,7 +40,7 @@ PowerSimulations Problem Duals Results

PowerSimulations Problem Parameters Results
┌────────────────────────────────────────────────────────────────────────┐
ActivePowerTimeSeriesParameter__RenewableFix
ActivePowerTimeSeriesParameter__RenewableNonDispatch
│ RenewablePowerTimeSeries__HybridSystem │
│ RequirementTimeSeriesParameter__VariableReserve__ReserveUp__Spin_Up_R3 │
│ RequirementTimeSeriesParameter__VariableReserve__ReserveUp__Reg_Up │
Expand Down
2 changes: 1 addition & 1 deletion docs/src/tutorials/adding_new_problem_model.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ my_model = DecisionModel{MyCustomDecisionProblem}(
These methods can be defined optionally for your problem. By default for problems subtyped from `DecisionProblem` these checks are not executed. If the problems are subtyped from `DefaultDecisionProblem` these checks are always conducted with PowerSimulations defaults and require compliance with those defaults to pass. In any case, these can be overloaded when necessary depending on the problem requirements.

1. `validate_template`
2. `validate_time_series`
2. `validate_time_series!`
3. `reset!`
4. `solve_impl!`

Expand Down
4 changes: 2 additions & 2 deletions docs/src/tutorials/decision_problem.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,14 @@ Here we define template entries for all devices that inject or withdraw power on
network. For each device type, we can define a distinct `AbstractDeviceFormulation`. In
this case, we're defining a basic unit commitment model for thermal generators,
curtailable renewable generators, and fixed dispatch (net-load reduction) formulations
for `HydroDispatch` and `RenewableFix` devices.
for `HydroDispatch` and `RenewableNonDispatch` devices.

```@example op_problem
set_device_model!(template_uc, ThermalStandard, ThermalStandardUnitCommitment)
set_device_model!(template_uc, RenewableDispatch, RenewableFullDispatch)
set_device_model!(template_uc, PowerLoad, StaticPowerLoad)
set_device_model!(template_uc, HydroDispatch, HydroDispatchRunOfRiver)
set_device_model!(template_uc, RenewableFix, FixedOutput)
set_device_model!(template_uc, RenewableNonDispatch, FixedOutput)
```

### Service Formulations
Expand Down
2 changes: 1 addition & 1 deletion docs/src/tutorials/pcm_simulation.md
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ problem definition), we can use:
```@example pcm
read_parameter(
ed_results,
"ActivePowerTimeSeriesParameter__RenewableFix",
"ActivePowerTimeSeriesParameter__RenewableNonDispatch",
initial_time = DateTime("2020-01-01T06:00:00"),
count = 5,
)
Expand Down
11 changes: 6 additions & 5 deletions src/PowerSimulations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export NetworkModel
export PTDFPowerModel
export CopperPlatePowerModel
export AreaBalancePowerModel
export AreaPTDFPowerModel

######## Device Models ########
export DeviceModel
Expand Down Expand Up @@ -112,7 +113,6 @@ export run_parallel_simulation
## Template Exports
export template_economic_dispatch
export template_unit_commitment
export template_agc_reserve_deployment
export EconomicDispatchProblem
export UnitCommitmentProblem
export AGCReserveDeployment
Expand Down Expand Up @@ -239,10 +239,10 @@ export PowerOutput

# Constraints
export AbsoluteValueConstraint
export LineFlowBoundConstraint
export ActivePowerVariableLimitsConstraint
export ActivePowerVariableTimeSeriesLimitsConstraint
export ActiveRangeICConstraint
export AreaDispatchBalanceConstraint
export AreaParticipationAssignmentConstraint
export BalanceAuxConstraint
export CommitmentConstraint
Expand Down Expand Up @@ -553,12 +553,13 @@ include("devices_models/devices/renewable_generation.jl")
include("devices_models/devices/thermal_generation.jl")
include("devices_models/devices/electric_loads.jl")
include("devices_models/devices/AC_branches.jl")
include("devices_models/devices/area_interchange.jl")
include("devices_models/devices/TwoTerminalDC_branches.jl")
include("devices_models/devices/HVDCsystems.jl")
include("devices_models/devices/regulation_device.jl")
#include("devices_models/devices/regulation_device.jl")

# Services Models
include("services_models/agc.jl")
#include("services_models/agc.jl")
include("services_models/reserves.jl")
include("services_models/reserve_group.jl")
include("services_models/transmission_interface.jl")
Expand All @@ -582,7 +583,7 @@ include("devices_models/device_constructors/hvdcsystems_constructor.jl")
include("devices_models/device_constructors/branch_constructor.jl")
include("devices_models/device_constructors/renewablegeneration_constructor.jl")
include("devices_models/device_constructors/load_constructor.jl")
include("devices_models/device_constructors/regulationdevice_constructor.jl")
#include("devices_models/device_constructors/regulationdevice_constructor.jl")

# Network constructors
include("network_models/network_constructor.jl")
Expand Down
Loading
Loading