1

It is stated that I am trying to convert my control scheme which is implemented in the Simulink into TwinCAT. I have used integrator and derivative blocks in my control scheme.

For testing purposes, I am trying to convert a simple Simulink file containing an integrator block. However, I got a build error. How can I resolve this?

Simulink-block-diagram

Simulink-block-diagram

Error Picture Simulink during building

Error Picture Simulink during building

enter image description here

Constantine
  • 650
  • 9
  • 15
  • Perhaps you could help us by telling which error you received? – Mikkel Dec 02 '21 at 09:32
  • I have added the error picture. – Muhammad Bilal Dec 02 '21 at 09:47
  • 1
    HI Muhammad, welcome to StackOverflow. Tip: you can put a `!` in front of the `[]` of image links to show the actual images in the post. See for example [here](https://stackoverflow.com/editing-help). – Roald Dec 02 '21 at 10:38
  • I don't know what is inside your MATLAB Function? Using S-function is not that easy when compiling from Simulink to Beckhoff. See below link. Can you try an even simpler model where you just pass a variable through? Or where you pass a variable through and multiply by a number. https://infosys.beckhoff.com/english.php?content=../content/1033/te1400_tc3_target_matlab/4567330059.html&id= – Mikkel Dec 02 '21 at 12:08
  • 1
    Yes, I have successfully converted a simple program to TwinCAT in which I added two variable merely. Moreover, I tested this conversion in real-time as well. But when I am trying to use an integrator block then it causes an error. I have added S-function snapshot. There is a simple for-loop in S-function. – Muhammad Bilal Dec 03 '21 at 04:08
  • I would think that the S-function is the problem. Have you tried compiling the integrator without the S-function? – Mikkel Dec 06 '21 at 07:14
  • I am using TwinCAT TE1400 module for stated purpose. One thing I want to mention here is that I also installed TE140x module as well as sample Simulink files. When I select TwinCAT.tlc under Code Generation in Simulink, the model build successfully. However, the model does not show in the TwinCAT TcCOM object under Block Diagram tab. The following error appears: Error initializing BlockDiagram PropertyPage: Object reference not set to an instance of an object. On the other side, when I used TwinCATGRT.tlc then the model does not build and shows error as Publish failed. – Muhammad Bilal Dec 09 '21 at 06:14

0 Answers0