变量现在从 j = 1 开始,但增量是错误的。对于 t = 0.5,它的值应该是 2,对于 t = 1,j = 3 等等...您会在下图中看到错误
class abc
import Modelica.SIunits;
parameter SIunits.Time delta_t = 0.5;
constant Real a[:] = {4,2,6,-1,3,5,7,4,-3,-6};
Real x;
Integer j(start=1);
Integer k = size(a,1);
algorithm
when {(sample(delta_t, delta_t) and j < k),j == 1} then
x := a[pre(j)];
j := pre(j) + 1;
end when;
end abc;
提前致谢。