|
173 | 173 | p = [rand()]
|
174 | 174 | x = [rand()]
|
175 | 175 | u = [rand()]
|
176 |
| - @test f[1](x, u, p, 1) == -x + u |
| 176 | + @test f[1](x, u, p, 1) ≈ -x + u |
177 | 177 |
|
178 | 178 | # With disturbance inputs
|
179 | 179 | @variables x(t)=0 u(t)=0 [input = true] d(t)=0
|
|
191 | 191 | p = [rand()]
|
192 | 192 | x = [rand()]
|
193 | 193 | u = [rand()]
|
194 |
| - @test f[1](x, u, p, 1) == -x + u |
| 194 | + @test f[1](x, u, p, 1) ≈ -x + u |
195 | 195 |
|
196 | 196 | ## With added d argument
|
197 | 197 | @variables x(t)=0 u(t)=0 [input = true] d(t)=0
|
|
210 | 210 | x = [rand()]
|
211 | 211 | u = [rand()]
|
212 | 212 | d = [rand()]
|
213 |
| - @test f[1](x, u, p, t, d) == -x + u + [d[]^2] |
| 213 | + @test f[1](x, u, p, t, d) ≈ -x + u + [d[]^2] |
214 | 214 | end
|
215 | 215 | end
|
216 | 216 |
|
@@ -434,7 +434,7 @@ matrices, ssys = linearize(augmented_sys,
|
434 | 434 | (; io_sys,) = ModelingToolkit.generate_control_function(sys, simplify = true)
|
435 | 435 | obsfn = ModelingToolkit.build_explicit_observed_function(
|
436 | 436 | io_sys, [x + u * t]; inputs = [u])
|
437 |
| - @test obsfn([1.0], [2.0], MTKParameters(io_sys, []), 3.0) == [7.0] |
| 437 | + @test obsfn([1.0], [2.0], MTKParameters(io_sys, []), 3.0) ≈ [7.0] |
438 | 438 | end
|
439 | 439 |
|
440 | 440 | # https://github.com/SciML/ModelingToolkit.jl/issues/2896
|
|
445 | 445 | @named sys = ODESystem(eqs, t, [x], [])
|
446 | 446 |
|
447 | 447 | f, dvs, ps, io_sys = ModelingToolkit.generate_control_function(sys, simplify = true)
|
448 |
| - @test f[1]([0.5], nothing, MTKParameters(io_sys, []), 0.0) == [1.0] |
| 448 | + @test f[1]([0.5], nothing, MTKParameters(io_sys, []), 0.0) ≈ [1.0] |
449 | 449 | end
|
450 | 450 |
|
451 | 451 | @testset "With callable symbolic" begin
|
|
0 commit comments