Combined Discrete-Continuous Simulation In SIMULINK

8 visualizaciones (últimos 30 días)
Sajjad Monfared
Sajjad Monfared el 3 de Ag. de 2024
Comentada: Sajjad Monfared el 6 de Ag. de 2024
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:
  1. is first transformed to through some algebraic functions,
  2. an IVP is set up with its initial condition set to . This IVP is then solved using a variable step ODE solver from to ,
  3. the solution at time , is then mapped to the next state by some other algebraic mappings.
blk-diagram
The following figure shows how the state is propagated thorugh time, in a single step:
timeline
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.

Respuestas (1)

Paul
Paul el 3 de Ag. de 2024
Editada: Paul el 3 de Ag. de 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 comentarios
Paul
Paul el 6 de Ag. de 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.
Sajjad Monfared
Sajjad Monfared el 6 de Ag. de 2024
Now that you mention it, this block diagram might not actually be a correct representation of the system dyanmics. I constructed it from the description I gave earlier of how the system is supposed to behave. But the diagram that comes after it clearly shows how I actually want the variables to change over time.
With reference to the second diagram, I realized that I should let the solver do its job (integration of the grayed continuous-time subsystem using a variable-step method) while I only intervene at times to manually change the state by applying necessary functions (, ) to the current state which is available in the state port.
Below is the output of the simulation (annotated by some arrows).

Iniciar sesión para comentar.

Categorías

Más información sobre Configure Simulation Conditions en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by