シミュレーションの演習のコード

BGSPによるコード

GS1.BGSのコードを以下に示します。このコードは BGSP用です。第1行の

BOND SYMBOL EXPR OUT DEFIN PARM INIT

はコードの一部ですから省略してはいけません。また、BGSPではカラム指定が厳格で1カラムでもずれるとエラーになります。また、許される文字は英数字、コロン(:)、スラッシュ(/)、加減乗算記号(+-*)、半角空白のみであり、制御文字が入るとエラーになります。倍角の空白はエラーを生じますが、ソースをプリントしても気づきにくいので注意が必要です。

GS1のコード

BOND SYMBOL EXPR OUT DEFIN PARM INIT
SF1    11
ZJ     -11   8     13
RE1    13
OJ     -8    12    17    9
II1    12
RE2    17
ZJ     -9    10    14    15
CI1    14
RE3    15
OJ     -10   16    18    19
II2    16
RE4    18
TF1    19    21
ZJ     -21   24    22
CI2    24
OJ     -22   26    23
II3    26
RE5    23
/
BC: FL1   FL11
BC: XI    EF11
BC: W12   FL12
BC: W16   FL16
BC: F17   FL17
BC: M13   EF13
BC: M14   EF14
BC: F13   FL13
BC: E15   EF15
BC: F15   FL15
BC: F16   FL16
BC: V26   FL26
/
SF1
PA: PF1    1.57D+02
       F=PF1
EOD
II1
PA: PI1    4.8000D-02
        L=Z/PI1
EOD
II2
PA: PI2    6.000D-03
        L=Z/PI2
EOD
II3
PA: PI3    7.8000D+03
        L=Z/PI3
EOD
RE3
PA: PR1    1.000D+00
PA: PR2    1.4933D+01
PA: PR3    2.2300D+02
PA: PR4    1.4933D+01
PA: PRX1   6.6667D-02
PA: PRX2   1.4933D+01
PA: PRX3   -2.230D+02
        IF(Z.LE.-30)THEN
         GZ=-225.0
        ELSEIF(Z.LE.-15.0)THEN
         GZ=Z*PR2+PR3
        ELSEIF(Z.LE.15.0)THEN
         GZ=PRX1*Z
        ELSEIF(Z.LE.30.0)THEN
        GZ=Z*PRX2+PRX3
        ELSE
        GZ=225.0
        ENDIF
        R=GZ
EOD
RE2
PA: PR5    3.1800D-03
        R=PR5*Z
EOD
RE1
PA: PR61   1.333D-01
PA: PR62   9.0323D-02
PA: PR63   3.2258D-01
PA: PR64   1.1111D-02
PA: PR65   2.1444D+00
PA: PR66   -1.000D-02
PA: PR67   2.8200D+00
PA: PR68   -2.222D-02
PA: PR69   3.33333D+00
PA: PR70   -3.2258D-02
PA: PR71   3.93548D+00
PA: PR72   -8.16327D-03
PA: PR73   1.74286D+00
PA: PR80   1.00000D+01
        IF(Z.LE.-7.5)THEN
         RR=-1.0
        ELSEIF(Z.LE.7.5)THEN
         RR=PR61*Z
        ELSEIF(Z.LE.23.0)THEN
         RR=PR62*Z+PR63
        ELSEIF(Z.LE.32.0)THEN
         RR=PR64*Z+PR65
        ELSEIF(Z.LE.42.0)THEN
         RR=PR66*Z+PR67
        ELSEIF(Z.LE.60.0)THEN
         RR=PR68*Z+PR69
        ELSEIF(Z.LE.91.0)THEN
         RR=PR70*Z+PR71
        ELSEIF(Z.LE.140.0)THEN
         RR=PR72*Z+PR73
        ELSE
         RR=0.6
        ENDIF
        R=RR*PR80
EOD
RE4
PA: PR74   3.1800D-03
        R=PR74*Z
EOD
RE5
PA: PR75   6.9000D+02
        R=PR75*Z
EOD
CI1
PA: PC1    1.000D-02
        C=Z/PC1
EOD
CI2
PA: PC2    2.660D-05
        C=Z/PC2
EOD
TF1
PA: PT1    4.1800D-03
        TF=PT1
EOD
/
0.0000            4.000D+00         1.000D-05         2000
/

20-Simによるコード

Sf
parameters
	real flow = 1.5e2;
variables
	real effort;
equations
	p.f = flow;
	effort = p.e;
R131
parameters
	real pr61 = 1.333e-1;
	real pr62=9.0323e-2;
	real pr63=3.2258e-1;
	real pr64=1.1111e-2;
	real pr65=2.1444e0;
	real pr66=-1.000e-2;
	real pr67=2.82e0;
	real pr68=-2.222e-2;
	real pr69=3.3333e0;
	real pr70=-3.32258e-2;
	real pr71=3.93548e0;
	real pr72=-8.16327e-3;
	real pr73=1.74286e0;
	real pr80=1.0e1;
variables
	real rr;
equations
	rr=if p.f <= -7.5 then
		-1.0
		else if p.f <= 7.5 then
		p.f*pr61
		else if p.f <= 23.0 then
		pr62*p.f+pr63
		else if p.f <=32.0 then
		p.f*pr64+pr65
		else if p.f <= 42.0 then
		pr66*p.f+pr67
		else if p.f <= 60.0 then
		pr68*p.f+pr69
		else if p.f <=91.0 then
		pr70*p.f +pr71
		else if p.f <=140.0 then
		pr72*p.f+pr73
		else
		0.6
		end
		end
		end
		end
		end
		end
		end
		end;
		p.e=rr*pr80;

I12
parameters
	real m1= 4.8e-2;
equations
    state = int(p.e);
    p.f = state / m1;

R17
parameters
	real pr5= 3.18e-3;
equations
	p.e = pr5* p.f;

C14
parameters
	real pc1= 1.0e-2;
equations
	state = int(p.f);
	p.e = state / pc1;

R151
parameters
	
	real pr2=1.4933e1;
	real pr3=2.23e2;
	real pr4=1.4933e1;
	real prx1=6.667e-2;
	real prx2=1.4933e1;
	real prx3=-2.23e2;
equations
	p.f=if  p.e <=  -30 then
		-225.0  
		else if p.e <= -15 then
			p.e *pr2+pr3
			else if p.e <= 15 then
				prx1*p.e
				else if p.e <= 30 then
					p.e*prx2+prx3
					else
						225.0
						end
					       end
					end
					end;
	
I16
parameters
	real m2 = 6.0e-3;
equations
    state = int(p.e);
    p.f = state / m2;

R18
parameters
	real pr74= 3.18e-3;
equations
	p.e =pr74 * p.f;

TF
parameters
	real pt1 = 4.13e-3;
equations
	p1.e = pt1 * p2.e;
	p2.f = pt1 * p1.f;

	
C24
parameters
	real pc2 = 2.66e-5;
equations
	state = int(p.f);
	p.e = state / pc2;

I26
parameters
	real m3 = 7.8e3;
equations
    state = int(p.e);
    p.f = state / m3;

R23
parameters
	real pr75= 6.9e2;
equations
	p.e = pr75 * p.f;




20-Simによるブロックボンドグラフのコード

BlockBond131
parameters					
	string filename= 'J:\20-sim\Simtec\GS1A.txt';
equations					
	r = table (filename, input);
   

parameters					
	string filename= 'J:\20-sim\Simtec\GS1A1.txt';
equations					
		r2= table (filename, input);

C14
parameters
	real pc1= 1.0e-2;
equations
	state = int(p.f);
	p.e = state / pc1;

C24
parameters
	real pc2 = 2.66e-5;
equations
	state = int(p.f);
	p.e = state / pc2;

I12
parameters
	real m1= 4.8e-2;
equations
    state = int(p.e);
    p.f = state / m1;



I15
parameters
	real m2 = 6.0e-3;
equations
    state = int(p.e);
    p.f = state / m2;

I25
parameters
	real m3 = 7.8e3;
equations
    state = int(p.e);
    p.f = state / m3;

MR131
equations
	port1=p.f;
	p.e = r*10.0 ;;

MR151
equations
	 p.f=r2;;

R17
parameters
	real pr5= 3.18e-3;
equations
	p.e = pr5* p.f;

R18
parameters
	real pr74= 3.18e-3;
equations
	p.e =pr74 * p.f;

R23
parameters
	real pr75= 6.9e2;
equations
	p.e = pr75 * p.f;

Sf
parameters
	real flow = 1.5e2;
variables
	real effort;
equations
	p.f = flow;
	effort = p.e;

TF
parameters
	real pt1 = 4.13e-3;
equations
	p1.e = pt1 * p2.e;
	p2.f = pt1 * p1.f;

BlockBond131
GS1A.txt

-7.5   -1.0
0.0    0.0
7.5    1.000
23.0   2.400
32.0   2.500
42.0   2.400
60.0   2.000
91.0   1.000
140.0  0.6000
157.0  0.6000


BlockBond151
GS1A1.txt
-30.0   -225.0
-15.0   -1.00
15.00   1.000
30.000  226.000