repeating a simulink program

8 ビュー (過去 30 日間)
Youness Tazi
Youness Tazi 2023 年 10 月 24 日
編集済み: Youness Tazi 2023 年 10 月 30 日
Hello,
Please i have the following code,

回答 (2 件)

Pratyush
Pratyush 2023 年 10 月 25 日
Hi Youness,
I understand that you want to repeat your code execution for 2hrs. The While Iterator block could be used for this purpose. You can refer to this documentation for more details on While Iterator block: https://in.mathworks.com/help/simulink/slref/whileiterator.html
To achieve this:
  1. Add a "While Iterator" block from the Simulink Library Browser. This block will create a loop that repeats your code until a certain condition is met.
  2. Connect the output of your code (the signal that controls the motor rotation) to the input of the "While Iterator" block.
  3. Add a "Relational Operator" block from the Simulink Library Browser. Set the input of the "Relational Operator" block to the desired condition for stopping the loop.
  4. Add a "Constant" block from the Simulink Library Browser and set its value to "true". Connect this block to the "Start" input of the "While Iterator" block. This will ensure that the loop starts when the simulation begins.
Hope this helps.
  1 件のコメント
Youness Tazi
Youness Tazi 2023 年 10 月 25 日
Thank you Pratyush, please i follow what you explain but i don't if that is correct or nor and i don't what i should connect on IC port and second input port for relational operator(because i have two input on my block idk which one to use with second relationnal block) could you help me with that please. attached picture.
Normally if you see on my block input there is 25mm and 0.5mm. those value is min and max (the value is from a potentiometer to change rotation of the motor, the initial state is when the position is at 0.5mm
Regards

サインインしてコメントする。


Youness Tazi
Youness Tazi 2023 年 10 月 26 日
;)

カテゴリ

Help Center および File ExchangeModeling についてさらに検索

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by