Skip to content

Latest commit

 

History

History
57 lines (43 loc) · 1.92 KB

parse_tabular_data.md

File metadata and controls

57 lines (43 loc) · 1.92 KB

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 get the test data using Artifacts. You can find the repository of the data of the GMLC system here:

using PowerSystemCaseBuilder #hide
DATA_DIR = PowerSystemCaseBuilder.DATA_DIR #hide
# include download methods
RTS_GMLC_DIR = joinpath(DATA_DIR, "RTS_GMLC")

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

First, we'll read the tabular data

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"),
)

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