Zero division when generating Simscape Code using Beckhoff TE1400

1 次查看(过去 30 天)
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?

采纳的回答

Sandro G
Sandro G 2024-4-18
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.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Troubleshooting 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by