JPG2
JPG2

Reputation: 9

How to define a Dialog for a connector with an array of parameters

Let say that I have a connector with a few number parameters (whose number can change). Those parameters are elements of an array.

Would it be possible to have a dialog box to enter each parameter value rather than an array constructor like {1,2,3, ....}?

Upvotes: 0

Views: 79

Answers (2)

Hans Olsson
Hans Olsson

Reputation: 12517

It's unclear what you mean with entering each parameter in the array. Modelica does not have a standard mechanism for entering array elements.

Some tools allow you to enter the parameters one by one - e.g. if you do

model M "Example model"
  parameter Real r3[:] = zeros(0) "Array parameter";
end M;

Then Dymola (standalone and as part of 3D Experience platform) will show a dialog box for M and then a sub-dialog for r3 allowing you to enter each element: dialog box for r3

Upvotes: 2

tbeu
tbeu

Reputation: 1349

Not sure, if I understood correctly, but you can use final to declare parameters that should not be modified by users. See for example

partial model M "Example model"
  parameter Real r1 = 1 "First parameter";
  parameter Real r2 = 2 "Second parameter";
  final parameter Real r[:] = {r1, r2} "Assembled array parameter";
end M;

Upvotes: 1

Related Questions