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
Copy file name to clipboardExpand all lines: src/named_systems2.jl
+10-6Lines changed: 10 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -182,12 +182,16 @@ end
182
182
183
183
Concatenate the operating points of the systems in `systems` into a single operating point, but only for the state vector `x`. The input vector `u` is taken from the first system's operating point, and all other systems are verified to have the same `u` operating point. If any system has an operating point, the resulting system will have an operating point with the concatenated state vector and the input vector from the first system.
184
184
"""
185
-
functionmerge_ops_x(systems...)
185
+
functionmerge_ops_x(systems...; u_from =:same)
186
186
ifany(has_operating_point, systems)
187
-
allequal(operating_point(sys).u for sys in systems) ||
188
-
throw(ArgumentError("All systems must have the same input operating point u to be concatenated."))
187
+
if u_from ===:same
188
+
allequal(operating_point(sys).u for sys in systems) ||
189
+
throw(ArgumentError("All systems must have the same input operating point u to be concatenated."))
190
+
opu =operating_point(systems[1]).u
191
+
elseif u_from isa Integer
192
+
opu =operating_point(systems[u_from]).u
193
+
end
189
194
opx =reduce(vcat, operating_point(sys).x for sys in systems)
190
-
opu =operating_point(systems[1]).u
191
195
op = (; x = opx, u = opu)
192
196
extra =Dict(:operating_point=> op)
193
197
else
@@ -296,8 +300,8 @@ function named_ss(sys::AbstractStateSpace{T};
296
300
throw(ArgumentError("Length of output names must match size(sys,1) ($(size(sys,1))), got length $(length(y))"))
297
301
298
302
check_unique(x, "x", "Cannot create a NamedStateSpace system with more than one variable with the same name")
299
-
check_unique(y, "y", "Cannot create a NamedStateSpace system with more than one variable with the same name")
300
303
if unique
304
+
check_unique(y, "y", "To allow connecting a single output signal to several outputs with the same name, pass `unique = false`.")
301
305
check_unique(u, "u", "To allow connecting a single input signal to several inputs with the same name, pass `unique = false`.")
302
306
end
303
307
@@ -420,7 +424,7 @@ function Base.:*(s1::NamedStateSpace{T}, s2::NamedStateSpace{T}) where {T <: CS.
0 commit comments