I am currently using Simulink with a Real-Time Windows Target in order to control and perform tests on a hardware-in-the-loop system. The hardware device is unstable, so I have designed a simple closed-loop controller in Simulink to keep the system stable during testing. I am using a fixed-step discrete-time solver (no continuous states).
A testing period lasts about an hour, so I use the "Inf" simulation end time trick to keep the controller operating the whole time. However, I need to perform a series of 30-second data collection trials during this hour. These data capture periods must be triggered manually by a technician.
During a given data capture period, I would like to save 30-second lengths of several signals to the workspace. For now, let's say that the technician starts a data capture period by pressing a button in a GUIDE GUI. I'm familiar with making a GUI modify Simulink parameters during run-time.
While implementing this functionality is trivial using M-code or C, I'm drawing a blank as to how to do it in Simulink. It seems as though the triggered or enabled subsystem blocks could be used, but I'm unsure how to they could be "turned off" at the correct time. In particular, the (seeming) inability to code for-loops that work from time-step to time-step instead of within a single time-step is frustrating.
Is there a good way to implement this functionality in Simulink? Thanks for any help.
Best Answer