Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)

Forgot password? | Forgot username? | Register

Assigning string variable from an option list

Assigning string variable from an option list


I am new on Modelica programming. I want to know if there is possible to assign a value to a string variable from a list. I am programming a thermal model to see the effect/influence of the fluid on the phenomena. In order to calculate thermo-physical properties, I would like to choose the fluid from a list before the simulation starts. I don't know if it is possible, I want avoiding to create a program for each fluid, but only one code for all of them. Please, let me know your knowledge about the topic.

Thank you in advanced for your attention. Best regards.

Re: Assigning string variable from an option list


This is Mark,you can use the annotation to solve the problem. For example:

parameter String Mode="Ave" annotation(choices(choice="Min",choice="Ave",choice="Max"));

This code can help you select "Min","Ave","Max" on the model setting interface.

I hope this helps.

There are 0 guests and 0 other users also viewing this topic
You are here: