customize the tabular data parser
This page describes how developers should read columns from raw data files.
The main point is that you should not read individual hard-coded column names from DataFrames. The parsing code includes mapping functionality that allows you to use PowerSystems-standard names while letting the users define their own custom names.
Note: This assumes that you are familiar with the PowerSystems Table Data Parser.
Procedure
Add an entry to the array of parameters for your category in
src/descriptors/power_system_inputs.json
according to the following:- Use
snake_case
for the name field. - The fields
name
anddescription
are required. - Try to use a name that is generic and not specific to one dataset.
- It is recommended that you define
unit
. - If PowerSystems expects the value to be per-unit then you must specify
system_per_unit=true
.
- Use
PowerSystems has two commonly-used datasets with customized user config files: PowerSystemsTestData and RTS_GMLC. Update both of these files and submit pull requests.
Parse the raw data like in this example:
function demo_bus_csv_parser!(data::PowerSystemTableData)
for bus in iterate_rows(data, BUS::InputCategory)
@show bus.name, bus.max_active_power, bus.max_reactive_power
end
end
iterate_rows
returns a NamedTuple where each name
defined in src/descriptors/power_system_inputs.json
is a field.