aesim-tech / simba-project

Roadmap & issue tracking
7 stars 0 forks source link

bug/crash with C block ! #346

Closed AdriPWS closed 10 months ago

AdriPWS commented 10 months ago

Describe the bug I use the SIMBA 23.9 version for describing the following bugs and crash: Monostable_moyenne.zip See attached the "zip" folder to reproduce the 2 issues:

If you open the zip folder and run the .jsimba file, you'll obtain 2 designs: "monostable" & "moyenne".

Issue 1: 1) For "monostable" design: run the circuit and the 2 outputs for each C block don't provide the same results. Of course the C code is the same. You need to put a "sample time" value inside the " C block (external)" to make it run with same results. see the gif: "C_code_bug" C_code_bug

2 For "moyenne" design: The bug/crash could be reproduced by following the "gif": "c_code_bug5". C_code_bug5

In deed, SIMBA crashes when the 2 C blocks are into the same design for this case. If you delete the "external one" or "normal", crash is avoided but it may happen randomly. And finally results check will provide a crash.

AdriPWS commented 10 months ago

For the issue 2) moyenne: You need to edit the code with "for(int i=0;i<4;i++)" into the "void initialize()" part. This is the final code to use !

jcornau commented 10 months ago

Issue 1 is fixed. External C code and internal c code are compiled differently. Also in this C code, the variable "out" is not initialized. This created a different behavior between both cases. Adding an initialization (out = 0) makes both c code block behaviors identical.

manu-aesim commented 10 months ago

The crash is fixed in this release:

https://aesimtech.s3.us-east-1.amazonaws.com/artifacts/8MiAE6Rsr4POgq20ogQgkqsrVmv80Q2n/simba.exe pip install aesim.simba==2023.10.17a1

@jcornau, you can check that it works and if it is the case you can close this issue.