Simulink errors related to EtherLab

From SymbitronWiki
Jump to: navigation, search

This page lists some Simulink errors we got while working with EtherLab, together with their solutions.

TLC file indirectly calls LibSystemOutputCustomCode

When compiling, Simulink (with Matlab 2014b under OpenSuse 13.1 with EtherLab 2.1.0) gave the following error:

<source> Error: Simulink Coder Error: Block TLC file indirectly calls LibSystemOutputCustomCode to insert custom code. To ensure the custom code is inserted, the block TLC file must directly call this TLC function at least once or include the string 'LibSystemOutputCustomCode()' in a TLC comment line at least once. </source>

The problem appeared to be an EtherCAT block inside an enabled subsystem; this is, apparently, not allowed. Solution: Make sure that no EtherCAT blocks are inside an enabled subsystem.

To reproduce the error: Create a new model and make the settings such that it compiles for EtherLab (i.e., fixed time step; Code generation|System target file: etherlab.tlc; Code Generation|Interface|Classic call interface checked). Add some EtherCAT block from the etherlab_lib to your model and verify that it compiles. Put the block inside a subblock (select block and press Ctrl-G) and verify that it compiles. Add a Ports&Subsystems|Enable block inside the subblock and verify that it does not compile. Replace the EtherCAT with any non-EtherCAT block and verify that it does compile again.

Call to rt_nonfinite.h

When compiling, Simulink gives this error:

<source> /vol/opt/etherlab/src/etherlab-2.0.0/rtw/src/hrt_main.c:137:26: fatal error: rt_nonfinite.h: No such file or directory compilation terminated. gmake: *** [hrt_main.o] Error 1

      1. Build procedure for model: 'etherlab' aborted due to an error.

</source>

Solution is to set these options in the Simulink options: Code Generation → Interface, choose options "Classic call interface". Also make sure that "Support for non-finite numbers" is unchecked. For higher Matlab versions (>=2017?) the "classic call interface" setting is hidden in the "Commonly used parameters". Instead, look for it in the "all parameters" tab.