首页 文章

从多个LUT中选择的最佳方法是什么? (Modelica的)

提问于
浏览
1

在我们的物理系统模型中,我们通过查找表中的因子修改一个通量值 . LUT本身是从基于整数索引的LUT目录中选择的 . 我们目前正在将表数据加载到CombiTable2D组件中 . 选择/定义正确LUT的正确方法是什么?如果我们将它们全部作为一个输入数据文件中的命名表,有没有办法根据它的tableName(CombiTable参数)选择一个LUT?我一直在使用等式或算法格式的For循环,但还没有找到可用的语法 .

提前感谢您的想法......

1 回答

  • 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;
    

相关问题