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

Add more tests on systems in RTS-GMLC #12

Merged
merged 5 commits into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
92 changes: 50 additions & 42 deletions src/PRAS2PSY.jl
Original file line number Diff line number Diff line change
@@ -1,32 +1,36 @@
"""
generate_outage_profile(pras_system,num_runs,psy_sys,num_scenarios,location)

Process the assess results to get timeseries of generator status and include
this timeseries data to the corresponding component in PSY System and exported
using to_json method (serializing the PSY System).

...

# Arguments

- `pras_system::PRAS.SystemModel`: PRAS System
- `num_runs::Int64`: Number of PRAS runs
- `psy_sys::PSY.System`: PSY System
- `num_scenarios::Int64`: Number of scenarios of user interest.
- `location::String`: Location to store outage profile.
...

# Examples

```julia-repl
julia> generate_outage_profile(results, pras_sys, psy_sys, 1)
PSY System exported using to_json method in InfrastructureSystems
```
"""
function generate_outage_profile(
pras_system::PRAS.SystemModel,
psy_sys::PSY.System;
location::Union{Nothing, String}=nothing,
num_runs::Union{Nothing, Int}=nothing,
num_scenarios::Union{Nothing, Int}=nothing,
)
"""
generate_outage_profile(pras_system,num_runs,psy_sys,num_scenarios,location)

Process the assess results to get timeseries of generator status and include
this timeseries data to the corresponding component in PSY System and exported
using to_json method (serializing the PSY System).

...
# Arguments
- `pras_system::PRAS.SystemModel`: PRAS System
- `num_runs::Int64`: Number of PRAS runs
- `psy_sys::PSY.System`: PSY System
- `num_scenarios::Int64`: Number of scenarios of user interest.
- `location::String`: Location to store outage profile.
...

# Examples
```julia-repl
julia> generate_outage_profile(results,pras_sys,psy_sys,1)
PSY System exported using to_json method in InfrastructureSystems
```
"""
#kwargs handling
if (location === nothing)
location = dirname(dirname(@__DIR__))
Expand Down Expand Up @@ -121,34 +125,38 @@ function generate_outage_profile(
@info "Succesfully exported PSY System(s). The .json files and corresponding data .h5 files for all scenarios are available here : $(dir_name)."
end

"""
generate_outage_profile(pras_system,num_runs,psy_sys,num_scenarios,location)

Process the assess results to get timeseries of generator status and include
this timeseries data to the corresponding component in PSY System and exported
using to_json method (serializing the PSY System).

...

# Arguments

- `pras_system::PRAS.SystemModel`: PRAS System
- `num_runs::Int64`: Number of PRAS runs
- `psy_sys::PSY.System`: PSY System
- `num_scenarios::Int64`: Number of scenarios of user interest.
- `location::String`: Location to store outage profile.
...

# Examples

```julia-repl
julia> generate_outage_profile(results, pras_sys, psy_sys, 1)
PSY System exported using to_json method in InfrastructureSystems
```
"""
function generate_csv_outage_profile(
pras_system::PRAS.SystemModel;
location::Union{Nothing, String}=nothing,
num_runs::Union{Nothing, Int}=nothing,
num_scenarios::Union{Nothing, Int}=nothing,
)
"""
generate_outage_profile(pras_system,num_runs,psy_sys,num_scenarios,location)

Process the assess results to get timeseries of generator status and include
this timeseries data to the corresponding component in PSY System and exported
using to_json method (serializing the PSY System).

...
# Arguments
- `pras_system::PRAS.SystemModel`: PRAS System
- `num_runs::Int64`: Number of PRAS runs
- `psy_sys::PSY.System`: PSY System
- `num_scenarios::Int64`: Number of scenarios of user interest.
- `location::String`: Location to store outage profile.
...

# Examples
```julia-repl
julia> generate_outage_profile(results,pras_sys,psy_sys,1)
PSY System exported using to_json method in InfrastructureSystems
```
"""
#kwargs handling
if (location === nothing)
location = dirname(dirname(@__DIR__))
Expand Down
1 change: 1 addition & 0 deletions src/PRASInterface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export generate_csv_outage_profile
export add_csv_time_series!
export add_csv_time_series_single_stage!
export make_generator_outage_draws!
export PRAS
#################################################################################
# Imports
#################################################################################
Expand Down
50 changes: 27 additions & 23 deletions src/PSY2PRAS.jl
Original file line number Diff line number Diff line change
@@ -1,33 +1,37 @@
#######################################################
# Main function to build a instance of PRAS SystemModel
# from Sienna/Data PowerSytems.jl System
#######################################################
"""
generate_pras_system(sys::PSY.System, aggregation; kwargs...)

Sienna/Data PowerSystems.jl System is the input and an object of PRAS SystemModel is returned.
...

# Arguments

- `sys::PSY.System`: Sienna/Data PowerSystems.jl System
- `aggregation<:PSY.AggregationTopology`: "PSY.Area" (or) "PSY.LoadZone" {Optional}
- `availability::Bool`: Takes into account avaialability of StaticInjection components when building the PRAS System {Optional}
- `lump_region_renewable_gens::Bool`: Whether to lumps PV and Wind generators in a region because usually these generators don't have FOR data {Optional}
- `export_location::String`: Export location of the .pras file
...

# Returns

- `PRAS.SystemModel`: PRAS SystemModel object

# Examples

```julia-repl
julia> make_pras_system(psy_sys)
PRAS SystemModel
```
"""
function generate_pras_system(
sys::PSY.System,
aggregation::Type{AT};
availability=true,
lump_region_renewable_gens=false,
export_location::Union{Nothing, String}=nothing,
) where {AT <: PSY.AggregationTopology}
"""
make_pras_system(psy_sys,system_model)

Sienna/Data PowerSystems.jl System is the input and an object of PRAS SystemModel is returned.
...
# Arguments
- `sys::PSY.System`: Sienna/Data PowerSystems.jl System
- `aggregation<:PSY.AggregationTopology`: "PSY.Area" (or) "PSY.LoadZone" {Optional}
- `availability::Bool`: Takes into account avaialability of StaticInjection components when building the PRAS System {Optional}
- `lump_region_renewable_gens::Bool`: Whether to lumps PV and Wind generators in a region because usually these generators don't have FOR data {Optional}
- `export_location::String`: Export location of the .pras file
...
)::PRAS.SystemModel where {AT <: PSY.AggregationTopology}

# Examples
```julia-repl
julia> make_pras_system(psy_sys)
PRAS SystemModel
```
"""
# PRAS needs Sienna\Data PowerSystems.jl System to be in NATURAL_UNITS
PSY.set_units_base_system!(sys, PSY.UnitSystem.NATURAL_UNITS)

Expand Down
4 changes: 3 additions & 1 deletion test/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
PRASInterface = "4b496c86-8d00-441d-b504-079c710e0aa7"
PowerSystemCaseBuilder = "f00506e0-b84f-492a-93c2-c0a9afc4364e"
PRASInterface = "4b496c86-8d00-441d-b504-079c710e0aa7"
PowerSystems = "bcd98974-b02a-5e2f-9ee0-a103f5c450dd"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
TimeSeries = "9e3dc215-6440-5c97-bce1-76c03772f85e"
TimeZones = "f269a46b-ccf7-5d73-abea-4c690281aa53"
Loading
Loading