2

When editing an array of enumeration with unknown size in Dymola (2025x r1), it is possible for the user to set a value to the array which is not a vector:

type Catalogue = enumeration(A "A",B "B");
model Test
    parameter Catalogue elements[:];
end Test;

In the parameter editing interface, when I use the down arrow to choose for elements, it set the value to

each elements = Catalogue.A

setting value for elements

This lead to wrong code:

parameter Catalogue elements[:]=Catalogue.A;

which instead should be, as far as I understand :

parameter Catalogue elements[:]={Catalogue.A};

On the other side when using the array edition tool, it is possible to properly set the array values: Editing elements with Edit Editing array for elements

leading to the correct code:

parameter Catalogue elements[:]={Catalogue.A,Catalogue.B};

Am I doing anything wrong ? In my use, I would make sure that using either the down arrow for setting just one element or the array edition tool, lead to correct code or to provide the user with only one interface to fill the values of the array.

1 Answer 1

1

This seems to be a bug in the GUI. As a workaround, you can prevent this state by suggesting some manual choices and eventually also disable manual editing:

model Test
  parameter Catalogue elements[:]
    annotation (
      __Dymola_editText = false,
      choices(
        choice = {Catalogue.A, Catalogue.B},
        choice = {Catalogue.A},
        choice = {Catalogue.B}));
end Test;

resulting pulldown menu

Sign up to request clarification or add additional context in comments.

2 Comments

ok well noted for the bug. I didn't know the Dymola annotation __Dymola_editText. What does it ? As far as my understanding goes from the Dymola Manual, it seems that it should display «A» instead of «Catalogue.A» but seems not to work so.
This would normally be the case, but not here due to choices. Additionally to the described behavior, it also prevents manual editing of the input field (but you can still use "Edit text" from the arrow menu to do so).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.