Public API Reference
PowerTableDataParser.PowerSystemTableData — Method
Reads in all the data stored in csv files in a directory
This parser is planned for deprecation. PowerSystems.jl will be moving to a database solution for handling data. There are plans to eventually include utility functions to translate from .csv files to the database, but there will probably be a gap in support. Users are recommended to write their own custom Julia code to import data from their unique data formats, rather than relying on this parsing code.
Arguments
directory::AbstractString: directory containing CSV filesbase_power::Float64: base power for thePowerSystems.Systemuser_descriptor_file::AbstractString: customized input descriptor file. Exampledescriptor_file=POWER_SYSTEM_DESCRIPTOR_FILE:PowerSystems.jldescriptor file. Defaultgenerator_mapping_file=GENERATOR_MAPPING_FILE_CDM: generator mapping configuration file. Defaulttimeseries_metadata_file = joinpath(directory, "timeseries_pointers"): Time series pointers .json file. Example
The general format for data in the directory is:
- bus.csv (required)
- columns specifying
areaandzonewill create a corresponding set ofAreaandLoadZoneobjects. - columns specifying
max_active_powerormax_reactive_powerwill createPowerLoadobjects when nonzero values are encountered and will contribute to thepeak_active_powerandpeak_reactive_powervalues for the correspondingLoadZoneobject.
- columns specifying
- branch.csv
- dc_branch.csv
- gen.csv
- load.csv
- reserves.csv
- storage.csv
Custom construction of generators
Each generator will be defined as a concrete subtype of PowerSystems.Generator, based on the fuel and type columns in gen.csv and the generator_mapping_file. The default mapping file is src/parsers/generator_mapping.yaml. You can override this behavior by specifying your own file.
Custom Column names
PowerSystems provides am input mapping capability that allows you to keep your own column names. For example, when parsing raw data for a generator the code expects a column called name. If the raw data instead defines that column as GEN UID then you can change the custom_name field under the generator category to GEN UID in your YAML file.
To enable the parsing of a custom set of csv files, you can generate a configuration file (such as user_descriptors.yaml) from the defaults, which are stored in src/descriptors/power_system_inputs.json.
python ./bin/generate_config_file.py ./user_descriptors.yamlNext, edit this file with your customizations.
Note that the user-specific customizations are stored in YAML rather than JSON to allow for easier editing. The next few sections describe changes you can make to this YAML file. Do not edit the default JSON file.
Per-unit conversion
PowerSystems defines whether it expects a column value to be per-unit system base, per-unit device base, or natural units in power_system_inputs.json. If it expects a per-unit convention that differs from your values then you can set the unit_system in user_descriptors.yaml and PowerSystems will automatically convert the values. For example, if you have a max_active_power value stored in natural units (MW), but power_system_inputs.json specifies unit_system: device_base, you can enter unit_system: natural_units in user_descriptors.yaml and PowerSystems will divide the value by the value of the corresponding entry in the column identified by the base_reference field in power_system_inputs.json. You can also override the base_reference setting by adding base_reference: My Column to make device base per-unit conversion by dividing the value by the entry in My Column. System base per-unit conversions always divide the value by the system base_power value instantiated when constructing a System.
PowerSystems provides a limited set of unit conversions. For example, if power_system_inputs.json indicates that a value's unit is degrees but your values are in radians then you can set unit: radian in your YAML file. Other valid unit entries include GW, GWh, MW, MWh, kW, and kWh.
Examples
data_dir = "/data/my-data-dir"
base_power = 100.0
descriptors = "./user_descriptors.yaml"
timeseries_metadata_file = "./timeseries_pointers.json"
generator_mapping_file = "./generator_mapping.yaml"
data = PowerSystemTableData(
data_dir,
base_power,
descriptors;
timeseries_metadata_file = timeseries_metadata_file,
generator_mapping_file = generator_mapping_file,
)
sys = System(data; time_series_in_memory = true)