How to use codesys standard functions in PLC coder (e.g. TON/TOF/SR)

13 次查看(过去 30 天)
Is it possible to generate structured text in Simulink PLC coder using the native codesys standard functions?
We have implemented some of the standard functions in the library, for example TON/TOF/SR, and would like to use the native functions when the PLC code is generated. Is this possible, or do we have to "make do" with our own implementations of these functions in Simulink.
CODESYS Online Help - link to example timer functions in Codesys.

回答(1 个)

SANKALP DEV
SANKALP DEV 2023-11-17
Dear David,
I understand that you are seeking information on the feasibility of generating structured text within Simulink PLC Coder while utilizing the native CODESYS standard functions.
Certainly, it is indeed possible to generate structured text code in Simulink PLC Coder while harnessing the native CODESYS standard functions. Simulink PLC Coder provides support for generating structured text code that adheres to the IEC 61131-3 standard, which includes the programming environment of CODESYS.
With the right configuration in Simulink PLC Coder, you can seamlessly incorporate native CODESYS standard functions like TON, TOF, and SR directly into your Simulink models. This negates the need to develop your custom implementations of these functions and empowers you to leverage the established and widely used CODESYS versions.
For further insights on designing and testing control systems using CODESYS and Simulink, please refer to this resource:
Additionally, to get started with Simulink PLC Coder in MATLAB, you can consult this link:
I hope that this information will be beneficial for you.
Regards,
Sankalp
  1 个评论
David
David 2023-11-20
Hi Sankalp,
% Certainly, it is indeed possible to generate structured text code in Simulink PLC Coder while harnessing the native CODESYS standard functions.
Is there a tutorial or video to guide me on how to do this please? I have found examples that use the TON functions for example in plcladderlib, but can't seem to understand how to create one from scratch.
web(fullfile(docroot, 'plccoder/ug/modeling-and-simulation-of-ladder-diagrams-in-simulink.html'))

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Simulink PLC Coder 的更多信息

产品


版本

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by