Is it possible to declare (or re-declare) components depending on the value of a time-dependent variable (as opposed to a parameter)? Conditional declaration has been discussed here numerous times (e.g., #1, #2 and #3), however in those examples, the condition depends on a parameter.
My situation is this: I have two models, NaturalConvectionHeatTransfer
and ForcedConvectionHeatTransfer
that extend from the same interface PartialHeatTransfer
. In a third model, I would like to do something like this:
model MyProblem
// stripped other declarations
input v "Velocity of fluid flow";
replaceable PartialHeatTransfer heatTransfer;
equation
if v == 0 then
// redeclare heatTransfer to be of type NaturalConvectionHeatTransfer
else
// redeclare heatTransfer to be of type ForcedConvectionHeatTransfer
end if;
end MyProblem;
A conditional declaration like Component blah if v==0;
certainly does not work if v
is not a parameter. Is there any way to achieve my goal? My guess is "no", meaning I will have to re-think the whole concept. However, perhaps someone sees an obvious solution I am missing. Any suggestion how to work around this would be appreciated.