#3094 closed defect (fixed)
XML Parse of output gives error
Reported by: | Owned by: | Lennart Ochel | |
---|---|---|---|
Priority: | high | Milestone: | 1.9.4 |
Component: | Run-time | Version: | trunk |
Keywords: | Cc: | Willi Braun |
Description
When I run the attached model, it compiles and runs. However the output that I see from OMEdit is:
stdout | OMEditInfo | <p>/private/var/folders/s4/0j3cshj161126ygbpbzsdkmd4h24dl/T/OpenModelica_adershowitz/OMEdit/CellFlow.Cells_v1 -port=50450 -logFormat=xml -override=startTime=0,stopTime=117,stepSize=0.117117,tolerance=1e-06,solver=dassl,outputFormat=mat,variableFilter=.* -dasslJacobian=coloredNumerical -w -lv=LOG_STATS</p>
Followed by:
Fatal error on line 1, column 520: unexpected character XML::
If I copy that entry, I see a bit more data:
stderr | error | Fatal error on line 1, column 520: unexpected character XML :: <root><message stream="stdout" type="OMEditInfo" text="/private/var/folders/s4/0j3cshj161126ygbpbzsdkmd4h24dl/T/OpenModelica_adershowitz/OMEdit/CellFlow.Cells_v1 -port=50450 -logFormat=xml -override=startTime=0,stopTime=117,stepSize=0.117117,tolerance=1e-06,solver=dassl,outputFormat=mat,variableFilter=.* -dasslJacobian=coloredNumerical -w -lv=LOG_STATS" /><message stream="stdout" type="error" text="Warning: Variable boundary.medium.MM out of [min, max] interval: boundary.medium.MM >= 0.001 and boundary.medium.MM <= 0.25 has value: 0 " />
However, the model does then run. So, there is something being added to the output of the simulation that is not parsed properly.
When I run the identical model on a Linux machine, I see the same results, except that the column number is different (463. Perhaps some different default value?).
Attachments (1)
Change History (17)
by , 10 years ago
comment:1 by , 10 years ago
comment:2 by , 10 years ago
Apparently, "<" is not a valid XML character, so it should not be passed to the XML parser. Instead, "&ls" should be used.
Additionally, I am not sure why the warning message comes up at all, since boundary.medium.MM does have a valid value, and is not zero.
comment:3 by , 10 years ago
This is even easier to see. Just run Modelica.Media.Examples.SimpleLiquidWater in OMEdit to see the same problem.
stderr | error | Fatal error on line 1, column 516: unexpected character XML :: <root><message stream="stdout" type="OMEditInfo" text="/private/var/folders/s4/0j3cshj161126ygbpbzsdkmd4h24dl/T/OpenModelica_adershowitz/OMEdit/Modelica.Media.Examples.SimpleLiquidWater -port=49993 -logFormat=xml -override=startTime=0,stopTime=100,stepSize=0.2,tolerance=0.0001,solver=dassl,outputFormat=mat,variableFilter=.* -dasslJacobian=coloredNumerical -w -lv=LOG_STATS" /><message stream="stdout" type="error" text="Warning: Variable medium2.MM out of [min, max] interval: medium2.MM >= 0.001 and medium2.MM <= 0.25 has value: 0 Warning: Variable medium.MM out of [min, max] interval: medium.MM >= 0.001 and medium.MM <= 0.25 has value: 0 " />
If I just run the simulation executable on the command line, it runs fine:
./Modelica.Media.Examples.SimpleLiquidWater Warning: Variable medium2.MM out of [min, max] interval: medium2.MM >= 0.001 and medium2.MM <= 0.25 has value: 0 Warning: Variable medium.MM out of [min, max] interval: medium.MM >= 0.001 and medium.MM <= 0.25 has value: 0
So, when running in OMEdit, the output is sent to the XML parser, and there are characters in that output that are not valid XML.
In fact, it looks like the actual stdout from the executable is just text, and not XML, but most simulations either don't output anything, or the parser manages fine with most text output. But, Media seems to report warnings that have these illegal characters, and then the parser fails.
comment:4 by , 10 years ago
Cc: | added |
---|---|
Component: | OMEdit → Run-time |
Owner: | changed from | to
Status: | new → assigned |
r24242 fixed the OMEdit parsing.
However, the warning message needs to be formatted to the xml format by the simulation runtime. I am assigning this ticket to Lennart and he will hopefully fix it.
comment:5 by , 10 years ago
This is a smaller test case:
model foo Real p(min=1, max=2) = 0; end foo;
$ ./foo -logFormat=xml Warning: Variable p out of [min, max] interval: p >= 1.0 and p <= 2.0 has value: 0
comment:6 by , 10 years ago
Status: | assigned → accepted |
---|
follow-up: 9 comment:8 by , 10 years ago
This does raise one other question. Why is the Molar Mass of the Media outside of the acceptable range at startup? Is this a bug in Modelica.Media?
It seems that the value is assigned, but not at startup, so the assert in Media issues the warning.
comment:9 by , 10 years ago
Replying to Adam Dershowitz <dersh@…>:
This does raise one other question. Why is the Molar Mass of the Media outside of the acceptable range at startup? Is this a bug in Modelica.Media?
It is a known OM bug actually. But I cannot remember the ticket number right now.
comment:11 by , 10 years ago
I just wanted to make sure that the bug was currently tracked, and clearly it is.
Thanks,
comment:12 by , 10 years ago
Replying to adrpo:
I guess it might be #3095.
This is not the ticket that I meant.
There is a problem with too early evaluated asserts if e.g. parameters are evaluated during initialization:
model test parameter Real p(fixed=false, min=1, max=2); initial equation p = 1.5; end test;
This example will display
Variable p out of [min, max] interval: p>= 1.0 and p <= 2.0 has value: 0
comment:14 by , 10 years ago
It looks like there is still an XML error. If I run Modelica.Media.Examples.IdealGasH2O I get the following output from OMEdit:
stdout | OMEditInfo | <p>/private/var/folders/s4/0j3cshj161126ygbpbzsdkmd4h24dl/T/OpenModelica_adershowitz/OMEdit/Modelica.Media.Examples.IdealGasH2O -port=55929 -logFormat=xml -override=startTime=0,stopTime=1,stepSize=0.002,tolerance=0.0001,solver=dassl,outputFormat=mat,variableFilter=.* -dasslJacobian=coloredNumerical -w -lv=LOG_STATS</p> stdout | error | <p>JSON array expected ',' or ']', got: ]}]}},<br> "s":{"comment<br> stdout | error | <p>Process crashed<br> Simulation process exited with code 0</p>
If I run the simulation on the command line, I still get an error:
./Modelica.Media.Examples.IdealGasH2O -lv=LOG_STATS JSON array expected ',' or ']', got: ]}]}}, "s":{"comment Abort trap: 6
If I don't log the stats, it runs OK on the command line.
comment:15 by , 9 years ago
Milestone: | Future → pre1.9.4 |
---|
It doesn't make sense to keep closed ticket in the "Future" milestone that were simply forgotten to assign to the correct milestone in the past.
comment:16 by , 7 years ago
Milestone: | pre1.9.4 → 1.9.4 |
---|
Removing the pre1.9.4 milestone in favor of 1.9.4.
I realized that column 520 is the equal sign in:
"boundary.medium.MM <= 0.25"
So, it seems that is happening is the XML parser is not correctly handling the "<=" and thinks that it is an XML token, instead of just part of a string.
So, there is a bug that either that is not be properly escaped or properly parsed. But, this error means that it is not possible to see most of the message output of a simulation, although the actual data results do get written properly.
I did also try to run this with 1.9.1 and I don't see this problem. So, between that version, and some recent version was a change. Perhaps in XML parsing, or in the media library warning messages.