我是Modelica的新手,並且無法嘗試對數組採樣連續的實數輸入信號。我嘗試過使用'樣本',但無法使其工作。下面的代碼的問題是每個x [i]是一個相同的採樣版本p每dt秒。我想要的是x [1]成爲第一個同樣,x [2]成爲第二個樣本等等。將信號採樣到Modelica中的陣列
model test_sample
parameter Real dt = 0.1 "Precision of monitor";
Real p;
Real[10] x;
Modelica.Blocks.Sources.Sine sine(freqHz=1);
equation
p = sine.y;
for j in 1:10 loop
when sample(0, dt) then
x[j] = p;
end when;
end for;
end test_sample;
任何幫助將不勝感激!
在此先感謝!