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: Francesco Casella Owned by: Adrian Pop
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 by Francesco Casella, 5 years ago

Milestone: 2.0.01.16.0
Priority: criticalblocker

comment:2 by timswait@…, 5 years ago

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 by Francesco Casella, 5 years ago

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.

in reply to:  3 comment:4 by timswait@…, 5 years ago

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 by Francesco Casella, 4 years ago

Owner: changed from Adeel Asghar to Adrian Pop
Status: newassigned

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 by Francesco Casella, 4 years ago

Milestone: 1.16.01.17.0

Retargeted to 1.17.0 after 1.16.0 release

comment:7 by Francesco Casella, 4 years ago

Component: OMEditNF API

comment:8 by Francesco Casella, 4 years ago

Milestone: 1.17.01.18.0

Rescheduled to 1.18.0

comment:9 by Francesco Casella, 3 years ago

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

comment:10 by Francesco Casella, 3 years ago

Milestone: 1.18.0

Ticket retargeted after milestone closed

comment:11 by Francesco Casella, 3 years ago

Milestone: 1.19.0

1.18.0 blocker tickets moved to 1.19.0

Note: See TracTickets for help on using tickets.