Help - Search - Members - Calendar
Full Version: Parameterization with interactive dialogue?
Modelica Forum > Modelica > Modelica
Hannes
Hi there!

My topic is the following: I'd like to model a "hydraulic two-pin" containing a freely definable characteristic curve which describes the stationary relation between delta pressure (pressure head) and volume flow rate => H-Q-diagram. This model then represents the characteristics of - for example - a hydraulic network, a filter, a pipe or what ever passive hydraulic device you like.

Now I'm thinking about how to program such a two-pin: It should allow a parametrization by a kind of end-user without going into the source-code. Therefore, eveything must be done via "parameter"-interaction.
I want to be able to define the (monotonically rising) curve ...

+ ... by directly typing the coefficients of a polynom of a degree that also may be defined by the user or ...
+ ... by defining points being approximated with a least-squares-algorithm (Is there a Modelica-tool to define the points grafically???) or
+ ... by using a pipe with a realistic internal friction-model I already developed.

Depending on the way you choose out of these three, different parameters are necessary. A simple way to deal with this could be asking for ALL the parameters nevertheless -- although I do not need all. But I think of a more comfortable way to ask for the parameters:
Is it possible to make a kind of "parametrization-assistant" or an interactive sequence of dialogues which only asks for the parameters which are really needed?

The most comfortable way I found to design such a "dialogue" is to use the choices-annotation (see book of Peter Fritzon). But also here I cannot blind out the not needed parameters... :-(

Can you help me?

Regards,
Hannes
Roland
Hello Hannes,

QUOTE(Hannes @ Mar 4 2008, 05:42 PM) *

The most comfortable way I found to design such a "dialogue" is to use the choices-annotation (see book of Peter Fritzon). But also here I cannot blind out the not needed parameters... :-(


You can use an annotation to deactivate parameter fields in the dialog. For example:

parameter Boolean enableParameter = true;
parameter Real param annotation(Dialog(enable=enableParameter));

If you now replace "enable=enableParameter" with the value of an entry in the choices, you can (de)activate parameter fields according to you choice.

Roland
Hannes
Wow! Thanks a lot! This really works fine. How did you know about the possibilities of Modelica 2.2.1? Or do you even use 3.0? Is it out already? Do you know a book like Peter Fritzson's "Principles of object-oriented modeling and simulation with Modelica 2.1" for a newer version of Modelica?

Have a nice day!

Hannes biggrin.gif
Roland
Hello Hannes,

sorry for the slightly delayed response.

QUOTE(Hannes @ Mar 13 2008, 03:12 PM) *
You are very welcome.


The easiest way (from a programming point of view) is to find a model that uses the wanted feature, look at the code and use this in your own model. In the Modelica Standard Library most of the possibilities of Modelica are used - finding them is the hard part ;-)

QUOTE
Or do you even use 3.0? Is it out already?

The Modelica Specification 3.0 has been released at the last Modelica Design Meeting on March 16th. The bigger problem is currently to find a tool that supports this version. Dymola 7.0 which has been released at the Modelica Conference in Bielefeld already supports Modelica 3.0 but there still seem to be some problems to get it.

QUOTE
Do you know a book like Peter Fritzson's "Principles of object-oriented modeling and simulation with Modelica 2.1" for a newer version of Modelica?

Since Modelica 2.2.x is fully backwards compatible, everything described in the book is still valid. I don't know a book or other source for newer Modelica versions - but Modelica 3.0 has not changed too much, so with your knowledge of Modelica 2.x you should be able to write models without any problems.


Roland
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.