4
是否可以根據取決於時間的變量(與參數相對)的值聲明(或重新聲明)組件?這裏已經多次討論了條件聲明(例如,#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;
像Component blah if v==0;
有條件的聲明,如果v
不是一個參數,肯定是不行的。有什麼方法可以實現我的目標嗎?我的猜測是「不」,這意味着我將不得不重新思考整個概念。但是,也許有人看到我缺少一個明顯的解決方案。任何建議如何解決這個問題將不勝感激。
再次感謝!該文件提供了一些有趣的見解。現在,我已經完成了你的建議 - 聲明兩個組件並在它們之間切換。 –