-
Notifications
You must be signed in to change notification settings - Fork 70
/
ReducedOrderPLL.jl
87 lines (78 loc) · 3.19 KB
/
ReducedOrderPLL.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
#=
This file is auto-generated. Do not edit.
=#
#! format: off
"""
mutable struct ReducedOrderPLL <: FrequencyEstimator
ω_lp::Float64
kp_pll::Float64
ki_pll::Float64
ext::Dict{String, Any}
states::Vector{Symbol}
n_states::Int
end
Parameters of a Phase-Locked Loop (PLL) based on Purba, Dhople, Jafarpour, Bullo and Johnson.
"Reduced-order Structure-preserving Model for Parallel-connected Three-phase Grid-tied Inverters."
2017 IEEE 18th Workshop on Control and Modeling for Power Electronics (COMPEL): 1-7.
# Arguments
- `ω_lp::Float64`: PLL low-pass filter frequency (rad/sec), validation range: `(0, nothing)`
- `kp_pll::Float64`: PLL proportional gain, validation range: `(0, nothing)`
- `ki_pll::Float64`: PLL integral gain, validation range: `(0, nothing)`
- `ext::Dict{String, Any}`
- `states::Vector{Symbol}`: The states of the ReducedOrderPLL model are:
vq_pll: q-axis of the measured voltage in the PLL synchronous reference frame (SRF),
ε_pll: Integrator state of the PI controller,
θ_pll: Phase angle displacement in the PLL SRF
- `n_states::Int`: ReducedOrderPLL has 3 states
"""
mutable struct ReducedOrderPLL <: FrequencyEstimator
"PLL low-pass filter frequency (rad/sec)"
ω_lp::Float64
"PLL proportional gain"
kp_pll::Float64
"PLL integral gain"
ki_pll::Float64
ext::Dict{String, Any}
"The states of the ReducedOrderPLL model are:
vq_pll: q-axis of the measured voltage in the PLL synchronous reference frame (SRF),
ε_pll: Integrator state of the PI controller,
θ_pll: Phase angle displacement in the PLL SRF"
states::Vector{Symbol}
"ReducedOrderPLL has 3 states"
n_states::Int
end
function ReducedOrderPLL(ω_lp, kp_pll, ki_pll, ext=Dict{String, Any}(), )
ReducedOrderPLL(ω_lp, kp_pll, ki_pll, ext, [:vq_pll, :ε_pll, :θ_pll], 3, )
end
function ReducedOrderPLL(; ω_lp, kp_pll, ki_pll, ext=Dict{String, Any}(), states=[:vq_pll, :ε_pll, :θ_pll], n_states=3, )
ReducedOrderPLL(ω_lp, kp_pll, ki_pll, ext, states, n_states, )
end
# Constructor for demo purposes; non-functional.
function ReducedOrderPLL(::Nothing)
ReducedOrderPLL(;
ω_lp=0,
kp_pll=0,
ki_pll=0,
ext=Dict{String, Any}(),
)
end
"""Get [`ReducedOrderPLL`](@ref) `ω_lp`."""
get_ω_lp(value::ReducedOrderPLL) = value.ω_lp
"""Get [`ReducedOrderPLL`](@ref) `kp_pll`."""
get_kp_pll(value::ReducedOrderPLL) = value.kp_pll
"""Get [`ReducedOrderPLL`](@ref) `ki_pll`."""
get_ki_pll(value::ReducedOrderPLL) = value.ki_pll
"""Get [`ReducedOrderPLL`](@ref) `ext`."""
get_ext(value::ReducedOrderPLL) = value.ext
"""Get [`ReducedOrderPLL`](@ref) `states`."""
get_states(value::ReducedOrderPLL) = value.states
"""Get [`ReducedOrderPLL`](@ref) `n_states`."""
get_n_states(value::ReducedOrderPLL) = value.n_states
"""Set [`ReducedOrderPLL`](@ref) `ω_lp`."""
set_ω_lp!(value::ReducedOrderPLL, val) = value.ω_lp = val
"""Set [`ReducedOrderPLL`](@ref) `kp_pll`."""
set_kp_pll!(value::ReducedOrderPLL, val) = value.kp_pll = val
"""Set [`ReducedOrderPLL`](@ref) `ki_pll`."""
set_ki_pll!(value::ReducedOrderPLL, val) = value.ki_pll = val
"""Set [`ReducedOrderPLL`](@ref) `ext`."""
set_ext!(value::ReducedOrderPLL, val) = value.ext = val