Opened 8 years ago
Closed 8 years ago
#4048 closed defect (fixed)
Where is function print defined?
Reported by: | Francesco Casella | Owned by: | somebody |
---|---|---|---|
Priority: | high | Milestone: | 1.11.0 |
Component: | *unknown* | Version: | |
Keywords: | Cc: | Adeel Asghar |
Description
Try this test model
model Test algorithm when sample(0,0.1) then print("It's now t = "+String(time)); end when; end Test;
The model compiles and runs, but it doesn't print anything anywhere. I wonder which print()
function is linked here, I am not aware of any pre-defined function in Modelica with that name.
Change History (16)
comment:1 by , 8 years ago
follow-up: 4 comment:3 by , 8 years ago
It seems to print to terminal just fine:
$ ./Test It's now t = 0It's now t = 0.1It's now t = 0.2It's now t = 0.3It's now t = 0.4It's now t = 0.5It's now t = 0.6It's now t = 0.7It's now t = 0.8It's now t = 0.9It's now t = 1
comment:4 by , 8 years ago
Replying to sjoelund.se:
It seems to print to terminal just fine:
$ ./Test It's now t = 0It's now t = 0.1It's now t = 0.2It's now t = 0.3It's now t = 0.4It's now t = 0.5It's now t = 0.6It's now t = 0.7It's now t = 0.8It's now t = 0.9It's now t = 1
It doesn't if I compile the model with OMEdit under both Linux and Windows and run it from there.
Long story: a colleague used print
instead of Modelica.Utilities.Stream.print
, got no ouptut and then got annoyed, because the compiler did not complain. I can see his point :)
Maybe when we are compiling Modelica code we should not be accepting MetaModelica stuff...
comment:5 by , 8 years ago
I think all output that the simulation generates should be visible somehow in the simulation window. Because we run the simulation executable with XML log only XML tags are show in there.
I already talked with Adeel about this but we haven't yet found a solution.
follow-up: 9 comment:6 by , 8 years ago
Cc: | added |
---|
Adeel, can one run the simulation without the XML logging? What is displayed in the output window if you do so?
comment:7 by , 8 years ago
Could possibly the XML logging use another stream than stdout, so that stdout remains reserved for the model?
Btw. what is the -port
used for? Could XML logging go through this?
comment:9 by , 8 years ago
Replying to adrpo:
Adeel, can one run the simulation without the XML logging? What is displayed in the output window if you do so?
One can't run the simulation without XML logging. -logFormat=xml
is hard coded.
I could make it user configurable but we have problems then e.g, making clickable error messages for transformational debugger.
comment:10 by , 8 years ago
Replying to adeas31:
-port
is used for simulation progress bar.
Couldn't the progress bar also fed with XML messages that use the same port as XML log messages?
I agree that it makes no sense to make XML log messages configurable. Don't want to miss the structuring into groups anymore!
follow-up: 12 comment:11 by , 8 years ago
Working on this, could you also check the coloring of xml log messages?
At the moment we get red for: error, warning, debug; black for info. Shouldn't only error and debug be red?
follow-up: 14 comment:12 by , 8 years ago
Replying to rfranke:
Shouldn't only error and debug be red?
Shouldn't only error messages be red? I think a debug message is more a special kind of notification than an error.
comment:13 by , 8 years ago
This is quite easy to fix. Just decide what you want OR what is good in general.
From my side I just need to update the following code,
source:/OMEdit/OMEdit/OMEditGUI/Util/StringHandler.cpp@c9166ec#L1486
comment:14 by , 8 years ago
Replying to lochel:
Replying to rfranke:
Shouldn't only error and debug be red?
Shouldn't only error messages be red? I think a debug message is more a special kind of notification than an error.
I meant "errors and warnings" not "errors and debug". So far you use three colors: black, red and blue. Without extending the number of colors it should be:
- errors and warnings: red
- debug and info: black
- issued from OMEdit: blue (as it is today)
What about assert
?
comment:15 by , 8 years ago
@rfranke I agree and would say asserts should be red as well:
- errors, warnings and asserts: red
- debug and info: black
- issues from OMEdit: blue (as it is today)
comment:16 by , 8 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Sorry I mistakenly edited @rfranke's comment instead of replying on it :).
Fixed the printing problem in c9166ec/OMEdit and colors in dfe7b6f/OMEdit.
There is the Modelica.Utilities.Streams.print() predefined function, if I use that I see the output. No idea which print function gets called in your case, though.