Help - Search - Members - Calendar
Full Version: Replaceable parameter - "String"
Modelica Forum > Modelica > Modelica
king
Hi,

In a model, I want to have a STRING parameter for which i should be able to choose an option from the drop-down list box. the options may be "pipe" & "hose".
(pipe & hose are just STRINGS and no record is associated with them)

Based on the selection of "pipe" or "hose" for that parameter, I have to use the equations ( i may use when statement)

how to do this?
wagner
Hello king,

are you using Dymola? I think there's an example in the Dymola 6 Addition-Manual on how to use drop-down-lists in the parameter dialog.

Regards

Florian
Roland
Hello king,

what you can write is:

parameter String modelType = "pipe"
annotation(
choices(
choice(modelType = "pipe" "pipe"),
choice(modelType = "hose" "hose")));

The first string in the choices is the value, modelType will have, the second string is the text displayed in the drop down box.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2012 Invision Power Services, Inc.