Skip to content

Commit

Permalink
define key consts and use in System defintion
Browse files Browse the repository at this point in the history
  • Loading branch information
BSnelling committed Jun 30, 2022
1 parent b7b790a commit 099486f
Showing 1 changed file with 17 additions and 21 deletions.
38 changes: 17 additions & 21 deletions src/system.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
const MARKET_WIDE_ZONE = -9999
const BidName = InlineString31
const ZoneNum = Int64
"""
$TYPEDEF
Expand All @@ -11,22 +13,17 @@ $TYPEDFIELDS
"""
struct Zone
"Zone number"
number::Int64
number::ZoneNum
"Zonal regulation requirement (pu)"
regulation::Float64
"Zonal operating reserve requirement (regulation + spinning + supplemental) (pu)"
operating_reserve::Float64
"Zonal good utility practice requirement (regulation + spinning) (pu)"
good_utility::Float64
end
const Zones = Dictionary{ZoneNum, Zone}

const Zones = Dictionary{Int, Zone}

###### Static Component Types ######
const BusName = InlineString15
const BranchName = InlineString31
const BidName = InlineString31

const UnitCode = Int64
"""
$TYPEDEF
Expand All @@ -38,7 +35,7 @@ $TYPEDFIELDS
"""
struct Generator
"Generator id/unit code"
unit_code::Int
unit_code::UnitCode
"Number of the zone the generator is located in"
zone::Int
"Cost of turning on the generator (\$)"
Expand All @@ -58,9 +55,9 @@ struct Generator
"Symbol describing the technology of the generator"
technology::Symbol
end
const Generators = Dictionary{UnitCode, Generator}

const Generators = Dictionary{Int, Generator}

const BusName = InlineString15
"""
$TYPEDEF
Expand All @@ -75,9 +72,9 @@ struct Bus
"Base voltage (kV)"
base_voltage::Float64
end

const Buses = Dictionary{BusName, Bus}

const BranchName = InlineString31
"""
$TYPEDEF
Expand Down Expand Up @@ -118,7 +115,6 @@ struct Branch
"Phase shift angle (radians)"
angle::Union{Missing, Float64}
end

const Branches = Dictionary{BranchName, Branch}

"""
Expand Down Expand Up @@ -321,13 +317,13 @@ mutable struct SystemDA <: System
loads_per_bus::Dictionary{BusName, Vector{BidName}}

"Zones in the `System`, which will also include a `Zone` entry for the market wide zone"
zones::Dictionary{Int, Zone}
zones::Zones
"Buses in the `System` indexed by bus name"
buses::Dictionary{BusName, Bus}
buses::Buses
"Generators in the `System` indexed by unit code"
generators::Dictionary{Int, Generator}
generators::Generators
"Branches in the `System` indexed by branch name"
branches::Dictionary{BranchName, Branch}
branches::Branches
"""
The line outage distribution factor matrix of the system for a set of contingencies given
by the keys of the `Dictionary`. Each entry is a `KeyedArray` with axis keys
Expand Down Expand Up @@ -374,13 +370,13 @@ mutable struct SystemRT <: System
loads_per_bus::Dictionary{BusName, Vector{BidName}}

"Zones in the `System`, which will also include a `Zone` entry for the market wide zone"
zones::Dictionary{Int, Zone}
zones::Zones
"Buses in the `System` indexed by bus name"
buses::Dictionary{BusName, Bus}
buses::Buses
"Generators in the `System` indexed by unit code"
generators::Dictionary{Int, Generator}
generators::Generators
"Branches in the `System` indexed by branch name"
branches::Dictionary{BranchName, Branch}
branches::Branches
"""
The line outage distribution factor matrix of the system for a set of contingencies given
by the keys of the `Dictionary`. Each entry is a `KeyedArray` with axis keys
Expand Down

0 comments on commit 099486f

Please sign in to comment.