-
-
Notifications
You must be signed in to change notification settings - Fork 209
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
solve
fails with InitialFailure
: overdetermined system
#3047
Comments
Isn't the initial value of |
Yep, this would be the expected behaviour for me too. For context, this is part of a higher level interface where |
Yes, there is nothing wrong here. It fails initialization because it's overdetermined and 0 is not the solution, but you're saying 0 has to be the solution. The working code is of course: using ModelingToolkit
using ModelingToolkit: t_nounits as t, D_nounits as D
using OrdinaryDiffEq
@variables x(t)=1 jcn(t) [input = true]
@parameters k=1 h=2
eqs = [
D(x) ~ -k*x + jcn,
jcn ~ -h*x
]
@named sys = System(eqs, t)
ss = structural_simplify(sys)
prob = ODEProblem(ss, [], (0, 10)) # errors with ;fully_determined=true
sol = solve(prob, Tsit5()) Do not mix guesses with chosen defaults. |
That's not how the default works. It is always a default equation, |
Yep, this was my fix. I just opened the issue for others, because I was not certain if this is expected behaviour or bug.
Got it, I was treating it as a guess. |
No, a guess is different. |
Describe the bug 🐞
solve
fails withInitialFailure
because it treats my system as overdetermined. System is technically not overdetermined, it just has an state (jcn(t)
) that only appears in an algebraic equation and it is successfully substituted/eliminated duringstructural_simplify
.Expected behavior
A clear and concise description of what you expected to happen.
Minimal Reproducible Example 👇
IIUC
generate_initializesystem
treats the default value ofjcn(t)=0
as one equation in the InitialSystem and its algebraic equationjcn ~ -hx
as a second equation, both involving a single state, thus overdetermined system? If I remove the default value ofjcn(t)
it works fine.Possibly related to #3033
Error & Stacktrace⚠️
Environment (please complete the following information):
using Pkg; Pkg.status()
versioninfo()
The text was updated successfully, but these errors were encountered: