#6432 closed defect (wontfix)
Variable not found in foriter loop scope
Reported by: | Owned by: | Per Östlund | |
---|---|---|---|
Priority: | normal | Milestone: | 1.18.0 |
Component: | New Instantiation | Version: | v1.17.0-dev |
Keywords: | Cc: |
Description
The following line (please look at the r_shape[1:3, pt_sel + 1]
part):
{Modelica.Math.Vectors.norm(r_shape[1:3, pt_sel + 1] - r_shape[:, pt_sel]) for pt_sel in 1:ptsCount - 1}
triggers the following error
[1] 20:21:21 Translation Error [PolyBeamShape: 5:3-5:145]: Variable r_shape[{1, 2, 3},1 + pt_sel,1] not found in scope PolyBeamShape.$foriter loop scope$. [6] 20:21:21 Translation Error [CodegenCFunctions.tpl: 5359:11-5359:11]: Template error: indexSubs got different number of dimensions and subscripts. [7] 20:21:21 Translation Error [C:/OM117/OM64bit/OMCompiler/Compiler/SimCode/SimCodeMain.mo: 478:7-478:78]: Internal error D:\OpenModelica\bin\OMEdit.exe: [unknown function name] failed
However, if you remove the 1:3
index selector and you just leave :
the code compiles just fine
Attachments (1)
Change History (5)
by , 4 years ago
Attachment: | PolyBeamShape.mo added |
---|
comment:1 by , 4 years ago
Version: | 1.16.2 → v1.17.0-dev |
---|
comment:2 by , 4 years ago
Component: | *unknown* → New Instantiation |
---|---|
Milestone: | NeedsInput → 1.18.0 |
Owner: | changed from | to
comment:3 by , 4 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
The errors are caused by using the old frontend, though I can't actually reproduce the "Variable not found" error (only the old frontend uses $foriter loop scope$
though). I do get the "Template error" from the code generation when using the old frontend though.
The model compiles and simulates successfully using the new frontend though, so I'm closing this ticket with the assumption that that's a good enough solution.
comment:4 by , 4 years ago
oh sorry, I left the flag to "Enable old fronted" and I forgot to test with the new one.
Minimal example