Automatically disable subsystem and manually re-enabled

조회 수: 12 (최근 30일)
Jack Daniels
Jack Daniels 2025년 1월 22일
편집: Epsilon 2025년 1월 26일
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?

답변 (1개)

Epsilon
Epsilon 2025년 1월 26일
편집: Epsilon 2025년 1월 26일
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.

카테고리

Help CenterFile Exchange에서 Event Functions에 대해 자세히 알아보기

제품


릴리스

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by