Skip to content

Commit 6d4e41f

Browse files
authored
Merge branch 'main' into bugfix/check_empty_not_nothing
2 parents 9ca67d5 + 985bdd5 commit 6d4e41f

File tree

13 files changed

+242
-17
lines changed

13 files changed

+242
-17
lines changed

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ The `PowerSystems.jl` package provides a rigorous data model using Julia structu
1313
## Version Advisory
1414

1515
- PowerSystems will work with Julia v1.6+.
16-
- If you are planning to use `PowerSystems.jl` in your package, check the [roadmap to version 4.0](https://github.com/NREL-Sienna/PowerSystems.jl/projects/4) for upcoming changes
1716

1817
## Device data enabled in PowerSystems
1918

src/PowerSystems.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ export DEGOV
192192
export DEGOV1
193193
export PIDGOV
194194
export WPIDHY
195+
export TGSimple
195196

196197
# Converter Exports
197198
export Converter

src/base.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const SYSTEM_KWARGS = Set((
1010
:generator_mapping,
1111
:internal,
1212
:load_name_formatter,
13-
:load_zone_formatter,
13+
:loadzone_name_formatter,
1414
:runchecks,
1515
:shunt_name_formatter,
1616
:time_series_directory,
@@ -2449,6 +2449,7 @@ function convert_component!(
24492449
(from_to = line.rating, to_from = line.rating),
24502450
line.rating,
24512451
line.angle_limits,
2452+
line.g,
24522453
line.services,
24532454
line.ext,
24542455
_copy_internal_for_conversion(line),
@@ -2492,6 +2493,7 @@ function convert_component!(
24922493
line.b,
24932494
line.rating,
24942495
line.angle_limits,
2496+
line.g,
24952497
line.services,
24962498
line.ext,
24972499
_copy_internal_for_conversion(line),

src/descriptors/power_system_structs.json

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -480,6 +480,18 @@
480480
},
481481
"validation_action": "error"
482482
},
483+
{
484+
"name": "g",
485+
"null_value": "(from=0.0, to=0.0)",
486+
"data_type": "FromTo",
487+
"comment": "Shunt conductance in pu ([`SYSTEM_BASE`](@ref per_unit)), specified both on the `from` and `to` ends of the line. These are commonly modeled with the same value",
488+
"valid_range": {
489+
"min": 0,
490+
"max": 100
491+
},
492+
"validation_action": "warn",
493+
"default": "(from=0.0, to=0.0)"
494+
},
483495
{
484496
"name": "services",
485497
"data_type": "Vector{Service}",
@@ -599,6 +611,18 @@
599611
},
600612
"validation_action": "error"
601613
},
614+
{
615+
"name": "g",
616+
"null_value": "(from=0.0, to=0.0)",
617+
"data_type": "FromTo",
618+
"comment": "Shunt conductance in pu ([`SYSTEM_BASE`](@ref per_unit)), specified both on the `from` and `to` ends of the line. These are commonly modeled with the same value",
619+
"valid_range": {
620+
"min": 0,
621+
"max": 100
622+
},
623+
"validation_action": "warn",
624+
"default": "(from=0.0, to=0.0)"
625+
},
602626
{
603627
"name": "services",
604628
"data_type": "Vector{Service}",
@@ -14122,6 +14146,72 @@
1412214146
],
1412314147
"supertype": "TurbineGov"
1412414148
},
14149+
{
14150+
"struct_name": "TGSimple",
14151+
"docstring": "Parameters of a Simple one-state Turbine Governor",
14152+
"fields": [
14153+
{
14154+
"name": "d_t",
14155+
"comment": "Inverse Droop parameter",
14156+
"null_value": 0,
14157+
"data_type": "Float64",
14158+
"valid_range": {
14159+
"min": 0,
14160+
"max": null
14161+
}
14162+
},
14163+
{
14164+
"name": "Tm",
14165+
"comment": "Turbine Governor Low-Pass Time Constant [s]",
14166+
"null_value": 0,
14167+
"data_type": "Float64",
14168+
"valid_range": {
14169+
"min": 0,
14170+
"max": null
14171+
}
14172+
},
14173+
{
14174+
"name": "P_ref",
14175+
"comment": "Reference Power Set-point (pu)",
14176+
"null_value": 0,
14177+
"default": "1.0",
14178+
"data_type": "Float64",
14179+
"valid_range": {
14180+
"min": 0,
14181+
"max": null
14182+
}
14183+
},
14184+
{
14185+
"name": "ext",
14186+
"comment": "An [*ext*ra dictionary](@ref additional_fields) for users to add metadata that are not used in simulation, such as latitude and longitude.",
14187+
"data_type": "Dict{String, Any}",
14188+
"null_value": "Dict{String, Any}()",
14189+
"default": "Dict{String, Any}()"
14190+
},
14191+
{
14192+
"name": "states",
14193+
"exclude_setter": true,
14194+
"comment": "(**Do not modify.**) The [states](@ref S) of the TGSimple model are:\n\tτm: mechanical torque",
14195+
"internal_default": "[:τm]",
14196+
"data_type": "Vector{Symbol}"
14197+
},
14198+
{
14199+
"name": "n_states",
14200+
"exclude_setter": true,
14201+
"comment": "(**Do not modify.**) TGSimple has 1 state",
14202+
"internal_default": 1,
14203+
"data_type": "Int"
14204+
},
14205+
{
14206+
"name": "internal",
14207+
"comment": "(**Do not modify.**) PowerSystems.jl internal reference",
14208+
"data_type": "InfrastructureSystemsInternal",
14209+
"internal_default": "InfrastructureSystemsInternal()",
14210+
"exclude_setter": true
14211+
}
14212+
],
14213+
"supertype": "TurbineGov"
14214+
},
1412514215
{
1412614216
"struct_name": "AverageConverter",
1412714217
"docstring": "Parameters of an average converter model",

src/models/generated/Line.jl

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ This file is auto-generated. Do not edit.
1616
b::FromTo
1717
rating::Float64
1818
angle_limits::MinMax
19+
g::FromTo
1920
services::Vector{Service}
2021
ext::Dict{String, Any}
2122
internal::InfrastructureSystemsInternal
@@ -34,6 +35,7 @@ An AC transmission line
3435
- `b::FromTo`: Shunt susceptance in pu ([`SYSTEM_BASE`](@ref per_unit)), specified both on the `from` and `to` ends of the line. These are commonly modeled with the same value, validation range: `(0, 100)`
3536
- `rating::Float64`: Thermal rating (MVA). Flow on the line must be between -`rating` and `rating`. When defining a line before it is attached to a `System`, `rating` must be in per-unit divided by the base power of the `System` it will be attached to
3637
- `angle_limits::MinMax`: Minimum and maximum angle limits (radians), validation range: `(-1.571, 1.571)`
38+
- `g::FromTo`: (default: `(from=0.0, to=0.0)`) Shunt conductance in pu ([`SYSTEM_BASE`](@ref per_unit)), specified both on the `from` and `to` ends of the line. These are commonly modeled with the same value, validation range: `(0, 100)`
3739
- `services::Vector{Service}`: (default: `Device[]`) Services that this device contributes to
3840
- `ext::Dict{String, Any}`: (default: `Dict{String, Any}()`) An [*ext*ra dictionary](@ref additional_fields) for users to add metadata that are not used in simulation, such as latitude and longitude.
3941
- `internal::InfrastructureSystemsInternal`: (**Do not modify.**) PowerSystems.jl internal reference
@@ -59,6 +61,8 @@ mutable struct Line <: ACBranch
5961
rating::Float64
6062
"Minimum and maximum angle limits (radians)"
6163
angle_limits::MinMax
64+
"Shunt conductance in pu ([`SYSTEM_BASE`](@ref per_unit)), specified both on the `from` and `to` ends of the line. These are commonly modeled with the same value"
65+
g::FromTo
6266
"Services that this device contributes to"
6367
services::Vector{Service}
6468
"An [*ext*ra dictionary](@ref additional_fields) for users to add metadata that are not used in simulation, such as latitude and longitude."
@@ -67,12 +71,12 @@ mutable struct Line <: ACBranch
6771
internal::InfrastructureSystemsInternal
6872
end
6973

70-
function Line(name, available, active_power_flow, reactive_power_flow, arc, r, x, b, rating, angle_limits, services=Device[], ext=Dict{String, Any}(), )
71-
Line(name, available, active_power_flow, reactive_power_flow, arc, r, x, b, rating, angle_limits, services, ext, InfrastructureSystemsInternal(), )
74+
function Line(name, available, active_power_flow, reactive_power_flow, arc, r, x, b, rating, angle_limits, g=(from=0.0, to=0.0), services=Device[], ext=Dict{String, Any}(), )
75+
Line(name, available, active_power_flow, reactive_power_flow, arc, r, x, b, rating, angle_limits, g, services, ext, InfrastructureSystemsInternal(), )
7276
end
7377

74-
function Line(; name, available, active_power_flow, reactive_power_flow, arc, r, x, b, rating, angle_limits, services=Device[], ext=Dict{String, Any}(), internal=InfrastructureSystemsInternal(), )
75-
Line(name, available, active_power_flow, reactive_power_flow, arc, r, x, b, rating, angle_limits, services, ext, internal, )
78+
function Line(; name, available, active_power_flow, reactive_power_flow, arc, r, x, b, rating, angle_limits, g=(from=0.0, to=0.0), services=Device[], ext=Dict{String, Any}(), internal=InfrastructureSystemsInternal(), )
79+
Line(name, available, active_power_flow, reactive_power_flow, arc, r, x, b, rating, angle_limits, g, services, ext, internal, )
7680
end
7781

7882
# Constructor for demo purposes; non-functional.
@@ -88,6 +92,7 @@ function Line(::Nothing)
8892
b=(from=0.0, to=0.0),
8993
rating=0.0,
9094
angle_limits=(min=-1.571, max=1.571),
95+
g=(from=0.0, to=0.0),
9196
services=Device[],
9297
ext=Dict{String, Any}(),
9398
)
@@ -113,6 +118,8 @@ get_b(value::Line) = value.b
113118
get_rating(value::Line) = get_value(value, value.rating)
114119
"""Get [`Line`](@ref) `angle_limits`."""
115120
get_angle_limits(value::Line) = value.angle_limits
121+
"""Get [`Line`](@ref) `g`."""
122+
get_g(value::Line) = value.g
116123
"""Get [`Line`](@ref) `services`."""
117124
get_services(value::Line) = value.services
118125
"""Get [`Line`](@ref) `ext`."""
@@ -138,6 +145,8 @@ set_b!(value::Line, val) = value.b = val
138145
set_rating!(value::Line, val) = value.rating = set_value(value, val)
139146
"""Set [`Line`](@ref) `angle_limits`."""
140147
set_angle_limits!(value::Line, val) = value.angle_limits = val
148+
"""Set [`Line`](@ref) `g`."""
149+
set_g!(value::Line, val) = value.g = val
141150
"""Set [`Line`](@ref) `services`."""
142151
set_services!(value::Line, val) = value.services = val
143152
"""Set [`Line`](@ref) `ext`."""

src/models/generated/MonitoredLine.jl

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ This file is auto-generated. Do not edit.
1717
flow_limits::FromTo_ToFrom
1818
rating::Float64
1919
angle_limits::MinMax
20+
g::FromTo
2021
services::Vector{Service}
2122
ext::Dict{String, Any}
2223
internal::InfrastructureSystemsInternal
@@ -38,6 +39,7 @@ For example, monitored lines can be used to restrict line flow following a conti
3839
- `flow_limits::FromTo_ToFrom`: Minimum and maximum permissable flow on the line (MVA), if different from the thermal rating defined in `rating`
3940
- `rating::Float64`: Thermal rating (MVA). Flow through the transformer must be between -`rating` and `rating`. When defining a line before it is attached to a `System`, `rating` must be in per-unit divided by the base power of the `System` it will be attached to
4041
- `angle_limits::MinMax`: Minimum and maximum angle limits (radians), validation range: `(-1.571, 1.571)`
42+
- `g::FromTo`: (default: `(from=0.0, to=0.0)`) Shunt conductance in pu ([`SYSTEM_BASE`](@ref per_unit)), specified both on the `from` and `to` ends of the line. These are commonly modeled with the same value, validation range: `(0, 100)`
4143
- `services::Vector{Service}`: (default: `Device[]`) Services that this device contributes to
4244
- `ext::Dict{String, Any}`: (default: `Dict{String, Any}()`) An [*ext*ra dictionary](@ref additional_fields) for users to add metadata that are not used in simulation, such as latitude and longitude.
4345
- `internal::InfrastructureSystemsInternal`: (**Do not modify.**) PowerSystems.jl internal reference
@@ -65,6 +67,8 @@ mutable struct MonitoredLine <: ACBranch
6567
rating::Float64
6668
"Minimum and maximum angle limits (radians)"
6769
angle_limits::MinMax
70+
"Shunt conductance in pu ([`SYSTEM_BASE`](@ref per_unit)), specified both on the `from` and `to` ends of the line. These are commonly modeled with the same value"
71+
g::FromTo
6872
"Services that this device contributes to"
6973
services::Vector{Service}
7074
"An [*ext*ra dictionary](@ref additional_fields) for users to add metadata that are not used in simulation, such as latitude and longitude."
@@ -73,12 +77,12 @@ mutable struct MonitoredLine <: ACBranch
7377
internal::InfrastructureSystemsInternal
7478
end
7579

76-
function MonitoredLine(name, available, active_power_flow, reactive_power_flow, arc, r, x, b, flow_limits, rating, angle_limits, services=Device[], ext=Dict{String, Any}(), )
77-
MonitoredLine(name, available, active_power_flow, reactive_power_flow, arc, r, x, b, flow_limits, rating, angle_limits, services, ext, InfrastructureSystemsInternal(), )
80+
function MonitoredLine(name, available, active_power_flow, reactive_power_flow, arc, r, x, b, flow_limits, rating, angle_limits, g=(from=0.0, to=0.0), services=Device[], ext=Dict{String, Any}(), )
81+
MonitoredLine(name, available, active_power_flow, reactive_power_flow, arc, r, x, b, flow_limits, rating, angle_limits, g, services, ext, InfrastructureSystemsInternal(), )
7882
end
7983

80-
function MonitoredLine(; name, available, active_power_flow, reactive_power_flow, arc, r, x, b, flow_limits, rating, angle_limits, services=Device[], ext=Dict{String, Any}(), internal=InfrastructureSystemsInternal(), )
81-
MonitoredLine(name, available, active_power_flow, reactive_power_flow, arc, r, x, b, flow_limits, rating, angle_limits, services, ext, internal, )
84+
function MonitoredLine(; name, available, active_power_flow, reactive_power_flow, arc, r, x, b, flow_limits, rating, angle_limits, g=(from=0.0, to=0.0), services=Device[], ext=Dict{String, Any}(), internal=InfrastructureSystemsInternal(), )
85+
MonitoredLine(name, available, active_power_flow, reactive_power_flow, arc, r, x, b, flow_limits, rating, angle_limits, g, services, ext, internal, )
8286
end
8387

8488
# Constructor for demo purposes; non-functional.
@@ -95,6 +99,7 @@ function MonitoredLine(::Nothing)
9599
flow_limits=(from_to=0.0, to_from=0.0),
96100
rating=0.0,
97101
angle_limits=(min=-1.571, max=1.571),
102+
g=(from=0.0, to=0.0),
98103
services=Device[],
99104
ext=Dict{String, Any}(),
100105
)
@@ -122,6 +127,8 @@ get_flow_limits(value::MonitoredLine) = get_value(value, value.flow_limits)
122127
get_rating(value::MonitoredLine) = get_value(value, value.rating)
123128
"""Get [`MonitoredLine`](@ref) `angle_limits`."""
124129
get_angle_limits(value::MonitoredLine) = value.angle_limits
130+
"""Get [`MonitoredLine`](@ref) `g`."""
131+
get_g(value::MonitoredLine) = value.g
125132
"""Get [`MonitoredLine`](@ref) `services`."""
126133
get_services(value::MonitoredLine) = value.services
127134
"""Get [`MonitoredLine`](@ref) `ext`."""
@@ -149,6 +156,8 @@ set_flow_limits!(value::MonitoredLine, val) = value.flow_limits = set_value(valu
149156
set_rating!(value::MonitoredLine, val) = value.rating = set_value(value, val)
150157
"""Set [`MonitoredLine`](@ref) `angle_limits`."""
151158
set_angle_limits!(value::MonitoredLine, val) = value.angle_limits = val
159+
"""Set [`MonitoredLine`](@ref) `g`."""
160+
set_g!(value::MonitoredLine, val) = value.g = val
152161
"""Set [`MonitoredLine`](@ref) `services`."""
153162
set_services!(value::MonitoredLine, val) = value.services = val
154163
"""Set [`MonitoredLine`](@ref) `ext`."""

src/models/generated/TGSimple.jl

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
#=
2+
This file is auto-generated. Do not edit.
3+
=#
4+
5+
#! format: off
6+
7+
"""
8+
mutable struct TGSimple <: TurbineGov
9+
d_t::Float64
10+
Tm::Float64
11+
P_ref::Float64
12+
ext::Dict{String, Any}
13+
states::Vector{Symbol}
14+
n_states::Int
15+
internal::InfrastructureSystemsInternal
16+
end
17+
18+
Parameters of a Simple one-state Turbine Governor
19+
20+
# Arguments
21+
- `d_t::Float64`: Inverse Droop parameter, validation range: `(0, nothing)`
22+
- `Tm::Float64`: Turbine Governor Low-Pass Time Constant [s], validation range: `(0, nothing)`
23+
- `P_ref::Float64`: (default: `1.0`) Reference Power Set-point (pu), validation range: `(0, nothing)`
24+
- `ext::Dict{String, Any}`: (default: `Dict{String, Any}()`) An [*ext*ra dictionary](@ref additional_fields) for users to add metadata that are not used in simulation, such as latitude and longitude.
25+
- `states::Vector{Symbol}`: (**Do not modify.**) The [states](@ref S) of the TGSimple model are:
26+
τm: mechanical torque
27+
- `n_states::Int`: (**Do not modify.**) TGSimple has 1 state
28+
- `internal::InfrastructureSystemsInternal`: (**Do not modify.**) PowerSystems.jl internal reference
29+
"""
30+
mutable struct TGSimple <: TurbineGov
31+
"Inverse Droop parameter"
32+
d_t::Float64
33+
"Turbine Governor Low-Pass Time Constant [s]"
34+
Tm::Float64
35+
"Reference Power Set-point (pu)"
36+
P_ref::Float64
37+
"An [*ext*ra dictionary](@ref additional_fields) for users to add metadata that are not used in simulation, such as latitude and longitude."
38+
ext::Dict{String, Any}
39+
"(**Do not modify.**) The [states](@ref S) of the TGSimple model are:
40+
τm: mechanical torque"
41+
states::Vector{Symbol}
42+
"(**Do not modify.**) TGSimple has 1 state"
43+
n_states::Int
44+
"(**Do not modify.**) PowerSystems.jl internal reference"
45+
internal::InfrastructureSystemsInternal
46+
end
47+
48+
function TGSimple(d_t, Tm, P_ref=1.0, ext=Dict{String, Any}(), )
49+
TGSimple(d_t, Tm, P_ref, ext, [:τm], 1, InfrastructureSystemsInternal(), )
50+
end
51+
52+
function TGSimple(; d_t, Tm, P_ref=1.0, ext=Dict{String, Any}(), states=[:τm], n_states=1, internal=InfrastructureSystemsInternal(), )
53+
TGSimple(d_t, Tm, P_ref, ext, states, n_states, internal, )
54+
end
55+
56+
# Constructor for demo purposes; non-functional.
57+
function TGSimple(::Nothing)
58+
TGSimple(;
59+
d_t=0,
60+
Tm=0,
61+
P_ref=0,
62+
ext=Dict{String, Any}(),
63+
)
64+
end
65+
66+
"""Get [`TGSimple`](@ref) `d_t`."""
67+
get_d_t(value::TGSimple) = value.d_t
68+
"""Get [`TGSimple`](@ref) `Tm`."""
69+
get_Tm(value::TGSimple) = value.Tm
70+
"""Get [`TGSimple`](@ref) `P_ref`."""
71+
get_P_ref(value::TGSimple) = value.P_ref
72+
"""Get [`TGSimple`](@ref) `ext`."""
73+
get_ext(value::TGSimple) = value.ext
74+
"""Get [`TGSimple`](@ref) `states`."""
75+
get_states(value::TGSimple) = value.states
76+
"""Get [`TGSimple`](@ref) `n_states`."""
77+
get_n_states(value::TGSimple) = value.n_states
78+
"""Get [`TGSimple`](@ref) `internal`."""
79+
get_internal(value::TGSimple) = value.internal
80+
81+
"""Set [`TGSimple`](@ref) `d_t`."""
82+
set_d_t!(value::TGSimple, val) = value.d_t = val
83+
"""Set [`TGSimple`](@ref) `Tm`."""
84+
set_Tm!(value::TGSimple, val) = value.Tm = val
85+
"""Set [`TGSimple`](@ref) `P_ref`."""
86+
set_P_ref!(value::TGSimple, val) = value.P_ref = val
87+
"""Set [`TGSimple`](@ref) `ext`."""
88+
set_ext!(value::TGSimple, val) = value.ext = val

0 commit comments

Comments
 (0)