Opened 7 years ago
Closed 7 years ago
#4702 closed defect (fixed)
Record binding missing causing string to be assigned 0.0
Reported by: | Owned by: | Martin Sjölund | |
---|---|---|---|
Priority: | high | Milestone: | 1.13.0 |
Component: | Frontend | Version: | v1.12.0 |
Keywords: | Cc: |
Description (last modified by )
Hi there,
After upgrading to the new version of omc and omlibraries, we found a compiling-related error while running a test case () from our open-modelica based repositort, SOLARTHERM, which can be found from https://github.com/SolarTherm/SolarTherm. The instructions to run this test case is given in https://github.com/SolarTherm/SolarTherm/wiki/Building-SolarTherm.
I am copying the error in the following:
[/build/openmodelica-djNULe/openmodelica-1.12.0/OMCompiler/Compiler/BackEnd/Unit.mo:869:7-869:68:writable] Error: Internal error function lexer failed Compiling simulator SimpleSystem.c:1135:91: warning: magnitude of floating-point constant too large for type 'double'; maximum is 1.7976931348623157E+308 [-Wliteral-range] .../* pri._nextTimeEventScaled DISCRETE */,1.797693134862316e+308); ^ SimpleSystem.c:1136:154: warning: magnitude of floating-point constant too large for type 'double'; maximum is 1.7976931348623157E+308 [-Wliteral-range] .../* pri._nextTimeEventScaled DISCRETE */:1.797693134862316e+308); ^ 2 warnings generated. SimpleSystem_06inz.c:468:88: warning: magnitude of floating-point constant too large for type 'double'; maximum is 1.7976931348623157E+308 [-Wliteral-range] .../* pri._nextTimeEventScaled DISCRETE */,1.797693134862316e+308); ^ SimpleSystem_06inz.c:469:151: warning: magnitude of floating-point constant too large for type 'double'; maximum is 1.7976931348623157E+308 [-Wliteral-range] .../* pri._nextTimeEventScaled DISCRETE */:1.797693134862316e+308); ^ 2 warnings generated. SimpleSystem_08bnd.c:675:44: error: assigning to 'modelica_string' (aka 'void *') from incompatible type 'double' data->simulationInfo->stringParameter[6] = 0.0; ^ ~~~ 1 error generated. <builtin>: recipe for target 'SimpleSystem_08bnd.o' failed make: *** [SimpleSystem_08bnd.o] Error 1 Traceback (most recent call last): File "/home/ali/.local/bin/st_simulate", line 103, in <module> sim.compile_sim(args=([] if args.v else ['-s'])) File "/home/ali/.local/lib/python2.7/site-packages/solartherm/simulation.py", line 244, in compile_sim + args) File "/usr/lib/python2.7/subprocess.py", line 541, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['make', '-j', '1', '-f', 'SimpleSystem.makefile', '-s']' returned non-zero exit status 2
Apparently, the issue is related to the Strings.substring command which is supposed to find a string from a file, but it sets a float value instead, and this raises an error. I should also mention that the older compiler versions were working just fine. As such we suspect that there is some bug in the compiling process in the omc v1.12.
I would greatly appreciate it if you could have a look at this issue and let us know what is exactly wrong.
Regards,
Ali Shirazi
Change History (5)
comment:1 by , 7 years ago
Description: | modified (diff) |
---|
comment:2 by , 7 years ago
Component: | *unknown* → Command Prompt Environment |
---|
comment:3 by , 7 years ago
comment:4 by , 7 years ago
Component: | Command Prompt Environment → Frontend |
---|---|
Owner: | changed from | to
Status: | new → accepted |
Looks like a frontend issue. In 1.11, the record was evaluated at compile-time and replaced with its values; in 1.12 we changed some things regarding records and it seems probably the evaluation fails. In the master, wea.meta = SolarTherm.Sources.Weather.getMetadata(wea.file_act);
appears as an initial equation which should have helped:
[/home/marsj/solartherm/SolarTherm/Sources/Weather.mo:21:2-21:49:writable] Notification: Moving binding to initial equation section and setting fixed attribute of wea.meta.name to false. [/home/marsj/solartherm/SolarTherm/Sources/Weather.mo:21:2-21:49:writable] Notification: Moving binding to initial equation section and setting fixed attribute of wea.meta.lat to false. [/home/marsj/solartherm/SolarTherm/Sources/Weather.mo:21:2-21:49:writable] Notification: Moving binding to initial equation section and setting fixed attribute of wea.meta.lon to false. [/home/marsj/solartherm/SolarTherm/Sources/Weather.mo:21:2-21:49:writable] Notification: Moving binding to initial equation section and setting fixed attribute of wea.meta.elev to false. [/home/marsj/solartherm/SolarTherm/Sources/Weather.mo:21:2-21:49:writable] Notification: Moving binding to initial equation section and setting fixed attribute of wea.meta.tzone to false. [/home/marsj/solartherm/SolarTherm/Sources/Weather.mo:21:2-21:49:writable] Notification: Moving binding to initial equation section and setting fixed attribute of wea.meta.tstart to false.
But we also get:
[/home/marsj/solartherm/SolarTherm/Sources/Weather.mo:92:2-92:28:writable] Warning: Parameter wea.meta.name has no value, and is fixed during initialization (fixed=true), using available start value (start=0.0) as default value. Error: The given system is mixed-determined. [index > 3] Please checkout the option "--maxMixedDeterminedIndex".
So I need to see what's going on there. It's unlikely to be fixed in a 1.12 maintenance release.
comment:5 by , 7 years ago
Milestone: | Future → 1.13.0 |
---|---|
Resolution: | → fixed |
Status: | accepted → closed |
Summary: | assigning to 'modelica_string' (aka 'void *') from incompatible type 'double' data->simulationInfo->stringParameter[6] = 0.0; → Record binding missing causing string to be assigned 0.0 |
Fixed by #4703. It would require some larger changes to the 1.12 release so I suggest using 1.11 or 1.13 nightly builds.
Further to this issue, I need to clarify that our test case has been run through terminal in Ubuntu 16.04.3 64 bit.