MATLAB Answers

0

Recommended method for importing data in bus object format into a Rapid Accelerator simulation.

Asked by Martin Butcher on 18 Jun 2015
Latest activity Commented on by Martin Butcher on 1 Jul 2015
Would very much appreciate recommendations / guidance on the below.
I wish to do the following:
  1. Run model1 (a physical system), log the simulation results.
  2. Run model2 (a monitoring system), importing the model1 results into model2
I would like model2 to run in rapid accelerator mode as I have many different tests scenarios from model1 to run through model2. The data being imported from model1 is always of the same format, but can be of different lengths (i.e. simulation times).
The model1 data is logged as a bus object and logged using signal logging + the dataset method (to logsout).
In model2, I import the logged data using the "Data Import/Export / load from workspace / input" field of the Configuration Parameters window using a command
logsout.getElement('myData');
I then import using a root level inport - which works fine in normal and accel, but not rapid accel mode. In rapid accel mode, I receive the error "Rapid accelerator only supports array or structure format".
I have also tried changing the root level inport to a "from workspace" block, but any changes to the length of the data it is pointing at trigger a rebuild, which I would like to avoid!
Comments and suggestions most welcome.
Martin.

  0 Comments

Sign in to comment.

1 Answer

Answer by Andrew Schenk on 19 Jun 2015
 Accepted Answer

A From File block supports reading a MAT file that is a struct of Timeseries as a bus array. Note that you will need to save the bus output from model1 in the v7.3 format:
myData = logsout.getElement('myData').Values;
save mydata.mat -v7.3 myData
Then in model2, replace the From Workspace with the From File block being sure to specify the appropriate bus object as the output data type.
I work at MathWorks and will pass along your feature request for Timeseries support of root level input ports in Rapid Accelerator mode.

  2 Comments

Thanks for the response and solution. It would be great to for root level inports to support bus objects in Rapid Accelerator mode.
I had come up with a work around by flattening my bus object to a structure of ts objects. But this was not so elegant, and you lose the robustness of signal naming.
I will try your method on Monday.
Thanks Andrew. Tried this and it works fine.
I did notice that the simulation was slower to run that when using structure arrays and root level inports using the same data. Typically total simulation time went from 70s to 130s using this method. (and this was with RapidAcceleratorUpToDateCheck = off).

Sign in to comment.