Skip to content

Commit b2b3f67

Browse files
committed
add names to batch_ss as well
1 parent a9fa17f commit b2b3f67

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/ode_system.jl

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ unsafe_comparisons(true)
346346
@variables x(t)=0 [bounds = (-2, 2)]
347347
@variables v(t)=0
348348
@variables u(t)=0
349-
@variables y(t)=0
349+
@variables y(t)
350350
351351
D = Differential(t)
352352
@@ -360,6 +360,7 @@ eqs = [D(x) ~ v
360360
bounds = getbounds(duffing, unknowns(duffing))
361361
sample_within_bounds((l, u)) = (u - l) * rand() + l
362362
# Create a vector of operating points
363+
N = 10
363364
ops = map(1:N) do i
364365
op = Dict(x => sample_within_bounds(bounds[x]) for x in keys(bounds) if isfinite(bounds[x][1]))
365366
end
@@ -403,7 +404,11 @@ See also [`trajectory_ss`](@ref) and [`fuzz`](@ref).
403404
"""
404405
function batch_ss(args...; kwargs...)
405406
lins, ssys, resolved_ops = batch_linearize(args...; kwargs...)
406-
[ss(l...) for l in lins], ssys, resolved_ops
407+
named_linsystems = map(lins) do l
408+
# Convert to a NamedStateSpace with the same names as the original system
409+
named_ss(ss(l.A, l.B, l.C, l.D); name = string(Base.nameof(ssys)), x = symstr.(unknowns(ssys)))
410+
end
411+
named_linsystems, ssys, resolved_ops
407412
end
408413

409414
# function unnamespace(ap)

0 commit comments

Comments
 (0)