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
The following model contains only discrete-time variables. It simplifies and solves, but the solution is completely incorrect, possibly because it is being incorrectly treated as a continuous-time system
using ModelingToolkit
using ModelingToolkitStandardLibrary.Blocks
using ModelingToolkit: t_nounits as t
k =ShiftIndex()
@mtkmodel Del begin@extend u, y = siso =SISO()
@structural_parametersbegin
n =1end@equationsbegin
y ~u(k-n)
endend@mtkmodel DelayModel begin@componentsbegin
delay =Del(n =3)
input =Constant(k =1)
end@equationsbeginconnect(input.output, delay.input)
endend@mtkbuild m =DelayModel()
prob =ODEProblem(m, [m.delay.u(k-3)=>0, m.delay.u(k-2)=>0, m.delay.u(k-1)=>0], (0.0, 10.0))
sol =solve(prob, Tsit5())
The following model contains only discrete-time variables. It simplifies and solves, but the solution is completely incorrect, possibly because it is being incorrectly treated as a continuous-time system
The solution should have only 1 and 0 elements
The solution here is$t, \frac{t^2}{2}, \frac{t^3}{6}$ , which happens to be correct for a continuous-time triple-integrator system.
Also:
The text was updated successfully, but these errors were encountered: