Clear Filters
Clear Filters

Zero division when generating Simscape Code using Beckhoff TE1400

6 views (last 30 days)
I am using the TwinCAT Target for Simulink TE1400 to generate Code from a Simscape model. I have all the necessary licenses and certificates. Generating Code and running it in TwinCat/Visual Studio works only sometimes. For example I tried to generate code of a simple RC-Circuit as shown in the picture. Then I get error messages like "undefined localtime", "conflict between signed and unsigned" and "possible division by 0" (see attached log file). With another model the code generation worked once and when trying to run it in VS I got another division by zero error.
So I guess there is some zero division in the model that I am not aware of. I found out that the error doesn't pop up when I get rid of the capacitor-block. Naturally I then made sure that there are no zero values in the capacitor-block and tried to set initial values as well, but all to no avail.
Does anybody know what causes the error?

Accepted Answer

Sandro G
Sandro G on 18 Apr 2024
The solution to this problem had nothing to do with the model itself. I still dont understand why it worked without the capacitor before but that doesn't matter now that it works. The problem was actually the certificate for tmx signing, ordered from beckhoff. In the windows environment variables, there was an old certificate that no longer worked. Even though I put the new certificate in the TC build setting in Simulink, the certificate from the environment variables caused the code generation to crash.
So to solve this, add the latest activated certificate to the windows environment variables and restart Matlab.

More Answers (0)

Categories

Find more on Trimming and Linearization in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!