필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Is it possible in Simulink for Fixed step discrete simulations (lets say it does 10 iterations) to save a variable only after conditions are met, so that output var has variable size (any size between 0 and 10)?

조회 수: 1 (최근 30일)
I am working on a real-time event-detection system for tokamaks. The detector will run during the entire time of the plasma discharge. It uses a fixed sample time as the detector will run on a computer node which executes the code every 1e-4[s].
For simplicity let's say that in total the detector will do 10 iterations. Currently all the signals that are stored will be of length equal to 10 (every iteration it saves a value).
This that the variable for "TimeOfDetection" will consists of values -1 when no detection occurred, and it will store the actual time of detection when in fact a detection has occurred.
However, this is not optimal and it would be better if only a value is if a detection has occurred, so that for example the length of TimeOfDetection is equal to 3 (if 3 detections have occurred), with as values only the detection times and no -1's to fill the other entries.
I already looked at triggered and enabled subsystems, but these systems seem to store an output during every cycle. I understand that normally you store a value at every iteration, so that you know by iteration number to which time a value corresponds, but if you are storing times as values themselves this is unneccessary.
So if anybody has any clever insights or ideas please let me know!
Thanks,
Ricardo

답변 (1개)

Suhan
Suhan 2017년 8월 29일
The triggered subsystems may help you in this. These subsystems are executed only when its activation condition is satisfied. You can use 'To Workspace' blocks inside these subsystems to save your data.

이 질문은 마감되었습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by