-
Notifications
You must be signed in to change notification settings - Fork 70
/
Source.jl
136 lines (127 loc) · 5.08 KB
/
Source.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
#=
This file is auto-generated. Do not edit.
=#
#! format: off
"""
mutable struct Source <: StaticInjection
name::String
available::Bool
bus::ACBus
active_power::Float64
reactive_power::Float64
R_th::Float64
X_th::Float64
internal_voltage::Float64
internal_angle::Float64
dynamic_injector::Union{Nothing, DynamicInjection}
services::Vector{Service}
ext::Dict{String, Any}
internal::InfrastructureSystemsInternal
end
This struct acts as an infinity bus.
# Arguments
- `name::String`
- `available::Bool`
- `bus::ACBus`
- `active_power::Float64`
- `reactive_power::Float64`
- `R_th::Float64`: Source Thevenin resistance, validation range: `(0, nothing)`
- `X_th::Float64`: Source Thevenin reactance, validation range: `(0, nothing)`
- `internal_voltage::Float64`: Internal Voltage, validation range: `(0, nothing)`
- `internal_angle::Float64`: Internal Angle
- `dynamic_injector::Union{Nothing, DynamicInjection}`: corresponding dynamic injection device
- `services::Vector{Service}`: Services that this device contributes to
- `ext::Dict{String, Any}`
- `internal::InfrastructureSystemsInternal`: power system internal reference, do not modify
"""
mutable struct Source <: StaticInjection
name::String
available::Bool
bus::ACBus
active_power::Float64
reactive_power::Float64
"Source Thevenin resistance"
R_th::Float64
"Source Thevenin reactance"
X_th::Float64
"Internal Voltage"
internal_voltage::Float64
"Internal Angle"
internal_angle::Float64
"corresponding dynamic injection device"
dynamic_injector::Union{Nothing, DynamicInjection}
"Services that this device contributes to"
services::Vector{Service}
ext::Dict{String, Any}
"power system internal reference, do not modify"
internal::InfrastructureSystemsInternal
end
function Source(name, available, bus, active_power, reactive_power, R_th, X_th, internal_voltage=1.0, internal_angle=0.0, dynamic_injector=nothing, services=Device[], ext=Dict{String, Any}(), )
Source(name, available, bus, active_power, reactive_power, R_th, X_th, internal_voltage, internal_angle, dynamic_injector, services, ext, InfrastructureSystemsInternal(), )
end
function Source(; name, available, bus, active_power, reactive_power, R_th, X_th, internal_voltage=1.0, internal_angle=0.0, dynamic_injector=nothing, services=Device[], ext=Dict{String, Any}(), internal=InfrastructureSystemsInternal(), )
Source(name, available, bus, active_power, reactive_power, R_th, X_th, internal_voltage, internal_angle, dynamic_injector, services, ext, internal, )
end
# Constructor for demo purposes; non-functional.
function Source(::Nothing)
Source(;
name="init",
available=false,
bus=ACBus(nothing),
active_power=0.0,
reactive_power=0.0,
R_th=0,
X_th=0,
internal_voltage=0,
internal_angle=0,
dynamic_injector=nothing,
services=Device[],
ext=Dict{String, Any}(),
)
end
"""Get [`Source`](@ref) `name`."""
get_name(value::Source) = value.name
"""Get [`Source`](@ref) `available`."""
get_available(value::Source) = value.available
"""Get [`Source`](@ref) `bus`."""
get_bus(value::Source) = value.bus
"""Get [`Source`](@ref) `active_power`."""
get_active_power(value::Source) = value.active_power
"""Get [`Source`](@ref) `reactive_power`."""
get_reactive_power(value::Source) = value.reactive_power
"""Get [`Source`](@ref) `R_th`."""
get_R_th(value::Source) = value.R_th
"""Get [`Source`](@ref) `X_th`."""
get_X_th(value::Source) = value.X_th
"""Get [`Source`](@ref) `internal_voltage`."""
get_internal_voltage(value::Source) = value.internal_voltage
"""Get [`Source`](@ref) `internal_angle`."""
get_internal_angle(value::Source) = value.internal_angle
"""Get [`Source`](@ref) `dynamic_injector`."""
get_dynamic_injector(value::Source) = value.dynamic_injector
"""Get [`Source`](@ref) `services`."""
get_services(value::Source) = value.services
"""Get [`Source`](@ref) `ext`."""
get_ext(value::Source) = value.ext
"""Get [`Source`](@ref) `internal`."""
get_internal(value::Source) = value.internal
"""Set [`Source`](@ref) `available`."""
set_available!(value::Source, val) = value.available = val
"""Set [`Source`](@ref) `bus`."""
set_bus!(value::Source, val) = value.bus = val
"""Set [`Source`](@ref) `active_power`."""
set_active_power!(value::Source, val) = value.active_power = val
"""Set [`Source`](@ref) `reactive_power`."""
set_reactive_power!(value::Source, val) = value.reactive_power = val
"""Set [`Source`](@ref) `R_th`."""
set_R_th!(value::Source, val) = value.R_th = val
"""Set [`Source`](@ref) `X_th`."""
set_X_th!(value::Source, val) = value.X_th = val
"""Set [`Source`](@ref) `internal_voltage`."""
set_internal_voltage!(value::Source, val) = value.internal_voltage = val
"""Set [`Source`](@ref) `internal_angle`."""
set_internal_angle!(value::Source, val) = value.internal_angle = val
"""Set [`Source`](@ref) `services`."""
set_services!(value::Source, val) = value.services = val
"""Set [`Source`](@ref) `ext`."""
set_ext!(value::Source, val) = value.ext = val