Clear Filters
Clear Filters

Simulink Logging Triggered data

3 views (last 30 days)
Reuben Symons
Reuben Symons on 11 Jan 2022
Answered: Vidip on 17 Jan 2024
I have a model I'm trying to test which has some sytems running on a continuous time step and some which are triggered externally.
I want to be able to perform checks on the data in the continuous system dependent on the output of the triggered system. My issue is that the timeseries object created in the simulink dataset for the triggered subsystem has only a single value in it from when that was triggered. In Simulink this value is set to held so it should be the initial value until the subsystem is triggered then the calculated value unless there is another call to that subsystem.
I thought I might fix the issue by logging the value from the continuous time subsytsem but that didn't work. I've tried resampling but that requires at least two datasamples.
Is there a way to get the initial value of an output to log so that I can make the resampling work, or a way to force the logging of a signal to occur at a fixed rate.
Example:
dataset.sltest_simout.get('logsout').get('clockedVar').Values.Data % Where clockedVar is in a subsytem updating every 100ms.
dataset.sltest_simout.get('logsout').get('triggeredVar').Values.Data % Where triggeredVar is in a subsytem triggered by a test harness input.
% I want to perform a check on some data if triggeredVar = 10 and clockedVar = 1
performTest = and(triggeredVar==10, clockedVar ==1) % this does not work as the times series objects are not aligned. The only workaround would be to filter clockedVar according to the timeStamp for the triggered Var if the triggeredVar ==10. This then gets messy if there is a second triggered value later as then you need to check each triggered value and then filter the clockedVar between the timestamps where triggeredVar ==10 and the next triggered value.

Answers (1)

Vidip
Vidip on 17 Jan 2024
I understand that you want to handle the issue of logging and comparing data from a continuous system and a triggered subsystem in Simulink.
In the Simulink model configuration parameters, under the "Data Import/Export" section, you can specify the logging options. You can adjust 'Decimation' and 'Logging intervals' to control the rate and intervals at which data is logged. When you only want to save and analyse data for particular time intervals, you can specify the time intervals in which to log data. Using logging intervals allows you to save specific data without changing or adding complexity to your model.
If you want to log a signal from a triggered subsystem at a fixed rate, you can use a Rate Transition block to resample the signal to the desired rate. This block can help you to bridge the gap between different sample times.
For further information, refer to the documentation links below:

Products


Release

R2018b

Community Treasure Hunt

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

Start Hunting!