シミュレーションの演習のコード
GS13のコードを以下に示します。このコードは 20-Sim用です。20-Simではボンドグラフを入力すると式も自動的に入力されますが、式が正しいとは限りませんので注意が必要です。
GS13のコード
C
parameters
real c = 7.15e-2;
equations
state = int(p.f);
p.e = state / c;
I1
parameters
real i = 1.0e2;
equations
state = int(p.e);
p.f = state / i;
Id
parameters
real i = 5.0;
equations
state = i*p.f;
p.e = ddt(state,0);
Integrate
parameters
real initial = 0; // initial value
equations
output = int (input, initial);
MTF
equations
p1.e = p2.e/r;
p2.f = p1.f/r;
R
parameters
real r = 0.25;
equations
p.f = p.e/r;
Se
parameters
real ylow = 1.0;
real t1 = 0.05;
real t2 = 0.4;
real peak =1.0e4;
variables
real flow;
real effort;
equations
if time <=t1 then
effort =ylow;
else if time <= t2 then
effort = peak;
else
effort =ylow;
end;
end;
p.e = -effort;
flow = p.f;
Sf
parameters
real flow = 6.0e2;
variables
real effort;
equations
p.f = flow;
effort = p.e;
Table
parameters
string filename= 'c:\users\mk\data.txt';
equations
output = table (filename, input);
TF
parameters
real r = 4.0e2;
equations
p1.e = p2.e/r;
p2.f = p1.f/r;
SignalMonitor
variables
real interesting plot;
equations
plot = input;
Table
0.000 0.4500000
0.1000000 0.4500000
0.2000000 0.5000000
0.2500000 0.6000000
0.3000000 0.7000000
0.3500000 0.8000000
0.4000000 1.0000
0.4500000 1.4000
0.5000000 2.0000
1.5000000 8.0000
