You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on May 12, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on May 12, 2026. It is now read-only.
When simulating systems, one often needs to keep track of the input and onput signals. Assume we have the following representation:
xdot = A*x + B*u(t,x)
y = C*x + D*u(t,x)
Then, a solution similar to
type TimeResponse{T} <:DEDataArray{T}
x::Array{T,1}
u::Array{T,1}
y::Array{T,1}endfunctionf(t::Real,x::TimeResponse,dx::AbstractVector,u)
ucalc =u(t, x.x) # callable object on (::Real,::AbstractVector)isa(ucalc, AbstractVector) ||DomainError()
x.u = ucalc
dx[:] = A*x.x + B*x.u # for some A, B
x.y = C*x.x + D*x.u
end
would handle everything. However, in this way, interpolation on u and y are note available in the current design.
Moreover, u object above can be a discrete-time system object on its own, with some samplingtime(u) defined. Then, this object will calculate the new values at each samplingtime(u) and hold the previous value at all times. See, e.g.,
function (u::System)(t::Real, x::AbstractVector)
if t >= u.tprev +samplingtime(u)
u.tprev = t
u.uprev =...# calculate new valueend
u.uprev
end
this approach can also run easily using tstops keyword.
However, if there is gonna be some change in DEDataArray type to support the algebraic equations as those above, one needs to think about this issue. Should it be DEDataArrays responsibility to take this discrete behaviour in mind (interpolation would yield the stairs), or should it be the object's job to cache some values and not do any interpolation when asked by the DifferentialEquations ecosystem packages? Would there exist some common interface between the two?
However, if there is gonna be some change in DEDataArray type to support the algebraic equations as those above, one needs to think about this issue. Should it be DEDataArrays responsibility to take this discrete behaviour in mind (interpolation would yield the stairs), or should it be the object's job to cache some values and not do any interpolation when asked by the DifferentialEquations ecosystem packages?
DEDataArray does its job which, while it can handle parts of this, is separate from this issue. So I think this should be a new type which is more specific to this problem.
I think the solution is to register u and C*x.x + D*x.u so that way x.u and x.y are calculated on-demand for interpolations.
should it be the object's job to cache some values
I'm not sure I know of another way to handle this if it's a function call. Maybe you can "register" variables as discrete, and it will do "discrete interpolation" (take the left endpoint of any known interval).
I'm not sure I know of another way to handle this if it's a function call. Maybe you can "register" variables as discrete, and it will do "discrete interpolation" (take the left endpoint of any known interval).
No, this is the proposed new type. Either compute values on demand using a function, or default to "discrete" and interpolate by taking the value from the left.
Actually, this is compatible with the current DEDataArray. That would follow directly if similar was changed. Computing values from a function can be another type, but making the interpolation include the discrete variables is an easy update.
Triage: DEDataArray/DEDataVector has been completely removed from DiffEqBase. MTK's observables system is the recommended replacement. This issue is no longer relevant. Recommend closing.
Closing: DEDataArray has been deprecated and removed. Algebraic relation interpolation is now handled by ModelingToolkit.jl. DiffEqBase.jl has been merged into OrdinaryDiffEq.jl.
Activity
ChrisRackauckas commentedon May 10, 2017
DEDataArraydoes its job which, while it can handle parts of this, is separate from this issue. So I think this should be a new type which is more specific to this problem.I think the solution is to register
uandC*x.x + D*x.uso that wayx.uandx.yare calculated on-demand for interpolations.I'm not sure I know of another way to handle this if it's a function call. Maybe you can "register" variables as discrete, and it will do "discrete interpolation" (take the left endpoint of any known interval).
aytekinar commentedon May 10, 2017
is this already supported? then it's great!
ChrisRackauckas commentedon May 10, 2017
No, this is the proposed new type. Either compute values on demand using a function, or default to "discrete" and interpolate by taking the value from the left.
Actually, this is compatible with the current
DEDataArray. That would follow directly ifsimilarwas changed. Computing values from a function can be another type, but making the interpolation include the discrete variables is an easy update.aytekinar commentedon May 10, 2017
I don't know what I can say --- that's just impressive! Would be cool to see that. Thanks!
ChrisRackauckas commentedon May 10, 2017
The discrete change is implemented on DiffEqBase master. Some tags are needed.
ChrisRackauckas-Claude commentedon Mar 24, 2026
Triage:
DEDataArray/DEDataVectorhas been completely removed from DiffEqBase. MTK's observables system is the recommended replacement. This issue is no longer relevant. Recommend closing.ChrisRackauckas commentedon Mar 24, 2026
Closing: DEDataArray has been deprecated and removed. Algebraic relation interpolation is now handled by ModelingToolkit.jl. DiffEqBase.jl has been merged into OrdinaryDiffEq.jl.