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

13 ビュー (過去 30 日間)
David
David 2023 年 10 月 3 日
コメント済み: David 2023 年 11 月 20 日
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 Center および File ExchangeSimulink PLC Coder についてさらに検索

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by