Skip to content

Commit e16cf4d

Browse files
fix: fix initialization of linearize testset
1 parent ce0533f commit e16cf4d

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

test/downstream/linearize.jl

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,16 @@ lsys, ssys = linearize(sys, r, r) # Test allow scalars
4747
```
4848

4949
function plant(; name)
50-
@variables x(t) = 1
51-
@variables u(t)=0 y(t)=0
50+
@variables x(t)
51+
@variables u(t) y(t)
5252
D = Differential(t)
5353
eqs = [D(x) ~ -x + u
5454
y ~ x]
5555
ODESystem(eqs, t; name = name)
5656
end
5757

5858
function filt_(; name)
59-
@variables x(t)=0 y(t)=0
59+
@variables x(t) y(t)
6060
@variables u(t)=0 [input = true]
6161
D = Differential(t)
6262
eqs = [D(x) ~ -2 * x + u
@@ -65,7 +65,7 @@ function filt_(; name)
6565
end
6666

6767
function controller(kp; name)
68-
@variables y(t)=0 r(t)=0 u(t)=0
68+
@variables y(t)=0 r(t)=0 u(t)
6969
@parameters kp = kp
7070
eqs = [
7171
u ~ kp * (r - y)
@@ -108,7 +108,8 @@ Nd = 10
108108
@named pid = LimPID(; k, Ti, Td, Nd)
109109

110110
@unpack reference, measurement, ctr_output = pid
111-
lsys0, ssys = linearize(pid, [reference.u, measurement.u], [ctr_output.u])
111+
lsys0, ssys = linearize(pid, [reference.u, measurement.u], [ctr_output.u];
112+
op = Dict(reference.u => 0.0, measurement.u => 0.0))
112113
@unpack int, der = pid
113114
desired_order = [int.x, der.x]
114115
lsys = ModelingToolkit.reorder_unknowns(lsys0, unknowns(ssys), desired_order)
@@ -314,7 +315,7 @@ matrices = linfun([1.0], Dict(p => 3.0), 1.0)
314315
end
315316

316317
@testset "Issue #2941" begin
317-
@variables x(t) y(t)
318+
@variables x(t) y(t) [guess = 1.0]
318319
@parameters p
319320
eqs = [0 ~ x * log(y) - p]
320321
@named sys = ODESystem(eqs, t; defaults = [p => 1.0])

0 commit comments

Comments
 (0)