try to have simulink's stop time as a block

조회 수: 2 (최근 30일)
Jorge
Jorge 2021년 11월 5일
답변: Salman Ahmed 2021년 11월 15일
I would like to have the simulink's stop time as a output block so that I can change the stop time based on the constant input value.
I noticed people have asked similar question, but I think most of replies are confused with " stop time" with "simulation time"
Thank you.
  댓글 수: 1
Paul
Paul 2021년 11월 5일
What are the definitions of "stop time" and "simulation time"?
What exactly do you want to be able to control? What is "the constant input value"? What does "stop time as a output block" mean?

댓글을 달려면 로그인하십시오.

답변 (2개)

Fangjun Jiang
Fangjun Jiang 2021년 11월 9일
Use a Clock block, which outputs the simulation time/clock. Compare the Clock with your Constant block. Connect the output to a Stop block. Whenever the clock is greater or equal to your constant, the simulation stops.

Salman Ahmed
Salman Ahmed 2021년 11월 15일
Hi Jorge,
Assuming you want to stop the simulation conditionally, the best way to achieve this would be using a Stop Simulation block. The Stop Simulation block stops the simulation when the input becomes non-zero.
To use the Stop block for a custom stop time, you could refer to the example mentioned by Fangjun which can be found at this link. Here, you would be comparing your simulation time with a constant and whenever you reach the constant value, you stop the simulation. Thus, you can change the constant block value to change your stop time. Hope it helps.

카테고리

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

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by