Save data from Simulink model run in external mode in real time directly to a file at each timestep

26 vues (au cours des 30 derniers jours)
I am trying to save a set of variables obtained in a Simulink simulation that is run in external mode on a Beaglebone Black. This simulation should go on for around 2h, and I am using a sample time of 0.006s.
I attempted using just the To Workspace blocks first, however, it seems like there is a limit on the amount of data that can be stored. I already put that limit as high as I can by doing
Code>External Mode Control Panel>Signal & Triggering>Trigger Options>Duration
and setting the limit to the max value that allows the model to still build (this happened to be 980000, which corresponds to 980000*0.006=5880s=98min). What happens is that if the duration of the simulation exceeds 98 min, I lose the data saved up until then.
So my thought was to save the data directly to a file at every timestep, instead of saving all of it at the end of the simulation. For this, I adapted the function sfun_mult234_2.c to use in an S-Function block, which reads a set of inputs and saves it directly to a file. I am able to save data just fine when using this function in a dummy model running in Normal mode, but when I try External mode in my actual model, the contents of the file are blank. The file is completely empty.
Does someone know how to solve this, or if there is another alternative?

Réponse acceptée

Urmila Rajpurohith
Urmila Rajpurohith le 4 Mar 2020
  1 commentaire
Number seven
Number seven le 5 Mar 2020
Thank you for the answer. I was able to solve my problem using the point 2 suggested in the linked answer.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Multicore Processor Targets 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