TON and TOF Timer Blocks in Simulink Ignore Preset Time (PRE)

조회 수: 8 (최근 30일)
Granto Natama
Granto Natama 2025년 1월 21일
답변: Epsilon 2025년 1월 27일
Hello,
I tried to simulate a very similar PLC model like presented in here https://nl.mathworks.com/help/plccoder/ug/ladder-logic-using-timers.html . The differences are Im using step signal which is converted into boolean for the input, you can see my model in the attached file.
However, it seems like the preset time just doesn't work. Everytime the switch is on, then the lamp is automatically "on", while it is supposed to be delayed for around 6 seconds (the preset time). I have tried everything, even mirroring every setting and values set in the file from here https://nl.mathworks.com/help/plccoder/ug/ladder-logic-using-timers.html. I have also ensured the initfcn, etc. But still doesnt work as it should be. Im using matlab R2024b. I also put the sceenshots of the windows below.
Thanks for the help.

답변 (1개)

Epsilon
Epsilon 2025년 1월 27일
Hi Granto,
In the above provided model the preset is depending on the sample time (single step size) rather than the preset values defined in the IntFcn. This can be observed by setting the step size in model configuration to 2. On doing so the motor start/stop gets delayed by the same time. Response with sample time 2 :
This seems to be due to discrepancy in the initialization of the ‘delayer_Data’ and ‘delayerOFF_Data’ data store memory. The desired preset delay is observed in the original example file on replacing the start/stop blocks with the step block. Response of the updated model in original example with preset of 10000 for both start & stop:
Please find the implemented model attached for reference.

카테고리

Help CenterFile Exchange에서 Simulink PLC Coder에 대해 자세히 알아보기

제품


릴리스

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by