Opened 4 years ago
Closed 4 years ago
#6296 closed defect (fixed)
FMI export recently fails with array outputs
Reported by: | Rüdiger Franke | Owned by: | arunkumar palanisamy |
---|---|---|---|
Priority: | blocker | Milestone: | 1.16.3 |
Component: | FMI | Version: | 1.16.0 |
Keywords: | Cc: | Adrian Pop, arunkumar palanisamy |
Description (last modified by )
This is a modified version of testArrayEquations, reduced by many features, but extended with a vector output yx1:
model ArrayEquationsTest parameter Integer n = 10; input Real[n] u(start = 1:n); Real[n] x1(each start = 1); output Real[n] yx1; output Real y1; equation when Clock(0.1) then // for eqation for i in 1:n loop x1[i] = if firstTick(x1[i]) then previous(x1[i]) else previous(x1[i]) + u[i]; yx1[i] = x1[i]; end for; end when; y1 = sum(x1); end ArrayEquationsTest;
Attempting to export this model as FMU with:
setCommandLineOptions("--std=3.3"); getErrorString(); setCommandLineOptions("-d=newInst,-nfScalarize,disableFMIDependency"); getErrorString(); setCommandLineOptions("--simCodeTarget=Cpp"); getErrorString(); loadFile("ArrayEquationsTest.mo"); getErrorString(); translateModelFMU(ArrayEquationsTest, version = "2.0"); getErrorString();
gives the error:
[/home/rfranke/OpenModelica/OMCompiler/Compiler/Template/Tpl.mo:2027:8-2027:159:writable] Error: Internal error Stack overflow when evaluating function: [bt] #1 /home/rfranke/OpenModelica/build/bin/../lib/x86_64-linux-gnu/omc/libOpenModelicaRuntimeC.so(mmc_setStacktraceMessages_threadData) [bt] #2 /home/rfranke/OpenModelica/build/bin/../lib/x86_64-linux-gnu/omc/libOpenModelicaRuntimeC.so(mmc_do_stackoverflow) [bt] #3 /home/rfranke/OpenModelica/build/bin/../lib/x86_64-linux-gnu/omc/libOpenModelicaCompiler.so(CodegenCppInit.fun_87) [bt] #4 /home/rfranke/OpenModelica/build/bin/../lib/x86_64-linux-gnu/omc/libOpenModelicaCompiler.so(CodegenCppInit.ScalarVariableTypeStartAttribute) [bt] #5 /home/rfranke/OpenModelica/build/bin/../lib/x86_64-linux-gnu/omc/libOpenModelicaCompiler.so(CodegenCppInit.fun_83) [bt] #6 /home/rfranke/OpenModelica/build/bin/../lib/x86_64-linux-gnu/omc/libOpenModelicaCompiler.so(CodegenCppInit.ScalarVariableType) [bt] #7 /home/rfranke/OpenModelica/build/bin/../lib/x86_64-linux-gnu/omc/libOpenModelicaCompiler.so(CodegenCppInit.fun_73) [bt] #8 /home/rfranke/OpenModelica/build/bin/../lib/x86_64-linux-gnu/omc/libOpenModelicaCompiler.so(CodegenCppInit.fun_76) [bt] #9 /home/rfranke/OpenModelica/build/bin/../lib/x86_64-linux-gnu/omc/libOpenModelicaCompiler.so(CodegenCppInit.scalarVariableXML) [bt] #10 /home/rfranke/OpenModelica/build/bin/../lib/x86_64-linux-gnu/omc/libOpenModelicaCompiler.so(CodegenCppInit.lm_74) [bt] #11 /home/rfranke/OpenModelica/build/bin/../lib/x86_64-linux-gnu/omc/libOpenModelicaCompiler.so(CodegenCppInit.fun_76) [bt] #12 /home/rfranke/OpenModelica/build/bin/../lib/x86_64-linux-gnu/omc/libOpenModelicaCompiler.so(CodegenCppInit.scalarVariableXML) ... [bt] #1024 /home/rfranke/OpenModelica/build/bin/../lib/x86_64-linux-gnu/omc/libOpenModelicaCompiler.so(CodegenCppInit.lm_74) [bt] #1025 [...] Error: Template error: A template call failed (/home/rfranke/OpenModelica/build/bin/../lib/x86_64-linux-gnu/omc/libOpenModelicaCompiler.so: (null)). One possible reason could be that a template imported function call failed (which should not happen for functions called from within template code; templates assert pure 'match'/non-failing semantics).
It was working with OM 1.14. It is not working with 1.16 and 1.17 anymore.
Change History (18)
comment:1 by , 4 years ago
Description: | modified (diff) |
---|
comment:2 by , 4 years ago
Component: | Cpp Run-time → FMI |
---|---|
Owner: | changed from | to
comment:3 by , 4 years ago
Description: | modified (diff) |
---|
comment:4 by , 4 years ago
Cc: | added |
---|
It appears that the following commit clear up $cse variables for FMI modelDescription.xml (#640) by @arun3688 broke the function SimCodeUtil.getScalarElements with the introduction of fmi_index.
The function now returns the array, resulting in an endless loop when called from templates such as CodegenFMUCommon.ScalarVariable.
comment:5 by , 4 years ago
@rfranke, the immediate fix for this problem is to use the config flag fmiFilter as none
should work eg. omc --fmiFilter=none testArrayEquation
comment:8 by , 4 years ago
I'd love to understand the root cause first. It's model outputs that should not be filtered out. Maybe a fix if the filter functionality is possible?
comment:9 by , 4 years ago
Milestone: | 1.16.2 → 1.17.0 |
---|
@rfranke, we released 1.16.2 today. I would reschedule this for 1.17.0, due end of January. I hope that is fine for you, we could make a 1.16.3 mid-January, but it's probably not worth it. Feel free to comment on this
comment:10 by , 4 years ago
Priority: | blocker → critical |
---|
Fine with me. Actually it's not a blocker anymore since a workaround is known.
comment:11 by , 4 years ago
Priority: | critical → blocker |
---|
I'm afraid I need to escalate this ticket again. The flag --fmiFilter=none
works for me with the current master under Linux. It seems to be ignored by the newly released 1.16.2 Win32bit though. No matter if I specify it or not under Tools->Options->Simulation Additional Translation Flags, OMEdit just disappears during FMI export. This makes any version released after 1.14 unusable.
Same with OMEdit under Linux: --fmiFilter does not take effect. So please, release 1.16.3!
comment:12 by , 4 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:13 by , 4 years ago
@rfranke, This PR https://github.com/OpenModelica/OpenModelica/pull/7067 should fix the issue
follow-up: 15 comment:14 by , 4 years ago
Thanks Arun! I will cherry-pick this to maintenance/v1.16 for 1.16.3.
comment:15 by , 4 years ago
Milestone: | 1.17.0 → 1.16.3 |
---|
Replying to adrpo:
Thanks Arun! I will cherry-pick this to maintenance/v1.16 for 1.16.3.
Please close the ticket once you've done it
comment:16 by , 4 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
comment:17 by , 4 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
Sorry @arun3688, let's keep this open as a reminder until the commit is merged into maintenance/1.16, it still isn't.
comment:18 by , 4 years ago
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
Will be fixed with: https://github.com/OpenModelica/OpenModelica/pull/7106
That's the diff between CodegenCppInit.tpl of master vs v1.14
So, hardly the reason for the malfunction. This is why I'm reassigning the ticket to FMI.