PowerSystems.jl Documentation
repository·main·Indexed 18 days ago
https://github.com/sienna-platform/powersystems.jlA rigorous data modeling package for power systems analysis providing core data structures for the Sienna Platform ecosystem, including PowerSimulations.jl and PowerSimulationsDynamics.jl. It supports a wide range of device data (generators, transmission, HVDC, storage, loads), parsing for MATPOWER, PSS/e, and RTS-GMLC formats, and a two-layer architecture separating static components from dynamic components. Requires Julia v1.6+.
What's inside PowerSystems.jl
- PowerSystems.jl provides a rigorous data model using Julia structures for power systems analysis and modeling. It serves as the foundational data container for other Sienna Platform packages, specifically PowerSimulations.jl and PowerSimulationsDynamics.jl.
What is MarketBidCost and how to use it
mainAMarketBidCostis anOperationalCostdata structure designed to model production costs similar to US electricity market auctions. It allows for joint bidding of energy and ancillary services. You can use it to define incremental or decremental offer curves, either as static curves or as time-varying data usingTimeSeriesData.What is a `System`?
mainA
Systemis the central data container inPowerSystems.jl. It acts as a registry that holds allComponentobjects (representing physical or logical elements like generators or buses) and references to their associated time series data.Data Storage Model:
PowerSystems.jluses a hybrid storage approach to manage memory efficiently:- Volatile Memory: Stores component data and time series references.
- HDF5 File: Stores the actual time series data.
This design ensures that only the relevant portions of data are loaded during a query, preventing high memory overhead when working with large datasets.
What is a `Component`?
mainA
Componentis any element within a power system model, such as generators, loads, buses, transmission lines, or services. Components are organized into an abstract type hierarchy based on their role in the system.Ownership Constraint: A component instance can belong to at most one
Systemat a time. If you attempt to add a component to a secondSystemwithout first removing it from its originalSystem, an error will be raised. This prevents silent aliasing and ensures unambiguous data ownership.Requirements for serializing custom components
mainTo support serialization and de-serialization of custom components, your struct must meet these criteria:
- Subtyping: Your struct should be a subtype of
PowerSystems.Component(which is a subtype ofInfrastructureSystemsType). This ensuresInfrastructureSystemshandles theserializeanddeserializemethods automatically. - Field Compatibility: All struct fields must be JSON-encodable (numbers, strings, arrays, or dictionaries of these) or handled by custom
serialize/deserializemethods. - Constructor: Structs relying on the default
deserializemethod must have a keyword-only constructor, as the deserialization process splats dictionary key/value pairs into the constructor. - Component References: If a struct contains other
PowerSystems.jlcomponents, you must serialize those components as UUIDs rather than actual values. This allows the deserializer to restore references to existing objects rather than creating duplicate copies.
Troubleshooting Serialization
- Abstract Fields: If a field is defined as an abstract type, the deserializer won't know which concrete type to build. Solution: Encode the concrete type name as a string in the serialized dictionary.
- Parameterized Abstract Fields: If a field is an abstract type but the struct is parameterized on a concrete type. Solution: Extract the concrete type from the serialized type information in a custom
deserializemethod.
- Subtyping: Your struct should be a subtype of
Use Forecasts for predicted data
mainForecasts are used for simulation with receding horizons. They are defined by a resolution (time between steps in the horizon), an interval (time between forecast updates), and a horizon (number of forecasted values).
PowerSystems.jlprovides three specific types of forecast structs:Deterministic: A point forecast containing only predicted values without uncertainty.Probabilistic: Stores discretized cumulative distribution functions (CDFs) or probability distribution functions (PDFs) for each time step.Scenarios: Stores a set of probable trajectories, where each trajectory is assumed to have equal probability.
Understand the PowerSystems.jl type hierarchy
mainThe
PowerSystems.jllibrary uses a structured type hierarchy to categorize different components of a power system. You can explore the complete tree of types by using theTypeTreeutility within a Julia environment. This hierarchy is organized around a root type (such asInfrastructureSystemsType) and branches out into specific system components.using PowerSystems # To visualize the hierarchy, you can use the TypeTree utility # (Note: This requires the TypeTree package and specific doc utilities) import TypeTree: tt # Example of printing the hierarchy under InfrastructureSystemsType print(join(tt(PowerSystems.IS.InfrastructureSystemsType), ""))Use RenewableGenerationCost for modeling renewable energy costs
mainTheRenewableGenerationCosttype is used to model the cost functions associated with renewable generation assets. It is part of thePowerSystemsmodule and is typically used to define how much it costs to operate or dispatch renewable resources within a power system model.Supported device data in PowerSystems.jl
mainPowerSystems.jl supports a wide range of device data types for modeling power systems, including:
- Generators: Thermal, Renewable, and Hydro
- Transmission: Lines, Transformers, DC Lines, and Phase Shifting Transformers
- HVDC: TwoTerminal and Multiterminal HVDC
- Topological elements: Buses, Arcs, and Areas
- Storage: Batteries
- Load: Static and Curtailable
- Services: Reserves and Transfers
- TimeSeries: Deterministic, Scenarios, and Probabilistic
- Dynamic Models: Dynamic Generators and Dynamic Inverters
Model hydro reservoir topology
mainIn
PowerSystems.jl, hydro reservoir topology is used to define the source and destination of water for hydropower units. This is achieved by linkingHydroReservoircomponents toHydroTurbineorHydroPumpTurbineunits through explicit component relationships.Key distinction:
- Reservoir topology describes where water comes from (the hydraulic connection).
- Penstock grouping (using the
HydroPowerPlantsupplemental attribute) describes which units share the same intake pipe for plant-level constraints.
Elevations defined on the reservoir and turbine structs are used to support head calculations for downstream simulation packages.
Update AC transmission type hierarchy in PowerSystems v5
mainIn PowerSystems v5, a new abstract typeACTransmissionhas been introduced to better distinguish between AC transmission objects connected betweenACBusobjects. Additionally, a newTwoTerminalHVDCabstract type was added to capture HVDC links connected betweenACBusobjects.Understand the role of PowerSystems.jl in the Sienna ecosystem
mainPowerSystems.jlprovides a rigorous data model using Julia structures for electric energy systems modeling. It is designed to be agnostic to specific mathematical models and serves as the foundation for the following Sienna applications:- Sienna\Data: Efficient data input, analysis, and transformation.
- Sienna\Ops: System scheduling simulations via optimization problems.
- Sienna\Dyn: System transient analysis (small signal stability and full system dynamic simulations).
Key capabilities include:
- An extensible library of data structures for modeling.
- Parsing tools for common formats like PSS/e (
.raw,.dyr),MATPOWER, and configurable tabular data (e.g., CSV). - Optimized containers for component data and time series with support for serialization and validation.