Public API Reference
Modeling
PowerSystems.PowerSystems
— ModuleModule for constructing self-contained power system objects.
PowerSystems.Component
— TypeSupertype for all PowerSystems components. All subtypes must include a InfrastructureSystemsInternal member. Subtypes should call InfrastructureSystemsInternal() by default, but also must provide a constructor that allows existing values to be deserialized.
PowerSystems.Device
— TypeSupertype for "devices" (bus, line, etc.)
PowerSystems.ACBranch
— TypeSupertype for all AC branches (branches connecting at least one AC node)
PowerSystems.Branch
— TypeSupertype for all branches
PowerSystems.DCBranch
— TypeSupertype for all DC branches (branches that connect only DC nodes)
PowerSystems.get_base_power
— Methodget_base_power(c::Component) -> Float64
Default behavior of a component. If there is no base_power field, assume is in the system's base power.
PowerSystems.set_dynamic_injector!
— Methodset_dynamic_injector!(
static_injector::StaticInjection,
dynamic_injector::Union{Nothing, DynamicInjection}
)
Any StaticInjection struct that wants to support dynamic injectors must implement this method to set the value.
The method is only for internal uses.
PowerSystems.clear_services!
— Methodclear_services!(device::Device)
Remove all services attached to the device.
PowerSystems.has_service
— Methodhas_service(device::Device, service::Service) -> Bool
Return true if the service is attached to the device.
PowerSystems.has_service
— Methodhas_service(device::Device, _::Type{T<:Service}) -> Bool
Return true if a service with type T is attached to the device.
PowerSystems.remove_service!
— Methodremove_service!(device::Device, service::Service)
Remove a service from a device.
Throws ArgumentError if the service is not attached to the device.
PowerSystems.ControllableLoad
— TypeSupertype for all controllable loads
PowerSystems.ElectricLoad
— TypeSupertype for all electric loads
PowerSystems.StaticLoad
— TypeSupertype for all static electric loads
PowerSystems.Generator
— TypeSupertype for all generation technologies
PowerSystems.HydroGen
— TypeSupertype for all Hydropower generation technologies
PowerSystems.RenewableGen
— TypeSupertype for all renewable generation technologies
Requires the implementation of get_rating
and get_power_factor
methods
PowerSystems.ThermalGen
— TypeSupertype for all Thermal generation technologies
PowerSystems.get_max_active_power
— Methodget_max_active_power(d::RenewableGen) -> Any
Return the max active power for the Renewable Generation calculated as the rating
* power_factor
PowerSystems.get_max_reactive_power
— Methodget_max_reactive_power(d::RenewableGen) -> Any
Return the max reactive power for the Renewable Generation calculated as the rating
* sin(acos(power_factor
))
PowerSystems.Reserve
— TypeA reserve product to be able to respond to unexpected disturbances, such as the sudden loss of a transmission line or generator.
PowerSystems.ReserveDirection
— TypeUsed to specify if a Reserve
is upwards, downwards, or symmetric
PowerSystems.ReserveDown
— TypeA downwards reserve to decrease generation or increase load
Downwards reserves are used when total load falls below its expected level, typically due to forecast errors or contingencies. Not work
A Reserve
can be specified as a ReserveDown
when it is defined.
PowerSystems.ReserveSymmetric
— TypeA symmetric reserve, procuring the same quantity (MW) of both upwards and downwards reserves
A symmetric reserve is a special case. ReserveUp
and ReserveDown
can be used individually to specify different quantities of upwards and downwards reserves, respectively.
A Reserve
can be specified as a ReserveSymmetric
when it is defined.
PowerSystems.ReserveUp
— TypeAn upwards reserve to increase generation or reduce load
Upwards reserves are used when total load exceeds its expected level, typically due to forecast errors or contingencies.
A Reserve
can be specified as a ReserveUp
when it is defined.
PowerSystems.Storage
— TypeSupertype for energy storage technologies
PowerSystems.Service
— TypeSupertype for all system services
Services (or ancillary services) include additional requirements and support to ensure reliable electricity service to customers. Common services are reserve products to be able to respond quickly to unexpected disturbances, such as the sudden loss of a transmission line or generator.
PowerSystems.GeometricDistributionForcedOutage
— TypeAttribute that contains information regarding forced outages where the transition probabilities are modeled with geometric distributions. The outage probabilities and recovery probabilities can be modeled as time series.
Arguments
time_to_recovery::Int
: Time elapsed to recovery after a failure in Milliseconds.outage_transition_probability::Float64
: Characterizes the probability of failure (1 - p) in the geometric distribution.internal::InfrastructureSystemsInternal
: power system internal reference, do not modify
PowerSystems.PlannedOutage
— TypeAttribute that contains information regarding planned outages.
Arguments
outage_schedule::String
: String name of the time series used for the scheduled outagesinternal::InfrastructureSystemsInternal
: power system internal reference, do not modify
PowerSystems.TimeSeriesForcedOutage
— TypeAttribute that contains the representation of the status of the component forced outage. The data can be obtained from the simulation of an stochastic process or historical information.
Arguments
outage_status_scenario::String
: String name of the time series used for the forced outage status in the model. 1 is used represent outaged and 0 for available.internal::InfrastructureSystemsInternal
: power system internal reference, do not modify
PowerSystems.get_mean_time_to_recovery
— Methodget_mean_time_to_recovery(
value::GeometricDistributionForcedOutage
) -> Float64
Get GeometricDistributionForcedOutage
time_to_recovery
.
PowerSystems.get_outage_schedule
— Methodget_outage_schedule(value::PlannedOutage) -> String
Get PlannedOutage
outage_schedule
.
PowerSystems.get_outage_transition_probability
— Methodget_outage_transition_probability(
value::GeometricDistributionForcedOutage
) -> Float64
Get GeometricDistributionForcedOutage
outage_transition_probability
.
PowerSystems.AggregationTopology
— TypeRepresents a geographical region of system components.
All subtypes must implement the method get_aggregation_topology_accessor
.
PowerSystems.Bus
— TypeAbstract type to represent any type of Bus, AC or DC.
PowerSystems.Topology
— TypeAbstract type to represent the structure and interconnectedness of the system
PowerSystems.get_aggregation_topology_accessor
— Methodget_aggregation_topology_accessor(
_::Type{T<:AggregationTopology}
) -> typeof(get_load_zone)
Return the method to be called on a ACBus to get its AggregationTopology value for this type.
PowerSystems.StaticInjection
— TypeAbstract type for devices that inject power or current
A static injection is a steady state injection, such as modeling the output power of a generator held constant over a five-minute period.
Many StaticInjection
models can accept a DynamicInjection
model as an optional add-on for conducting dynamic simulations.
PowerSystems.add_component_to_subsystem!
— Methodadd_component_to_subsystem!(
sys::System,
subsystem_name::AbstractString,
component::Component
)
Add a component to a subsystem.
PowerSystems.add_subsystem!
— Methodadd_subsystem!(sys::System, subsystem_name::AbstractString)
Add a new subsystem to the system.
PowerSystems.get_assigned_subsystems
— Methodget_assigned_subsystems(
sys::System,
component::Component
) -> Vector
Return a Vector of subsystem names that contain the component.
PowerSystems.get_num_subsystems
— Methodget_num_subsystems(sys::System) -> Int64
Return the number of subsystems stored in the system.
PowerSystems.get_subsystem_components
— Methodget_subsystem_components(
sys::System,
subsystem_name::AbstractString
) -> Base.Generator{Set{Base.UUID}, InfrastructureSystems.var"#419#420"{InfrastructureSystems.SystemData}}
Return a Generator of all components in the subsystem.
Throws ArgumentError if the subsystem name is not stored.
PowerSystems.get_subsystems
— Methodget_subsystems(
sys::System
) -> Base.KeySet{String, Dict{String, Set{Base.UUID}}}
Return an iterator of all subsystem names in the system.
PowerSystems.has_component
— Methodhas_component(
sys::System,
subsystem_name::AbstractString,
component::Component
) -> Bool
Return true if the component is in the subsystem.
PowerSystems.has_subsystems
— Methodhas_subsystems(sys::System) -> Bool
Return true if the system has one or more subsystems.
PowerSystems.is_assigned_to_subsystem
— Methodis_assigned_to_subsystem(
sys::System,
component::Component,
subsystem_name::AbstractString
) -> Bool
Return true if the component is assigned to the subsystem.
PowerSystems.is_assigned_to_subsystem
— Methodis_assigned_to_subsystem(
sys::System,
component::Component
) -> Bool
Return true if the component is assigned to any subsystems.
PowerSystems.remove_component_from_subsystem!
— Methodremove_component_from_subsystem!(
sys::System,
subsystem_name::AbstractString,
component::Component
)
Remove a component from a subsystem.
Throws ArgumentError if the subsystem name or component is not stored.
PowerSystems.remove_subsystem!
— Methodremove_subsystem!(
sys::System,
subsystem_name::AbstractString
)
Remove a subsystem from the system.
Throws ArgumentError if the subsystem name is not stored.
PowerSystems.StaticInjectionSubsystem
— TypeAbstract type for a subsystem that contains multiple instances of StaticInjection
Subtypes must implement:
- get_subcomponents(subsystem::StaticInjectionSubsystem)
The subcomponents in subtypes must be attached to the System as masked components.
PowerSystems.copy_subcomponent_time_series!
— Methodcopy_subcomponent_time_series!(
subsystem::StaticInjectionSubsystem,
subcomponent::Component
)
Efficiently add all time series data in the subcomponent to the subsystem by copying the underlying references.
PowerSystems.DynamicComponent
— TypeAbstract type for all components used to compose a DynamicInjection
device
PowerSystems.DynamicInjection
— TypeAbstract type for all Dynamic Devices
A dynamic injection is the continuous time response of a generator, typically modeled with differential equations.
DynamicInjection
components can added on to StaticInjection
components, which together define all the information needed to model the device in a dynamic simulation.
PowerSystems.get_dynamic_components
— Methodget_dynamic_components(
device::DynamicInjection
) -> Base.Generator{I, F} where {I<:(Base.Iterators.Filter{PowerSystems.var"#6#8", I} where I<:(Base.Iterators.Zip{Is} where Is<:Tuple{Any, Tuple})), F<:(PowerSystems.var"#5#7"{<:DynamicInjection})}
Return all the dynamic components of a DynamicInjection
device
PowerSystems.get_states_types
— Methodget_states_types(d::DynamicComponent) -> Vector{StateTypes}
Default implementation of get_state_types for dynamic components. Assumes all states are
Differential
PowerSystems.OperationalCost
— TypeSupertype for operational cost representations
Current concrete types include:
InfrastructureSystems.get_fuel_cost
— Methodget_fuel_cost(
component::StaticInjection;
start_time,
len
) -> Union{Float64, TimeSeries.TimeArray}
Get the fuel cost of the component's variable cost, which must be a FuelCurve
.
PowerSystems.get_decremental_initial_input
— Methodget_decremental_initial_input(
device::StaticInjection,
cost::MarketBidCost;
start_time,
len
) -> Union{Nothing, TimeSeries.TimeArray}
Retrieve the decremental_initial_input
for a StaticInjection
device with a MarketBidCost
.
PowerSystems.get_decremental_offer_curves
— Methodget_decremental_offer_curves(
device::StaticInjection,
cost::MarketBidCost;
start_time,
len
) -> Union{CostCurve{PiecewiseIncrementalCurve}, TimeSeries.TimeArray}
Retrieve the decremental_offer_curves
for a StaticInjection
device with a MarketBidCost
. If this field is a time series, the user may specify start_time
and len
and the function returns a TimeArray
of Float64
s; if the field is not a time series, the function returns a single Float64
or Nothing
.
PowerSystems.get_decremental_variable_cost
— Methodget_decremental_variable_cost(
device::StaticInjection,
cost::MarketBidCost;
start_time,
len
) -> Any
Retrieve the variable cost bid for a StaticInjection
device with a MarketBidCost
. If any of the relevant fields (decremental_offer_curves
, initial_input
, no_load_cost
) are time series, the user may specify start_time
and len
and the function returns a TimeArray
of CostCurve
s; if the field is not a time series, the function returns a single CostCurve
.
PowerSystems.get_incremental_initial_input
— Methodget_incremental_initial_input(
device::StaticInjection,
cost::MarketBidCost;
start_time,
len
) -> Union{Nothing, TimeSeries.TimeArray}
Retrieve the incremental_initial_input
for a StaticInjection
device with a MarketBidCost
.
PowerSystems.get_incremental_offer_curves
— Methodget_incremental_offer_curves(
device::StaticInjection,
cost::MarketBidCost;
start_time,
len
) -> Union{CostCurve{PiecewiseIncrementalCurve}, TimeSeries.TimeArray}
Retrieve the incremental_offer_curves
for a StaticInjection
device with a MarketBidCost
. If this field is a time series, the user may specify start_time
and len
and the function returns a TimeArray
of Float64
s; if the field is not a time series, the function returns a single Float64
or Nothing
.
PowerSystems.get_incremental_variable_cost
— Methodget_incremental_variable_cost(
device::StaticInjection,
cost::MarketBidCost;
start_time,
len
) -> Any
Retrieve the variable cost bid for a StaticInjection
device with a MarketBidCost
. If any of the relevant fields (incremental_offer_curves
, initial_input
, no_load_cost
) are time series, the user may specify start_time
and len
and the function returns a TimeArray
of CostCurve
s; if the field is not a time series, the function returns a single CostCurve
.
PowerSystems.get_no_load_cost
— Methodget_no_load_cost(
device::StaticInjection,
cost::MarketBidCost;
start_time,
len
) -> Any
Retrieve the no-load cost data for a StaticInjection
device with a MarketBidCost
. If this field is a time series, the user may specify start_time
and len
and the function returns a TimeArray
of Float64
s; if the field is not a time series, the function returns a single Float64
or Nothing
.
PowerSystems.get_services_bid
— Methodget_services_bid(
device::StaticInjection,
cost::MarketBidCost,
service::Service;
start_time,
len
) -> TimeSeries.TimeArray
Return service bid time series data for a StaticInjection
device with a MarketBidCost
. The user may specify start_time
and len
and the function returns a TimeArray
of CostCurve
s.
PowerSystems.get_start_up
— Methodget_start_up(
device::StaticInjection,
cost::MarketBidCost;
start_time,
len
) -> Union{@NamedTuple{hot::Float64, warm::Float64, cold::Float64}, TimeSeries.TimeArray}
Retrieve the startup cost data for a StaticInjection
device with a MarketBidCost
. If this field is a time series, the user may specify start_time
and len
and the function returns a TimeArray
of Float64
s; if the field is not a time series, the function returns a single Float64
.
PowerSystems.get_variable_cost
— Methodget_variable_cost(
service::ReserveDemandCurve;
start_time,
len
) -> Union{CostCurve{PiecewiseIncrementalCurve}, TimeSeries.TimeArray}
Retrieve the variable cost data for a ReserveDemandCurve
. The user may specify start_time
and len
and the function returns a TimeArray
of CostCurve
s.
PowerSystems.get_variable_cost
— Methodget_variable_cost(
device::StaticInjection,
cost::MarketBidCost;
start_time,
len
) -> Any
Retrieve the variable cost bid for a StaticInjection
device with a MarketBidCost
. If any of the relevant fields (incremental_offer_curves
, initial_input
, no_load_cost
) are time series, the user may specify start_time
and len
and the function returns a TimeArray
of CostCurve
s; if the field is not a time series, the function returns a single CostCurve
.
PowerSystems.set_decremental_initial_input!
— Methodset_decremental_initial_input!(
sys::System,
component::StaticInjection,
data::Union{Float64, TimeSeriesData}
) -> TimeSeriesKey
Set the decremental_initial_input
for a StaticInjection
device with a MarketBidCost
to either a scalar or a time series.
Arguments
sys::System
: PowerSystem Systemcomponent::StaticInjection
: Static injection devicetime_series_data::Union{Float64, IS.TimeSeriesData},
: the data. If a time series, must be of eltypeFloat64
.
PowerSystems.set_decremental_variable_cost!
— Methodset_decremental_variable_cost!(
sys::System,
component::StaticInjection,
data::Union{Nothing, CostCurve{PiecewiseIncrementalCurve}, TimeSeriesData},
power_units::UnitSystem
)
Set the decremental variable cost bid for a StaticInjection
device with a MarketBidCost
.
Arguments
sys::System
: PowerSystem Systemcomponent::StaticInjection
: Static injection devicetime_series_data::Union{Nothing, IS.TimeSeriesData, CostCurve{PiecewiseIncrementalCurve}},
: the data. If using a time series, must be of eltypePiecewiseStepData
.PiecewiseIncrementalCurve
is only accepted for single CostCurve and not accepted for time series data.power_units::UnitSystem
: Units to be used for data.
PowerSystems.set_fuel_cost!
— Methodset_fuel_cost!(
sys::System,
component::StaticInjection,
data::Union{Float64, TimeSeriesData}
) -> Any
Set the fuel cost of the component's variable cost, which must be a FuelCurve
.
PowerSystems.set_incremental_initial_input!
— Methodset_incremental_initial_input!(
sys::System,
component::StaticInjection,
data::Union{Float64, TimeSeriesData}
) -> TimeSeriesKey
Set the incremental_initial_input
for a StaticInjection
device with a MarketBidCost
to either a scalar or a time series.
Arguments
sys::System
: PowerSystem Systemcomponent::StaticInjection
: Static injection devicetime_series_data::Union{Float64, IS.TimeSeriesData},
: the data. If a time series, must be of eltypeFloat64
.
PowerSystems.set_incremental_variable_cost!
— Methodset_incremental_variable_cost!(
sys::System,
component::StaticInjection,
data::Union{Nothing, CostCurve{PiecewiseIncrementalCurve}, TimeSeriesData},
power_units::UnitSystem
)
Set the incremental variable cost bid for a StaticInjection
device with a MarketBidCost
.
Arguments
sys::System
: PowerSystem Systemcomponent::StaticInjection
: Static injection devicetime_series_data::Union{Nothing, IS.TimeSeriesData, CostCurve{PiecewiseIncrementalCurve}},
: the data. If using a time series, must be of eltypePiecewiseStepData
.PiecewiseIncrementalCurve
is only accepted for single CostCurve and not accepted for time series data.power_units::UnitSystem
: Units to be used for data.
PowerSystems.set_no_load_cost!
— Methodset_no_load_cost!(
sys::System,
component::StaticInjection,
data::Union{Float64, TimeSeriesData}
) -> Union{Float64, TimeSeriesKey}
Set the no-load cost for a StaticInjection
device with a MarketBidCost
to either a scalar or a time series.
Arguments
sys::System
: PowerSystem Systemcomponent::StaticInjection
: Static injection devicetime_series_data::Union{Float64, IS.TimeSeriesData},
: the data. If a time series, must be of eltypeFloat64
.
PowerSystems.set_service_bid!
— Methodset_service_bid!(
sys::System,
component::StaticInjection,
service::Service,
time_series_data::TimeSeriesData,
power_units::UnitSystem
)
Adds service bids time-series data to the MarketBidCost.
Arguments
sys::System
: PowerSystem Systemcomponent::StaticInjection
: Static injection deviceservice::Service,
: Service for which the device is eligible to contributetime_series_data::IS.TimeSeriesData
: TimeSeriesData
PowerSystems.set_start_up!
— Methodset_start_up!(
sys::System,
component::StaticInjection,
data::Union{@NamedTuple{hot::Float64, warm::Float64, cold::Float64}, TimeSeriesData}
) -> Union{@NamedTuple{hot::Float64, warm::Float64, cold::Float64}, TimeSeriesKey}
Set the startup cost for a StaticInjection
device with a MarketBidCost
to either a single StartUpStages
or a time series.
Arguments
sys::System
: PowerSystem Systemcomponent::StaticInjection
: Static injection devicetime_series_data::Union{StartUpStages, IS.TimeSeriesData},
: the data. If a time series, must be of eltypeNTuple{3, Float64}
.
PowerSystems.set_variable_cost!
— Methodset_variable_cost!(
_::System,
component::ReserveDemandCurve,
data::CostCurve{PiecewiseIncrementalCurve}
) -> CostCurve{PiecewiseIncrementalCurve}
Adds fixed energy market bids to the ReserveDemandCurve.
Arguments
sys::System
: PowerSystem Systemcomponent::ReserveDemandCurve
: the curve- `timeseriesdata::CostCurve{PiecewiseIncrementalCurve}
PowerSystems.set_variable_cost!
— Methodset_variable_cost!(
sys::System,
component::ReserveDemandCurve,
data::Union{Nothing, TimeSeriesData}
) -> TimeSeriesKey
Adds energy market bids time-series to the ReserveDemandCurve.
Arguments
sys::System
: PowerSystem Systemcomponent::ReserveDemandCurve
: the curvetime_series_data::IS.TimeSeriesData
: TimeSeriesData
PowerSystems.set_variable_cost!
— Methodset_variable_cost!(
sys::System,
component::StaticInjection,
data::Union{Nothing, CostCurve{PiecewiseIncrementalCurve}, TimeSeriesData},
power_units::UnitSystem
)
Set the incremental variable cost bid for a StaticInjection
device with a MarketBidCost
.
Arguments
sys::System
: PowerSystem Systemcomponent::StaticInjection
: Static injection devicetime_series_data::Union{Nothing, IS.TimeSeriesData, CostCurve{PiecewiseIncrementalCurve}},
: the data. If using a time series, must be of eltypePiecewiseStepData
.PiecewiseIncrementalCurve
is only accepted for single CostCurve and not accepted for time series data.power_units::UnitSystem
: Units to be used for data. Must be NATURAL_UNITS.
Operating Costs
InfrastructureSystems.CostCurve
— Typestruct CostCurve{T<:ValueCurve} <: ProductionVariableCostCurve{T<:ValueCurve}
value_curve::ValueCurve
: The underlyingValueCurve
representation of thisProductionVariableCostCurve
power_units::UnitSystem
: (default: natural units (MW)) The units for the x-axis of the curvevom_cost::LinearCurve
: (default of 0) Additional proportional Variable Operation and Maintenance Cost in /(power_unit h), represented as aLinearCurve
CostCurve(value_curve, power_units, vom_cost)
CostCurve(; value_curve, power_units, vom_cost)
Direct representation of the variable operation cost of a power plant in currency. Composed of a ValueCurve
that may represent input-output, incremental, or average rate data. The default units for the x-axis are MW and can be specified with power_units
.
InfrastructureSystems.FuelCurve
— Typestruct FuelCurve{T<:ValueCurve} <: ProductionVariableCostCurve{T<:ValueCurve}
value_curve::ValueCurve
: The underlyingValueCurve
representation of thisProductionVariableCostCurve
power_units::UnitSystem
: (default: natural units (MW)) The units for the x-axis of the curvefuel_cost::Union{Float64, TimeSeriesKey}
: Either a fixed value for fuel cost or theTimeSeriesKey
to a fuel cost time seriesvom_cost::LinearCurve
: (default of 0) Additional proportional Variable Operation and Maintenance Cost in /(power_unit h) represented as aLinearCurve
FuelCurve(value_curve, power_units, fuel_cost, vom_cost)
FuelCurve(value_curve, fuel_cost)
FuelCurve(value_curve, fuel_cost, vom_cost)
FuelCurve(value_curve, power_units, fuel_cost)
FuelCurve(; value_curve, power_units, fuel_cost, vom_cost)
Representation of the variable operation cost of a power plant in terms of fuel (MBTU, liters, m^3, etc.), coupled with a conversion factor between fuel and currency. Composed of a ValueCurve
that may represent input-output, incremental, or average rate data. The default units for the x-axis are MW and can be specified with power_units
.
InfrastructureSystems.get_fuel_cost
— Methodget_fuel_cost(
cost::FuelCurve
) -> Union{Float64, TimeSeriesKey}
Get the fuel cost or the name of the fuel cost time series
InfrastructureSystems.get_function_data
— Methodget_function_data(cost::ProductionVariableCostCurve) -> Any
Get the FunctionData
representation of this ProductionVariableCostCurve
's ValueCurve
InfrastructureSystems.get_initial_input
— Methodget_initial_input(
cost::ProductionVariableCostCurve
) -> Union{Nothing, Float64}
Get the initial_input
field of this ProductionVariableCostCurve
's ValueCurve
(not defined for input-output data)
InfrastructureSystems.get_power_units
— Methodget_power_units(cost::ProductionVariableCostCurve) -> Any
Get the units for the x-axis of the curve
InfrastructureSystems.get_value_curve
— Methodget_value_curve(cost::ProductionVariableCostCurve) -> Any
Get the underlying ValueCurve
representation of this ProductionVariableCostCurve
InfrastructureSystems.get_vom_cost
— Methodget_vom_cost(cost::ProductionVariableCostCurve) -> Any
Get the variable operation and maintenance cost in currency/(power_units h)
InfrastructureSystems.is_convex
— Methodis_convex(cost::ProductionVariableCostCurve) -> Any
Calculate the convexity of the underlying data
InfrastructureSystems.LinearCurve
— TypeLinearCurve(proportional_term::Float64)
LinearCurve(proportional_term::Float64, constant_term::Float64)
A linear input-output curve, representing a constant marginal rate. May have zero no-load cost (i.e., constant average rate) or not.
Arguments
proportional_term::Float64
: marginal rateconstant_term::Float64
: optional, cost at zero production, defaults to0.0
InfrastructureSystems.PiecewiseAverageCurve
— TypePiecewiseAverageCurve(initial_input::Union{Float64, Nothing}, x_coords::Vector{Float64}, slopes::Vector{Float64})
A piecewise linear curve specified by average rates between production points. May have nonzero initial value.
Arguments
initial_input::Union{Float64, Nothing}
: cost at minimum production pointfirst(x_coords)
(NOT at zero production), defines the start of the curvex_coords::Vector{Float64}
: vector ofn
production pointsslopes::Vector{Float64}
: vector ofn-1
average rates/slopes of the curve segments between the points
InfrastructureSystems.PiecewiseIncrementalCurve
— TypePiecewiseIncrementalCurve(initial_input::Union{Float64, Nothing}, x_coords::Vector{Float64}, slopes::Vector{Float64})
PiecewiseIncrementalCurve(input_at_zero::Union{Nothing, Float64}, initial_input::Union{Float64, Nothing}, x_coords::Vector{Float64}, slopes::Vector{Float64})
A piecewise linear curve specified by marginal rates (slopes) between production points. May have nonzero initial value.
Arguments
input_at_zero::Union{Nothing, Float64}
: (optional, defaults tonothing
) cost at zero production, does NOT represent a part of the curveinitial_input::Union{Float64, Nothing}
: cost at minimum production pointfirst(x_coords)
(NOT at zero production), defines the start of the curvex_coords::Vector{Float64}
: vector ofn
production pointsslopes::Vector{Float64}
: vector ofn-1
marginal rates/slopes of the curve segments between the points
InfrastructureSystems.PiecewisePointCurve
— TypePiecewisePointCurve(points::Vector{Tuple{Float64, Float64}})
A piecewise linear curve specified by cost values at production points.
Arguments
points::Vector{Tuple{Float64, Float64}}
or similar: vector of(production, cost)
pairs
InfrastructureSystems.QuadraticCurve
— TypeQuadraticCurve(quadratic_term::Float64, proportional_term::Float64, constant_term::Float64)
A quadratic input-output curve, may have nonzero no-load cost.
Arguments
quadratic_term::Float64
: quadratic term of the curveproportional_term::Float64
: proportional term of the curveconstant_term::Float64
: constant term of the curve
InfrastructureSystems.get_average_rates
— Methodget_average_rates(
vc::PiecewiseAverageCurve
) -> Vector{Float64}
Get the average rates that define the PiecewiseAverageCurve
InfrastructureSystems.get_constant_term
— Methodget_constant_term(vc::LinearCurve) -> Float64
Get the constant term (i.e., intercept) of the LinearCurve
InfrastructureSystems.get_constant_term
— Methodget_constant_term(vc::QuadraticCurve) -> Float64
Get the constant term of the QuadraticCurve
InfrastructureSystems.get_points
— Methodget_points(
vc::PiecewisePointCurve
) -> Vector{@NamedTuple{x::Float64, y::Float64}}
Get the points that define the PiecewisePointCurve
InfrastructureSystems.get_proportional_term
— Methodget_proportional_term(vc::LinearCurve) -> Float64
Get the proportional term (i.e., slope) of the LinearCurve
InfrastructureSystems.get_proportional_term
— Methodget_proportional_term(vc::QuadraticCurve) -> Float64
Get the proportional (i.e., linear) term of the QuadraticCurve
InfrastructureSystems.get_quadratic_term
— Methodget_quadratic_term(vc::QuadraticCurve) -> Float64
Get the quadratic term of the QuadraticCurve
InfrastructureSystems.get_slopes
— Methodget_slopes(vc::PiecewiseIncrementalCurve) -> Vector{Float64}
Fetch the slopes that define the PiecewiseIncrementalCurve
InfrastructureSystems.get_slopes
— Methodget_slopes(vc::PiecewisePointCurve) -> Vector{Float64}
Calculate the slopes of the line segments defined by the PiecewisePointCurve
InfrastructureSystems.get_x_coords
— Methodget_x_coords(vc::PiecewiseAverageCurve) -> Vector{Float64}
Get the x-coordinates that define the PiecewiseAverageCurve
InfrastructureSystems.get_x_coords
— Methodget_x_coords(
vc::PiecewiseIncrementalCurve
) -> Vector{Float64}
Get the x-coordinates that define the PiecewiseIncrementalCurve
InfrastructureSystems.get_x_coords
— Methodget_x_coords(vc::PiecewisePointCurve) -> Vector{Float64}
Get the x-coordinates of the points that define the PiecewisePointCurve
InfrastructureSystems.get_y_coords
— Methodget_y_coords(vc::PiecewisePointCurve) -> Vector{Float64}
Get the y-coordinates of the points that define the PiecewisePointCurve
InfrastructureSystems.AverageRateCurve
— TypeAn average rate curve, relating the production quantity to the average cost rate from the origin: y = f(x)/x
. Can be used, for instance, in the representation of a CostCurve
where x
is MW and y
is currency/MWh, or in the representation of a FuelCurve
where x
is MW and y
is fuel/MWh. Typically calculated by dividing absolute values of cost rate or fuel input rate by absolute values of electric power.
InfrastructureSystems.IncrementalCurve
— TypeAn incremental (or 'marginal') curve, relating the production quantity to the derivative of cost: y = f'(x)
. Can be used, for instance, in the representation of a CostCurve
where x
is MW and y
is currency/MWh, or in the representation of a FuelCurve
where x
is MW and y
is fuel/MWh.
InfrastructureSystems.InputOutputCurve
— TypeAn input-output curve, directly relating the production quantity to the cost: y = f(x)
. Can be used, for instance, in the representation of a CostCurve
where x
is MW and y
is currency/hr, or in the representation of a FuelCurve
where x
is MW and y
is fuel/hr.
InfrastructureSystems.ValueCurve
— TypeSupertype that represents a unitless cost curve
Concrete subtypes are:
InfrastructureSystems.get_function_data
— Methodget_function_data(curve::ValueCurve) -> Any
Get the underlying FunctionData
representation of this ValueCurve
InfrastructureSystems.get_initial_input
— Methodget_initial_input(
curve::Union{AverageRateCurve, IncrementalCurve}
) -> Union{Nothing, Float64}
Get the initial_input
field of this ValueCurve
(not defined for InputOutputCurve
)
InfrastructureSystems.get_input_at_zero
— Methodget_input_at_zero(curve::ValueCurve) -> Any
Get the input_at_zero
field of this ValueCurve
InfrastructureSystems.is_convex
— Methodis_convex(curve::ValueCurve) -> Bool
Calculate the convexity of the underlying data
Time Series
InfrastructureSystems.TimeSeriesData
— TypeAbstract type for time series stored in the system. Components store references to these through TimeSeriesMetadata values so that data can reside on storage media instead of memory.
InfrastructureSystems.Deterministic
— Typemutable struct Deterministic <: AbstractDeterministic
name::String
data::SortedDict
resolution::Dates.Period
scaling_factor_multiplier::Union{Nothing, Function}
internal::InfrastructureSystemsInternal
end
A deterministic forecast for a particular data field in a Component.
Arguments
name::String
: user-defined namedata::SortedDict
: timestamp - scalingfactorresolution::Dates.Period
: forecast resolutionscaling_factor_multiplier::Union{Nothing, Function}
: Applicable when the time series data are scaling factors. Called on the associated component to convert the values.internal::InfrastructureSystemsInternal
InfrastructureSystems.Deterministic
— MethodDeterministic(
name::AbstractString,
input_data::AbstractDict{Dates.DateTime, <:TimeSeries.TimeArray};
normalization_factor,
scaling_factor_multiplier
) -> Deterministic
Construct Deterministic from a Dict of TimeArrays.
Arguments
name::AbstractString
: user-defined nameinput_data::AbstractDict{Dates.DateTime, TimeSeries.TimeArray}
: time series data.normalization_factor::NormalizationFactor = 1.0
: optional normalization factor to apply to each data entryscaling_factor_multiplier::Union{Nothing, Function} = nothing
: If the data are scaling factors then this function will be called on the component and applied to the data whenget_time_series_array
is called.timestamp = :timestamp
: If the values are DataFrames is passed then this must be the column name that contains timestamps.
InfrastructureSystems.Deterministic
— MethodDeterministic(
name::AbstractString,
filename::AbstractString,
component::InfrastructureSystems.InfrastructureSystemsComponent,
resolution::Dates.Period;
normalization_factor,
scaling_factor_multiplier
) -> Deterministic
Construct Deterministic from a CSV file. The first column must be a timestamp in DateTime format and the columns the values in the forecast window.
Arguments
name::AbstractString
: user-defined namefilename::AbstractString
: name of CSV file containing datacomponent::InfrastructureSystemsComponent
: component associated with the datanormalization_factor::NormalizationFactor = 1.0
: optional normalization factor to apply to each data entryscaling_factor_multiplier::Union{Nothing, Function} = nothing
: If the data are scaling factors then this function will be called on the component and applied to the data whenget_time_series_array
is called.
InfrastructureSystems.Deterministic
— MethodDeterministic(
name::AbstractString,
series_data::InfrastructureSystems.RawTimeSeries,
resolution::Dates.Period;
normalization_factor,
scaling_factor_multiplier
) -> Deterministic
Construct Deterministic from RawTimeSeries.
InfrastructureSystems.Deterministic
— MethodDeterministic(
src::Deterministic,
name::AbstractString;
scaling_factor_multiplier
) -> Deterministic
Construct Deterministic that shares the data from an existing instance.
This is useful in cases where you want a component to use the same time series data for two different attributes.
Examples
resolution = Dates.Hour(1)
data = Dict(
DateTime("2020-01-01T00:00:00") => ones(24),
DateTime("2020-01-01T01:00:00") => ones(24),
)
# Define a Deterministic for the first attribute
forecast_max_active_power = Deterministic(
"max_active_power",
data,
resolution,
scaling_factor_multiplier = get_max_active_power,
)
add_time_series!(sys, generator, forecast_max_active_power)
# Reuse time series for second attribute
forecast_max_reactive_power = Deterministic(
forecast_max_active_power,
"max_reactive_power"
scaling_factor_multiplier = get_max_reactive_power,
)
add_time_series!(sys, generator, forecast_max_reactive_power)
InfrastructureSystems.Deterministic
— MethodDeterministic(
forecast::Deterministic,
data
) -> Deterministic
Construct a new Deterministic from an existing instance and a subset of data.
InfrastructureSystems.get_data
— Methodget_data(value::Deterministic) -> DataStructures.SortedDict
Get Deterministic
data
.
InfrastructureSystems.get_name
— Methodget_name(value::Deterministic) -> String
Get Deterministic
name
.
InfrastructureSystems.get_resolution
— Methodget_resolution(value::Deterministic) -> Dates.Period
Get Deterministic
resolution
.
InfrastructureSystems.iterate_windows
— Methoditerate_windows(
forecast::Deterministic
) -> Base.Generator{I, InfrastructureSystems.var"#105#106"{Deterministic}} where I<:(DataStructures.SDMKeyIteration{T} where T<:DataStructures.SortedDict)
Iterate over the windows in a forecast
Examples
for window in iterate_windows(forecast)
@show values(maximum(window))
end
InfrastructureSystems.set_name!
— Methodset_name!(value::Deterministic, val) -> Any
Set Deterministic
name
.
InfrastructureSystems.DeterministicSingleTimeSeries
— Typemutable struct DeterministicSingleTimeSeries <: AbstractDeterministic
single_time_series::SingleTimeSeries
initial_timestamp::Dates.DateTime
interval::Dates.Period
count::Int
horizon::Int
end
A deterministic forecast that wraps a SingleTimeSeries
DeterministicSingleTimeSeries
behaves exactly like a Deterministic
, but instead of storing windows at each initial time it provides a view into the existing SingleTimeSeries
at incrementing offsets. This avoids large data duplications when there are the overlapping windows between forecasts.
Can be used as a perfect forecast based on historical data when real forecast data is unavailable.
Arguments
single_time_series::SingleTimeSeries
: wrappedSingleTimeSeries
objectinitial_timestamp::Dates.DateTime
: time series availability timeinterval::Dates.Period
: time step between forecast windowscount::Int
: number of forecast windowshorizon::Int
: length of this time series
InfrastructureSystems.get_horizon
— Methodget_horizon(
value::DeterministicSingleTimeSeries
) -> Dates.Period
Get DeterministicSingleTimeSeries
horizon
.
InfrastructureSystems.iterate_windows
— Methoditerate_windows(
forecast::DeterministicSingleTimeSeries
) -> Any
Iterate over the windows in a forecast
Examples
for window in iterate_windows(forecast)
@show values(maximum(window))
end
InfrastructureSystems.Probabilistic
— Typemutable struct Probabilistic <: Forecast
name::String
resolution::Dates.Period
percentiles::Vector{Float64}
data::SortedDict
scaling_factor_multiplier::Union{Nothing, Function}
internal::InfrastructureSystemsInternal
end
A Probabilistic forecast for a particular data field in a Component.
Arguments
name::String
: user-defined nameresolution::Dates.Period
: forecast resolutionpercentiles::Vector{Float64}
: Percentiles for the probabilistic forecastdata::SortedDict
: timestamp - scalingfactorscaling_factor_multiplier::Union{Nothing, Function}
: Applicable when the time series data are scaling factors. Called on the associated component to convert the values.internal::InfrastructureSystemsInternal
InfrastructureSystems.Probabilistic
— MethodProbabilistic(
name::AbstractString,
input_data::AbstractDict,
percentiles::Vector,
resolution::Dates.Period;
normalization_factor,
scaling_factor_multiplier
) -> Probabilistic
Construct Probabilistic from a SortedDict of Arrays.
Arguments
name::AbstractString
: user-defined nameinput_data::AbstractDict{Dates.DateTime, Matrix{Float64}}
: time series data.percentiles
: Percentiles represented in the probabilistic forecastresolution::Dates.Period
: The resolution of the forecast in Dates.Period`normalization_factor::NormalizationFactor = 1.0
: optional normalization factor to apply to each data entryscaling_factor_multiplier::Union{Nothing, Function} = nothing
: If the data are scaling factors then this function will be called on the component and applied to the data whenget_time_series_array
is called.
InfrastructureSystems.Probabilistic
— MethodProbabilistic(
name::AbstractString,
input_data::AbstractDict{Dates.DateTime, <:TimeSeries.TimeArray},
percentiles::Vector{Float64};
normalization_factor,
scaling_factor_multiplier
) -> Probabilistic
Construct Probabilistic from a Dict of TimeArrays.
Arguments
name::AbstractString
: user-defined nameinput_data::AbstractDict{Dates.DateTime, TimeSeries.TimeArray}
: time series data.percentiles
: Percentiles represented in the probabilistic forecastnormalization_factor::NormalizationFactor = 1.0
: optional normalization factor to apply to each data entryscaling_factor_multiplier::Union{Nothing, Function} = nothing
: If the data are scaling factors then this function will be called on the component and applied to the data whenget_time_series_array
is called.timestamp = :timestamp
: If the values are DataFrames is passed then this must be the column name that contains timestamps.
InfrastructureSystems.Probabilistic
— MethodProbabilistic(
name::AbstractString,
series_data::InfrastructureSystems.RawTimeSeries,
percentiles::Vector,
resolution::Dates.Period;
normalization_factor,
scaling_factor_multiplier
) -> Probabilistic
Construct Deterministic from RawTimeSeries.
InfrastructureSystems.Probabilistic
— MethodProbabilistic(
src::Probabilistic,
name::AbstractString;
scaling_factor_multiplier
) -> Probabilistic
Construct a Probabilistic that shares the data from an existing instance.
This is useful in cases where you want a component to use the same time series data for two different attributes.
InfrastructureSystems.get_data
— Methodget_data(value::Probabilistic) -> DataStructures.SortedDict
Get Probabilistic
data
.
InfrastructureSystems.get_name
— Methodget_name(value::Probabilistic) -> String
Get Probabilistic
name
.
InfrastructureSystems.get_percentiles
— Methodget_percentiles(value::Probabilistic) -> Vector{Float64}
Get Probabilistic
percentiles
.
InfrastructureSystems.get_resolution
— Methodget_resolution(value::Probabilistic) -> Dates.Period
Get Probabilistic
resolution
.
InfrastructureSystems.iterate_windows
— Methoditerate_windows(
forecast::Probabilistic
) -> Base.Generator{I, InfrastructureSystems.var"#105#106"{Probabilistic}} where I<:(DataStructures.SDMKeyIteration{T} where T<:DataStructures.SortedDict)
Iterate over the windows in a forecast
Examples
for window in iterate_windows(forecast)
@show values(maximum(window))
end
InfrastructureSystems.set_name!
— Methodset_name!(value::Probabilistic, val) -> Any
Set Probabilistic
name
.
InfrastructureSystems.Scenarios
— Typemutable struct Scenarios <: Forecast
name::String
resolution::Dates.Period
scenario_count::Int64
data::SortedDict
scaling_factor_multiplier::Union{Nothing, Function}
internal::InfrastructureSystemsInternal
end
A Discrete Scenario Based time series for a particular data field in a Component.
Arguments
name::String
: user-defined nameresolution::Dates.Period
: forecast resolutionscenario_count::Int64
: Number of scenariosdata::SortedDict
: timestamp - scalingfactorscaling_factor_multiplier::Union{Nothing, Function}
: Applicable when the time series data are scaling factors. Called on the associated component to convert the values.internal::InfrastructureSystemsInternal
InfrastructureSystems.Scenarios
— MethodScenarios(
name::AbstractString,
input_data::AbstractDict,
resolution::Dates.Period;
normalization_factor,
scaling_factor_multiplier
) -> Scenarios
Construct Scenarios from a SortedDict of Arrays.
Arguments
name::AbstractString
: user-defined nameinput_data::AbstractDict{Dates.DateTime, Matrix{Float64}}
: time series data.resolution::Dates.Period
: The resolution of the forecast in Dates.Period`normalization_factor::NormalizationFactor = 1.0
: optional normalization factor to apply to each data entryscaling_factor_multiplier::Union{Nothing, Function} = nothing
: If the data are scaling factors then this function will be called on the component and applied to the data whenget_time_series_array
is called.
InfrastructureSystems.Scenarios
— MethodScenarios(
name::AbstractString,
input_data::AbstractDict{Dates.DateTime, <:TimeSeries.TimeArray};
normalization_factor,
scaling_factor_multiplier
) -> Scenarios
Construct Scenarios from a Dict of TimeArrays.
Arguments
name::AbstractString
: user-defined nameinput_data::AbstractDict{Dates.DateTime, TimeSeries.TimeArray}
: time series data.normalization_factor::NormalizationFactor = 1.0
: optional normalization factor to apply to each data entryscaling_factor_multiplier::Union{Nothing, Function} = nothing
: If the data are scaling factors then this function will be called on the component and applied to the data whenget_time_series_array
is called.timestamp = :timestamp
: If the values are DataFrames is passed then this must be the column name that contains timestamps.
InfrastructureSystems.Scenarios
— MethodScenarios(
src::Scenarios,
name::AbstractString;
scaling_factor_multiplier
) -> Scenarios
Construct Scenarios that shares the data from an existing instance.
This is useful in cases where you want a component to use the same time series data for two different attributes.
InfrastructureSystems.get_data
— Methodget_data(value::Scenarios) -> DataStructures.SortedDict
Get Scenarios
data
.
InfrastructureSystems.get_name
— Methodget_name(value::Scenarios) -> String
Get Scenarios
name
.
InfrastructureSystems.get_resolution
— Methodget_resolution(value::Scenarios) -> Dates.Period
Get Scenarios
resolution
.
InfrastructureSystems.get_scenario_count
— Methodget_scenario_count(value::Scenarios) -> Int64
Get Scenarios
scenario_count
.
InfrastructureSystems.iterate_windows
— Methoditerate_windows(
forecast::Scenarios
) -> Base.Generator{I, InfrastructureSystems.var"#105#106"{Scenarios}} where I<:(DataStructures.SDMKeyIteration{T} where T<:DataStructures.SortedDict)
Iterate over the windows in a forecast
Examples
for window in iterate_windows(forecast)
@show values(maximum(window))
end
InfrastructureSystems.set_name!
— Methodset_name!(value::Scenarios, val) -> Any
Set Scenarios
name
.
InfrastructureSystems.StaticTimeSeries
— TypeSupertype for static time series, which has one value per time point
Current concrete subtypes are:
See also: Forecast
InfrastructureSystems.SingleTimeSeries
— Typemutable struct SingleTimeSeries <: StaticTimeSeries
name::String
data::TimeSeries.TimeArray
scaling_factor_multiplier::Union{Nothing, Function}
internal::InfrastructureSystemsInternal
end
A single column of time series data for a particular data field in a Component.
In contrast with a forecast, this can represent one continual time series, such as a series of historical measurements or realizations or a single scenario (e.g. a weather year or different input assumptions).
Arguments
name::String
: user-defined namedata::TimeSeries.TimeArray
: timestamp - scalingfactorresolution::Dates.Period
: Time duration between steps in the time series. The resolution must be the same throughout the time seriesscaling_factor_multiplier::Union{Nothing, Function}
: Applicable when the time series data are scaling factors. Called on the associated component to convert the values.internal::InfrastructureSystemsInternal
InfrastructureSystems.SingleTimeSeries
— MethodSingleTimeSeries(
name::AbstractString,
filename::AbstractString,
component::InfrastructureSystems.InfrastructureSystemsComponent,
resolution::Dates.Period;
normalization_factor,
scaling_factor_multiplier
) -> SingleTimeSeries
Construct SingleTimeSeries from a CSV file. The file must have a column that is the name of the component.
Arguments
name::AbstractString
: user-defined namefilename::AbstractString
: name of CSV file containing datacomponent::InfrastructureSystemsComponent
: component associated with the dataresolution::Dates.Period
: resolution of the time seriesnormalization_factor::NormalizationFactor = 1.0
: optional normalization factor to apply to each data entryscaling_factor_multiplier::Union{Nothing, Function} = nothing
: If the data are scaling factors then this function will be called on the component and applied to the data whenget_time_series_array
is called.
InfrastructureSystems.SingleTimeSeries
— MethodSingleTimeSeries(
name::AbstractString,
data::Union{DataFrames.DataFrame, TimeSeries.TimeArray};
normalization_factor,
scaling_factor_multiplier,
timestamp
) -> SingleTimeSeries
Construct SingleTimeSeries from a TimeArray or DataFrame.
Arguments
name::AbstractString
: user-defined namedata::Union{TimeSeries.TimeArray, DataFrames.DataFrame}
: time series datanormalization_factor::NormalizationFactor = 1.0
: optional normalization factor to apply to each data entryscaling_factor_multiplier::Union{Nothing, Function} = nothing
: If the data are scaling factors then this function will be called on the component and applied to the data whenget_time_series_array
is called.timestamp = :timestamp
: If a DataFrame is passed then this must be the column name that contains timestamps.
InfrastructureSystems.SingleTimeSeries
— MethodSingleTimeSeries(
src::SingleTimeSeries,
name::AbstractString;
scaling_factor_multiplier
) -> SingleTimeSeries
Construct SingleTimeSeries that shares the data from an existing instance.
This is useful in cases where you want a component to use the same time series data for two different attribtues.
InfrastructureSystems.SingleTimeSeries
— MethodSingleTimeSeries(
time_series::SingleTimeSeries,
data::TimeSeries.TimeArray
) -> Any
Creates a new SingleTimeSeries from an existing instance and a subset of data.
InfrastructureSystems.SingleTimeSeries
— MethodSingleTimeSeries(
name::String,
resolution::Dates.Period,
initial_time::Dates.DateTime,
time_steps::Int64
) -> SingleTimeSeries
Construct SingleTimeSeries after constructing a TimeArray from initial_time
and time_steps
.
InfrastructureSystems.get_data
— Methodget_data(value::SingleTimeSeries) -> TimeSeries.TimeArray
Get SingleTimeSeries
data
.
InfrastructureSystems.get_name
— Methodget_name(value::SingleTimeSeries) -> String
Get SingleTimeSeries
name
.
InfrastructureSystems.get_resolution
— Methodget_resolution(value::SingleTimeSeries) -> Dates.Period
Get SingleTimeSeries
resolution
.
InfrastructureSystems.set_name!
— Methodset_name!(value::SingleTimeSeries, val) -> Any
Set SingleTimeSeries
name
.
InfrastructureSystems.Forecast
— TypeSupertype for forecast time series Current concrete subtypes are:
Subtypes of Forecast must implement:
get_horizon_count
get_initial_times
get_initial_timestamp
get_name
get_scaling_factor_multiplier
get_window
iterate_windows
InfrastructureSystems.get_window
— Methodget_window(forecast::Forecast, index::Int64; len) -> Any
Return the forecast window corresponsing to interval index.
InfrastructureSystems.ForecastCache
— MethodConstruct ForecastCache to automatically control caching of forecast data. Maintains some count of forecast windows in memory based on cache_size_bytes
.
Call Base.iterate or get_next_time_series_array!
to retrieve data. Each iteration will return a TimeSeries.TimeArray covering one forecast window of length horizon_count
.
Arguments
::Type{T}
: subtype of Forecastcomponent::InfrastructureSystemsComponent
: componentname::AbstractString
: forecast namestart_time::Union{Nothing, Dates.DateTime} = nothing
: forecast start timehorizon_count::Union{Nothing, Int} = nothing
: forecast horizon countcache_size_bytes = TIME_SERIES_CACHE_SIZE_BYTES
: maximum size of data to keep in memoryignore_scaling_factors = false
: controls whether to ignorescaling_factor_multiplier
in the time series instance
InfrastructureSystems.StaticTimeSeriesCache
— MethodConstruct StaticTimeSeriesCache to automatically control caching of time series data. Maintains rows of data in memory based on cache_size_bytes
.
Call Base.iterate or get_time_series_array
to retrieve data. Each iteration will return a TimeSeries.TimeArray of size 1.
Arguments
::Type{T}
: subtype of StaticTimeSeriescomponent::InfrastructureSystemsComponent
: componentname::AbstractString
: time series namecache_size_bytes = TIME_SERIES_CACHE_SIZE_BYTES
: maximum size of data to keep in memoryignore_scaling_factors = false
: controls whether to ignore scalingfactormultiplier in the time series instance
InfrastructureSystems.get_next_time
— Methodget_next_time(
cache::InfrastructureSystems.TimeSeriesCache
) -> Any
Return the timestamp for the next read with get_next_time_series_array!
.
Return nothing
if all data has been read.
InfrastructureSystems.get_next_time_series_array!
— Methodget_next_time_series_array!(
cache::InfrastructureSystems.TimeSeriesCache
) -> Any
Return the next TimeSeries.TimeArray.
Returns nothing
when all data has been read. Call reset!
to restart. Call get_next_time
to check the start time.
Reads from storage if the data is not already in cache.
Arguments
cache::StaticTimeSeriesCache
: cached instance
Examples
cache = ForecastCache(Deterministic, component, "max_active_power")
window1 = get_next_time_series_array!(cache)
window2 = get_next_time_series_array!(cache)
InfrastructureSystems.reset!
— Methodreset!(cache::InfrastructureSystems.TimeSeriesCache)
Reset parameters in order to start reading data from the beginning with get_next_time_series_array!
InfrastructureSystems.copy_time_series!
— Methodcopy_time_series!(
dst::Union{InfrastructureSystems.InfrastructureSystemsComponent, SupplementalAttribute},
src::Union{InfrastructureSystems.InfrastructureSystemsComponent, SupplementalAttribute};
name_mapping,
scaling_factor_multiplier_mapping
)
Efficiently add all time_series in one component to another by copying the underlying references.
Arguments
dst::TimeSeriesOwners
: Destination ownersrc::TimeSeriesOwners
: Source ownername_mapping::Dict = nothing
: Optionally map src names to different dst names. If provided and src has a timeseries with a name not present in namemapping, that timeseries will not copied. If namemapping is nothing then all time_series will be copied with src's names.scaling_factor_multiplier_mapping::Dict = nothing
: Optionally map src multipliers to different dst multipliers. If provided and src has a timeseries with a multiplier not present in scalingfactormultipliermapping, that timeseries will not copied. If scalingfactormultipliermapping is nothing then all time_series will be copied with src's multipliers.
InfrastructureSystems.get_time_series
— Functionget_time_series(
owner::Union{InfrastructureSystems.InfrastructureSystemsComponent, SupplementalAttribute},
key::TimeSeriesKey
) -> Any
get_time_series(
owner::Union{InfrastructureSystems.InfrastructureSystemsComponent, SupplementalAttribute},
key::TimeSeriesKey,
start_time::Union{Nothing, Dates.DateTime}
) -> Any
get_time_series(
owner::Union{InfrastructureSystems.InfrastructureSystemsComponent, SupplementalAttribute},
key::TimeSeriesKey,
start_time::Union{Nothing, Dates.DateTime},
len::Union{Nothing, Int64}
) -> Any
get_time_series(
owner::Union{InfrastructureSystems.InfrastructureSystemsComponent, SupplementalAttribute},
key::TimeSeriesKey,
start_time::Union{Nothing, Dates.DateTime},
len::Union{Nothing, Int64},
count::Union{Nothing, Int64}
) -> Any
Return the exact stored data in a time series, using a time series key look up
This will load all forecast windows into memory by default. Be aware of how much data is stored.
Specify start_time and len if you only need a subset of data.
Does not apply a scaling factor multiplier.
Arguments
owner::TimeSeriesOwners
: Component or attribute containing the time serieskey::TimeSeriesKey
: the time series' keystart_time::Union{Nothing, Dates.DateTime} = nothing
: If nothing, use theinitial_timestamp
of the time series. If the time series is a subtype of Forecast thenstart_time
must be the first timestamp of a window.len::Union{Nothing, Int} = nothing
: Length in the time dimension. If nothing, use the entire length.count::Union{Nothing, Int} = nothing
: Only applicable to subtypes of Forecast. Number of forecast windows starting atstart_time
to return. Defaults to all available.features...
: User-defined tags that differentiate multiple time series arrays for the same component attribute, such as different arrays for different scenarios or years
See also: get_time_series
by name
InfrastructureSystems.get_time_series
— Methodget_time_series(
::Type{T<:TimeSeriesData},
owner::Union{InfrastructureSystems.InfrastructureSystemsComponent, SupplementalAttribute},
name::AbstractString;
start_time,
len,
count,
features...
) -> Any
Return the exact stored data in a time series
This will load all forecast windows into memory by default. Be aware of how much data is stored.
Specify start_time
and len
if you only need a subset of data.
Does not apply a scaling factor multiplier.
Arguments
::Type{T}
: Concrete subtype ofTimeSeriesData
to returnowner::TimeSeriesOwners
: Component or attribute containing the time seriesname::AbstractString
: name of time seriesstart_time::Union{Nothing, Dates.DateTime} = nothing
: If nothing, use theinitial_timestamp
of the time series. If T is a subtype of Forecast thenstart_time
must be the first timestamp of a window.len::Union{Nothing, Int} = nothing
: Length in the time dimension. If nothing, use the entire length.count::Union{Nothing, Int} = nothing
: Only applicable to subtypes of Forecast. Number of forecast windows starting atstart_time
to return. Defaults to all available.features...
: User-defined tags that differentiate multiple time series arrays for the same component attribute, such as different arrays for different scenarios or years
See also: get_time_series_array
, get_time_series_values
, get_time_series
by key
InfrastructureSystems.get_time_series_array
— Functionget_time_series_array(
owner::Union{InfrastructureSystems.InfrastructureSystemsComponent, SupplementalAttribute},
time_series::StaticTimeSeries;
...
) -> Any
get_time_series_array(
owner::Union{InfrastructureSystems.InfrastructureSystemsComponent, SupplementalAttribute},
time_series::StaticTimeSeries,
start_time::Union{Nothing, Dates.DateTime};
len,
ignore_scaling_factors
) -> Any
Return a TimeSeries.TimeArray
from a cached StaticTimeSeries
instance.
If the time series data are scaling factors, the returned data will be scaled by the scaling factor multiplier by default.
Arguments
owner::TimeSeriesOwners
: Component or attribute containing the time seriestime_series::StaticTimeSeries
: subtype ofStaticTimeSeries
(e.g.,SingleTimeSeries
)start_time::Union{Nothing, Dates.DateTime} = nothing
: the first timestamp to retrieve. If nothing, use theinitial_timestamp
of the time series.len::Union{Nothing, Int} = nothing
: Length of time-series to retrieve (i.e. number of timestamps). If nothing, use the entire lengthignore_scaling_factors = false
: Iftrue
, the time-series data will be multiplied by the result of calling the storedscaling_factor_multiplier
function on theowner
See also: get_time_series_values
, get_time_series_timestamps
, StaticTimeSeriesCache
, get_time_series_array
by name from storage, get_time_series_array
from a ForecastCache
InfrastructureSystems.get_time_series_array
— Methodget_time_series_array(
owner::Union{InfrastructureSystems.InfrastructureSystemsComponent, SupplementalAttribute},
forecast::Forecast,
start_time::Dates.DateTime;
len,
ignore_scaling_factors
) -> Any
Return a TimeSeries.TimeArray
for one forecast window from a cached Forecast
instance
If the time series data are scaling factors, the returned data will be scaled by the scaling factor multiplier by default.
Arguments
owner::TimeSeriesOwners
: Component or attribute containing the time seriesforecast::Forecast
: a concrete subtype ofForecast
start_time::Union{Nothing, Dates.DateTime} = nothing
: the first timestamp of one of the forecast windowslen::Union{Nothing, Int} = nothing
: Length of time-series to retrieve (i.e. number of timestamps). If nothing, use the entire length.ignore_scaling_factors = false
: Iftrue
, the time-series data will be multiplied by the result of calling the storedscaling_factor_multiplier
function on theowner
See also get_time_series_values
, get_time_series_timestamps
, ForecastCache
, get_time_series_array
by name from storage, get_time_series_array
from a StaticTimeSeriesCache
InfrastructureSystems.get_time_series_array
— Methodget_time_series_array(
::Type{T<:TimeSeriesData},
owner::Union{InfrastructureSystems.InfrastructureSystemsComponent, SupplementalAttribute},
name::AbstractString;
start_time,
len,
ignore_scaling_factors,
features...
) -> Any
Return a TimeSeries.TimeArray
from storage for the given time series parameters.
If the time series data are scaling factors, the returned data will be scaled by the scaling factor multiplier by default.
This will load all forecast windows into memory by default. Be aware of how much data is stored.
Specify start_time
and len
if you only need a subset of data.
Arguments
::Type{T}
: the type of time series (a concrete subtype ofTimeSeriesData
)owner::TimeSeriesOwners
: Component or attribute containing the time seriesname::AbstractString
: name of time seriesstart_time::Union{Nothing, Dates.DateTime} = nothing
: If nothing, use theinitial_timestamp
of the time series. If T is a subtype ofForecast
thenstart_time
must be the first timestamp of a window.len::Union{Nothing, Int} = nothing
: Length of time-series to retrieve (i.e. number of timestamps). If nothing, use the entire length.ignore_scaling_factors = false
: Iftrue
, the time-series data will be multiplied by the result of calling the storedscaling_factor_multiplier
function on theowner
features...
: User-defined tags that differentiate multiple time series arrays for the same component attribute, such as different arrays for different scenarios or years
See also: get_time_series_values
, get_time_series_timestamps
, get_time_series_array
from a StaticTimeSeriesCache
, get_time_series_array
from a ForecastCache
InfrastructureSystems.get_time_series_keys
— Methodget_time_series_keys(
owner::Union{InfrastructureSystems.InfrastructureSystemsComponent, SupplementalAttribute}
) -> Vector
Return information about each time series array attached to the owner. This information can be used to call get_time_series(::TimeSeriesOwners, ::TimeSeriesKey)
.
InfrastructureSystems.get_time_series_multiple
— Functionget_time_series_multiple(
owner::Union{InfrastructureSystems.InfrastructureSystemsComponent, SupplementalAttribute};
...
) -> Union{Tuple{}, Channel{Any}}
get_time_series_multiple(
owner::Union{InfrastructureSystems.InfrastructureSystemsComponent, SupplementalAttribute},
filter_func;
type,
name
) -> Union{Tuple{}, Channel{Any}}
Returns an iterator of TimeSeriesData instances attached to the component or attribute.
Note that passing a filter function can be much slower than the other filtering parameters because it reads time series data from media.
Call collect
on the result to get an array.
Arguments
owner::TimeSeriesOwners
: component or attribute from which to get time_seriesfilter_func = nothing
: Only return time_series for which this returns true.type = nothing
: Only return time_series with this type.name = nothing
: Only return time_series matching this value.
See also: get_time_series_multiple
from a System
InfrastructureSystems.get_time_series_timestamps
— Functionget_time_series_timestamps(
owner::Union{InfrastructureSystems.InfrastructureSystemsComponent, SupplementalAttribute},
forecast::Forecast;
...
)
get_time_series_timestamps(
owner::Union{InfrastructureSystems.InfrastructureSystemsComponent, SupplementalAttribute},
forecast::Forecast,
start_time::Union{Nothing, Dates.DateTime};
len
) -> Vector{D} where D<:Dates.TimeType
Return a vector of timestamps from a cached Forecast instance.
Arguments
owner::TimeSeriesOwners
: Component or attribute containing the time seriesforecast::Forecast
: a concrete subtype ofForecast
start_time::Union{Nothing, Dates.DateTime} = nothing
: the first timestamp of one of the forecast windowslen::Union{Nothing, Int} = nothing
: Length of time-series to retrieve (i.e. number of timestamps). If nothing, use the entire length.
See also: get_time_series_array
, get_time_series_values
, ForecastCache
, get_time_series_timestamps
by name from storage, get_time_series_timestamps
from a StaticTimeSeriesCache
InfrastructureSystems.get_time_series_timestamps
— Functionget_time_series_timestamps(
owner::Union{InfrastructureSystems.InfrastructureSystemsComponent, SupplementalAttribute},
time_series::StaticTimeSeries;
...
) -> Vector{D} where D<:Dates.TimeType
get_time_series_timestamps(
owner::Union{InfrastructureSystems.InfrastructureSystemsComponent, SupplementalAttribute},
time_series::StaticTimeSeries,
start_time::Union{Nothing, Dates.DateTime};
len
) -> Vector{D} where D<:Dates.TimeType
Return a vector of timestamps from a cached StaticTimeSeries instance.
Arguments
owner::TimeSeriesOwners
: Component or attribute containing the time seriestime_series::StaticTimeSeries
: subtype ofStaticTimeSeries
(e.g.,SingleTimeSeries
)start_time::Union{Nothing, Dates.DateTime} = nothing
: the first timestamp to retrieve. If nothing, use theinitial_timestamp
of the time series.len::Union{Nothing, Int} = nothing
: Length of time-series to retrieve (i.e. number of timestamps). If nothing, use the entire length
See also: get_time_series_array
, get_time_series_values
, StaticTimeSeriesCache
, get_time_series_timestamps
by name from storage, get_time_series_timestamps
from a ForecastCache
InfrastructureSystems.get_time_series_timestamps
— Methodget_time_series_timestamps(
::Type{T<:TimeSeriesData},
owner::Union{InfrastructureSystems.InfrastructureSystemsComponent, SupplementalAttribute},
name::AbstractString;
start_time,
len,
features...
) -> Vector{D} where D<:Dates.TimeType
Return a vector of timestamps from storage for the given time series parameters.
Arguments
::Type{T}
: the type of time series (a concrete subtype ofTimeSeriesData
)owner::TimeSeriesOwners
: Component or attribute containing the time seriesname::AbstractString
: name of time seriesstart_time::Union{Nothing, Dates.DateTime} = nothing
: If nothing, use theinitial_timestamp
of the time series. If T is a subtype ofForecast
thenstart_time
must be the first timestamp of a window.len::Union{Nothing, Int} = nothing
: Length of time-series to retrieve (i.e. number of timestamps). If nothing, use the entire length.features...
: User-defined tags that differentiate multiple time series arrays for the same component attribute, such as different arrays for different scenarios or years
See also: get_time_series_array
, get_time_series_values
, get_time_series_timestamps
from a StaticTimeSeriesCache
, get_time_series_timestamps
from a ForecastCache
InfrastructureSystems.get_time_series_values
— Functionget_time_series_values(
owner::Union{InfrastructureSystems.InfrastructureSystemsComponent, SupplementalAttribute},
time_series::StaticTimeSeries;
...
) -> Any
get_time_series_values(
owner::Union{InfrastructureSystems.InfrastructureSystemsComponent, SupplementalAttribute},
time_series::StaticTimeSeries,
start_time::Union{Nothing, Dates.DateTime};
len,
ignore_scaling_factors
) -> Any
Return an vector of timeseries data without timestamps from a cached StaticTimeSeries
instance
Arguments
owner::TimeSeriesOwners
: Component or attribute containing the time seriestime_series::StaticTimeSeries
: subtype ofStaticTimeSeries
(e.g.,SingleTimeSeries
)start_time::Union{Nothing, Dates.DateTime} = nothing
: the first timestamp to retrieve. If nothing, use theinitial_timestamp
of the time series.len::Union{Nothing, Int} = nothing
: Length of time-series to retrieve (i.e. number of timestamps). If nothing, use the entire lengthignore_scaling_factors = false
: Iftrue
, the time-series data will be multiplied by the result of calling the storedscaling_factor_multiplier
function on theowner
See also: get_time_series_array
, get_time_series_timestamps
, StaticTimeSeriesCache
, get_time_series_values
by name from storage, get_time_series_values
from a ForecastCache
InfrastructureSystems.get_time_series_values
— Methodget_time_series_values(
owner::Union{InfrastructureSystems.InfrastructureSystemsComponent, SupplementalAttribute},
forecast::Forecast,
start_time::Dates.DateTime;
len,
ignore_scaling_factors
) -> Any
Return an vector of timeseries data without timestamps for one forecast window from a cached Forecast
instance.
Arguments
owner::TimeSeriesOwners
: Component or attribute containing the time seriesforecast::Forecast
: a concrete subtype ofForecast
start_time::Union{Nothing, Dates.DateTime} = nothing
: the first timestamp of one of the forecast windowslen::Union{Nothing, Int} = nothing
: Length of time-series to retrieve (i.e. number of timestamps). If nothing, use the entire length.ignore_scaling_factors = false
: Iftrue
, the time-series data will be multiplied by the result of calling the storedscaling_factor_multiplier
function on theowner
See also: get_time_series_array
, get_time_series_timestamps
, ForecastCache
, get_time_series_values
by name from storage, get_time_series_values
from a StaticTimeSeriesCache
InfrastructureSystems.get_time_series_values
— Methodget_time_series_values(
::Type{T<:TimeSeriesData},
owner::Union{InfrastructureSystems.InfrastructureSystemsComponent, SupplementalAttribute},
name::AbstractString;
start_time,
len,
ignore_scaling_factors,
features...
) -> Any
Return an vector of timeseries data without timestamps from storage
If the data size is small and this will be called many times, consider using the version that accepts a cached TimeSeriesData
instance.
Arguments
::Type{T}
: type of the time series (a concrete subtype ofTimeSeriesData
)owner::TimeSeriesOwners
: Component or attribute containing the time seriesname::AbstractString
: name of time seriesstart_time::Union{Nothing, Dates.DateTime} = nothing
: If nothing, use theinitial_timestamp
of the time series. If T is a subtype ofForecast
thenstart_time
must be the first timestamp of a window.len::Union{Nothing, Int} = nothing
: Length of time-series to retrieve (i.e. number of timestamps). If nothing, use the entire length.ignore_scaling_factors = false
: Iftrue
, the time-series data will be multiplied by the result of calling the storedscaling_factor_multiplier
function on theowner
features...
: User-defined tags that differentiate multiple time series arrays for the same component attribute, such as different arrays for different scenarios or years
See also: get_time_series_array
, get_time_series_timestamps
, get_time_series
, get_time_series_values
from a StaticTimeSeriesCache
, get_time_series_values
from a ForecastCache
InfrastructureSystems.has_time_series
— Methodhas_time_series(
owner::Union{InfrastructureSystems.InfrastructureSystemsComponent, SupplementalAttribute}
) -> Any
Return true if the component or supplemental attribute has time series data.
InfrastructureSystems.has_time_series
— Methodhas_time_series(
val::Union{InfrastructureSystems.InfrastructureSystemsComponent, SupplementalAttribute},
_::Type{T<:TimeSeriesData}
) -> Any
Return true if the component or supplemental attribute has time series data of type T.
InfrastructureSystems.ForecastKey
— TypeA unique key to identify and retrieve a Forecast
See: get_time_series_keys
and get_time_series(::TimeSeriesOwners, ::TimeSeriesKey)
.
InfrastructureSystems.StaticTimeSeriesKey
— TypeA unique key to identify and retrieve a StaticTimeSeries
See: get_time_series_keys
and get_time_series(::TimeSeriesOwners, ::TimeSeriesKey)
.
InfrastructureSystems.TimeSeriesAssociation
— TypeDefines an association between a time series owner (component or supplemental attribute) and the time series metadata.
Examples
association1 = TimeSeriesAssociation(component, time_series)
association2 = TimeSeriesAssociation(component, time_series, scenario = "high")
InfrastructureSystems.TimeSeriesCounts
— TypeProvides counts of time series including attachments to components and supplemental attributes.
InfrastructureSystems.TimeSeriesKey
— TypeSupertype for keys that can be used to access a desired time series dataset
Concrete subtypes:
Required methods:
get_name
get_time_series_type
The default methods rely on the field names name
and time_series_type
.
InfrastructureSystems.CompressionSettings
— TypeCompressionSettings(enabled, type, level, shuffle)
Provides customization of HDF5 compression settings.
enabled::Bool
: Controls whether compression is enabled.type::CompressionTypes
: Specifies the type of compression to use.level::Int64
: Supported values are 0-9. Higher values deliver better compression ratios but take longer.shuffle::Bool
: Controls whether to enable the shuffle filter. Used with DEFLATE.
Refer to the HDF5.jl and HDF5 documentation for more details on the options.
Example
settings = CompressionSettings(
enabled = true,
type = CompressionTypes.DEFLATE, # BLOSC is also supported
level = 3,
shuffle = true,
)
InfrastructureSystems.show_time_series
— Methodshow_time_series(
owner::Union{InfrastructureSystems.InfrastructureSystemsComponent, SupplementalAttribute}
)
Show a table with time series data attached to the component.
System
PowerSystems.System
— TypeA power system
System
is the main data container in PowerSystems.jl, including basic metadata (base power, frequency), components (network topology, loads, generators, and services), and time series data.
System(base_power)
System(base_power, buses, components...)
System(base_power, buses, generators, loads, branches, storage, services; kwargs...)
System(base_power, buses, generators, loads; kwargs...)
System(file; kwargs...)
System(; buses, generators, loads, branches, storage, base_power, services, kwargs...)
System(; kwargs...)
Arguments
base_power::Float64
: the base power value for the systembuses::Vector{ACBus}
: an array of busescomponents...
: Each element (e.g.,buses
,generators
, ...) must be an iterable containing subtypes ofComponent
.
Keyword arguments
ext::Dict
: Contains user-defined parameters. Should only contain standard types.frequency::Float64
: (default = 60.0) Operating frequency (Hz)runchecks::Bool
: Run available checks on input fields and when add_component! is called. Throws InvalidValue if an error is found.time_series_in_memory::Bool=false
: Store time series data in memory instead of HDF5.time_series_directory::Union{Nothing, String}
: Directory for the time series HDF5 file. Defaults to the tmp file systemenable_compression::Bool=false
: Enable compression of time series data in HDF5.compression::CompressionSettings
: Allows customization of HDF5 compression settings.config_path::String
: specify path to validation config fileunit_system::String
: (Default ="SYSTEM_BASE"
) Set the unit system for per-unitization while getting and setting data ("SYSTEM_BASE"
,"DEVICE_BASE"
, or"NATURAL_UNITS"
)
By default, time series data is stored in an HDF5 file in the tmp file system to prevent large datasets from overwhelming system memory (see Data Storage). If the system's time series data will be larger than the amount of tmp space available, use the time_series_directory
parameter to change its location. You can also override the location by setting the environment variable SIENNA_TIME_SERIES_DIRECTORY
to another directory.
HDF5 compression is not enabled by default, but you can enable it with enable_compression
to get significant storage savings at the cost of CPU time. CompressionSettings
can be used to customize the HDF5 compression.
If you know that your dataset will fit in your computer's memory, then you can increase performance by storing it in memory with time_series_in_memory
.
Examples
sys = System(100.0; enable_compression = true)
sys = System(100.0; compression = CompressionSettings(
enabled = true,
type = CompressionTypes.DEFLATE, # BLOSC is also supported
level = 3,
shuffle = true)
)
sys = System(100.0; time_series_in_memory = true)
PowerSystems.System
— MethodSystem(
sys_file::AbstractString,
dyr_file::AbstractString;
kwargs...
) -> Any
Parse static and dynamic data directly from PSS/e text files. Automatically generates all the relationships between the available dynamic injection models and the static counterpart
Each dictionary indexed by id contains a vector with 5 of its components:
- Machine
- Shaft
- AVR
- TurbineGov
- PSS
Files must be parsed from a .raw file (PTI data format) and a .dyr file.
Examples:
raw_file = "Example.raw"
dyr_file = "Example.dyr"
sys = System(raw_file, dyr_file)
PowerSystems.System
— MethodSystem(
file_path::AbstractString;
assign_new_uuids,
kwargs...
) -> Any
Constructs a System from a file path ending with .m, .RAW, or .json
If the file is JSON then assignnewuuids = true will generate new UUIDs for the system and all components.
PowerSystems.System
— MethodSystem(
data,
base_power::Number;
internal,
kwargs...
) -> System
Construct a System
from InfrastructureSystems.SystemData
PowerSystems.System
— MethodSystem(
base_power::Float64,
buses::Vector{ACBus},
components...;
kwargs...
) -> System
System constructor when components are constructed externally.
PowerSystems.System
— MethodSystem(
::Nothing;
buses,
generators,
loads,
branches,
storage,
base_power,
services,
kwargs...
) -> System
Constructs a non-functional System for demo purposes.
PowerSystems.System
— MethodSystem(base_power::Number; kwargs...) -> System
Construct an empty System
. Useful for building a System while parsing raw data.
InfrastructureSystems.from_json
— Methodfrom_json(
io::Union{IO, String},
::Type{System};
runchecks,
assign_new_uuids,
kwargs...
) -> System
If assignnewuuids = true, generate new UUIDs for the system and all components.
Warning: time series data is not restored by this method. If that is needed, use the normal process to construct the system from a serialized JSON file instead, such as with System("sys.json")
.
InfrastructureSystems.get_name
— Methodget_name(sys::System) -> Union{Nothing, String}
Get the name of the system.
InfrastructureSystems.get_supplemental_attribute
— Methodget_supplemental_attribute(
sys::System,
uuid::Base.UUID
) -> SupplementalAttribute
Return the supplemental attribute with the given uuid.
Throws ArgumentError if the attribute is not stored.
InfrastructureSystems.get_supplemental_attributes
— Methodget_supplemental_attributes(
filter_func::Function,
_::Type{T<:SupplementalAttribute},
sys::System
) -> InfrastructureSystems.FlattenIteratorWrapper{T, I} where {T<:SupplementalAttribute, I<:(Vector)}
Returns an iterator of supplemental attributes. T can be concrete or abstract. Call collect on the result if an array is desired.
Examples
iter = get_supplemental_attributes(GeometricDistributionForcedOutage, sys)
iter = get_supplemental_attributes(Outage, sys)
iter = get_supplemental_attributes(x -> get_mean_time_to_recovery(x) == >= 0.5, GeometricDistributionForcedOutage, sys)
outages = get_supplemental_attributes(GeometricDistributionForcedOutage, sys) do outage
get_mean_time_to_recovery(x) == >= 0.5
end
outages = collect(get_supplemental_attributes(GeometricDistributionForcedOutage, sys))
See also: iterate_supplemental_attributes
InfrastructureSystems.get_time_series_multiple
— Functionget_time_series_multiple(sys::System; ...) -> Channel{Any}
get_time_series_multiple(
sys::System,
filter_func;
type,
name
) -> Channel{Any}
Return an iterator of time series in order of initial time.
Note that passing a filter function can be much slower than the other filtering parameters because it reads time series data from media.
Call collect
on the result to get an array.
Arguments
data::SystemData
: systemfilter_func = nothing
: Only return time series for which this returns true.type = nothing
: Only return time series with this type.name = nothing
: Only return time series matching this value.
Examples
for time_series in get_time_series_multiple(sys)
@show time_series
end
ts = collect(get_time_series_multiple(sys; type = SingleTimeSeries))
InfrastructureSystems.set_name!
— Methodset_name!(
component::Component,
name::AbstractString
) -> AbstractString
Set the name of a component.
Throws an exception if the component is attached to a system.
InfrastructureSystems.set_name!
— Methodset_name!(
sys::System,
name::AbstractString
) -> AbstractString
Set the name of the system.
InfrastructureSystems.set_name!
— Methodset_name!(
sys::System,
component::Component,
name::AbstractString
)
Set the name for a component that is attached to the system.
InfrastructureSystems.to_json
— Methodto_json(
sys::System,
filename::AbstractString;
user_data,
pretty,
force,
runchecks
)
Serializes a system to a JSON file and saves time series to an HDF5 file.
Arguments
sys::System
: systemfilename::AbstractString
: filename to write
Keyword arguments
user_data::Union{Nothing, Dict} = nothing
: optional metadata to recordpretty::Bool = false
: whether to pretty-print the JSONforce::Bool = false
: whether to overwrite existing filescheck::Bool = false
: whether to run system validation checks
Refer to check_component
for exceptions thrown if check = true
.
PowerSystems.add_component!
— Methodadd_component!(
sys::System,
dyn_injector::DynamicInjection,
static_injector::StaticInjection;
kwargs...
)
Add a dynamic injector to the system.
A component cannot be added to more than one System
. Throws ArgumentError if the name does not match the static_injector
name. Throws ArgumentError if the static_injector
is not attached to the system.
All rules for the generic add_component!
method also apply.
PowerSystems.add_component!
— Methodadd_component!(
sys::System,
component::Component;
skip_validation,
kwargs...
)
Add a component to the system.
A component cannot be added to more than one System
. Throws ArgumentError if the component's name is already stored for its concrete type. Throws ArgumentError if any Component-specific rule is violated. Throws InvalidValue if any of the component's field values are outside of defined valid range.
Examples
sys = System(100.0)
# Add a single component.
add_component!(sys, bus)
# Add many at once.
buses = [bus1, bus2, bus3]
generators = [gen1, gen2, gen3]
foreach(x -> add_component!(sys, x), Iterators.flatten((buses, generators)))
See also add_components!
.
PowerSystems.add_components!
— Methodadd_components!(sys::System, components)
Add many components to the system at once.
A component cannot be added to more than one System
. Throws ArgumentError if the component's name is already stored for its concrete type. Throws ArgumentError if any Component-specific rule is violated. Throws InvalidValue if any of the component's field values are outside of defined valid range.
Examples
sys = System(100.0)
buses = [bus1, bus2, bus3]
generators = [gen1, gen2, gen3]
add_components!(sys, Iterators.flatten((buses, generators))
PowerSystems.add_service!
— Methodadd_service!(device::Device, service::Service, sys::System)
Similar to add_service!
but for Service and Device already stored in the system. Performs validation checks on the device and the system
Arguments
device::Device
: Deviceservice::Service
: Servicesys::System
: system
PowerSystems.add_service!
— Methodadd_service!(
sys::System,
service::ConstantReserveGroup,
contributing_services::Vector{<:Service};
skip_validation,
kwargs...
)
Similar to add_component!
but for ConstantReserveGroup.
Arguments
sys::System
: systemservice::ConstantReserveGroup
: service to addcontributing_services
: contributing services to the group
PowerSystems.add_service!
— Methodadd_service!(
sys::System,
service::ConstantReserveGroup;
skip_validation,
kwargs...
)
Similar to add_component!
but for ConstantReserveGroup.
Arguments
sys::System
: systemservice::ConstantReserveGroup
: service to add
PowerSystems.add_service!
— Methodadd_service!(
sys::System,
service::Service,
contributing_devices;
kwargs...
)
Similar to add_component!
but for services.
Arguments
sys::System
: systemservice::Service
: service to addcontributing_devices
: Must be an iterable of type Device
PowerSystems.add_service!
— Methodadd_service!(
sys::System,
service::Service,
contributing_device::Device;
kwargs...
)
Similar to add_component!
but for services.
Arguments
sys::System
: systemservice::Service
: service to addcontributing_device::Device
: Valid Device
PowerSystems.add_supplemental_attribute!
— Methodadd_supplemental_attribute!(
sys::System,
component::Component,
attribute::SupplementalAttribute
)
Add a supplemental attribute to the component. The attribute may already be attached to a different component.
PowerSystems.add_time_series!
— Methodadd_time_series!(
sys::System,
metadata_file::AbstractString;
resolution
) -> Vector{TimeSeriesKey}
Add time series data from a metadata file or metadata descriptors.
Arguments
sys::System
: systemmetadata_file::AbstractString
: metadata file for timeseries that includes an array of IS.TimeSeriesFileMetadata instances or a vector.resolution::DateTime.Period=nothing
: skip time series that don't match this resolution.
PowerSystems.add_time_series!
— Methodadd_time_series!(
sys::System,
components,
time_series::TimeSeriesData;
features...
) -> TimeSeriesKey
Add the same time series data to multiple components.
This function stores a single copy of the data. Each component will store a reference to that data. This is significantly more efficent than calling add_time_series!
for each component individually with the same data because in this case, only one time series array is stored.
Throws ArgumentError if a component is not stored in the system.
PowerSystems.add_time_series!
— Methodadd_time_series!(
sys::System,
component::Component,
time_series::TimeSeriesData;
features...
) -> TimeSeriesKey
Add time series data to a component.
Throws ArgumentError if the component is not stored in the system.
PowerSystems.add_time_series!
— Methodadd_time_series!(
sys::System,
file_metadata::Vector{InfrastructureSystems.TimeSeriesFileMetadata};
resolution
) -> Vector{TimeSeriesKey}
Add time series data from a metadata file or metadata descriptors.
Arguments
sys::System
: systemtimeseries_metadata::Vector{IS.TimeSeriesFileMetadata}
: metadata for timeseriesresolution::DateTime.Period=nothing
: skip time series that don't match this resolution.
PowerSystems.bulk_add_time_series!
— Methodbulk_add_time_series!(
sys::System,
associations;
batch_size
) -> Vector{TimeSeriesKey}
Add many time series in bulk
This method is advantageous when adding thousands of time series arrays because of the overhead in writing the time series to the underlying storage.
Arguments
sys::System
: systemassociations
: Iterable ofTimeSeriesAssociation
instances. Using a Vector is not recommended. Pass a Generator or Iterator to avoid loading all time series data into system memory at once.batch_size::Int
: (Default = 100) Number of time series to add per batch.
Examples
# Assumes `read_time_series` will return data appropriate for Deterministic forecasts
# based on the generator name and the filenames match the component and time series names.
resolution = Dates.Hour(1)
associations = (
IS.TimeSeriesAssociation(
gen,
Deterministic(
data = read_time_series(get_name(gen) * ".csv"),
name = "get_max_active_power",
resolution=resolution),
)
for gen in get_components(ThermalStandard, sys)
)
bulk_add_time_series!(sys, associations)
See also: open_time_series_store!
to minimize HDF5 file handle overhead if you must add time series arrays one at a time
PowerSystems.check
— Methodcheck(sys::System)
Check system consistency and validity.
PowerSystems.check_component
— Methodcheck_component(sys::System, component::Component)
Check the values of a component.
Throws InvalidValue if any of the component's field values are outside of defined valid range or if the custom validate method for the type fails its check.
PowerSystems.check_components
— Methodcheck_components(sys::System, components)
Check the values of each component in an iterable of components. See check_component
for exceptions thrown.
PowerSystems.check_components
— Methodcheck_components(sys::System; check_masked_components)
Check the values of all components. See check_component
for exceptions thrown.
PowerSystems.check_components
— Methodcheck_components(
sys::System,
::Type{T<:Component};
check_masked_components
)
Check the values of components of a given abstract or concrete type. See check_component
for exceptions thrown.
PowerSystems.check_time_series_consistency
— Methodcheck_time_series_consistency(
sys::System,
_::Type{T<:TimeSeriesData}
) -> Union{Nothing, Tuple{Any, Any}}
Checks time series in the system for inconsistencies.
For SingleTimeSeries, returns a Tuple of initial_timestamp and length.
This is a no-op for subtypes of Forecast because those are already guaranteed to be consistent.
Throws InfrastructureSystems.InvalidValue if any time series is inconsistent.
PowerSystems.clear_components!
— Methodclear_components!(sys::System)
Remove all components from the system.
PowerSystems.clear_ext!
— Methodclear_ext!(sys::System)
Clear any value stored in ext.
PowerSystems.clear_time_series!
— Methodclear_time_series!(sys::System)
Clear all time series data from the system.
If you are storing time series data in an HDF5 file, this will will delete the HDF5 file and create a new one.
See also: remove_time_series!
PowerSystems.convert_component!
— Methodconvert_component!(
sys::System,
line::Line,
linetype::Type{MonitoredLine};
kwargs...
)
Converts a Line component to a MonitoredLine component and replaces the original in the system
PowerSystems.convert_component!
— Methodconvert_component!(
sys::System,
line::MonitoredLine,
linetype::Type{Line};
kwargs...
)
Converts a MonitoredLine component to a Line component and replaces the original in the system.
PowerSystems.convert_component!
— Methodconvert_component!(
sys::System,
old_load::PowerLoad,
new_type::Type{StandardLoad};
kwargs...
)
Converts a PowerLoad component to a StandardLoad component and replaces the original in the system. Does not set any fields in StandardLoad that lack a PowerLoad equivalent.
PowerSystems.filter_components_by_subsystem!
— Methodfilter_components_by_subsystem!(
sys::System,
subsystem::AbstractString;
runchecks
)
Filter out all components that are not part of the subsystem.
PowerSystems.from_subsystem
— Methodfrom_subsystem(
sys::System,
subsystem::AbstractString;
runchecks
) -> System
Construct a System from a subsystem of an existing system.
PowerSystems.get_aggregation_topology_mapping
— Methodget_aggregation_topology_mapping(
_::Type{T<:AggregationTopology},
sys::System
) -> Dict{String, Vector{ACBus}}
Return a mapping of AggregationTopology name to vector of buses within it.
PowerSystems.get_available_components
— Methodget_available_components(
_::Type{T<:Component},
sys::System
) -> InfrastructureSystems.FlattenIteratorWrapper{T, I} where {T<:Component, I<:(Vector)}
Gets components availability. Requires type T to have the method get_available implemented.
PowerSystems.get_base_power
— Methodget_base_power(sys::System) -> Float64
Return the system's base power.
PowerSystems.get_bus
— Methodget_bus(
sys::System,
name::AbstractString
) -> Union{Nothing, InfrastructureSystems.InfrastructureSystemsComponent}
Return bus with name.
PowerSystems.get_bus
— Methodget_bus(sys::System, bus_number::Int64) -> Any
Return bus with bus_number.
PowerSystems.get_bus_numbers
— Methodget_bus_numbers(sys::System) -> Vector{Int64}
Return a sorted vector of bus numbers in the system.
PowerSystems.get_buses
— Methodget_buses(
sys::System,
aggregator::AggregationTopology
) -> Vector{ACBus}
Return a vector of buses contained within the AggregationTopology.
PowerSystems.get_buses
— Methodget_buses(
sys::System,
bus_numbers::Set{Int64}
) -> Vector{ACBus}
Return all buses values with bus_numbers.
PowerSystems.get_component
— Methodget_component(
sys::System,
uuid::Base.UUID
) -> InfrastructureSystems.InfrastructureSystemsComponent
Get the component by UUID.
PowerSystems.get_component
— Methodget_component(
_::Type{T<:Component},
sys::System,
name::AbstractString
) -> Union{Nothing, InfrastructureSystems.InfrastructureSystemsComponent}
Get the component of type T with name. Returns nothing if no component matches. If T is an abstract type then the names of components across all subtypes of T must be unique.
See get_components_by_name
for abstract types with non-unique names across subtypes.
Throws ArgumentError if T is not a concrete type and there is more than one component with requested name
PowerSystems.get_components
— Methodget_components(
sys::System,
attribute::SupplementalAttribute
) -> Any
Return a vector of components that are attached to the supplemental attribute.
PowerSystems.get_components
— Methodget_components(
::Type{T<:Component},
sys::System;
subsystem_name
) -> InfrastructureSystems.FlattenIteratorWrapper{T, I} where {T<:Component, I<:(Vector)}
Returns an iterator of components. T can be concrete or abstract. Call collect on the result if an array is desired.
Examples
iter = PowerSystems.get_components(ThermalStandard, sys)
iter = PowerSystems.get_components(Generator, sys)
iter = PowerSystems.get_components(x -> PowerSystems.get_available(x), Generator, sys)
thermal_gens = get_components(ThermalStandard, sys) do gen
get_available(gen)
end
generators = collect(PowerSystems.get_components(Generator, sys))
See also: iterate_components
PowerSystems.get_components_by_name
— Methodget_components_by_name(
_::Type{T<:Component},
sys::System,
name::AbstractString
) -> Vector{T} where T<:InfrastructureSystems.InfrastructureSystemsComponent
Get the components of abstract type T with name. Note that PowerSystems enforces unique names on each concrete type but not across concrete types.
See get_component
if the concrete type is known.
Throws ArgumentError if T is not an abstract type.
PowerSystems.get_components_in_aggregation_topology
— Methodget_components_in_aggregation_topology(
_::Type{T<:StaticInjection},
sys::System,
aggregator::AggregationTopology
) -> Vector{T} where T<:StaticInjection
Return a vector of components with buses in the AggregationTopology.
PowerSystems.get_compression_settings
— Methodget_compression_settings(sys::System) -> CompressionSettings
Return the compression settings used for system data such as time series arrays.
PowerSystems.get_contributing_device_mapping
— Methodget_contributing_device_mapping(
sys::System
) -> Dict{@NamedTuple{type::DataType, name::String}, ServiceContributingDevices}
Return an instance of ServiceContributingDevicesMapping.
PowerSystems.get_contributing_devices
— Methodget_contributing_devices(
sys::System,
service::Service
) -> Vector
Return a vector of devices contributing to the service.
PowerSystems.get_description
— Methodget_description(sys::System) -> Union{Nothing, String}
Get the description of the system.
PowerSystems.get_existing_component_types
— Methodget_existing_component_types(
sys::System
) -> Vector{DataType}
Return all the component types in the system. It does not return masked components.
PowerSystems.get_existing_device_types
— Methodget_existing_device_types(sys::System) -> Vector{DataType}
Return all the device types in the system. It does not return component types or masked components.
PowerSystems.get_ext
— Methodget_ext(sys::System) -> Union{Nothing, Dict{String, Any}}
Return a user-modifiable dictionary to store extra information.
PowerSystems.get_forecast_horizon
— Methodget_forecast_horizon(sys::System) -> Any
Return the horizon for all forecasts.
PowerSystems.get_forecast_initial_times
— Methodget_forecast_initial_times(sys::System) -> Any
Return the initial times for all forecasts.
PowerSystems.get_forecast_initial_timestamp
— Methodget_forecast_initial_timestamp(sys::System) -> Any
Return the initial_timestamp for all forecasts.
PowerSystems.get_forecast_interval
— Methodget_forecast_interval(sys::System) -> Any
Return the interval for all forecasts.
PowerSystems.get_forecast_window_count
— Methodget_forecast_window_count(sys::System) -> Any
Return the window count for all forecasts.
PowerSystems.get_frequency
— Methodget_frequency(sys::System) -> Float64
Return the system's frequency.
PowerSystems.get_runchecks
— Methodget_runchecks(sys::System) -> Bool
Return true if checks are enabled on the system.
PowerSystems.get_time_series_counts
— Methodget_time_series_counts(sys::System) -> TimeSeriesCounts
Returns counts of time series including attachments to components and supplemental attributes.
PowerSystems.get_time_series_resolutions
— Methodget_time_series_resolutions(
sys::System;
time_series_type
) -> Any
Return a sorted Vector of distinct resolutions for all time series of the given type (or all types).
PowerSystems.get_units_base
— Methodget_units_base(system::System) -> String
Get the system's unit base)
PowerSystems.has_component
— Methodhas_component(
sys::System,
T::Type{<:Component},
name::AbstractString
) -> Bool
Check to see if the component of type T with name exists.
PowerSystems.has_component
— Methodhas_component(sys::System, T::Type{<:Component})
Check to see if the component of type T exists.
PowerSystems.is_component_in_aggregation_topology
— Methodis_component_in_aggregation_topology(
comp::Component,
aggregator::AggregationTopology
) -> Union{Missing, Bool}
Return whether the given component's bus is in the AggregationTopology.
PowerSystems.iterate_components
— Methoditerate_components(
sys::System
) -> Base.Iterators.Flatten{Base.Generator{Base.ValueIterator{Dict{DataType, Dict{String, <:InfrastructureSystems.InfrastructureSystemsComponent}}}, InfrastructureSystems.var"#110#111"}}
Iterates over all components.
Examples
for component in iterate_components(sys)
@show component
end
See also: get_components
PowerSystems.iterate_supplemental_attributes
— Methoditerate_supplemental_attributes(
sys::System
) -> Base.Iterators.Flatten{Base.Generator{Base.ValueIterator{Dict{DataType, Dict{Base.UUID, <:SupplementalAttribute}}}, InfrastructureSystems.var"#110#111"}}
Iterates over all supplemental_attributes.
Examples
for supplemental_attribute in iterate_supplemental_attributes(sys)
@show supplemental_attribute
end
See also: get_supplemental_attributes
PowerSystems.open_time_series_store!
— Functionopen_time_series_store!(
func::Function,
sys::System;
...
) -> Any
open_time_series_store!(
func::Function,
sys::System,
mode,
args...;
kwargs...
) -> Any
Open the time series store for bulk additions or reads
This is recommended before calling add_time_series!
many times because of the overhead associated with opening and closing an HDF5 file.
This is not necessary for an in-memory time series store.
Examples
# Assume there is a system with an array of Components and SingleTimeSeries
# stored in the variables components and single_time_series, respectively
open_time_series_store!(sys, "r+") do
for (component, ts) in zip(components, single_time_series)
add_time_series!(sys, component, ts)
end
end
You can also use this function to make reads faster. Change the mode from "r+"
to "r"
to open the file read-only.
See also: bulk_add_time_series!
PowerSystems.remove_component!
— Methodremove_component!(sys::System, component::Component)
Remove a component from the system by its value.
Throws ArgumentError if the component is not stored.
PowerSystems.remove_component!
— Methodremove_component!(
_::Type{T<:Component},
sys::System,
name::AbstractString
)
Remove a component from the system by its name.
Throws ArgumentError if the component is not stored.
PowerSystems.remove_supplemental_attribute!
— Methodremove_supplemental_attribute!(
sys::System,
component::Component,
attribute::SupplementalAttribute
)
Remove the supplemental attribute from the component. The attribute will be removed from the system if it is not attached to any other component.
PowerSystems.remove_supplemental_attribute!
— Methodremove_supplemental_attribute!(
sys::System,
attribute::SupplementalAttribute
)
Remove the supplemental attribute from the system and all attached components.
PowerSystems.remove_supplemental_attributes!
— Methodremove_supplemental_attributes!(
_::Type{T<:SupplementalAttribute},
sys::System
)
Remove all supplemental attributes with the given type from the system.
PowerSystems.remove_time_series!
— Methodremove_time_series!(
sys::System,
_::Type{T<:TimeSeriesData},
component::Component,
name::String
)
Remove the time series data for a component and time series type.
PowerSystems.remove_time_series!
— Methodremove_time_series!(sys::System, _::Type{T<:TimeSeriesData})
Remove all the time series data for a time series type.
See also: clear_time_series!
If you are storing time series data in an HDF5 file, remove_time_series!
does not actually free up file space (HDF5 behavior). If you want to remove all or most time series instances then consider using clear_time_series!
. It will delete the HDF5 file and create a new one. PowerSystems has plans to automate this type of workflow.
PowerSystems.sanitize_component!
— Methodsanitize_component!(component::Component, sys::System)
Sanitize component values.
PowerSystems.set_contributing_services!
— Methodset_contributing_services!(
sys::System,
service::ConstantReserveGroup,
val::Vector{<:Service}
)
Set ConstantReserveGroup contributing_services with check
PowerSystems.set_description!
— Methodset_description!(
sys::System,
description::AbstractString
) -> AbstractString
Set the description of the system.
PowerSystems.set_runchecks!
— Methodset_runchecks!(sys::System, value::Bool)
Enable or disable system checks. Applies to component addition as well as overall system consistency.
PowerSystems.set_units_base_system!
— Methodset_units_base_system!(system::System, settings::String)
Sets the units base for the getter functions on the devices. It modifies the behavior of all getter functions
PowerSystems.transform_single_time_series!
— Methodtransform_single_time_series!(
sys::System,
horizon::Dates.Period,
interval::Dates.Period
)
Transform all instances of SingleTimeSeries
in a System
to DeterministicSingleTimeSeries
This can be used to generate a perfect forecast from historical measurements or realizations when actual forecasts are unavailable, without unnecessarily duplicating data.
If all SingleTimeSeries
instances cannot be transformed then none will be.
Any existing DeterministicSingleTimeSeries
forecasts will be deleted even if the inputs are invalid.
Arguments
PowerSystems.validate_component
— Methodvalidate_component(component::Component) -> Bool
Validate the component fields using only those fields. Refer to validate_component_with_system
to use other System data for the validation.
Return true if the instance is valid.
PowerSystems.validate_component_with_system
— Methodvalidate_component_with_system(
component::Component,
sys::System
) -> Bool
Validate a component against System data. Return true if the instance is valid.
Refer to validate_component
if the validation logic only requires data contained within the instance.
InfrastructureSystems.show_time_series
— Methodshow_time_series(sys::System)
Show a table with the summary of time series attached to the system.
PowerSystems.show_components
— Functionshow_components(
sys::System,
component_type::Type{<:Component};
...
)
show_components(
sys::System,
component_type::Type{<:Component},
additional_columns::Union{Dict, Vector};
kwargs...
)
Show all components of the given type in a table.
Arguments
sys::System
: System containing the components.component_type::Type{<:Component}
: Type to display. Must be a concrete type.additional_columns::Union{Dict, Vector}
: Additional columns to display. The Dict option is a mapping of column name to function. The function must accept a component. The Vector option is an array of field names for thecomponent_type
.
Extra keyword arguments are forwarded to PrettyTables.pretty_table.
Examples
show_components(sys, ThermalStandard)
show_components(sys, ThermalStandard, Dict("has_time_series" => x -> has_time_series(x)))
show_components(sys, ThermalStandard, [:active_power, :reactive_power])
PowerSystems.generate_struct_file
— Methodgenerate_struct_file(
definition::StructDefinition;
filename,
output_directory
)
Generate a Julia source code file for one struct from a StructDefinition
.
Refer to StructDefinition
and StructField
for descriptions of the available fields.
Arguments
definition::StructDefinition
: Defines the struct and all fields.filename::AbstractString
: Add the struct definition to this JSON file. Defaults tosrc/descriptors/power_system_structs.json
output_directory::AbstractString
: Generate the files in this directory. Defaults tosrc/models/generated
PowerSystems.generate_struct_files
— Methodgenerate_struct_files(
definitions;
filename,
output_directory
)
Generate Julia source code files for multiple structs from a iterable of StructDefinition
instances.
Refer to StructDefinition
and StructField
for descriptions of the available fields.
Arguments
definitions
: Defines the structs and all fields.filename::AbstractString
: Add the struct definition to this JSON file. Defaults tosrc/descriptors/power_system_structs.json
output_directory::AbstractString
: Generate the files in this directory. Defaults tosrc/models/generated
Additional Component Methods
PowerSystems.get_max_active_power
— Methodget_max_active_power(d::Device) -> Any
Return the max active power for a device from getactivepower_limits.max
PowerSystems.get_max_reactive_power
— Methodget_max_reactive_power(d::RenewableDispatch) -> Any
Return the max reactive power for the Renewable Generation calculated as the rating * powerfactor if reactivepower_limits is nothing
PowerSystems.get_max_reactive_power
— Methodget_max_reactive_power(d::Device) -> Any
Return the max reactive power for a device from getreactivepower_limits.max
Parsing
PowerSystems.PowerSystemTableData
— MethodPowerSystemTableData(
directory::AbstractString,
base_power::Float64,
user_descriptor_file::AbstractString;
descriptor_file,
generator_mapping_file,
timeseries_metadata_file
) -> PowerSystemTableData
Reads in all the data stored in csv files The general format for data is folder: gen.csv branch.csv bus.csv .. load.csv
Arguments
directory::AbstractString
: directory containing CSV filesbase_power::Float64
: base power for Systemuser_descriptor_file::AbstractString
: customized input descriptor filedescriptor_file=POWER_SYSTEM_DESCRIPTOR_FILE
: PowerSystems descriptor filegenerator_mapping_file=GENERATOR_MAPPING_FILE
: generator mapping configuration file
PowerSystems.create_poly_cost
— Methodcreate_poly_cost(
gen,
cost_colnames
) -> Union{Tuple{LinearCurve, Float64}, Tuple{QuadraticCurve, Float64}}
create_poly_cost(gen, cost_colnames)
Return a Polynomial function cost based on the coeffiecients provided on gen.
Three supported cases,
- If three values are passed then we have data looking like:
a2 * x^2 + a1 * x + a0
, - If
a1
anda0
are passed then we have data looking like:a1 * x + a0
, - If only
a1
is passed then we have data looking like:a1 * x
.
PowerSystems.PowerModelsData
— TypeContainer for data parsed by PowerModels
PowerSystems.PowerModelsData
— MethodPowerModelsData(
file::Union{IO, String};
kwargs...
) -> PowerModelsData
Constructs PowerModelsData from a raw file. Currently Supports MATPOWER and PSSE data files parsed by PowerModels.
PowerSystems.TamuSystem
— MethodTamuSystem(tamu_folder::AbstractString; kwargs...) -> Any
Creates a system from a PSS/e .RAW (v33) load flow case, and an associated .csv with MW load time series data. The format is established by the Texas A&M University Test Case Archive
The general format for data is folder: [casename].raw [casename]loadtimeseriesMW.csv
Arguments
directory::AbstractString
: directory containing RAW and CSV files
Examples
sys = TamuSystem(
"./ACTIVSg25k",
config_path = "ACTIVSg25k_validation.json",
bus_name_formatter = x->string(x["name"]*"-"*string(x["index"])),
load_name_formatter = x->strip(join(x["source_id"], "_"))
)
PowerSystems.add_dyn_injectors!
— Methodadd_dyn_injectors!(sys::System, dyr_file::AbstractString)
Add to a system already created the dynamic components. The system should already be parsed from a .raw file.
Examples:
dyr_file = "Example.dyr"
add_dyn_injectors!(sys, dyr_file)
PowerSystems.parse_file
— Methodparse_file(
io::IO;
import_all,
validate,
correct_branch_rating,
filetype
) -> Any
Parses the iostream from a file
PowerSystems.parse_file
— Methodparse_file(
file::String;
import_all,
validate,
correct_branch_rating
) -> Any
parse_file(
file;
import_all = false,
validate = true,
correct_branch_rating = true,
)
Parses a Matpower .m file
or PTI (PSS(R)E-v33) .raw file
into a PowerModels data structure. All fields from PTI files will be imported if import_all
is true (Default: false).
Logging
PowerSystems.configure_logging
— Methodconfigure_logging(
;
console_level,
file_level,
filename
) -> MultiLogger
Creates console and file loggers.
Note: Log messages may not be written to the file until flush() or close() is called on the returned logger.
Arguments
console_level = Logging.Error
: level for console messagesfile_level = Logging.Info
: level for file messagesfilename::Union{Nothing, AbstractString} = "power-systems.log"
: log file; pass nothing to disable file logging
Example
logger = configure_logging(console_level = Logging.Info)
@info "log message"
close(logger)