SIIP Tutorial

Parsing Tabular Data

Originally Contributed by: Clayton Barrows

Introduction

An example of how to parse tabular files (CSV) files similar to the format established in the RTS-GMLC and create a System using PowerSystems.jl

Dependencies

using PowerSystems
using TimeSeries
using Dates

Fetch Data

PowerSystems.jl links to some test data that is suitable for this example. Let's download the test data

PowerSystems.download(PowerSystems.TestData; branch = "master") # *note* add `force=true` to get a fresh copy
base_dir = dirname(dirname(pathof(PowerSystems)));

The tabular data format relies on a folder containing *.csv files and a user_descriptors.yaml file

First, we'll read the tabular data

RTS_GMLC_DIR = joinpath(base_dir, "data", "RTS_GMLC");
rawsys = PowerSystems.PowerSystemTableData(
    RTS_GMLC_DIR,
    100.0,
    joinpath(RTS_GMLC_DIR, "user_descriptors.yaml"),
    timeseries_metadata_file = joinpath(RTS_GMLC_DIR, "timeseries_pointers.json"),
    generator_mapping_file = joinpath(RTS_GMLC_DIR, "generator_mapping_multi_start.yaml"),
)
PowerSystems.PowerSystemTableData:
  directory:  /home/runner/.julia/packages/PowerSystems/zVsmd/data/RTS_GMLC
  timeseries_metadata_file:  /home/runner/.julia/packages/PowerSystems/zVsmd/data/RTS_GMLC/timeseries_pointers.json
  base_power:  100.0
  PowerSystems.InputCategoryModule.InputCategory.GENERATOR = 4:  158×58 DataFrame
  PowerSystems.InputCategoryModule.InputCategory.DC_BRANCH = 3:  1×60 DataFrame
  PowerSystems.InputCategoryModule.InputCategory.BUS = 2:  73×15 DataFrame
  PowerSystems.InputCategoryModule.InputCategory.RESERVE = 6:  7×7 DataFrame
  PowerSystems.InputCategoryModule.InputCategory.BRANCH = 1:  120×14 DataFrame
  PowerSystems.InputCategoryModule.InputCategory.STORAGE = 8:  22×8 DataFrame

Create a System

Next, we'll create a System from the rawsys data. Since a System is predicated on a time series resolution and the rawsys data includes both 5-minute and 1-hour resolution time series, we also need to specify which time series we want to include in the System. The time_series_resolution kwarg filters to only include time series with a matching resolution.

sys = System(rawsys; time_series_resolution = Dates.Hour(1));
horizon = 24;
interval = Dates.Hour(24);
transform_single_time_series!(sys, horizon, interval);
sys
System
Property Value
System Units Base DEVICE_BASE
Base Power 100.0
Base Frequency 60.0
Num Components 525
Static Components
Type Count Has Static Time Series Has Forecasts
Arc 109 false false
Area 3 false false
Bus 73 false false
GenericBattery 1 false false
HVDCLine 1 false false
HydroDispatch 20 true true
Line 105 false false
LoadZone 3 true true
PowerLoad 51 true true
RenewableDispatch 30 true true
RenewableFix 31 true true
TapTransformer 15 false false
ThermalMultiStart 76 false false
VariableReserve{PowerSystems.ReserveDown} 2 true true
VariableReserve{PowerSystems.ReserveUp} 5 true true
Time Series Summary
Property Value
Components with time series data 142
Total StaticTimeSeries 182
Total Forecasts 182
Resolution 60 minutes
First initial time 2020-01-01T00:00:00
Last initial time 2020-01-01T00:00:00
Horizon 24
Interval 0 minutes
Forecast window count 1
CC BY-SA 4.0 "Dheepak Krishnamurthy". Last modified: August 26, 2022. Website built with Franklin.jl and the Julia programming language.