Matlab function in Simulink exhibiting slow reaction time

조회 수: 6 (최근 30일)
I have a function block within my simulink file. It reads a "current" value, and compares it to a reference value.
If the value is higher than ref is turns off one input, and the next time the function block is called the expected behavior is that it should turn off a additional input if the value is still higher than reference.
For some reason it only turns off additional inputs every ~1700 seconds or so. Simulation time is 24h. I do not really see what could cause this. It behaves as expected, but as if it is only called every 1700 seconds.
There is a delay block at the output of the funciton, that then feeds back - giving the current status of all inputs. It is set to a delay of 1.

채택된 답변

Fangjun Jiang
Fangjun Jiang 2025년 3월 6일
편집: Fangjun Jiang 2025년 3월 6일
I must know this. 1700 seconds is roughly 1/50 of the simulation time (24 hours). It is the default setting. It must mean that you didn't specify the simulation step size. One step of simulation of your model is about 1700 seconds. That is the reason.
Specify a reasonable step size and you will see the effect.
  댓글 수: 1
Lillebror Sagmen-Andersson
Lillebror Sagmen-Andersson 2025년 3월 6일
Aha! There we have it! I did not realize the deafult was 1/50. Thanks for the help :)

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Run on Target Hardware에 대해 자세히 알아보기

제품


릴리스

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by