我创建了一个名为combitable1.txt的txt.文件
C:\Users\Yamaha R6\Desktop\FileOpenModelica
我想将此文件的数据“加载”到 OpenModelica 中的 Combitable1D 中。如果您看到图像,在语音“表”下,我写了:
loadResource("C:/Users/Yamaha R6/Desktop/FileOpenModelica/combitable1.txt")
但是当我模拟模型时出现以下错误:
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/