Zero division when generating Simscape Code using Beckhoff TE1400

조회 수: 1 (최근 30일)
Sandro G
Sandro G 2024년 4월 11일
답변: Sandro G 2024년 4월 18일
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