2015-04-03 48 views
1

在我們的物理系統模型中,我們通過查找表中的一個因子修改一個通量值。 LUT本身是從基於整數索引的LUT的目錄中選擇的。我們目前正在將表格數據加載到CombiTable2D組件中。選擇/定義正確的LUT的正確方法是什麼?如果我們把它們全部作爲一個輸入數據文件中的命名錶,有沒有辦法根據它的tableName(CombiTable參數)來選擇一個LUT?我一直在用For循環或者算法格式來玩For循環,但還沒有找到可用的語法。從多個LUT中選擇的最佳方法? (Modelica)

預先感謝的想法...

回答

1

我認爲這只是每個文件一個表的工作原理,所以你可以有表的數組,喜歡的東西:

parameter Integer N = 3; 
parameter String selectTable = "tab2"; 
Modelica.Blocks.Tables.CombiTable2D tableArray[N](
    each tableOnFile = true, 
    fileName = {"file1", "file2", "file3"}, 
    tableName={"tab1", "tab2", "tab3"}); 
// use the tableArray 
for i in 1:N loop 
    // note that N and selectTable need to be known at compile 
    // time so that the if and the for loop can be expanded 
    if (tableArray[i].tableName == selectTable) 
    then 
    connect(tableArray[i].u1, u1); 
    connect(tableArray[i].u2, u2); 
    connect(tableArray[i].y, y); 
    endif; 
end for; 
相關問題