Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions test/Blocks/continuous.jl
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ end
@named pt2 = SecondOrder(; k = k, w = w, d = d)
@named iosys = System(connect(c.output, pt2.input), t, systems = [pt2, c])
sys = mtkcompile(iosys)
prob = ODEProblem(sys, [unknowns(sys) .=> 0.0...; pt2.xd => 0.0], (0.0, 100.0))
prob = ODEProblem(sys, unknowns(sys) .=> 0.0, (0.0, 100.0))
sol = solve(prob, Rodas4())
@test sol.retcode == Success
@test sol[pt2.output.u] ≈ pt2_func.(sol.t, k, w, d) atol = 1.0e-3
Expand Down Expand Up @@ -176,7 +176,6 @@ end
systems = [pi_controller, plant, ref, fb]
)
sys = mtkcompile(model)
initial_conditions(sys)[sys.pi_controller.gainPI.k] = 1.0
prob = ODEProblem(sys, Pair[], (0.0, 100.0))
sol = solve(prob, Rodas4())
@test sol.retcode == Success
Expand Down Expand Up @@ -277,7 +276,6 @@ end
systems = [pi_controller, plant, ref, fb, sat]
)
sys = mtkcompile(model)
initial_conditions(sys)[sys.pi_controller.gainPI.k] = 1.0
prob = ODEProblem(sys, Pair[], (0.0, 20.0))
sol = solve(prob, Rodas4())
end
Expand Down
4 changes: 2 additions & 2 deletions test/Blocks/test_analysis_points.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ using SciCompDSL
using ModelingToolkit
using ModelingToolkitStandardLibrary.Blocks
using OrdinaryDiffEq
using ModelingToolkit: get_eqs, vars, @set!, t_nounits as t
using ModelingToolkit: t_nounits as t
using ControlSystemsBase

@named P = FirstOrder(k = 1, T = 1)
Expand Down Expand Up @@ -80,7 +80,7 @@ L = P*C
open_sys, (u, y) = ModelingToolkit.open_loop(sys, :plant_input)

# Linearizing the open-loop system should yield the same system as get_looptransfer
matrices, _ = linearize(open_sys, [u], [y])
matrices, _ = linearize(open_sys, u, y)
@test matrices.A[] == -1
@test matrices.B[] * matrices.C[] == -1 # either one negative
@test matrices.D[] == 0
Expand Down
8 changes: 4 additions & 4 deletions test/Electrical/analog.jl
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,7 @@ end
end
end

@mtkbuild sys = SimpleNMOSCircuit(V_cc = 5.0, V_b = 3.5)
@mtkcompile sys = SimpleNMOSCircuit(V_cc = 5.0, V_b = 3.5)

prob = ODEProblem(sys, Pair[], (0.0, 10.0))
sol = solve(prob)
Expand Down Expand Up @@ -673,7 +673,7 @@ end
end
end

@mtkbuild flipped_sys = FlippedNMOSCircuit(V_cc = 5.0, V_b = 3.5)
@mtkcompile flipped_sys = FlippedNMOSCircuit(V_cc = 5.0, V_b = 3.5)

flipped_prob = ODEProblem(flipped_sys, Pair[], (0.0, 10.0))
flipped_sol = solve(flipped_prob)
Expand Down Expand Up @@ -717,7 +717,7 @@ end
end
end

@mtkbuild sys = SimplePMOSCircuit(V_s = 5.0, V_b = 2.5, V_d = 3)
@mtkcompile sys = SimplePMOSCircuit(V_s = 5.0, V_b = 2.5, V_d = 3)

prob = ODEProblem(sys, Pair[], (0.0, 10.0))
sol = solve(prob)
Expand Down Expand Up @@ -760,7 +760,7 @@ end
end
end

@mtkbuild flipped_sys = FlippedPMOSCircuit(V_s = 5.0, V_b = 2.5, V_d = 3)
@mtkcompile flipped_sys = FlippedPMOSCircuit(V_s = 5.0, V_b = 2.5, V_d = 3)

flipped_prob = ODEProblem(flipped_sys, Pair[], (0.0, 10.0))
flipped_sol = solve(flipped_prob)
Expand Down
2 changes: 1 addition & 1 deletion test/Hydraulic/isothermal_compressible.jl
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ end
defs[sys.input.buffer] = Parameter(0.5 * x, dt)

# NOTE: bypassing initialization system: https://github.com/SciML/ModelingToolkit.jl/issues/3312
prob = ODEProblem(sys, [unknowns(initsys)[1] => initsol[1]], (0, 0.1); build_initializeprob = false)
prob = ODEProblem(sys, unknowns(initsys) .=> initsol.u[end], (0, 0.1); build_initializeprob = false)

#TODO: Implement proper initialization system after issue is resolved
#TODO: How to bring the body back and not have an overdetermined system?
Expand Down
Loading