Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#6432 closed defect (wontfix)

Variable not found in foriter loop scope

Reported by: dariomangoni@… 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)

PolyBeamShape.mo (392 bytes ) - added by dariomangoni@… 4 years ago.
Minimal example

Download all attachments as: .zip

Change History (5)

by dariomangoni@…, 4 years ago

Attachment: PolyBeamShape.mo added

Minimal example

comment:1 by dariomangoni@…, 4 years ago

Version: 1.16.2v1.17.0-dev

comment:2 by Francesco Casella, 4 years ago

Component: *unknown*New Instantiation
Milestone: NeedsInput1.18.0
Owner: changed from somebody to Per Östlund

comment:3 by Per Östlund, 4 years ago

Resolution: wontfix
Status: newclosed

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 dariomangoni@…, 4 years ago

oh sorry, I left the flag to "Enable old fronted" and I forgot to test with the new one.

Note: See TracTickets for help on using tickets.