Automatically disable subsystem and manually re-enabled

11 Ansichten (letzte 30 Tage)
Jack Daniels
Jack Daniels am 22 Jan. 2025
Bearbeitet: Epsilon am 26 Jan. 2025
I need to create the "Enabled Subsystem" which is automatically switch off (disabled) after time expire off and after it is able to restart (Enabled) by writing to the enable.Value from matlab command line (set_param) manually ... So basically I am able to fire/enable the single "sine" manually.
Initially I've created this
where I use "Set Variable Enable to 0 and stop Generator" with "Parameter Writer" pointing to Enable.Value
Any idea how to go about Algebraic loop or other way to achieve described behavior?

Antworten (1)

Epsilon
Epsilon am 26 Jan. 2025
Bearbeitet: Epsilon am 26 Jan. 2025
Dear Jack,
An “Enabled subsystem” can be enabled for a desired duration via ‘set_param’ by using a ‘Delay’, ‘Subtract’ and ‘Compare to Constant’ block.
Use a Delay block to store the previous value of the constant input. The Difference block can be used to calculate the difference between the current and previous value of the constant input. The Compare to Constant block can then compare the value to be exactly 1 (when value of constant block changes from 0 to 1) thus enabling the system for a desired length only.
Please refer to the image below for this model configuration:
Use the set_param function to change the value of the constant block. Setting its value to 1 will enable the subsystem for a desired time length, which can be controlled by the ‘delay length’ parameter in the delay block.
Additionally if you want to send a single pulse of a desired phase, place it in another enabled subsystem and enable it using the same signal. Please find the attached example model for this implementation.

Kategorien

Mehr zu Event Functions finden Sie in Help Center und File Exchange

Produkte


Version

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by