シミュレーションの演習のコード
GS19のコードを以下に示します。このコードは 20-Sim用です。
GS19のコード
C
parameters
real c = 2.5e-3;
real cin=-8.0e-5;
equations
state = int(p.f)+cin;
p.e = state / c;
C1
parameters
real c = 1;
string filename='c:\data3.txt';
equations
state = int(p.f);
p.e = table(filename,state) / c;
Constant
parameters
real C = 6.0e-5; // output value
equations
output = C;
Gain
parameters
real K = 1.0; // gain
equations
output = K * (input-port1);
Gain1
parameters
real K = 1.0; // gain
equations
output = K * (input+port1);
GY
parameters
real r = 0.08;
equations
p1.e = r * p2.f;
p2.e = r * p1.f;
I
parameters
real i = 5.0e-4;
equations
state = int(p.e);
p.f = state / i;
I1
parameters
real i = 0.1;
equations
state = int(p.e);
p.f = state / i;
MR
parameters
real rx=10.8;
equations
p.e = r *rx* p.f;
port1=p.e;
MR1
parameters
real rx=10.8;
equations
p.e =r * p.f*rx;
port1=p.e;
MSe
parameters
real r1=42.0;
variables
real flow;
equations
p.e = effort*r1;
flow = p.f;
port1=p.e;
MSe1
parameters
real r1=42.0;
variables
real flow;
equations
p.e = effort*r1;
flow = p.f;
port1=p.e;
R
parameters
real r = 0.1;
equations
p.e = r * p.f;
R1
parameters
real r = 71.0;
equations
p.e = r * p.f;
Sf
parameters
real flow = 0.4;
variables
real effort;
equations
p.f = flow;
effort = p.e;
Table
parameters
string filename='c:\data1.txt';
equations
output = table (filename, input);
Table1
parameters
string filename='c:\data2.txt';
equations
output = table (filename, input);
Table2
parameters
string filename='c:\data1.txt';
equations
output = table (filename, input);
Table3
parameters
string filename='c:\data2.txt';
equations
output = table (filename, input);
TF
parameters
real r = 38.5;
equations
p1.e = p2.e/r;
p2.f = p1.f/r;
TF1
parameters
real r = 38.5;
equations
p1.e =r* p2.e;
p2.f = r*p1.f;
Sf
parameters
real flow = 0.5;
real t1=2.0e-3;
real k=0.0;
variables
real effort;
equations
if time<=t1 then
p.f = flow;
else
p.f=k;
end;
effort = p.e;
c:\data1.txt
-200.0000e-06 0.0000
0.0000 0.0000
25.000e-06 0.0048810
50.000e-06 0.0522810
75.000e-06 0.1747940
100.00e-06 0.3212330
125.00e-06 0.4341870
150.00e-06 0.5049530
175.00e-06 0.5424600
200.00e-06 0.5440000
300.00e-06 0.5440000
c:\data2.txt
-200.0000e-06 0.0000
0.0000 0.0000
25.000e-06 0.0048460
50.000e-06 0.0486680
75.000e-06 0.1426410
100.00e-06 0.2324530
125.00e-06 0.2909700
150.00e-06 0.3240510
175.00e-06 0.3406250
200.00e-06 0.3450000
300.00e-06 0.3450000
c:\data3.txt
-0.001400 -9.200e+03
-400.000e-06 -92.0000
400.0000e-06 92.00000
0.0014000 9.200e+03
