Closed ven-k closed 2 weeks ago
@ChrisRackauckas My understanding from our discussion this morning is that you don't think this is actually a bug. But can you explain in this issue why you think this isn't a valid bug and what the remedy is? I'm just the middle man here.
I think the answer to the initialization_eqs
is:
Comment by Chris in this issue:
Yes, the equations are not satisfiable. Note that it's not (x=>1, y=>1, x^2 + y^2 ~ 1), it's (x=>1, y ~ 1, x^2 + y^2 ~ 1). That's different. initialization_eqs can have any nonlinear function. You cannot assume it's always analytically solvable. There is an issue of asking why this one isn't actually simplified out, which may be related to the unsatisfiabiltiy, but you should expect that if you can put in a nonlinear system then you need a guess.
But also, x = 1, y = 1, x^2 + y^2 != 1, so this test case is erroring for good reasons.
But I wonder if guesses
can be promoted as u0
whenever available.
But I wonder if guesses can be promoted as u0 whenever available.
There is already so much confusion about the relationship between guesses and initial conditions, I don't want to do anything to reinforce that.
I need to revisit the tests
I had previously reviewed to understand why this is even coming up. I don't understand why we are adding initialization equations that cannot be satisfied.
There is already so much confusion about the relationship between guesses and initial conditions, I don't want to do anything to reinforce that.
There is no confusion between guesses and initial conditions. They are separate. And we want to keep it that way. "But I wonder if guesses can be promoted as u0 whenever available." is exactly the kind of thing that would confuse them which is why we won't do it.
@ChrisRackauckas My understanding from our discussion this morning is that you don't think this is actually a bug. But can you explain in this issue why you think this isn't a valid bug and what the remedy is? I'm just the middle man here.
No, I was talking about the other issue that @ven-k opened at the same time https://github.com/SciML/ModelingToolkit.jl/issues/2787. This one seems to have opened after our discussion.
But I agree with the error message:
isys = generate_initializesystem(model)
julia> equations(isys)
3-element Vector{Equation}:
0 ~ c₊k - c₊output₊u(t)
0 ~ -pt2₊y(t) + pt2₊x(t)
0 ~ c₊output₊u(t) - pt2₊u(t)
julia> unknowns(isys)
5-element Vector{SymbolicUtils.BasicSymbolic{Real}}:
pt2₊x(t)
pt2₊xd(t)
c₊output₊u(t)
pt2₊y(t)
pt2₊u(t)
that pt2₊xd(t) is not in the system. Though I think you are hitting a bug here about underdetermined systems that are fully solvable.
julia> sys = structural_simplify(isys; fully_determined = false)
Model model with 0 equations
Unknowns (0):
Parameters (5):
c₊k [defaults to 1]: Constant output value of block
pt2₊k [defaults to 1]: Gain
There should be 2 unknowns in here after simplifying 3 equations to 0. It's another instance of https://github.com/SciML/ModelingToolkit.jl/issues/2515. @YingboMa can you take a look at that?
Describe the bug 🐞
Despite setting the ~
initialization_eqs
(or~guesses
, initialization fails during the construction of ODEProblem; passing au0
with same values works.Expected behavior
Whenever
guesses
are in the model, andu0
doesn't override its values, it should be used to complete the initialization.Minimal Reproducible Example 👇
Error & Stacktrace ⚠️
Environment (please complete the following information):
using Pkg; Pkg.status()
versioninfo()