11
2+ """
3+ Return the appropriate accessor function for the given aggregation topology type.
4+ For [`Area`](@ref) types, returns [`get_area`](@ref); for [`LoadZone`](@ref) types, returns [`get_load_zone`](@ref).
5+ """
26get_aggregation_topology_accessor (:: Type{Area} ) = get_area
7+ """
8+ Return the appropriate accessor function for the given aggregation topology type.
9+ For [`Area`](@ref) types, returns [`get_area`](@ref); for [`LoadZone`](@ref) types, returns [`get_load_zone`](@ref).
10+ """
311get_aggregation_topology_accessor (:: Type{LoadZone} ) = get_load_zone
412
13+ """
14+ Set the [`LoadZone`](@ref) for an [`ACBus`](@ref).
15+ """
516set_load_zone! (bus:: ACBus , load_zone:: LoadZone ) = bus. load_zone = load_zone
17+ """
18+ Set the [`Area`](@ref) for an [`ACBus`](@ref).
19+ """
620set_area! (bus:: ACBus , area:: Area ) = bus. area = area
721
822"""
9- Remove the aggregation topology in a ACBus
23+ Remove the aggregation topology in a [` ACBus`](@ref) by setting the corresponding field to `nothing`.
1024"""
1125_remove_aggregration_topology! (bus:: ACBus , :: LoadZone ) = bus. load_zone = nothing
1226_remove_aggregration_topology! (bus:: ACBus , :: Area ) = bus. area = nothing
1327
1428"""
15- Calculate the admittance of AC branches
29+ Generic method to calculate the admittance of [`ACTransmission`](@ref) devices.
1630"""
17- get_series_susceptance (b:: ACBranch ) = 1 / get_x (b)
31+ get_series_susceptance (b:: ACTransmission ) = 1 / get_x (b)
1832
1933"""
20-
34+ Returns the series susceptance of a controllable 2-winding transformer (e.g., [`TapTransformer`](@ref), [`PhaseShiftingTransformer`](@ref)) following the convention
2135in power systems to define susceptance as the inverse of the imaginary part of the impedance.
2236In the case of phase shifter transformers the angle is ignored.
2337
@@ -29,13 +43,22 @@ function get_series_susceptance(b::Union{TapTransformer, PhaseShiftingTransforme
2943 return y_a
3044end
3145
46+ function get_series_susceptance (:: Union{PhaseShiftingTransformer3W, Transformer3W} )
47+ throw (
48+ ArgumentError (
49+ " get_series_susceptance not implemented for multi-winding transformers, use get_series_susceptances instead" ,
50+ ),
51+ )
52+ end
53+
3254"""
33- Returns the series susceptance of a 3 winding phase shifting transformer as three values
34- (for each of the 3 branches) following the convention
35- in power systems to define susceptance as the inverse of the imaginary part of the impedance.
55+ Returns the series susceptance of a [`PhaseShiftingTransformer3W`](@ref) as three values
56+ (for each of the 3 branches) following the convention in power systems to define susceptance as the inverse of the imaginary part of the impedance.
3657The phase shift angles are ignored in the susceptance calculation.
58+
59+ See also: [`get_series_susceptance`](@ref) for 2-winding transformers and [`get_series_susceptances`](@ref get_series_susceptances(b::Transformer3W)) for [`Transformer3W`](@ref)
3760"""
38- function get_series_susceptance (b:: PhaseShiftingTransformer3W )
61+ function get_series_susceptances (b:: PhaseShiftingTransformer3W )
3962 y1 = 1 / get_x_primary (b)
4063 y2 = 1 / get_x_secondary (b)
4164 y3 = 1 / get_x_tertiary (b)
@@ -48,11 +71,13 @@ function get_series_susceptance(b::PhaseShiftingTransformer3W)
4871end
4972
5073"""
51- Returns the series susceptance of a 3 winding transformer as three values
74+ Returns the series susceptance of a [`Transformer3W`](@ref) as three values
5275(for each of the 3 branches) following the convention
5376in power systems to define susceptance as the inverse of the imaginary part of the impedance.
77+
78+ See also: [`get_series_susceptance`](@ref) for 2-winding transformers and [`get_series_susceptances`](@ref get_series_susceptances(b::PhaseShiftingTransformer3W)) for [`PhaseShiftingTransformer3W`](@ref)
5479"""
55- function get_series_susceptance (b:: Transformer3W )
80+ function get_series_susceptances (b:: Transformer3W )
5681 Z1s = get_r_primary (b) + get_x_primary (b) * 1im
5782 Z2s = get_r_secondary (b) + get_x_secondary (b) * 1im
5883 Z3s = get_r_tertiary (b) + get_x_tertiary (b) * 1im
@@ -64,28 +89,40 @@ function get_series_susceptance(b::Transformer3W)
6489 return (b1s, b2s, b3s)
6590end
6691
67- get_series_admittance (b:: ACBranch ) = 1 / (get_r (b) + get_x (b) * 1im )
92+ """
93+ Calculate the series admittance of a [`ACTransmission`](@ref) as the inverse of the complex impedance.
94+ Returns 1/(R + jX) where R is resistance and X is reactance.
95+ """
96+ get_series_admittance (b:: ACTransmission ) = 1 / (get_r (b) + get_x (b) * 1im )
97+
98+ function get_series_admittance (:: Union{PhaseShiftingTransformer3W, Transformer3W} )
99+ throw (
100+ ArgumentError (
101+ " get_series_admittance not implemented for multi-winding transformers." ,
102+ ),
103+ )
104+ end
68105
69106"""
70- Return the max active power for a device from get_active_power_limits.max
107+ Return the max active power for a device as the max field in the named tuple returned by [` get_active_power_limits`](@ref).
71108"""
72- function get_max_active_power (d:: T ) where {T <: Device }
109+ function get_max_active_power (d:: T ) where {T <: StaticInjection }
73110 return get_active_power_limits (d). max
74111end
75112
76113"""
77- Return the max reactive power for a device from get_reactive_power_limits.max
114+ Return the max reactive power for a device as the max field in the named tuple returned by [` get_reactive_power_limits`](@ref).
78115"""
79- function get_max_reactive_power (d:: T ):: Float64 where {T <: Device }
116+ function get_max_reactive_power (d:: T ):: Float64 where {T <: StaticInjection }
80117 if isnothing (get_reactive_power_limits (d))
81118 return Inf
82119 end
83120 return get_reactive_power_limits (d). max
84121end
85122
86123"""
87- Return the max reactive power for the Renewable Generation calculated as the rating * power_factor if
88- reactive_power_limits is nothing
124+ Return the max reactive power for a [`RenewableDispatch`](@ref) generator calculated as the ` rating` * ` power_factor` if
125+ the field ` reactive_power_limits` is ` nothing`
89126"""
90127function get_max_reactive_power (d:: RenewableDispatch )
91128 reactive_power_limits = get_reactive_power_limits (d)
@@ -95,55 +132,88 @@ function get_max_reactive_power(d::RenewableDispatch)
95132 return reactive_power_limits. max
96133end
97134
135+ """
136+ Generic fallback function for getting active power limits. Throws `ArgumentError` for devices
137+ that don't implement this function.
138+ """
98139get_active_power_limits (:: T ) where {T <: Device } =
99140 throw (ArgumentError (" get_active_power_limits not implemented for $T " ))
141+ """
142+ Generic fallback function for getting reactive power limits. Throws `ArgumentError` for devices
143+ that don't implement this function.
144+ """
100145get_reactive_power_limits (:: T ) where {T <: Device } =
101146 throw (ArgumentError (" get_reactive_power_limits not implemented for $T " ))
147+ """
148+ Generic fallback function for getting device rating. Throws `ArgumentError` for devices
149+ that don't implement this function.
150+ """
102151get_rating (:: T ) where {T <: Device } =
103152 throw (ArgumentError (" get_rating not implemented for $T " ))
153+ """
154+ Generic fallback function for getting power factor. Throws `ArgumentError` for devices
155+ that don't implement this function.
156+ """
104157get_power_factor (:: T ) where {T <: Device } =
105158 throw (ArgumentError (" get_power_factor not implemented for $T " ))
106159
107- function get_max_active_power (d:: StandardLoad )
108- total_load = get_max_constant_active_power (d)
109- # TODO : consider voltage
110- total_load += get_max_impedance_active_power (d)
111- total_load += get_max_current_active_power (d)
112- return total_load
113- end
114-
115- function get_max_active_power (d:: InterruptibleStandardLoad )
160+ """
161+ Calculate the maximum active power for a [`StandardLoad`](@ref) or [`InterruptibleStandardLoad`](@ref)
162+ by summing the maximum constant, impedance, and current components assuming a 1.0 voltage magnitude at the bus.
163+ """
164+ function get_max_active_power (d:: Union{InterruptibleStandardLoad, StandardLoad} )
116165 total_load = get_max_constant_active_power (d)
117- # TODO : consider voltage
118166 total_load += get_max_impedance_active_power (d)
119167 total_load += get_max_current_active_power (d)
120168 return total_load
121169end
122170
171+ """
172+ Get the flow limits from source [`Area`](@ref) to destination [`Area`](@ref) for an [`AreaInterchange`](@ref).
173+ """
123174function get_from_to_flow_limit (a:: AreaInterchange )
124175 return get_flow_limits (a). from_to
125176end
177+ """
178+ Get the flow limits from destination [`Area`](@ref) to source [`Area`](@ref) for an [`AreaInterchange`](@ref).
179+ """
126180function get_to_from_flow_limit (a:: AreaInterchange )
127181 return get_flow_limits (a). to_from
128182end
129183
184+ """
185+ Get the minimum active power flow limit for a [`TransmissionInterface`](@ref).
186+ """
130187function get_min_active_power_flow_limit (tx:: TransmissionInterface )
131188 return get_active_power_flow_limits (tx). min
132189end
133190
191+ """
192+ Get the maximum active power flow limit for a [`TransmissionInterface`](@ref).
193+ """
134194function get_max_active_power_flow_limit (tx:: TransmissionInterface )
135195 return get_active_power_flow_limits (tx). max
136196end
137197
198+ """
199+ Calculate the phase shift angle α for a [`TapTransformer`](@ref) or [`Transformer2W`](@ref) based on its winding group number.
200+ Returns the angle in radians, calculated as -(π/6) * `winding_group_number`.
201+ If the `winding_group_number` is `WindingGroupNumber.UNDEFINED`, returns 0.0 and issues a warning.
202+ """
138203function get_α (t:: Union{TapTransformer, Transformer2W} )
139204 if get_winding_group_number (t) == WindingGroupNumber. UNDEFINED
140- @warn " winding group number for summary (t ) is undefined, assuming zero phase shift"
205+ @warn " winding group number for $( summary (t) ) is undefined, assuming zero phase shift"
141206 return 0.0
142207 else
143208 return get_winding_group_number (t). value * - (π / 6 )
144209 end
145210end
146211
212+ """
213+ Calculate the phase shift angle α for the primary winding of a [`Transformer3W`](@ref)
214+ based on its primary winding group number. Returns the angle in radians, calculated
215+ as -(π/6) * `primary_group_number`. If `primary_group_number` is `WindingGroupNumber.UNDEFINED`, returns 0.0 and issues a warning.
216+ """
147217function get_α_primary (t:: Transformer3W )
148218 if get_primary_group_number (t) == WindingGroupNumber. UNDEFINED
149219 @warn " primary winding group number for $(summary (t)) is undefined, assuming zero phase shift"
@@ -152,6 +222,11 @@ function get_α_primary(t::Transformer3W)
152222 return get_primary_group_number (t). value * - (π / 6 )
153223 end
154224end
225+ """
226+ Calculate the phase shift angle α for the secondary winding of a [`Transformer3W`](@ref)
227+ based on its secondary winding group number. Returns the angle in radians, calculated
228+ as -(π/6) * `secondary_group_number`. If `secondary_group_number` is `WindingGroupNumber.UNDEFINED`, returns 0.0 and issues a warning.
229+ """
155230function get_α_secondary (t:: Transformer3W )
156231 if get_secondary_group_number (t) == WindingGroupNumber. UNDEFINED
157232 @warn " secondary winding group number for $(summary (t)) is undefined, assuming zero phase shift"
@@ -160,6 +235,11 @@ function get_α_secondary(t::Transformer3W)
160235 return get_secondary_group_number (t). value * - (π / 6 )
161236 end
162237end
238+ """
239+ Calculate the phase shift angle α for the tertiary winding of a [`Transformer3W`](@ref)
240+ based on its tertiary winding group number. Returns the angle in radians, calculated
241+ as -(π/6) * `tertiary_group_number`. If `tertiary_group_number` is `WindingGroupNumber.UNDEFINED`, returns 0.0 and issues a warning.
242+ """
163243function get_α_tertiary (t:: Transformer3W )
164244 if get_tertiary_group_number (t) == WindingGroupNumber. UNDEFINED
165245 @warn " tertiary winding group number for $(summary (t)) is undefined, assuming zero phase shift"
0 commit comments