Saarland University
Lehrstuhl für Automatisierungstechnik

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> enable dialog depending on the choice of a replaceable model
ETH
post May 26 2009, 08:10 PM
Post #1


Newbie
*

Group: Members
Posts: 4
Joined: 12-March 09
Member No.: 33,062



Attached Image
QUOTE(uwe @ May 26 2009, 01:27 PM) *

hello all,

i like to enable various parameters using the enable functionality in the dialog part of annotations. the trigger for true/false should be the choice of certain replaceable model. This means, if a certain model is chosen via the parameter dialog, corresponding parameter should fade in or out. i tried a lot but i did not find a solution. here is part of my code....

...

parameter Integer numberReactions(start=10) "Number of reactions"
annotation(Dialog(tab="Reaction", group="Gas phase",
enable=if ChemicalReactionModel==CementProcess.WorkBase.RotaryKiln.BaseClasses.ChemicalReactions.NoChemicalReaction then false else true),
Evaluate=true);

...

replaceable
CementProcess.WorkBase.RotaryKiln.BaseClasses.ChemicalReactions.NoChemicalReaction
ChemicalReactionModel(redeclare final package Medium = Medium,
redeclare final package MediumExchange
= MediumGasExchange, redeclare final function
KineticReaction =
KineticReaction, final n=n,
final numberReactions=numberReactions,
final reactionOn=reactionOn,
final Ai=Ai,
final nF=nF,
final Ea=Ea,
T=medium.T,
MoDXi=MolarDensity,
MoDExXi=fill(0,n,MediumGasExchange.nXi))
constrainedby
CementProcess.WorkBase.RotaryKiln.BaseClasses.ChemicalReactions.PartialChemicalReaction(
redeclare package Medium = Medium,
redeclare package MediumExchange =
MediumGasExchange, redeclare function KineticReaction =
KineticReaction, n=n,
numberReactions=numberReactions,
reactionOn=reactionOn,
Ai=Ai,
nF=nF,
Ea=Ea,
T=medium.T,
MoDXi=MolarDensity,
MoDExXi=fill(0,n,MediumGasExchange.nXi))
"Model for chemical reactions in the gas phase"
annotation (Dialog(tab="Reaction", group="Reaction model"),choicesAllMatching,
Placement(transformation(extent={{-4,-4},{20,20}}, rotation=180,
origin={38,10})));

as one might see, i introduced the replaceable model ChemicalReactionModel. It is intialized with ...NoChemicalReaction. Now i like to trigger the parameter numberReactions in the dialog field of annotations using enable....

I did not found the correct syntax that makes it work.

If you have any ideas i would be very grateful.

Thanks a lot

Uwe


For me your code is correct
As I missed some of your code to test it, I created these following models:

partial model PartialChemicalReaction:
//...
equation
//...
end PartialChemicalReaction;

model NoChemicalReaction "NoChemicalReaction"
extends PartialChemicalReaction;
equation
//...
end NoChemicalReaction;

model WithChemicalReaction "WithChemicalReaction"
extends PartialChemicalReaction;
equation
//...
end WithChemicalReaction;

And I obtain the result of the attached image. Is is what you want ?

Best regards,

ETH smile.gif
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
uwe
post May 26 2009, 01:27 PM
Post #2


Newbie
*

Group: Members
Posts: 5
Joined: 13-January 09
Member No.: 27,539



hello all,

i like to enable various parameters using the enable functionality in the dialog part of annotations. the trigger for true/false should be the choice of certain replaceable model. This means, if a certain model is chosen via the parameter dialog, corresponding parameter should fade in or out. i tried a lot but i did not find a solution. here is part of my code....

...

parameter Integer numberReactions(start=10) "Number of reactions"
annotation(Dialog(tab="Reaction", group="Gas phase",
enable=if ChemicalReactionModel==CementProcess.WorkBase.RotaryKiln.BaseClasses.ChemicalReactions.NoChemicalReaction then false else true),
Evaluate=true);

...

replaceable
CementProcess.WorkBase.RotaryKiln.BaseClasses.ChemicalReactions.NoChemicalReaction
ChemicalReactionModel(redeclare final package Medium = Medium,
redeclare final package MediumExchange
= MediumGasExchange, redeclare final function
KineticReaction =
KineticReaction, final n=n,
final numberReactions=numberReactions,
final reactionOn=reactionOn,
final Ai=Ai,
final nF=nF,
final Ea=Ea,
T=medium.T,
MoDXi=MolarDensity,
MoDExXi=fill(0,n,MediumGasExchange.nXi))
constrainedby
CementProcess.WorkBase.RotaryKiln.BaseClasses.ChemicalReactions.PartialChemicalReaction(
redeclare package Medium = Medium,
redeclare package MediumExchange =
MediumGasExchange, redeclare function KineticReaction =
KineticReaction, n=n,
numberReactions=numberReactions,
reactionOn=reactionOn,
Ai=Ai,
nF=nF,
Ea=Ea,
T=medium.T,
MoDXi=MolarDensity,
MoDExXi=fill(0,n,MediumGasExchange.nXi))
"Model for chemical reactions in the gas phase"
annotation (Dialog(tab="Reaction", group="Reaction model"),choicesAllMatching,
Placement(transformation(extent={{-4,-4},{20,20}}, rotation=180,
origin={38,10})));

as one might see, i introduced the replaceable model ChemicalReactionModel. It is intialized with ...NoChemicalReaction. Now i like to trigger the parameter numberReactions in the dialog field of annotations using enable....

I did not found the correct syntax that makes it work.

If you have any ideas i would be very grateful.

Thanks a lot

Uwe
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



Lo-Fi Version Time is now: 20th August 2019 - 02:44 PM