Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Psy3 #1012

Merged
merged 63 commits into from
Sep 12, 2023
Merged

Psy3 #1012

Show file tree
Hide file tree
Changes from 52 commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
c2df64f
[PSY 3.0] Change Bus to ACBus (#956)
rodrigomha Jan 30, 2023
e28e56b
Add Standard DC and T-Model DC Lines (#960)
rodrigomha Feb 1, 2023
ec2d3b0
Jd/two terminal rename (#962)
jd-lara Feb 2, 2023
74a7ead
Add IPCs to psy3 (#964)
rodrigomha Feb 4, 2023
18e0f18
change limits of line to rate (#967)
rodrigomha Feb 6, 2023
5eb1a10
[PSY 3.0] Change Bus to ACBus (#956)
rodrigomha Jan 30, 2023
6c764ca
Add Standard DC and T-Model DC Lines (#960)
rodrigomha Feb 1, 2023
b4db077
Address Deserialization issue (#969)
rodrigomha Feb 7, 2023
5c64ce0
Merge branch 'psy3' of https://github.com/NREL-SIIP/PowerSystems.jl i…
jd-lara Feb 7, 2023
dd4b944
formatter
jd-lara Feb 7, 2023
ec7bea4
fix rebase problem
rodrigomha Feb 14, 2023
5f1b7f2
[PSY 3.0] Change Bus to ACBus (#956)
rodrigomha Jan 30, 2023
5d9f9ce
Add Standard DC and T-Model DC Lines (#960)
rodrigomha Feb 1, 2023
16015cb
[PSY 3.0] Change Bus to ACBus (#956)
jd-lara Jul 5, 2023
ad43f94
Jd/two terminal rename (#962)
jd-lara Feb 2, 2023
1589e78
Add IPCs to psy3 (#964)
rodrigomha Feb 4, 2023
50509dc
change limits of line to rate (#967)
rodrigomha Feb 6, 2023
f08f763
Address Deserialization issue (#969)
rodrigomha Feb 7, 2023
96c50b4
Merge branch 'psy3' of https://github.com/NREL-SIIP/PowerSystems.jl i…
jd-lara Jul 5, 2023
cd7450b
remove duplicate methods
jd-lara Jul 5, 2023
cafb59b
update test
jd-lara Jul 5, 2023
71975a3
[PSY 3.0] Change Bus to ACBus (#956)
rodrigomha Jan 30, 2023
6f2caf5
Add Standard DC and T-Model DC Lines (#960)
rodrigomha Feb 1, 2023
32f69c0
[PSY 3.0] Change Bus to ACBus (#956)
jd-lara Jul 5, 2023
bdd146e
Jd/two terminal rename (#962)
jd-lara Feb 2, 2023
0199156
Add IPCs to psy3 (#964)
rodrigomha Feb 4, 2023
7b8aa15
change limits of line to rate (#967)
rodrigomha Feb 6, 2023
1b51162
Address Deserialization issue (#969)
rodrigomha Feb 7, 2023
3076ee6
[PSY 3.0] Change Bus to ACBus (#956)
jd-lara Sep 5, 2023
99d4454
Add Standard DC and T-Model DC Lines (#960)
jd-lara Sep 5, 2023
4196f94
[PSY 3.0] Change Bus to ACBus (#956)
jd-lara Sep 5, 2023
787cce8
Add Standard DC and T-Model DC Lines (#960)
rodrigomha Feb 1, 2023
f83d616
Jd/two terminal rename (#962)
jd-lara Feb 2, 2023
d41bc85
Add IPCs to psy3 (#964)
rodrigomha Feb 4, 2023
d426f99
Address Deserialization issue (#969)
rodrigomha Feb 7, 2023
d9447f0
formatter
jd-lara Feb 7, 2023
b6413b7
remove duplicate methods
jd-lara Jul 5, 2023
9087fe3
update test
jd-lara Jul 5, 2023
9dff487
Merge branch 'psy3' of https://github.com/NREL-SIIP/PowerSystems.jl i…
jd-lara Sep 5, 2023
863d778
remove duplicates
jd-lara Sep 5, 2023
721331a
fix type instability get_prime_mover
jd-lara Sep 5, 2023
fd3b444
re run autogeneration
jd-lara Sep 5, 2023
1536ae7
replace prime_mover -> prime_mover_type
jd-lara Sep 5, 2023
ca8bea4
more prime mover updates
jd-lara Sep 5, 2023
fada010
bump PSB
jd-lara Sep 5, 2023
fa3cf43
remove duplicate includes
jd-lara Sep 5, 2023
3ce9e25
fix test
jd-lara Sep 5, 2023
1b67434
changes to handle backwards de-serialization
jd-lara Sep 6, 2023
cc34836
test fixing
jd-lara Sep 6, 2023
41fb263
remove duplicates
jd-lara Sep 6, 2023
23cd27a
fix bad merge
jd-lara Sep 6, 2023
e170d5b
fix test
jd-lara Sep 6, 2023
5a2f1ce
run formatter
jd-lara Sep 6, 2023
30c9768
bump version
jd-lara Sep 6, 2023
d2e612b
remove custom deserialize
jd-lara Sep 6, 2023
867d891
update conversion code
jd-lara Sep 6, 2023
0409e9b
add HVDC data conversion logic
jd-lara Sep 6, 2023
46c39f7
Merge branch 'main' into psy3
jd-lara Sep 8, 2023
543f570
Merge branch 'main' into psy3
jd-lara Sep 11, 2023
92ebe1a
change message in case of failure
jd-lara Sep 11, 2023
df6ba39
Merge branch 'psy3' of https://github.com/NREL-SIIP/PowerSystems.jl i…
jd-lara Sep 11, 2023
1b35d39
formatter
jd-lara Sep 11, 2023
4e1d886
simplify method conversion
jd-lara Sep 11, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/src/modeler_guide/enumerated_types.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,13 @@ are intended to reflect the options denoted by
| `PS` | Energy Storage, Reversible Hydraulic Turbine (Pumped Storage) |
| `OT` | Other |
| `ST` | Steam Turbine (including nuclear, geothermal and solar steam; does not include combined-cycle turbine) |
| `PV` | Photovoltaic *renaming from EIA PV to PVe to avoid conflict with BusType.PV |
| `PV` | Photovoltaic *renaming from EIA PV to PVe to avoid conflict with ACBusType.PV |
| `WT` | Wind Turbine, Onshore |
| `WS` | Wind Turbine, Offshore |

## `BusTypes`
## `ACBusTypes`

`BusTypes` is used to denote which quantities are specified for load flow calculations and
`ACBusTypes` is used to denote which quantities are specified for load flow calculations and
to otherwise categorize buses for modeling activities.

| EnumName | Description |
Expand Down
4 changes: 2 additions & 2 deletions docs/src/modeler_guide/market_bid_cost.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ The code below shows an example how we can create a thermal device with MarketBi

```@repl market_bid_cost
using PowerSystems, Dates
bus = Bus(1, "nodeE", "REF", 0, 1.0, (min = 0.9, max = 1.05), 230, nothing, nothing)
bus = ACBus(1, "nodeE", "REF", 0, 1.0, (min = 0.9, max = 1.05), 230, nothing, nothing)
generator = ThermalStandard(
name = "Brighton",
Expand All @@ -25,7 +25,7 @@ generator = ThermalStandard(
active_power = 6.0,
reactive_power = 1.50,
rating = 0.75,
prime_mover = PrimeMovers.ST,
prime_mover_type = PrimeMovers.ST,
fuel = ThermalFuels.COAL,
active_power_limits = (min = 0.0, max = 6.0),
reactive_power_limits = (min = -4.50, max = 4.50),
Expand Down
2 changes: 1 addition & 1 deletion docs/src/modeler_guide/type_structure.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ types and create generic code to support modeling technologies that are not yet
implemented in the package.

`PowerSystems.jl` has a category [`Topology`](@ref) of topological components
(e.g., [`Bus`](@ref), [`Arc`](@ref)), separate from the physical components.
(e.g., [`ACBus`](@ref), [`Arc`](@ref)), separate from the physical components.

The hierarchy also includes components absent in standard data models, such as services.
The services category includes reserves, transfers and [`AGC`](@ref). The power of `PowerSystems.jl`
Expand Down
4 changes: 2 additions & 2 deletions docs/src/quick_start_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,11 @@ system = System(joinpath(file_dir, "case5.m"))
new_renewable = RenewableDispatch(
name = "WindPowerNew",
available = true,
bus = get_component(Bus, system, "3"),
bus = get_component(ACBus, system, "3"),
active_power = 2.0,
reactive_power = 1.0,
rating = 1.2,
prime_mover = PrimeMovers.WT,
prime_mover_type = PrimeMovers.WT,
reactive_power_limits = (min = 0.0, max = 0.0),
base_power = 100.0,
operation_cost = TwoPartCost(22.0, 0.0),
Expand Down
10 changes: 7 additions & 3 deletions src/PowerSystems.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ module PowerSystems
export System
export Topology
export Bus
export ACBus
export DCBus
export Arc
export AggregationTopology
export Area
Expand All @@ -28,8 +30,9 @@ export ACBranch
export Line
export MonitoredLine
export DCBranch
export HVDCLine
export VSCDCLine
export TwoTerminalHVDCLine
export TwoTerminalVSCDCLine
export TModelHVDCLine
export Transformer2W
export TapTransformer
export PhaseShiftingTransformer
Expand All @@ -48,6 +51,7 @@ export HydroGen
export HydroDispatch
export HydroEnergyReservoir
export HydroPumpedStorage
export InterconnectingConverter

export RenewableGen
export RenewableFix
Expand Down Expand Up @@ -213,7 +217,7 @@ export VariableReserveNonSpinning
export TransmissionInterface

export AngleUnits
export BusTypes
export ACBusTypes
export PrimeMovers
export ThermalFuels
export StateTypes
Expand Down
40 changes: 20 additions & 20 deletions src/base.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const SYSTEM_KWARGS = Set((
))

# This will be used in the future to handle serialization changes.
const DATA_FORMAT_VERSION = "2.0.0"
const DATA_FORMAT_VERSION = "3.0.0"

mutable struct SystemMetadata <: IS.InfrastructureSystemsType
name::Union{Nothing, String}
Expand All @@ -51,7 +51,7 @@ System(; kwargs...)

# Arguments
- `base_power::Float64`: the base power value for the system
- `buses::Vector{Bus}`: an array of buses
- `buses::Vector{ACBus}`: an array of buses
- `components...`: Each element must be an iterable containing subtypes of Component.

# Keyword arguments
Expand Down Expand Up @@ -136,7 +136,7 @@ end
"""
System constructor when components are constructed externally.
"""
function System(base_power::Float64, buses::Vector{Bus}, components...; kwargs...)
function System(base_power::Float64, buses::Vector{ACBus}, components...; kwargs...)
data = _create_system_data_from_kwargs(; kwargs...)
sys = System(data, base_power; kwargs...)

Expand All @@ -159,10 +159,10 @@ end
function System(
::Nothing;
buses = [
Bus(;
ACBus(;
number = 0,
name = "init",
bustype = BusTypes.REF,
bustype = ACBusTypes.REF,
angle = 0.0,
magnitude = 0.0,
voltage_limits = (min = 0.0, max = 0.0),
Expand Down Expand Up @@ -498,7 +498,7 @@ function add_component!(
# occurred when the original addition ran and do not apply to that scenario.
handle_component_addition!(sys, component; kwargs...)
# Special condition required to populate the bus numbers in the system after
elseif component isa Bus
elseif component isa ACBus
handle_component_addition!(sys, component; kwargs...)
end

Expand Down Expand Up @@ -1062,14 +1062,14 @@ function get_aggregation_topology_mapping(
::Type{T},
sys::System,
) where {T <: AggregationTopology}
mapping = Dict{String, Vector{Bus}}()
mapping = Dict{String, Vector{ACBus}}()
accessor_func = get_aggregation_topology_accessor(T)
for bus in get_components(Bus, sys)
for bus in get_components(ACBus, sys)
aggregator = accessor_func(bus)
name = get_name(aggregator)
buses = get(mapping, name, nothing)
if isnothing(buses)
mapping[name] = Vector{Bus}([bus])
mapping[name] = Vector{ACBus}([bus])
else
push!(buses, bus)
end
Expand All @@ -1087,8 +1087,8 @@ end

function _get_buses(data::IS.SystemData, aggregator::T) where {T <: AggregationTopology}
accessor_func = get_aggregation_topology_accessor(T)
buses = Vector{Bus}()
for bus in IS.get_components(Bus, data)
buses = Vector{ACBus}()
for bus in IS.get_components(ACBus, data)
_aggregator = accessor_func(bus)
if IS.get_uuid(_aggregator) == IS.get_uuid(aggregator)
push!(buses, bus)
Expand Down Expand Up @@ -1304,7 +1304,7 @@ IS.validate_struct(component::Component) = validate_component(component)
Check system consistency and validity.
"""
function check(sys::System)
buses = get_components(Bus, sys)
buses = get_components(ACBus, sys)
slack_bus_check(buses)
buscheck(buses)
critical_components_check(sys)
Expand Down Expand Up @@ -1539,14 +1539,14 @@ end
Return bus with name.
"""
function get_bus(sys::System, name::AbstractString)
return get_component(Bus, sys, name)
return get_component(ACBus, sys, name)
end

"""
Return bus with bus_number.
"""
function get_bus(sys::System, bus_number::Int)
for bus in get_components(Bus, sys)
for bus in get_components(ACBus, sys)
if bus.number == bus_number
return bus
end
Expand All @@ -1559,8 +1559,8 @@ end
Return all buses values with bus_numbers.
"""
function get_buses(sys::System, bus_numbers::Set{Int})
buses = Vector{Bus}()
for bus in get_components(Bus, sys)
buses = Vector{ACBus}()
for bus in get_components(ACBus, sys)
if bus.number in bus_numbers
push!(buses, bus)
end
Expand Down Expand Up @@ -1707,7 +1707,7 @@ function check_component_addition(sys::System, dyn_injector::DynamicInjection; k
return
end

function check_component_addition(sys::System, bus::Bus; kwargs...)
function check_component_addition(sys::System, bus::ACBus; kwargs...)
number = get_number(bus)
if number in sys.bus_numbers
throw(ArgumentError("bus number $number is already stored in the system"))
Expand All @@ -1724,7 +1724,7 @@ function check_component_addition(sys::System, bus::Bus; kwargs...)
end
end

function handle_component_addition!(sys::System, bus::Bus; kwargs...)
function handle_component_addition!(sys::System, bus::ACBus; kwargs...)
number = get_number(bus)
@assert !(number in sys.bus_numbers) "bus number $number is already stored"
push!(sys.bus_numbers, number)
Expand Down Expand Up @@ -1791,7 +1791,7 @@ end
"""
Throws ArgumentError if the bus number is not stored in the system.
"""
function handle_component_removal!(sys::System, bus::Bus)
function handle_component_removal!(sys::System, bus::ACBus)
_handle_component_removal_common!(bus)
number = get_number(bus)
@assert number in sys.bus_numbers "bus number $number is not stored"
Expand All @@ -1816,7 +1816,7 @@ end

function handle_component_removal!(sys::System, value::T) where {T <: AggregationTopology}
_handle_component_removal_common!(value)
for device in get_components(Bus, sys)
for device in get_components(ACBus, sys)
if get_aggregation_topology_accessor(T)(device) == value
_remove_aggregration_topology!(device, value)
end
Expand Down
10 changes: 5 additions & 5 deletions src/data_format_conversions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ function pre_deserialize_conversion!(raw, sys::System)
end
end
end
elseif old == "1.0.1"
# Version 1.0.1 can be converted
elseif old == "1.0.1" || old == "2.0.0"
@warn(
"System is saved in the data format version 1.0.1 will be automatically upgraded to 2.0.0 upon saving"
"System is saved in the data format version 2.0.0. Deseralizing HVDC related data might fail. \
If there are no errors during deserialization, the data be automatically upgraded to 3.0.0 upon saving"
)
return
else
Expand All @@ -54,11 +54,11 @@ function post_deserialize_conversion!(sys::System, raw)
end
end
end
elseif old == "1.0.1"
elseif old == "1.0.1" || old == "2.0.0"
# Version 1.0.1 can be converted
raw["data_format_version"] = DATA_FORMAT_VERSION
@warn(
"System is saved in the data format version 1.0.1 will be automatically upgraded to 2.0.0 upon saving"
"System is saved in the data format version $old will be automatically upgraded to $DATA_FORMAT_VERSION upon saving"
)
return
else
Expand Down
2 changes: 1 addition & 1 deletion src/definitions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ IS.@scoped_enum(GeneratorCostModels, PIECEWISE_LINEAR = 1, POLYNOMIAL = 2,)
IS.@scoped_enum(AngleUnits, DEGREES = 1, RADIANS = 2,)

# "From http://www.pserc.cornell.edu/matpower/MATPOWER-manual.pdf Table B-1"
IS.@scoped_enum(BusTypes, PQ = 1, PV = 2, REF = 3, ISOLATED = 4, SLACK = 5,)
IS.@scoped_enum(ACBusTypes, PQ = 1, PV = 2, REF = 3, ISOLATED = 4, SLACK = 5,)

"From https://www.eia.gov/survey/form/eia_923/instructions.pdf"

Expand Down
6 changes: 3 additions & 3 deletions src/descriptors/power_system_inputs.json
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,11 @@
{
"name": "dc_line_category",
"value_options": [
"VSCDCLine",
"HVDCLine"
"TwoTerminalVSCDCLine",
"TwoTerminalHVDCLine"
],
"description": "Type of Struct",
"default_value": "HVDCLine"
"default_value": "TwoTerminalHVDCLine"
}
],
"branch": [
Expand Down
Loading
Loading