Opened 6 years ago

Last modified 3 years ago

#5405 assigned defect

OMEdit cannot generate 'each' modifiers for parameters of arrays of components

Reported by: casella Owned by: adrpo
Priority: blocker Milestone: 1.19.0
Component: NF API Version:
Keywords: Cc:

Description

Drag any component from the Modelica Standard Library into a test system model. Right-click on it, select Attributes and give the component some array dimension (e.g., [3]). Then, try to modify any of the parameters of the component array: the parameter window only allows me to input an array value for each parameter. There is no way to use the each modifier, allowing to only input one value if it is the same for all the components.

We should introduce a way to do so in an intuitive way, e.g. with an by adding an each checkbox side by side to the value input field (of course only in the case of arrays of components).

BTW, we should also allow to make the parameter final, but that's probably the topic for another ticket.

Change History (11)

comment:1 Changed 5 years ago by casella

  • Milestone changed from 2.0.0 to 1.16.0
  • Priority changed from critical to blocker

comment:2 Changed 4 years ago by timswait@…

This is causing a problem for me. I have dropped a bodyCylinder onto my model, I have tried to set the r_0.start checkbox to 'false' but when I try to run the model I get the error:

[2] 11:41:10 Translation Error [Modelica.Mechanics.MultiBody.Parts: 1596:5-1599:72]: 
Non-array modification ‘false‘ for array component ‘fixed‘, possibly due to missing ‘each‘.

I also get the same problem if I set it to 'true', the only value that actually works in the checkbox is 'inherited'. Is there any other way to work around this?

comment:3 follow-up: Changed 4 years ago by casella

You should switch to the textual view and locate the component declaration, which will have a modifier like BodyCylinder bodyCylinder(r_0(fixed = true)). Just add each before fixed, e.g. r_0(each fixed = true), so that all the element of the array get the scalar value.

Of course this is just a workaround, OMEdit should generate correct Modelica code out of the box.

comment:4 in reply to: ↑ 3 Changed 4 years ago by timswait@…

Thank you!

Replying to casella:

You should switch to the textual view and locate the component declaration, which will have a modifier like BodyCylinder bodyCylinder(r_0(fixed = true)). Just add each before fixed, e.g. r_0(each fixed = true), so that all the element of the array get the scalar value.

Of course this is just a workaround, OMEdit should generate correct Modelica code out of the box.

comment:5 Changed 4 years ago by casella

  • Owner changed from adeas31 to adrpo
  • Status changed from new to assigned

Reassigned to @adrpo after today's devmeeting, there is probably already some support for this in the new API.

We agree that we should have a checkbox for "each" in case the parameter is an array. It is then up to the user to select it or not, and hence provide a scalar or an appropriate array.

comment:6 Changed 4 years ago by casella

  • Milestone changed from 1.16.0 to 1.17.0

Retargeted to 1.17.0 after 1.16.0 release

comment:7 Changed 4 years ago by casella

  • Component changed from OMEdit to NF API

comment:8 Changed 4 years ago by casella

  • Milestone changed from 1.17.0 to 1.18.0

Rescheduled to 1.18.0

comment:9 Changed 3 years ago by casella

@adeas31 reports that the updateComponent API function needs to be fixed.

comment:10 Changed 3 years ago by casella

  • Milestone 1.18.0 deleted

Ticket retargeted after milestone closed

comment:11 Changed 3 years ago by casella

  • Milestone set to 1.19.0

1.18.0 blocker tickets moved to 1.19.0

Note: See TracTickets for help on using tickets.