我在 Modelica 的 2D-CombiTimeTable 中使用了一个 .txt 文件 (T_in1) 作为输入。它包含一个大小为 (4,2) 的数组;第一列是时间,第二列是时间相关变量。我想对每个时间步的第二列求和或(求平均值)。如果在这方面有任何帮助,我将不胜感激。代码如下:
model integration
import Modelica.Fluid.Types;
Modelica.Blocks.Sources.CombiTimeTable T_in1(
extrapolation=Modelica.Blocks.Types.Extrapolation.LastTwoPoints,
fileName="C:/Users/Tin1.txt",
smoothness=Modelica.Blocks.Types.Smoothness.LinearSegments,
tableName="tab1",
tableOnFile=true,
timeEvents=Modelica.Blocks.Types.TimeEvents.Always,
timeScale(displayUnit="min") = 60) annotation (
Placement(visible = true, transformation(origin={-61,32.2828}, extent = {{-6, -6}, {6, 6}}, rotation = 0)));
equation
for i in 1:3 loop
...
...
end for;
annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(
coordinateSystem(preserveAspectRatio=false)),
experiment(StopTime=240, __Dymola_Algorithm="Dassl"));
end integration;