【发布时间】:2014-06-24 15:34:42
【问题描述】:
是否可以根据与时间相关的变量(而不是参数)的值来声明(或重新声明)组件?条件声明已在此处多次讨论(例如,#1、#2 和 #3),但在这些示例中,条件取决于参数。
我的情况是这样的:我有两个模型,NaturalConvectionHeatTransfer 和 ForcedConvectionHeatTransfer,它们从同一接口 PartialHeatTransfer 扩展而来。在第三种模型中,我想做这样的事情:
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;
如果v 不是参数,像Component blah if v==0; 这样的条件声明肯定不起作用。有什么方法可以实现我的目标吗?我的猜测是“不”,这意味着我将不得不重新考虑整个概念。但是,也许有人看到了我缺少的明显解决方案。任何关于如何解决此问题的建议将不胜感激。
【问题讨论】:
标签: modelica