Jf/set initial param levels#98
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #98 +/- ##
==========================================
- Coverage 83.13% 81.30% -1.84%
==========================================
Files 45 45
Lines 2325 2407 +82
==========================================
+ Hits 1933 1957 +24
- Misses 392 450 +58 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 8 out of 12 changed files in this pull request and generated 23 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 8 out of 12 changed files in this pull request and generated 6 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| transitions from forced outage to operational during a given simulation | ||
| timestep, for each storage unit in each timeperiod. Unitless. | ||
|
|
||
| An optional parameter is available to set the initial state of charge for the unit: |
There was a problem hiding this comment.
Isn't this a one dimensional array, if so, is it still a dataset, can we qualify it better with info on shape?
| initialize_availability!( | ||
| rng, state.lines_available, state.lines_nexttransition, | ||
| system.lines, N) | ||
| if size(system.storages.energy_capacity, 1) > 0 |
There was a problem hiding this comment.
Is it possible to have one function for these 3 blocks?
| operational during a given simulation timestep, for each generator-storage unit in each | ||
| timeperiod. Unitless. | ||
| - `initial_soc`: Optional keyword for initial state of charge as a fraction [0.0, 1.0] of | ||
| `energy_capacity` at the first timestep for each storage unit. Default is zero. |
| λ::Matrix{Float64}, μ::Matrix{Float64}, | ||
| borrowefficiency::Matrix{Float64},paybackefficiency::Matrix{Float64} | ||
| λ::Matrix{Float64}, μ::Matrix{Float64}; | ||
| initial_borrowed_load::Vector{Float64} = zeros(Float64, length(names)), |
There was a problem hiding this comment.
Why don't we keep this as the last argument, much like the others?
| """ | ||
| Read a SystemModel from a PRAS file in version 0.8.1+ format. Requires initial SOC levels for storages/generator-storages and initial borrowed load/efficiency parameters for demand responses. | ||
| """ | ||
| function systemmodel_0_8_1(f::File) |
There was a problem hiding this comment.
We're gonna release this with PRASFiles 0.9, so let's call this function.
|
|
||
| path = dirname(@__FILE__) | ||
| version_0_7_0 = SystemModel(path * "/versioned_toy/toymodel_v0_7_0.pras") | ||
| version_0_8_1 = SystemModel(path * "/versioned_toy/toymodel_v0_8_1.pras") |
There was a problem hiding this comment.
Again, think this can be 0.9
| end | ||
|
|
||
|
|
||
| @testset "Read version 0.7.0 to 0.8.1 compatibility" begin |
There was a problem hiding this comment.
What are we trying to test for here? To test backward compatibility of our reader, to ensure if we can read 0.7, 0.8 version etc.? The 0.8.1 (or other newer versions) are written from those, original right?
| has_storages = haskey(f, "storages") | ||
| has_generatorstorages = haskey(f, "generatorstorages") | ||
|
|
||
| if has_storages |
There was a problem hiding this comment.
Let's pull these blocks into 2 functions read_storages() and read_genstorages(), which take the file handle and the version as a symbol and passes 0 for version <0.9, and passes read-in SoC to the asset struct which is sent back to the calling function. We can then call this in core and can do the same thing as before for 0_5 and 0_8. Same deal with read_demandresponses() except we only check for versions 0_8 and 0_9.
| load_matrix(f["storages/carryoverefficiency"], region_order, Float64), | ||
| load_matrix(f["storages/failureprobability"], region_order, Float64), | ||
| load_matrix(f["storages/repairprobability"], region_order, Float64); | ||
| initial_soc = load_matrix(f["storages/initialsoc"], region_order, Float64) |
There was a problem hiding this comment.
Why not read with read_vector?
Creating initial PR now-will update with graphics/analysis on impact in varying param. Core functionality with backwards compat file reading tests is present though