modelica - 当数据存储在txtFile中时,我必须在combiTable1D参数的字符串 "table"中写入什么?

标签 modelica

我创建了一个名为combitable1.txt的txt.文件

C:\Users\Yamaha R6\Desktop\FileOpenModelica

我想将此文件的数据“加载”到 OpenModelica 中的 Combitable1D 中。如果您看到图像,在语音“表”下,我写了:

loadResource("C:/Users/Yamaha R6/Desktop/FileOpenModelica/combitable1.txt")

但是当我模拟模型时出现以下错误:

enter image description here

15:51:20 Translation Error Class loadResource not found in scope (looking for a function or record)

我能做什么?

最佳答案

在这种情况下,您不需要使用 loadResource 函数。您可以保留表名称不变

parameter Real table[:, :] = fill(0.0, 0, 2)
  "Table matrix (grid = first column; e.g., table=[0,2])"

您的文件格式应如下所示,假设文本文件 myFile.txt:

#1
double myTable(200000,2)
0.000000 0.110519
0.001000 0.316248
0.002000 0.505827
0.003000 0.703204
0.004000 0.894942
0.005000 1.072796
...      ...

对 Modelica.Blocks.Sources.CombiTimeTable 进行以下输入

parameter String fileName = "C:\\SomeLocation\\myFile.txt";
parameter String tableName = "myTable";

关于modelica - 当数据存储在txtFile中时,我必须在combiTable1D参数的字符串 "table"中写入什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46024403/

相关文章:

modelica - 验证 Modelica smoothOrder 注解的正确性

modelica - 获取 Dymola 中的当前模型名称和文件路径

modelica - 使用可扩展连接器在 Dymola 中构建控制总线

modelica - 示例功能在 Dymola 上不起作用

ode - Dymola DAE 求解器

modelica - 计算带有连接器的模型中的方程数量

Modelica - 是否可以将子模型的名称设置为另一个变量的值?

modelica - 在 Modelica (SystemModeler) 中生成白噪声

modelica - Modelica 中的抽象开关

modelica - 在 OpenModelica 中保存开始/初始猜测值并从文件中实现初始值