- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » Usage of print() inside functions in...
Usage of print() inside functions in 1.18.0
Usage of print() inside functions in 1.18.0
Hi,
during development I like to use print() statements inside functions to display variables and parameters in order to help with debugging.
However, after moving from Openmodelica 1.17.x to 1.18.0 print() statements in functions seem to be ignored as there is no output written. Writing to stdout or files does not make a difference.
From inside models it is working fine.
Please find attached a small sample showing the issue.
I am running the current stable release 64bit on Windows 10.
Is this a problem with 1.18.0? What am I doing wrong?
--Philipp
test.mo
Re: Usage of print() inside functions in 1.18.0
You need to make the input not be a constant or OMC evaluates the function at compile-time. If you pass x*time to square, the results are printed.
- sjoelund.se
- 1700 Posts
Re: Usage of print() inside functions in 1.18.0
Thank you very much for your fast and helpful reply.
I am now using your suggestion of passing time variable as a workaround
I wasn't aware that using constants in a function results in it being evaluated at compile-time only.
- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » Usage of print() inside functions in...