-
Notifications
You must be signed in to change notification settings - Fork 70
/
SimpleAFMachine.jl
169 lines (160 loc) · 6.86 KB
/
SimpleAFMachine.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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
#=
This file is auto-generated. Do not edit.
=#
#! format: off
"""
mutable struct SimpleAFMachine <: Machine
R::Float64
Xd::Float64
Xq::Float64
Xd_p::Float64
Xq_p::Float64
Xd_pp::Float64
Xq_pp::Float64
Td0_p::Float64
Tq0_p::Float64
Td0_pp::Float64
Tq0_pp::Float64
ext::Dict{String, Any}
states::Vector{Symbol}
n_states::Int
internal::InfrastructureSystemsInternal
end
Parameters of 4-states simplified Anderson-Fouad (SimpleAFMachine) model.
The derivative of stator fluxes (ψd and ψq) is neglected and ωψd = ψd and
ωψq = ψq is assumed (i.e. ω=1.0). This is standard when transmission network
dynamics is neglected.
If transmission dynamics is considered use the full order Anderson Fouad model.
# Arguments
- `R::Float64`: Resistance after EMF in machine per unit, validation range: `(0, nothing)`
- `Xd::Float64`: Reactance after EMF in d-axis per unit, validation range: `(0, nothing)`
- `Xq::Float64`: Reactance after EMF in q-axis per unit, validation range: `(0, nothing)`
- `Xd_p::Float64`: Transient reactance after EMF in d-axis per unit, validation range: `(0, nothing)`
- `Xq_p::Float64`: Transient reactance after EMF in q-axis per unit, validation range: `(0, nothing)`
- `Xd_pp::Float64`: Sub-Transient reactance after EMF in d-axis per unit, validation range: `(0, nothing)`
- `Xq_pp::Float64`: Sub-Transient reactance after EMF in q-axis per unit, validation range: `(0, nothing)`
- `Td0_p::Float64`: Time constant of transient d-axis voltage, validation range: `(0, nothing)`
- `Tq0_p::Float64`: Time constant of transient q-axis voltage, validation range: `(0, nothing)`
- `Td0_pp::Float64`: Time constant of sub-transient d-axis voltage, validation range: `(0, nothing)`
- `Tq0_pp::Float64`: Time constant of sub-transient q-axis voltage, validation range: `(0, nothing)`
- `ext::Dict{String, Any}`
- `states::Vector{Symbol}`: The states are:
eq_p: q-axis transient voltage,
ed_p: d-axis transient voltage,
eq_pp: q-axis subtransient voltage,
ed_pp: d-axis subtransient voltage
- `n_states::Int`: SimpleAFMachine has 4 states
- `internal::InfrastructureSystemsInternal`: power system internal reference, do not modify
"""
mutable struct SimpleAFMachine <: Machine
"Resistance after EMF in machine per unit"
R::Float64
"Reactance after EMF in d-axis per unit"
Xd::Float64
"Reactance after EMF in q-axis per unit"
Xq::Float64
"Transient reactance after EMF in d-axis per unit"
Xd_p::Float64
"Transient reactance after EMF in q-axis per unit"
Xq_p::Float64
"Sub-Transient reactance after EMF in d-axis per unit"
Xd_pp::Float64
"Sub-Transient reactance after EMF in q-axis per unit"
Xq_pp::Float64
"Time constant of transient d-axis voltage"
Td0_p::Float64
"Time constant of transient q-axis voltage"
Tq0_p::Float64
"Time constant of sub-transient d-axis voltage"
Td0_pp::Float64
"Time constant of sub-transient q-axis voltage"
Tq0_pp::Float64
ext::Dict{String, Any}
"The states are:
eq_p: q-axis transient voltage,
ed_p: d-axis transient voltage,
eq_pp: q-axis subtransient voltage,
ed_pp: d-axis subtransient voltage"
states::Vector{Symbol}
"SimpleAFMachine has 4 states"
n_states::Int
"power system internal reference, do not modify"
internal::InfrastructureSystemsInternal
end
function SimpleAFMachine(R, Xd, Xq, Xd_p, Xq_p, Xd_pp, Xq_pp, Td0_p, Tq0_p, Td0_pp, Tq0_pp, ext=Dict{String, Any}(), )
SimpleAFMachine(R, Xd, Xq, Xd_p, Xq_p, Xd_pp, Xq_pp, Td0_p, Tq0_p, Td0_pp, Tq0_pp, ext, [:eq_p, :ed_p, :eq_pp, :ed_pp], 4, InfrastructureSystemsInternal(), )
end
function SimpleAFMachine(; R, Xd, Xq, Xd_p, Xq_p, Xd_pp, Xq_pp, Td0_p, Tq0_p, Td0_pp, Tq0_pp, ext=Dict{String, Any}(), states=[:eq_p, :ed_p, :eq_pp, :ed_pp], n_states=4, internal=InfrastructureSystemsInternal(), )
SimpleAFMachine(R, Xd, Xq, Xd_p, Xq_p, Xd_pp, Xq_pp, Td0_p, Tq0_p, Td0_pp, Tq0_pp, ext, states, n_states, internal, )
end
# Constructor for demo purposes; non-functional.
function SimpleAFMachine(::Nothing)
SimpleAFMachine(;
R=0,
Xd=0,
Xq=0,
Xd_p=0,
Xq_p=0,
Xd_pp=0,
Xq_pp=0,
Td0_p=0,
Tq0_p=0,
Td0_pp=0,
Tq0_pp=0,
ext=Dict{String, Any}(),
)
end
"""Get [`SimpleAFMachine`](@ref) `R`."""
get_R(value::SimpleAFMachine) = value.R
"""Get [`SimpleAFMachine`](@ref) `Xd`."""
get_Xd(value::SimpleAFMachine) = value.Xd
"""Get [`SimpleAFMachine`](@ref) `Xq`."""
get_Xq(value::SimpleAFMachine) = value.Xq
"""Get [`SimpleAFMachine`](@ref) `Xd_p`."""
get_Xd_p(value::SimpleAFMachine) = value.Xd_p
"""Get [`SimpleAFMachine`](@ref) `Xq_p`."""
get_Xq_p(value::SimpleAFMachine) = value.Xq_p
"""Get [`SimpleAFMachine`](@ref) `Xd_pp`."""
get_Xd_pp(value::SimpleAFMachine) = value.Xd_pp
"""Get [`SimpleAFMachine`](@ref) `Xq_pp`."""
get_Xq_pp(value::SimpleAFMachine) = value.Xq_pp
"""Get [`SimpleAFMachine`](@ref) `Td0_p`."""
get_Td0_p(value::SimpleAFMachine) = value.Td0_p
"""Get [`SimpleAFMachine`](@ref) `Tq0_p`."""
get_Tq0_p(value::SimpleAFMachine) = value.Tq0_p
"""Get [`SimpleAFMachine`](@ref) `Td0_pp`."""
get_Td0_pp(value::SimpleAFMachine) = value.Td0_pp
"""Get [`SimpleAFMachine`](@ref) `Tq0_pp`."""
get_Tq0_pp(value::SimpleAFMachine) = value.Tq0_pp
"""Get [`SimpleAFMachine`](@ref) `ext`."""
get_ext(value::SimpleAFMachine) = value.ext
"""Get [`SimpleAFMachine`](@ref) `states`."""
get_states(value::SimpleAFMachine) = value.states
"""Get [`SimpleAFMachine`](@ref) `n_states`."""
get_n_states(value::SimpleAFMachine) = value.n_states
"""Get [`SimpleAFMachine`](@ref) `internal`."""
get_internal(value::SimpleAFMachine) = value.internal
"""Set [`SimpleAFMachine`](@ref) `R`."""
set_R!(value::SimpleAFMachine, val) = value.R = val
"""Set [`SimpleAFMachine`](@ref) `Xd`."""
set_Xd!(value::SimpleAFMachine, val) = value.Xd = val
"""Set [`SimpleAFMachine`](@ref) `Xq`."""
set_Xq!(value::SimpleAFMachine, val) = value.Xq = val
"""Set [`SimpleAFMachine`](@ref) `Xd_p`."""
set_Xd_p!(value::SimpleAFMachine, val) = value.Xd_p = val
"""Set [`SimpleAFMachine`](@ref) `Xq_p`."""
set_Xq_p!(value::SimpleAFMachine, val) = value.Xq_p = val
"""Set [`SimpleAFMachine`](@ref) `Xd_pp`."""
set_Xd_pp!(value::SimpleAFMachine, val) = value.Xd_pp = val
"""Set [`SimpleAFMachine`](@ref) `Xq_pp`."""
set_Xq_pp!(value::SimpleAFMachine, val) = value.Xq_pp = val
"""Set [`SimpleAFMachine`](@ref) `Td0_p`."""
set_Td0_p!(value::SimpleAFMachine, val) = value.Td0_p = val
"""Set [`SimpleAFMachine`](@ref) `Tq0_p`."""
set_Tq0_p!(value::SimpleAFMachine, val) = value.Tq0_p = val
"""Set [`SimpleAFMachine`](@ref) `Td0_pp`."""
set_Td0_pp!(value::SimpleAFMachine, val) = value.Td0_pp = val
"""Set [`SimpleAFMachine`](@ref) `Tq0_pp`."""
set_Tq0_pp!(value::SimpleAFMachine, val) = value.Tq0_pp = val
"""Set [`SimpleAFMachine`](@ref) `ext`."""
set_ext!(value::SimpleAFMachine, val) = value.ext = val