Combined Discrete-Continuous Simulation In SIMULINK
9 views (last 30 days)
Show older comments
I am not even sure if that is the right title for this question.
Here's the question:
How to implement the following dynamic system in Simulink?
Here's the problem:
Time points are used to establish a uniform time grid on the interval , where the constant step size is . The solver is assumed to be at the beginning of the time step , where the state at the current time , is known, and the objective is to compute the next state through the relation , where F is described as follows:
- is first transformed to through some algebraic functions,
- an IVP is set up with its initial condition set to . This IVP is then solved using a variable step ODE solver from to ,
- the solution at time , is then mapped to the next state by some other algebraic mappings.
The following figure shows how the state is propagated thorugh time, in a single step:
In the output, I need the intermediate solutions (denoted by x) in each step, as well as the state variables .This can be easily done in a script, but I am looking for a way to do it in Simulink; which may be trivial problem, but I am really confused at this moment and I can't really find a way to do it.
In some ways, in each step, the continuous-time subsystem waits for the input to be available, and once it is there, the external solver "waits" for the continuous-time subsystem to locally solve the continuous-time dynamical equations using an adaptive step-size solver, then the external solver receives this subsystem's output and continuous to perform the remaining functions to produce . I feel like this should be logical workflow of the simulation, but I am not sure how Simulink treats problems of this type.
0 Comments
Answers (1)
Paul
on 3 Aug 2024
Edited: Paul
on 3 Aug 2024
Hi Sajjad,
It sounds like you want to use the feature of the Integrator block for Resetting the State. At every t_i, you can reset the state to z_1 using the External Initial Condition.
3 Comments
Paul
on 6 Aug 2024
It sounds like the current approach does not implement the block diagram shown in the question. For that system as shown, there's no need to use the state port, and the corresponding Simulink model would satisfy the relation z2(t_i) = z1(t_i).
If the delay from q(t_i+1) to q(t_i) is removed, then I think you get into the situation of the "self resetting integrator," in which case the state port is needed. But again, that doesn't match the block diagram as shown.
Having said that, what you have now sounds like it's what you want; happy to hear that you achieved a solution.
See Also
Categories
Find more on Configure Simulation Conditions in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!