I have a ModelingToolkit model that is a nonlinear ODE. I have made steady-state, transient and optimization analyses on this model.
Now I would like to impose an additional constraint on one of the variables of the model, and find a steady-state solution that respects this additional constraint.
I do not want to rebuild another model from scratch, only to add this constraint for specific solutions.
@ChrisRackauckas seems to provide a solution for that in SteadyStateProblem solved result problem - #21 by ChrisRackauckas, but that forbids using standard ModelingToolkit indexing of solutions and other convenient tools.
Here is an example based on ModelingToolkit’s documentation (maybe not a good one).
using ModelingToolkit, OrdinaryDiffEq
using ModelingToolkit: t_nounits as t, D_nounits as D
@parameters g
@variables x(t) y(t) [state_priority = 10] λ(t)
eqs = [D(D(x)) ~ λ * x
D(D(y)) ~ λ * y - g
x^2 + y^2 ~ 1]
@mtkbuild pend = ODESystem(eqs, t)
What I would like to do is to modify pend
in some fashion to enforce e.g. lambda = 1
at all times