You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Connect `in` and `out` with an [`AnalysisPoint`](@ref) inbetween.
83
+
The incoming connection `in` is expected to be of type [`RealOutput`](@ref), and vice versa.
84
+
85
+
# Arguments:
86
+
- `in`: A connector of type [`RealOutput`](@ref)
87
+
- `out`: A connector of type [`RealInput`](@ref)
88
+
- `ap`: An explicitly created [`AnalysisPoint`](@ref)
89
+
- `ap_name`: If a name is given, an [`AnalysisPoint`](@ref) with the given name will be created automatically.
90
+
"""
91
+
function ModelingToolkit.connect(in, ap::AnalysisPoint, out)
92
+
ap.in =in
93
+
ap.out = out
94
+
return0~ ap
95
+
end
96
+
97
+
function ModelingToolkit.connect(in, ap_name::Symbol, out)
98
+
return0~AnalysisPoint(in, out, ap_name)
99
+
end
100
+
101
+
ModelingToolkit.vars(ap::AnalysisPoint; op = Differential) =vars(connect(ap.in, ap.out); op)
102
+
103
+
"""
104
+
find_analysis_point(sys, name::Symbol)
105
+
106
+
Find and return the analysis point in `sys` with the specified `name`. If no matching [`AnalysisPoint`](@ref) is found, `nothing` is returned.
107
+
"""
108
+
functionfind_analysis_point(sys, name)
109
+
for eq inequations(sys)
110
+
eq.rhs isa AnalysisPoint && eq.rhs.name == name && (return eq.rhs)
111
+
end
112
+
nothing
113
+
end
114
+
115
+
"""
116
+
expand_analysis_points(sys)
117
+
118
+
Replace analysis points with the identity connection connect(ap.in, ap.out). This is called before a system containing analysis points is simulated, in which case analysis points have no effect.
119
+
"""
120
+
functionexpand_analysis_points(sys)
121
+
new_eqs =map(get_eqs(sys)) do eq
122
+
eq.rhs isa AnalysisPoint || (return eq)
123
+
ap = eq.rhs
124
+
connect(ap.in, ap.out)
125
+
end
126
+
@set! sys.eqs = new_eqs
127
+
sys
128
+
end
129
+
130
+
"""
131
+
get_sensitivity(sys, ap::AnalysisPoint; kwargs)
132
+
get_sensitivity(sys, ap_name::Symbol; kwargs)
133
+
134
+
Compute the sensitivity function in analysis point `ap`. The sensitivity function is obtained by introducing an infinitesimal perturbation `d` at the input of `ap`, linearizing the system and computing the transfer function between `d` and the output of `ap`.
135
+
136
+
# Arguments:
137
+
- `kwargs`: Are sent to `ModelingToolkit.linearize`
Compute the complementary sensitivity function in analysis point `ap`. The complementary sensitivity function is obtained by introducing an infinitesimal perturbation `d` at the output of `ap`, linearizing the system and computing the transfer function between `d` and the input of `ap`.
158
+
159
+
# Arguments:
160
+
- `kwargs`: Are sent to `ModelingToolkit.linearize`
0 commit comments