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

change implementation of parameters #899

Merged
merged 86 commits into from
Dec 22, 2022
Merged
Show file tree
Hide file tree
Changes from 83 commits
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
8513182
change dependencies
jd-lara Jul 10, 2022
508e4a7
update utils code
jd-lara Jul 10, 2022
84eb081
remove old containers
jd-lara Jul 10, 2022
b0d6aed
first pass at substitutions
jd-lara Jul 10, 2022
7c32f6f
update tests
jd-lara Jul 10, 2022
2c6a87d
run formatter
jd-lara Jul 10, 2022
6217da1
remove more references
jd-lara Jul 10, 2022
06a537a
update dependencies
jd-lara Jul 10, 2022
a7f17d0
add POI
jd-lara Jul 11, 2022
80d75ac
fix printing bug
jd-lara Jul 11, 2022
5ae741c
change implementation of prepare
jd-lara Jul 11, 2022
73dac80
remove PJ
jd-lara Jul 11, 2022
3502028
update model build flow
jd-lara Jul 13, 2022
a4d5845
update ic update
jd-lara Jul 13, 2022
d3b41d4
change parameter update
jd-lara Jul 13, 2022
973ae4b
other minor changes
jd-lara Jul 13, 2022
f33dc6c
fix typo
jd-lara Jul 13, 2022
ec8178c
fix formatting
jd-lara Jul 13, 2022
2e44503
remove option
jd-lara Jul 26, 2022
e9a48fe
comment out the variable warm start
jd-lara Jul 26, 2022
b8d1cca
add peformance check test
jd-lara Jul 26, 2022
823a3c9
update performance check
jd-lara Jul 26, 2022
09fe25f
change comment
jd-lara Jul 26, 2022
b7ce82c
add rethrow to check error
jd-lara Jul 26, 2022
d5be050
fix solver def
jd-lara Jul 26, 2022
77abd8a
add Dates deps
jd-lara Jul 26, 2022
a62adfb
add 4 threads to performance testing
jd-lara Jul 27, 2022
422d171
change dependencies
jd-lara Jul 10, 2022
9aedc1b
update utils code
jd-lara Jul 10, 2022
3571a7e
remove old containers
jd-lara Jul 10, 2022
a585368
first pass at substitutions
jd-lara Jul 10, 2022
8fc9934
update tests
jd-lara Jul 10, 2022
7462573
run formatter
jd-lara Jul 10, 2022
6002351
remove more references
jd-lara Jul 10, 2022
1483fe8
update dependencies
jd-lara Jul 10, 2022
73b2a0d
add POI
jd-lara Jul 11, 2022
32d26bc
fix printing bug
jd-lara Jul 11, 2022
4593d2a
change implementation of prepare
jd-lara Jul 11, 2022
7342f9e
remove PJ
jd-lara Jul 11, 2022
cb4ba6d
update model build flow
jd-lara Jul 13, 2022
a88a0f2
update ic update
jd-lara Jul 13, 2022
1cfebf8
change parameter update
jd-lara Jul 13, 2022
5f1db24
other minor changes
jd-lara Jul 13, 2022
723c628
fix typo
jd-lara Jul 13, 2022
44056af
fix formatting
jd-lara Jul 13, 2022
9c6aab6
remove option
jd-lara Jul 26, 2022
69c2679
comment out the variable warm start
jd-lara Jul 26, 2022
7e3c58a
add peformance check test
jd-lara Jul 26, 2022
239029f
update performance check
jd-lara Jul 26, 2022
cd21330
change comment
jd-lara Jul 26, 2022
93ae2a7
add rethrow to check error
jd-lara Jul 26, 2022
9d40ef3
fix solver def
jd-lara Jul 26, 2022
594ce52
add Dates deps
jd-lara Jul 26, 2022
2311b35
add 4 threads to performance testing
jd-lara Jul 27, 2022
fb081ea
Merge branch 'jd/use_poi_v2' of https://github.com/NREL-SIIP/PowerSim…
jd-lara Aug 29, 2022
1b0d2a2
fix typos
jd-lara Aug 29, 2022
ac90070
enable back warm starts and checks
jd-lara Aug 29, 2022
1489c17
Merge pull request #869 from NREL-SIIP/jd/use_poi_v2
jd-lara Aug 31, 2022
8345963
WIP: test using fixed variales instead of ParameterJuMP
odow Dec 6, 2022
4e3f291
Update
odow Dec 6, 2022
518d689
Merge branch 'jd/use_poi_v3' into od/var-fix
jd-lara Dec 7, 2022
5c7b48c
Merge pull request #889 from odow/od/var-fix
jd-lara Dec 7, 2022
5137777
wip remove POI
jd-lara Dec 15, 2022
c4083d7
fix optimizer instantiation
jd-lara Dec 16, 2022
7192df0
remove unused code
jd-lara Dec 16, 2022
aec8ce7
update constructors
jd-lara Dec 16, 2022
94bc9da
update README
jd-lara Dec 16, 2022
2bb7d04
address issues with sparse containers
jd-lara Dec 20, 2022
ee269a1
fix hacks
jd-lara Dec 20, 2022
1e2a9bd
update tests
jd-lara Dec 20, 2022
423c3c0
more test fixes
jd-lara Dec 20, 2022
8de4760
more fixes for hybrid systems
jd-lara Dec 20, 2022
7556e3d
remove hybrid systems from tests
jd-lara Dec 20, 2022
798cc38
more fixes for sparse arrays
jd-lara Dec 20, 2022
af8aaf0
more fixes for sparse arrays
jd-lara Dec 20, 2022
61f2980
update test code
jd-lara Dec 20, 2022
eefabcb
fixes for initial conditions
jd-lara Dec 20, 2022
c76b38e
fix log test
jd-lara Dec 21, 2022
2d2dfa9
fix logging issue
jd-lara Dec 21, 2022
d5b79aa
remove last references to PJ
jd-lara Dec 21, 2022
142e8a5
remove PSY deprecated use
jd-lara Dec 21, 2022
992757b
run formatter
jd-lara Dec 21, 2022
deb0ea0
fix deprecations
jd-lara Dec 21, 2022
6f7fd44
run formatter
jd-lara Dec 21, 2022
915efe9
send files to temp dir
jd-lara Dec 21, 2022
9adbfed
run formatter
jd-lara Dec 21, 2022
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
72 changes: 72 additions & 0 deletions .github/workflows/performance_comparison.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: 'Performance Comparison'

on:
pull_request:

jobs:
comparison:
runs-on: ubuntu-latest
steps:
- uses: julia-actions/setup-julia@latest
- uses: actions/checkout@v1
- name: Run Perfomance Test Master
run: |
julia --project=test -e 'using Pkg; Pkg.add(PackageSpec(name="PowerSimulationsDynamics", rev="master")); Pkg.instantiate()'
julia -t 4 --project=test test/performance/performance_test.jl "Master"
- name: Run Perfomance Test Branch
run: |
julia --project=test -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()'
julia -t 4 --project=test test/performance/performance_test.jl "This Branch"
- name: Read precompile results
id: precompile_results
run: |
body="$(cat precompile_time.txt)"
body="${body//'%'/'%25'}"
body="${body//$'\n'/'%0A'}"
body="${body//$'\r'/'%0D'}"
echo "::set-output name=body::$body"
- name: Read build results
id: build_results
run: |
body="$(cat build_time.txt)"
body="${body//'%'/'%25'}"
body="${body//$'\n'/'%0A'}"
body="${body//$'\r'/'%0D'}"
echo "::set-output name=body::$body"
- name: Find Comment
uses: peter-evans/find-comment@v1
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: Performance Results
- name: Create comment
if: steps.fc.outputs.comment-id == ''
uses: peter-evans/create-or-update-comment@v1
with:
issue-number: ${{ github.event.pull_request.number }}
body: |
Performance Results
| Version | Precompile Time |
| :--- | :----: |
${{ steps.precompile_results.outputs.body }}

| Version | Build Time |
| :--- | :----: |
${{ steps.build_results.outputs.body }}
- name: Update comment
if: steps.fc.outputs.comment-id != ''
uses: peter-evans/create-or-update-comment@v1
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
body: |
Performance Results
| Version | Precompile Time |
| :--- | :----: |
${{ steps.precompile_results.outputs.body }}

| Version | Build Time |
| :--- | :----: |
${{ steps.build_results.outputs.body }}

edit-mode: replace
2 changes: 0 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ JuMP = "4076af6c-e467-56ae-b986-b466b2749572"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Logging = "56ddb016-857b-54e1-b83d-db4d58db5568"
MathOptInterface = "b8f27783-ece8-5eb3-8dc8-9495eed66fee"
ParameterJuMP = "774612a8-9878-5177-865a-ca53ae2495f9"
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
PowerModels = "c36e90e8-916a-50a6-bd94-075b64ef4655"
PowerSystems = "bcd98974-b02a-5e2f-9ee0-a103f5c450dd"
Expand All @@ -41,7 +40,6 @@ JSON = "0.21"
JSON3 = "1"
JuMP = "1"
MathOptInterface = "1"
ParameterJuMP = "~v0.4"
PowerModels = "~0.19"
PowerSystems = "^1.24"
PrettyTables = "^1.3, 2"
Expand Down
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,25 @@ The flexible modeling framework is enabled through a modular set of capabilities

For example, an annual production cost modeling simulation can be created by formulating a unit commitment model against system data to assemble a set of 365 daily time-coupled scheduling problems.

### _Simulations_ enabled by PowerSimulations
## Simulations enabled by PowerSimulations

- Integrated Resource Planning
- Production Cost Modeling

### _Model_ formulations contained in PowerSimulations
## Opertation model formulations contained in PowerSimulations

- [Unit Commitment](https://en.wikipedia.org/wiki/Unit_commitment_problem_in_electrical_power_production)
- [Economic Dispatch](https://en.wikipedia.org/wiki/Economic_dispatch)

### Installation
## Installation

```julia
julia> ]
(v1.6) pkg> add PowerSystems
(v1.6) pkg> add PowerSimulations
(v1.8) pkg> add PowerSystems
(v1.8) pkg> add PowerSimulations
```

### Usage
## Usage

`PowerSimulations.jl` uses [PowerSystems.jl](https://github.com/NREL/PowerSystems.jl) to handle the data used in the simulations.

Expand Down
2 changes: 0 additions & 2 deletions src/PowerSimulations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,6 @@ import JuMP: optimizer_with_attributes
import JuMP.Containers: DenseAxisArray, SparseAxisArray
export optimizer_with_attributes
import MathOptInterface
import ParameterJuMP
import LinearAlgebra
import JSON3
import PowerSystems
Expand Down Expand Up @@ -425,7 +424,6 @@ const PSI = PowerSimulations
const IS = InfrastructureSystems
const MOI = MathOptInterface
const MOIU = MathOptInterface.Utilities
const PJ = ParameterJuMP
const MOPFM = MOI.FileFormats.Model
const TS = TimeSeries

Expand Down
15 changes: 11 additions & 4 deletions src/core/definitions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,22 @@ const BUILD_PROBLEMS_TIMER = TimerOutputs.TimerOutput()
const RUN_OPERATION_MODEL_TIMER = TimerOutputs.TimerOutput()
const RUN_SIMULATION_TIMER = TimerOutputs.TimerOutput()

# Type Alias for JuMP and PJ containers
const PGAE = PJ.ParametrizedGenericAffExpr{Float64, JuMP.VariableRef}
# Type Alias for JuMP containers
const GAE = JuMP.GenericAffExpr{Float64, JuMP.VariableRef}
const JuMPAffineExpressionArray = Matrix{GAE}
const JuMPAffineExpressionVector = Vector{GAE}
const JuMPConstraintArray = DenseAxisArray{JuMP.ConstraintRef}
const JuMPVariableArray = DenseAxisArray{JuMP.VariableRef}
const JuMPParamArray = DenseAxisArray{PJ.ParameterRef}
const JuMPVariableMatrix = DenseAxisArray{
JuMP.VariableRef,
2,
Tuple{Vector{String}, UnitRange{Int64}},
Tuple{
JuMP.Containers._AxisLookup{Dict{String, Int64}},
JuMP.Containers._AxisLookup{Tuple{Int64, Int64}},
},
}
const JuMPFloatArray = DenseAxisArray{Float64}
const JuMPVariableArray = DenseAxisArray{JuMP.VariableRef}

# Settings constants
const UNSET_HORIZON = 0
Expand Down
12 changes: 6 additions & 6 deletions src/core/initial_conditions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ get_component_type(::ICKey{T, U}) where {T <: InitialConditionType, U <: PSY.Com
"""
Container for the initial condition data
"""
struct InitialCondition{T <: InitialConditionType, U <: Union{PJ.ParameterRef, Float64}}
struct InitialCondition{T <: InitialConditionType, U <: Union{JuMP.VariableRef, Float64}}
component::PSY.Component
value::U
end
Expand All @@ -28,7 +28,7 @@ function InitialCondition(
::Type{T},
component::PSY.Component,
value::U,
) where {T <: InitialConditionType, U <: Union{PJ.ParameterRef, Float64}}
) where {T <: InitialConditionType, U <: Union{JuMP.VariableRef, Float64}}
return InitialCondition{T, U}(component, value)
end

Expand All @@ -39,7 +39,7 @@ function InitialCondition(
) where {
T <: InitialConditionType,
U <: PSY.Component,
V <: Union{PJ.ParameterRef, Float64},
V <: Union{JuMP.VariableRef, Float64},
}
return InitialCondition{T, U}(component, value)
end
Expand All @@ -49,7 +49,7 @@ function get_condition(p::InitialCondition{T, Float64}) where {T <: InitialCondi
end

function get_condition(
p::InitialCondition{T, PJ.ParameterRef},
p::InitialCondition{T, JuMP.VariableRef},
) where {T <: InitialConditionType}
return jump_value(p.value)
end
Expand All @@ -60,10 +60,10 @@ get_component_name(ic::InitialCondition) = PSY.get_name(ic.component)
get_component_type(ic::InitialCondition) = typeof(ic.component)
get_ic_type(
::Type{InitialCondition{T, U}},
) where {T <: InitialConditionType, U <: Union{PJ.ParameterRef, Float64}} = T
) where {T <: InitialConditionType, U <: Union{JuMP.VariableRef, Float64}} = T
get_ic_type(
::InitialCondition{T, U},
) where {T <: InitialConditionType, U <: Union{PJ.ParameterRef, Float64}} = T
) where {T <: InitialConditionType, U <: Union{JuMP.VariableRef, Float64}} = T

"""
Stores data to populate initial conditions before the build call
Expand Down
Loading