How to read and save a counter value on the target computer when xPC starts and stops (operating cycle counter)?

1 view (last 30 days)
To log the number of cycles executed by an test rig during the control development and testing phase, I would like to read and save a counter value to disk when an xPC model is started and stopped, respectively. The idea is to count the number of cycles (fatigue) every time the model is executed and store this on the target computer. Ideally, this is done automatically, in other words without intervention or using a custom stop script on the host computer, and with minimal load on the target (e.g. logging the number every second with a file scope).
Can the two Simulink coder blocks 'System Start' and 'System Terminate' be used to perform this task? Better yet, are there native Simulink block to replace these functions? Or can I use these blocks to generate a trigger and then use triggered sub-systems to do the actual work?
Is it possible to use one file for both a file scope and a 'From File' block?
Matlab version: 2012b

Answers (0)

Community Treasure Hunt

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

Start Hunting!