-
-
Notifications
You must be signed in to change notification settings - Fork 233
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Take the following...
using ModelingToolkit
using ModelingToolkit: t_nounits as t, D_nounits as D
pars = @parameters begin
k = 1
end
vars = @variables begin
x(t) = 0
dx(t) = 0
ddx(t) = 0
y(t)
dy(t)
ddy(t)
input(t) = 0, [input=true]
end
eqs = [
D(x) ~ dx
D(dx) ~ ddx
D(y) ~ dy
D(dy) ~ ddy
ddy ~ k*(y - x)
D(ddy) ~ input
]
@named sys = ODESystem(eqs, t, vars, pars)
sys, = structural_simplify(sys, ([input], Num[]))This gives the following equations and observables...
julia> full_equations(sys)
3-element Vector{Equation}:
Differential(t)(ddy(t)) ~ input(t)
Differential(t)(dy(t)) ~ ddy(t)
Differential(t)(y(t)) ~ dy(t)
julia> observed(sys)
8-element Vector{Equation}:
x(t) ~ (-ddy(t) + k*y(t)) / k
ddyˍtt(t) ~ Differential(t)(input(t))
yˍtt(t) ~ ddy(t)
xˍt(t) ~ (-input(t) + k*dy(t)) / k
xˍtt(t) ~ (-ddyˍtt(t) + k*yˍtt(t)) / k
dx(t) ~ xˍt(t)
dxˍt(t) ~ xˍtt(t)
ddx(t) ~ dxˍt(t)
Note: the term ddyˍtt(t) ~ Differential(t)(input(t)). Inputs should be considered piecewise constant and therefore the derivative should be assumed zero. Or if that assumption is not acceptable, there should be a way to then provide the definition of D(input).
This issue expands on the requirements laid out in #3823
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working