{ "cells": [ { "cell_type": "markdown", "source": [ "# `System` library management with `PowerSystemCaseBuilder.jl`" ], "metadata": {} }, { "cell_type": "markdown", "source": [ "**Originally Contributed by**: Clayton Barrows" ], "metadata": {} }, { "cell_type": "markdown", "source": [ "## Introduction" ], "metadata": {} }, { "cell_type": "markdown", "source": [ "[PowerSystemCaseBuilder.jl](github.com/NREL-SIIP/PowerSystemCaseBuilder.jl) provides a utility to manage a library of `System`s.\n", "The package has utilities to list the available system data and to create instances of each system. By keeping track of which systems\n", "have been constructed locally, it makes the re-instantiation of systems efficient by utilizing the serialization features and avoiding\n", "the parsing process for systems that have been previously constructed." ], "metadata": {} }, { "cell_type": "markdown", "source": [ "### Dependencies" ], "metadata": {} }, { "outputs": [], "cell_type": "code", "source": [ "using PowerSystemCaseBuilder" ], "metadata": {}, "execution_count": 1 }, { "cell_type": "markdown", "source": [ "### List all systems in library" ], "metadata": {} }, { "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "Category: MatPowerTestSystems\n", "\n", "┌──────────────────────────────┬───────────────────────────────────┐\n", "│ Name │ Descriptor │\n", "├──────────────────────────────┼───────────────────────────────────┤\n", "│ matpower_ACTIVSg10k_sys │ ACTIVSg10k Test system │\n", "│ matpower_ACTIVSg2000_sys │ MATPOWER ACTIVSg2000 Test system │\n", "│ matpower_RTS_GMLC_sys │ Matpower RTS-GMLC Test system │\n", "│ matpower_case14_sys │ Matpower Test system │\n", "│ matpower_case24_sys │ Matpower Test system │\n", "│ matpower_case2_sys │ Matpower Test system │\n", "│ matpower_case30_sys │ Matpower Test system │\n", "│ matpower_case3_tnep_sys │ Matpower Test system │\n", "│ matpower_case5_asym_sys │ Matpower Test system │\n", "│ matpower_case5_dc_sys │ Matpower Test system │\n", "│ matpower_case5_gap_sys │ Matpower Test system │\n", "│ matpower_case5_pwlc_sys │ Matpower Test system │\n", "│ matpower_case5_re_intid_sys │ Matpower Test system │\n", "│ matpower_case5_re_sys │ Matpower Test system │\n", "│ matpower_case5_re_uc_pwl_sys │ Matpower Test system │\n", "│ matpower_case5_re_uc_sys │ Matpower Test system │\n", "│ matpower_case5_strg_sys │ Matpower Test system │\n", "│ matpower_case5_sys │ Matpower Test system │\n", "│ matpower_case5_th_intid_sys │ Matpower Test system │\n", "│ matpower_case5_tnep_sys │ Matpower Test system │\n", "│ matpower_case6_sys │ Matpower Test system │\n", "│ matpower_case7_tplgy_sys │ Matpower Test system │\n", "│ matpower_frankenstein_00_sys │ Matpower Frankenstein Test system │\n", "└──────────────────────────────┴───────────────────────────────────┘\n", "\n", "Category: PSITestSystems\n", "\n", "┌──────────────────────────┬───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐\n", "│ Name │ Descriptor │\n", "├──────────────────────────┼───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤\n", "│ RTS_GMLC_sys │ RTS-GMLC Full system from git repo for day-ahead simulations │\n", "│ batt_test_case_b_sys │ test system for Storage Energy Target formulation(case-b) │\n", "│ batt_test_case_c_sys │ test system for Storage Energy Target formulation(case-c) │\n", "│ batt_test_case_d_sys │ test system for Storage Energy Target formulation(case-d) │\n", "│ batt_test_case_e_sys │ test system for Storage Energy Target formulation(case-e) │\n", "│ batt_test_case_f_sys │ test system for Storage Energy Target formulation(case-f) │\n", "│ c_duration_test │ 1 Bus for duration testing │\n", "│ c_linear_pwl_test │ 1 Bus lineal PWL linear testing │\n", "│ c_market_bid_cost │ 1 bus system with MarketBidCost Model │\n", "│ c_ramp_test │ 1-bus for ramp testing │\n", "│ c_sos_pwl_test │ 1 Bus lineal PWL sos testing │\n", "│ c_sys14 │ 14-bus system │\n", "│ c_sys14_dc │ 14-bus system with DC line │\n", "│ c_sys5 │ 5-bus system │\n", "│ c_sys5_bat │ 5-bus system with Storage Device │\n", "│ c_sys5_bat_ems │ 5-bus system with Storage Device with EMS │\n", "│ c_sys5_dc │ Systems with HVDC data in the branches │\n", "│ c_sys5_ed │ 5-bus System for Economic Dispatch Simulations │\n", "│ c_sys5_hy │ 5-bus system with HydroDispatch │\n", "│ c_sys5_hy_ed │ 5-bus system with Hydro-Power for Economic Dispatch Simulations │\n", "│ c_sys5_hy_ems_ed │ 5-bus system with Hydro-Power for Economic Dispatch Simulations │\n", "│ c_sys5_hy_ems_uc │ 5-bus system with Hydro-Power for Unit Commitment Simulations │\n", "│ c_sys5_hy_uc │ 5-bus system with Hydro-Power for Unit Commitment Simulations │\n", "│ c_sys5_hybrid │ 5-bus system with Hybrid devices │\n", "│ c_sys5_hyd │ 5-bus system with Hydro Energy Reservoir │\n", "│ c_sys5_hyd_ems │ 5-bus system with Hydro Energy Reservoir │\n", "│ c_sys5_il │ System with Interruptible Load │\n", "│ c_sys5_ml │ │\n", "│ c_sys5_pglib │ 5-bus with ThermalMultiStart │\n", "│ c_sys5_pglib_sim │ 5-bus with ThermalMultiStart for simulation │\n", "│ c_sys5_phes_ed │ 5-bus system with Hydro Pumped Energy Storage for Economic Dispatch Simulations │\n", "│ c_sys5_pwl_ed │ 5-bus with pwl cost function │\n", "│ c_sys5_pwl_ed_nonconvex │ 5-bus with SOS cost function for Economic Dispatch Simulations │\n", "│ c_sys5_pwl_uc │ 5-bus with SOS cost function for Unit Commitment Simulations │\n", "│ c_sys5_re │ 5-bus system with Renewable Energy │\n", "│ c_sys5_re_only │ 5-bus system with only Renewable Energy │\n", "│ c_sys5_reg │ 5-bus with regulation devices and AGC │\n", "│ c_sys5_uc │ 5-bus system for Unit Commitment Simulations │\n", "│ hydro_test_case_b_sys │ test system for HydroGen Energy Target formulation(case-b) │\n", "│ hydro_test_case_c_sys │ test system for HydroGen Energy Target formulation(case-c) │\n", "│ hydro_test_case_d_sys │ test system for HydroGen Energy Target formulation(case-d) │\n", "│ hydro_test_case_e_sys │ test system for HydroGen Energy Target formulation(case-e) │\n", "│ hydro_test_case_f_sys │ test system for HydroGen Energy Target formulation(case-f) │\n", "│ modified_RTS_GMLC_DA_sys │ Modified RTS-GMLC Full system for day-ahead simulations\\n with modifications to reserve definitions to improve feasibility │\n", "│ modified_RTS_GMLC_RT_sys │ Modified RTS-GMLC Full system for real-time simulations\\n with modifications to reserve definitions to improve feasibility │\n", "│ test_RTS_GMLC_sys │ RTS-GMLC test system with day-ahead forecast │\n", "└──────────────────────────┴───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘\n", "\n", "Category: PSSETestSystems\n", "\n", "┌─────────────────────────────────┬────────────────────────────────────┐\n", "│ Name │ Descriptor │\n", "├─────────────────────────────────┼────────────────────────────────────┤\n", "│ psse_3bus_gen_cls_sys │ PSSE 3-bus Test system with CLS │\n", "│ psse_3bus_no_cls_sys │ PSSE 3-bus Test system without CLS │\n", "│ psse_ACTIVSg2000_sys │ PSSE ACTIVSg2000 Test system │\n", "│ psse_Benchmark_4ger_33_2015_sys │ PSSE Benchmark system │\n", "│ psse_OMIB_sys │ PSSE OMIB Test system │\n", "│ psse_RTS_GMLC_sys │ PSSE .raw RTS-GMLC system │\n", "│ pti_case14_sys │ PSSE 14-bus Test system │\n", "│ pti_case24_sys │ PSSE 24-bus Test system │\n", "│ pti_case30_sys │ PSSE 30-bus Test system │\n", "│ pti_case3_sys │ PSSE 3-bus Test system │\n", "│ pti_case5_alc_sys │ PSSE 5-bus alc Test system │\n", "│ pti_case5_sys │ PSSE 5-bus Test system │\n", "│ pti_case73_sys │ PSSE 73-bus Test system │\n", "│ pti_case7_tplgy_sys │ PSSE 7-bus Test system │\n", "│ pti_frankenstein_00_2_sys │ PSSE frankenstein Test system │\n", "│ pti_frankenstein_00_sys │ PSSE frankenstein Test system │\n", "│ pti_frankenstein_20_sys │ PSSE frankenstein Test system │\n", "│ pti_frankenstein_70_sys │ PSSE frankenstein Test system │\n", "│ pti_parser_test_a_sys │ PSSE Test system │\n", "│ pti_three_winding_mag_test_sys │ PSSE Test system │\n", "│ pti_three_winding_test_2_sys │ PSSE Test system │\n", "│ pti_three_winding_test_sys │ PSSE Test system │\n", "│ pti_two_terminal_hvdc_test_sys │ PSSE Test system │\n", "│ pti_two_winding_mag_test_sys │ PSSE Test system │\n", "│ pti_vsc_hvdc_test_sys │ PSSE Test system │\n", "└─────────────────────────────────┴────────────────────────────────────┘\n", "\n", "Category: PSYTestSystems\n", "\n", "┌──────────────────────┬──────────────────────────────────┐\n", "│ Name │ Descriptor │\n", "├──────────────────────┼──────────────────────────────────┤\n", "│ dynamic_inverter_sys │ PSY test dynamic inverter system │\n", "│ tamu_ACTIVSg2000_sys │ TAMU ACTIVSg2000 Test system │\n", "└──────────────────────┴──────────────────────────────────┘\n", "\n", "Category: SIIPExampleSystems\n", "\n", "┌────────────────────┬────────────────────────────────────────────┐\n", "│ Name │ Descriptor │\n", "├────────────────────┼────────────────────────────────────────────┤\n", "│ 5_bus_hydro_ed_sys │ 5-bus hydro economic dispatch data │\n", "│ 5_bus_hydro_uc_sys │ 5-bus hydro unit commitment data │\n", "│ 5_bus_hydro_wk_sys │ 5-bus hydro system for weekly dispatch │\n", "│ 5_bus_matpower_AGC │ matpower 5-bus system with AGC time series │\n", "│ 5_bus_matpower_DA │ matpower 5-bus system with DA time series │\n", "│ 5_bus_matpower_RT │ matpower 5-bus system with RT time series │\n", "└────────────────────┴────────────────────────────────────────────┘\n" ] } ], "cell_type": "code", "source": [ "show_systems()" ], "metadata": {}, "execution_count": 2 }, { "cell_type": "markdown", "source": [ "### Systems can be listed by category\n", "the available categories can be displayed with:" ], "metadata": {} }, { "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "MatPowerTestSystems\n", "PSITestSystems\n", "PSSETestSystems\n", "PSYTestSystems\n", "SIIPExampleSystems\n" ] } ], "cell_type": "code", "source": [ "show_categories()" ], "metadata": {}, "execution_count": 3 }, { "cell_type": "markdown", "source": [ "the available systems can be displayed with:" ], "metadata": {} }, { "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "┌────────────────────┬────────────────────────────────────────────┐\n", "│ Name │ Descriptor │\n", "├────────────────────┼────────────────────────────────────────────┤\n", "│ 5_bus_hydro_ed_sys │ 5-bus hydro economic dispatch data │\n", "│ 5_bus_hydro_uc_sys │ 5-bus hydro unit commitment data │\n", "│ 5_bus_hydro_wk_sys │ 5-bus hydro system for weekly dispatch │\n", "│ 5_bus_matpower_AGC │ matpower 5-bus system with AGC time series │\n", "│ 5_bus_matpower_DA │ matpower 5-bus system with DA time series │\n", "│ 5_bus_matpower_RT │ matpower 5-bus system with RT time series │\n", "└────────────────────┴────────────────────────────────────────────┘\n" ] } ], "cell_type": "code", "source": [ "show_systems(SIIPExampleSystems)" ], "metadata": {}, "execution_count": 4 }, { "cell_type": "markdown", "source": [ "### Create a `System`\n", "*The first time this is run, it will parse csv data. Subsequent executions will rely on serialized data and will execute much faster*" ], "metadata": {} }, { "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "┌ Info: Building new system 5_bus_hydro_ed_sys from raw data\n", "└ sys_descriptor.raw_data = \"/Users/cbarrows/.julia/packages/PowerSystemCaseBuilder/1xViZ/data\"\n", "[ Info: Parsing csv data in Hydro_Upstream_Input.csv ...\n", "[ Info: Successfully parsed Hydro_Upstream_Input.csv\n", "[ Info: Parsing csv data in branch.csv ...\n", "[ Info: Successfully parsed branch.csv\n", "[ Info: Parsing csv data in bus.csv ...\n", "[ Info: Successfully parsed bus.csv\n", "[ Info: Parsing csv data in gen.csv ...\n", "[ Info: Successfully parsed gen.csv\n", "[ Info: Parsing csv data in reserves.csv ...\n", "[ Info: Successfully parsed reserves.csv\n", "[ Info: Parsing csv data in storage.csv ...\n", "[ Info: Successfully parsed storage.csv\n", "[ Info: Unit System changed to UnitSystem.DEVICE_BASE = 1\n", "┌ Warning: Missing PowerSystems.InputCategoryModule.InputCategory.DC_BRANCH = 3 data.\n", "└ @ PowerSystems ~/.julia/packages/PowerSystems/N2l8o/src/parsers/power_system_table_data.jl:212\n", "┌ Warning: Missing PowerSystems.InputCategoryModule.InputCategory.LOAD = 5 data.\n", "└ @ PowerSystems ~/.julia/packages/PowerSystems/N2l8o/src/parsers/power_system_table_data.jl:212\n", "┌ Warning: Missing PowerSystems.InputCategoryModule.InputCategory.DC_BRANCH = 3 data.\n", "└ @ PowerSystems ~/.julia/packages/PowerSystems/N2l8o/src/parsers/power_system_table_data.jl:212\n", "┌ Warning: Missing PowerSystems.InputCategoryModule.InputCategory.LOAD = 5 data.\n", "└ @ PowerSystems ~/.julia/packages/PowerSystems/N2l8o/src/parsers/power_system_table_data.jl:212\n", "[ Info: Adding contributing generators for REG1 by category\n", "┌ Warning: no component category=Generator name=SolarBusC\n", "└ @ InfrastructureSystems ~/.julia/packages/InfrastructureSystems/lYELp/src/system_data.jl:448\n", "┌ Warning: no component category=Generator name=WindBusA\n", "└ @ InfrastructureSystems ~/.julia/packages/InfrastructureSystems/lYELp/src/system_data.jl:448\n", "[ Info: Serialized time series data to /Users/cbarrows/.julia/packages/PowerSystemCaseBuilder/1xViZ/data/serialized_system/ForecastOnly/5_bus_hydro_ed_sys_time_series_storage.h5.\n", "[ Info: Serialized System to /Users/cbarrows/.julia/packages/PowerSystemCaseBuilder/1xViZ/data/serialized_system/ForecastOnly/5_bus_hydro_ed_sys.json\n" ] }, { "output_type": "execute_result", "data": { "text/plain": "System\n======\nSystem Units Base: DEVICE_BASE\nBase Power: 100.0\nBase Frequency: 60.0\n\nComponents\n==========\nNum components: 35\n\n\u001b[1m12×3 DataFrame\u001b[0m\n\u001b[1m Row \u001b[0m│\u001b[1m ConcreteType \u001b[0m\u001b[1m SuperTypes \u001b[0m\u001b[1m Count \u001b[0m\n\u001b[1m \u001b[0m│\u001b[90m String \u001b[0m\u001b[90m String \u001b[0m\u001b[90m Int64 \u001b[0m\n─────┼──────────────────────────────────────────────────────────────────────\n 1 │ Arc Topology <: Component <: Infrast… 6\n 2 │ Area AggregationTopology <: Topology … 2\n 3 │ Bus Topology <: Component <: Infrast… 5\n 4 │ HydroDispatch HydroGen <: Generator <: StaticI… 1\n 5 │ HydroEnergyReservoir HydroGen <: Generator <: StaticI… 2\n 6 │ HydroPumpedStorage HydroGen <: Generator <: StaticI… 1\n 7 │ Line ACBranch <: Branch <: Device <: … 5\n 8 │ LoadZone AggregationTopology <: Topology … 2\n 9 │ PowerLoad StaticLoad <: ElectricLoad <: St… 3\n 10 │ TapTransformer ACBranch <: Branch <: Device <: … 2\n 11 │ ThermalStandard ThermalGen <: Generator <: Stati… 5\n 12 │ VariableReserve{ReserveUp} Reserve{ReserveUp} <: Service <:… 1\n\nTimeSeriesContainer\n===================\nComponents with time series data: 6\nTotal StaticTimeSeries: 12\nTotal Forecasts: 12\nResolution: 60 minutes\nFirst initial time: 2020-01-01T00:00:00\nLast initial time: 2020-03-24T12:00:00\nHorizon: 12\nInterval: 60 minutes\nForecast window count: 2005\n", "text/html": [ "

System

\n", "

Base Power: 100.0

\n", "

Components

\n", "

Num components: 35

\n", "

12 rows × 3 columns

ConcreteTypeSuperTypesCount
StringStringInt64
1ArcTopology <: Component <: InfrastructureSystemsComponent <: InfrastructureSystemsType <: Any6
2AreaAggregationTopology <: Topology <: Component <: InfrastructureSystemsComponent <: InfrastructureSystemsType <: Any2
3BusTopology <: Component <: InfrastructureSystemsComponent <: InfrastructureSystemsType <: Any5
4HydroDispatchHydroGen <: Generator <: StaticInjection <: Device <: Component <: InfrastructureSystemsComponent <: InfrastructureSystemsType <: Any1
5HydroEnergyReservoirHydroGen <: Generator <: StaticInjection <: Device <: Component <: InfrastructureSystemsComponent <: InfrastructureSystemsType <: Any2
6HydroPumpedStorageHydroGen <: Generator <: StaticInjection <: Device <: Component <: InfrastructureSystemsComponent <: InfrastructureSystemsType <: Any1
7LineACBranch <: Branch <: Device <: Component <: InfrastructureSystemsComponent <: InfrastructureSystemsType <: Any5
8LoadZoneAggregationTopology <: Topology <: Component <: InfrastructureSystemsComponent <: InfrastructureSystemsType <: Any2
9PowerLoadStaticLoad <: ElectricLoad <: StaticInjection <: Device <: Component <: InfrastructureSystemsComponent <: InfrastructureSystemsType <: Any3
10TapTransformerACBranch <: Branch <: Device <: Component <: InfrastructureSystemsComponent <: InfrastructureSystemsType <: Any2
11ThermalStandardThermalGen <: Generator <: StaticInjection <: Device <: Component <: InfrastructureSystemsComponent <: InfrastructureSystemsType <: Any5
12VariableReserve{ReserveUp}Reserve{ReserveUp} <: Service <: Component <: InfrastructureSystemsComponent <: InfrastructureSystemsType <: Any1
\n", "\n", "

TimeSeriesContainer

\n", "

Components with time series data: 6

\n", "

Total StaticTimeSeries: 12

\n", "

Total Forecasts: 12

\n", "

Resolution: 60 minutes

\n", "

First initial time: 2020-01-01T00:00:00

\n", "

Last initial time: 2020-03-24T12:00:00

\n", "

Horizon: 12

\n", "

Interval: 60 minutes

\n", "

Forecast window count: 2005

\n" ] }, "metadata": {}, "execution_count": 5 } ], "cell_type": "code", "source": [ "sys = build_system(SIIPExampleSystems, \"5_bus_hydro_ed_sys\")" ], "metadata": {}, "execution_count": 5 }, { "cell_type": "markdown", "source": [ "---\n", "\n", "*This notebook was generated using [Literate.jl](https://github.com/fredrikekre/Literate.jl).*" ], "metadata": {} } ], "nbformat_minor": 3, "metadata": { "language_info": { "file_extension": ".jl", "mimetype": "application/julia", "name": "julia", "version": "1.5.4" }, "kernelspec": { "name": "julia-1.5", "display_name": "Julia 1.5.4", "language": "julia" } }, "nbformat": 4 }