Skip to content

Commit b240dcc

Browse files
committed
Add error checking
1 parent 7452f5a commit b240dcc

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

src/systems/abstractsystem.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -746,6 +746,7 @@ end
746746
# to an `ODESystem` to connect systems, and we later can reply on
747747
# `structural_simplify` to convert `ODESystem`s to `NonlinearSystem`s.
748748
function toodesystem(sys, t; name=nameof(sys))
749+
isempty(observed(sys)) || throw(ArgumentError("`toodesystem` cannot handle reduced model (i.e. observed(sys) is non-empty)."))
749750
t = value(t)
750751
varmap = Dict()
751752
sts = states(sys)

test/nonlinearsystem.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,3 +106,4 @@ sys = structural_simplify(sys)
106106
prob = ODEProblem(sys, [subsys.x => 1, subsys.z => 2.0], (0, 1.0), [subsys.σ=>1,subsys.ρ=>2,subsys.β=>3])
107107
sol = solve(prob, Rodas5())
108108
@test sol[subsys.x] + sol[subsys.y] - sol[subsys.z] sol[subsys.u]
109+
@test_throws ArgumentError toodesystem(sys, t)

0 commit comments

Comments
 (0)