シミュレーションの演習のコード
GS6.BGSのコードを以下に示します。このコードは BGSP用です。第1行の
BOND SYMBOL EXPR OUT DEFIN PARM INIT
はコードの一部ですから省略してはいけません。また、BGSPではカラム指定が厳格で1カラムでもずれるとエラーになります。また、許される文字は英数字、コロン(:)、スラッシュ(/)、加減乗算記号(+-*)、半角空白のみであり、制御文字が入るとエラーになります。倍角の空白はエラーを生じますが、ソースをプリントしても気づきにくいので注意が必要です。
GS6のコード
BOND SYMBOL EXPR OUT DEFIN PARM INIT
SF1 1
ZJ -1 2 3
RE1 2
CI1 3
/
BC: V131 DP3
BC: PR EF3
BC: PX FL3
/
SF1
PA: P1 10.0
F=P1
EOD
RE1
PA: PR 0.033
R=Z*PR
EOD
CI1
PA: PC 1.0
C=Z/PC
IF(C.LT.2.0) THEN
C=3.5*C
ELSE
IF(C.LT.194.0) THEN
C=1.32/192.0 *(C-2)+7.0
ELSE
IF(C.LT.351.0) THEN
C=8.32+1.58/157.0 *(C-194.0)
ELSE
IF(C.LT.478.0) THEN
C=9.9+1.8/127.0*(C-351.0)
ELSE
IF(C.LT.580.0) THEN
C=11.7 +2.3/102.0 *(C-478.0)
ELSE
IF(C.LT.727.0) THEN
C=14.0 +5.8 /147.0 *(C-580.0)
ELSE
IF(C.LT.823.0) THEN
C=19.8+8.2/96.0 *(C-727.0)
ELSE
C=28.0+28.0/103.0*(C-823.0)
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
EOD
/
0.0 100.0 0.1 1000
/
DP3 2.0D00
/
20-Simによるコード:ブロックボンドグラフを要素内に包含した場合
Sf parameters real flow = 10.0; variables real effort; equations p.f = flow; effort = p.e; C31 parameters real c = 1; variables real zx; equations zx= int(p.f,0.0001)/c;//ZX:Effort p.e= if zx < 2.0 then //P:Pressure 3.5*zx else if zx <194.0 then 1.32/192.0*(zx-2)+7.0 else if zx < 351.0 then 8.32+1.58/157.0*(zx-194.0) else if zx < 478.0 then 9.9+1.8/127.0*(zx-351.0) else if zx < 580.0 then 11.7+2.3/102.0*(zx-478.0) else if zx < 727.0 then 14.0+5.8/147.0*(zx-580.0) else if zx < 823.0 then 19.8+8.2/96.0*(zx-727.0) else 28.0+28.0/103.0*(zx-823.0) end end end end end end end; R12 parameters real r = 0.033; equations p.f= p.e*r;;
20-Simによるコード:ブロックボンドグラフを要素外にした場合
Sf11
parameters
real flow = 10.0;
variables
real effort;
equations
p.f = flow;
effort = p.e;
C131parameters
real c = 1;
variables
real zx;
equations
zx= int(p.f,0.05)/c;//ZX:Effort
port1=zx;
p.e= port2;
R12
parameters
real r = 0.033;
equations
p.f= p.e*r;;
Table
parameters
string filename='J:\20-sim\Simtec\GS6.txt';
equations
output= table (filename, input);
J:\20-sim\Simtec\GS6.txt
0.0000 0.0000
2.0000 7.0000
194.0000 8.3200
351.0000 9.9000
478.0000 11.7000
580.0000 14.0000
727.0000 19.8000
823.0000 28.0000
926.0000 56.0000
