Automatically disable subsystem and manually re-enabled
24 ビュー (過去 30 日間)
古いコメントを表示
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
2025 年 1 月 26 日 10:17
編集済み: Epsilon
2025 年 1 月 26 日 10:19
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.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Programmatic Model Editing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!