I have a model representing some chemical process, and I want the reaction model to be switched between the absorption and desorption class (which defines the corresponding model) based on the Boolean parameter. I tried to do it like this:
model Sorption
boolean parameter absorbing;
AbsorptionModel if absorbing else Desorptionmodel reaction;
equation
reaction.T = T;
...
Use it as:
Sorption TestAbsorption(absorbing=true);
Sorption TestDesorption(absorbing=false);
Of course, this method does not work. absorbingknown at compile time, so I feel that it must be good to achieve this somehow.
I tried to use replaceable, but I don't want (optionally) to make two separate subclasses Sorptionjust to switch the type of reaction model. Removable / redeclare seems to be applicable only for inheritance, but can I be wrong? Is there a way to do what I want?
AbsorptionModel DesorptionModel , .