+3 votes
116 views
in Modeling by Fabian de Gasparo (15 points)

Hello,

I want to generate a random number at startup of the VHIL. For that I want a random seed. However I was not able to use srand(time(NULL)).

What is the alternative to #include <time.h> in the schematic editor?

How can I know thich libraries are already installed?

Then I also have a more genral questions to the c-functions. How to debug? "Exception occured: ... please make the needed correction..." is not helping.

Thanks in advance! The help is appriciated a lot.

Best,

Fabian

<!--StartFragment--><!--EndFragment-->

2 Answers

+1 vote
by Era Bajpai (282 points)

Dear Fabian,

You can use this link to understand which python libraries are currently installed and supported.

Regarding c-function block, could you maybe try to send a screenshot the error? In case there is a syntax issue in the code, try to use check syntax option available at the bottom of the c-function dialog box.

Hope this helps.

ago by Fabian de Gasparo (15 points)
Hello,
Unfortunately this was not my question. I am not talking about test IDE but about C functions.

Concerning the error that is not very usful I mean this:

-----------------------------------
Exception occurred: [13-Feb-2025 @ 11:33:09 AM]
-----------------------------------
2024.3
Please, make the needed corrections and restart the compilation.
Compilation process interrupted.
0 votes
ago by Ricardo Morim (78 points)
Hello Fabian,

In C function you can use rand() to get a random number.

W.r.t the error you are getting, it probably has to do with some syntax issue in your C code.

Try looking at the log files generated in Target Files folder.

Regards,

Ricardo
...