How can I use simulink without time simulation?

21 vues (au cours des 30 derniers jours)
David Rojas Blanco
David Rojas Blanco le 19 Fév 2019
Hi everyone,
This is my very first time posting here. Let's say that I'm a "rookie" eager to learn more and more from Matlab and Simulink. I will be starting soon to start some simulink tasks at my job (with help from some guy who knows about Matlab) but I'm developing (or trying) to do some things on my own just to progress.
I want to build a simulink model which has to read the data from an Excel file. The data in the Excel comes from a data acquisition system which has logged:
  • 1 column for air pressure
  • 1 column with time (1 read every 1 milisecond -1kHz-)
The purpose of my model is to read the air pressure value and integrate it but it has to do it according to the corresponding recording time in the cell of the adjacent column. I'm stuck at understanding how simulink performs the simulations because I want the model to introduce the air pressure value read every 1 milisecond as recorded in the data acquisition system but I'm forced to set a simulation time in simulink which doesn't match my data.
How can I tell Simulink "hey, this is my air pressure at 1 milisecond, integrate it, then, this is my air pressure at 2 miliseconds and integrate it" and so on?
I hope my question is clear

Réponse acceptée

Jim Riggs
Jim Riggs le 19 Fév 2019
Modifié(e) : Jim Riggs le 19 Fév 2019
If your timestep is constant, you can set your model to run at a fixed timestep. You can even specify a non-zero start time if you want to. To do this, click on the model configuration parameters button, then on the "solver" tab, set the solver type to "fixed-step". Then you can specify the time step under "additional settings".
A second approach is to build yourself a simple tick counter like so:
On each pass of the simulation, this counter will increment by one (no matter what the time step is). You can use this counter as an index to do a table look-up on your data.
  1 commentaire
Jim Riggs
Jim Riggs le 19 Fév 2019
Note that you can turn the tick counter into your own fixed-step clock by multiplying the tick count by the time step.
MatlabAnswers 20190219b.JPG

Connectez-vous pour commenter.

Plus de réponses (3)

David Rojas Blanco
David Rojas Blanco le 20 Fév 2019
Thank you very much for your quick reply Jim! I think that now I understand your approach and how the simulink manages the inputs, I will modify my model as you suggest and see what happens.
Thanks again.

David Rojas Blanco
David Rojas Blanco le 21 Fév 2019
I have tried to set the solver to the suggested parameters but since all the values I have to simulate in a vector called "p_boost" so I have done a loop to change the index and simulate the points one by one but then it says that the relational operators cannot accept data like this.
Find enclosed the part of the model with the issue and the reported error.
Captura.PNG
2.PNG

David Rojas Blanco
David Rojas Blanco le 21 Fév 2019
I think that I just found the problem. I have to add the same loop to change the index of the input vector to the "rpm" block as well.

Catégories

En savoir plus sur Programmatic Model Editing dans Help Center et File Exchange

Produits


Version

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by