Save data from Simulink model run in external mode in real time directly to a file at each timestep
6 views (last 30 days)
Show older comments
Number seven
on 21 Jan 2020
Commented: Number seven
on 5 Mar 2020
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?
0 Comments
Accepted Answer
More Answers (0)
See Also
Categories
Find more on Simulink Coder in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!