Zero division when generating Simscape Code using Beckhoff TE1400

1 Ansicht (letzte 30 Tage)
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?

Akzeptierte Antwort

Sandro G
Sandro G am 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.

Weitere Antworten (0)

Kategorien

Mehr zu Troubleshooting finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by