- Set Up the Trigger: Use a Triggered Subsystem in Simulink to execute actions only when a trigger event occurs. This subsystem will help isolate the logic for storing output values. Create a Triggered Subsystem in Simulink. Set the trigger type to 'rising' or 'falling' based on your control signal
- Implement a Counter: Use a counter within the Triggered Subsystem that increments each time the trigger event occurs. This counter value can be used to index into a lookup table. Inside the Triggered Subsystem, use a counter block. Connect the counter output to the lookup table input
- Store Output Values: Use a Data Store Memory block to store the output values at each trigger instance. This block can be accessed globally within the model. Add a Data Store Memory block to store output values. Use a Data Store Write block within the Triggered Subsystem to write values.
- Retrieve and Use Stored Values: Access the stored values using a Data Store Read block to use them elsewhere in your model or for analysis. Use a Data Store Read block to access the stored output values
- Test and Validate: Run your Simulink model to ensure that the output values are correctly stored only at trigger instances. Adjust the logic as needed for accuracy.
Storing value of a trigger
3 views (last 30 days)
Show older comments
I have a simulink model in which a trigger happens according to a control signal. Each time a trigger happens,a counter is activated and goes as input to lookup table and the corresponding value goes into plant model.I don't know the time instance of trigger. Hence i have set simulation time as infinite so that my counter works till last value of input. Based on the trigger ,which propagated the counter the output are obtained.Iam trying to establish a logic where the iam trying to store the value of output only at instance of trigger.
0 Comments
Answers (1)
Hari
on 13 Nov 2024 at 7:50
Hi Arjun,
I understand that you want to store the output value of a Simulink model only at the instances when a control signal triggers a counter, and you are unsure of the time instances of these triggers.
I assume you have configured your Simulink model with an infinite simulation time and have a mechanism to detect when a trigger occurs. You can follow the below steps to acheive the same:
Refer to the documentation of the Triggered Subsystem for more details: https://www.mathworks.com/help/simulink/ug/triggered-subsystems.html
Refer to the documentation of the Data Store Memory block for more details: https://www.mathworks.com/help/simulink/slref/datastorememory.html
Hope this helps!
0 Comments
See Also
Categories
Find more on Schedule Model Components in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!