Quanser+Simulink Real-time workshop, triggered save to host computer.

Hello,
I have a problem configuring a real-time experiment to save data the way I want to, if someone here could help I would be very grateful.
The setup that I'm using is a Quanser Shake Table II and a Quanser Q8 data acquisition card installed in a PC running 32-bit Windows 7 and Matlab/Simulink with real time workshop.
I've managed to set everything up so that it is to control the shaking table and read out the response from the mechanical system mounted on the table. After changing the forcing parameters (frequency and amplitude) of the table, the mechanical system has a long transient period, before it settles down to a stationary behavior. Since I'm only interested in saving data for a short period of the stationary behavior, and the continue changing the parameters of the experiment, I need to be able to trigger the data-streaming on/off. Qunaser made a block specifically for writing data to the host-pc, and this block can be triggered in the same way as scopes through the 'External Mode Control Panel' in Simulink.
Now my problem is that it is not possible for me to choose different options for triggering different signals. If i make a trigger signal, that will allow me to trigger the data-stream to disk, all the scopes that triggers using this signal. This is very unfortunate since it is important for me to be able to monitor the experiments throught the scopes, while it is running. Furthermore, the .mat file that the Quanser block creates appears to be corrupted, unless I stop the execution of the model on the Real-time target before loading it. This same is the case if I use the save data to workspace feature from the scopes. Since my experiment has to run continously it is not possible for me to start and stop the model on the real time target.
I am sorry for the lengthy text, it was hard to explain shorter..
If anybody could help me with this, or even just if anybody has an idea of what I could try, I would be greatly apreciated!
Thank you very much!
- Emil

 Accepted Answer

What version of MATLAB are you using? At least in the latest release, it appears possible to select individual signals for triggering: http://www.mathworks.com/help/toolbox/rtw/ug/bs61qx2.html#f1003723 (full disclosure: I don't have any experience with external mode simulations)
There also appears to be an option "Write intermediate results to workspace" which should let you examine the data without stopping the model.

1 Comment

Thank you very much for the reply! I tried this and would have expected it to work, but unfortunately this is not the case. I think the 'Write intermediate results to workspace' is simply for dumping data onto the host computer, in order to save memory on the real time board. But the data is not accessible - e.g. if I try to load an intermediate .mat file it gives me a 'file damaged' (can't remember the exact message) error. The Quanser Simulink models seems only to dump the data and make files accessible when the model is terminated. Luckily there is a workaround, that I will try to post for anyone who's interested. See below.

Sign in to comment.

More Answers (1)

Hi everybody
The guys at Quanser tech support was very kind to help me with a workaround for this problem. So I will briefly sketch this here, so that anybody with the same problems can refer to this. Please feel free to contact me to get the models solving this problem.
The workaround is:
- Have two models running on the real time board. One model is running continuously and managing the experiment. This model includes the 'stream server block', making it possible to stream selected data to another model. The other one is called when needed, receives the streamed data and writes it to a file. After the desired recording time, this model is terminated and the data is saved.

Community Treasure Hunt

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

Start Hunting!