Good morning everyone,
During my last seagoing contract i've take the occasion to solve the problem about how plan correctly the bunker on board.
Bunker means fuel on board, the bunker plan it's the filling plan on store tanks, that it's much important for a correct balance of weight on board.
Now i've take my pocket CASIO PB 700 and Z1, BASIC and C programmable, i've choice the basic because it's very LOW programming system and it' so fast to think and wrote.
THAT it's the PB 700 version
BUNKER PLAN
Motorship MAIOR , italian RO-RO container fuel store double bottoms
# include <stdio.h>
ooops! No C !! but only the classic BASIC!!
10 CLS:CLEAR ' start and clear memory
15 FOR H=0 TO 18
16 LOCATE H,2:PRINT” *” ' star effect and logo
17 NEXT H
20 LOCATE 4,1:PRINT”BUNKER PLAN”:LOCATE 10,3:PRINT CHR$(64);”2015
V.1”
22 FOR H=1 TO 500
25 NEXT H :BEEP1:CLS ' timer
30 DIM A!(3):DIM S!(3):DIM T!(3):DIM D!(3) ' array declarations
35 DIM H!(10):DIM K!(10):DIM L!(11)
50 CLS:LOCATE 4,0:PRINT”1-DIESEL 7”:LOCATE 4,1:PRINT”2-FUEL 3”
55 LOCATE 4,2:INPUT”3-BUNKER PLAN”;Q$
60 IF Q$=”1” THEN B=130 :C=.6:GOTO 1100 ' sound graph
65 IF Q$=”2” THEN B=630 :C=.127:GOTO 1100
70 IF Q$=”3” THEN GOTO 100 ELSE BEEP:END ' go to plan
100 CLS:LOCATE 4,0:PRINT”BUNKER PLAN”
110 LOCATE 0,2:PRINT”DIESEL PLAN : D”
120 LOCATE 0,3:INPUT”FUEL PLAN : F”;Q$
130 IF Q$=”D” THEN GOTO 3000
140 IF Q$=”F” THEN GOSUB 3100
150 REM FILLING PLAN
160 CLS:BEEP1:LOCATE 1,0:PRINT”M/V MAIOR D.O. 7 & F.O. 3”
170 LOCATE 0,1:PRINT” A-STBD B-PORT”
180 FOR I=0 TO 400
190 NEXT I ' timer
200 CLS: LOCATE 0,0:INPUT”STBD A sound”;S!(0)
210 LOCATE 0,1:INPUT”PORT B sound”;S!(1)
300 IF S!(0)<=H!(0) THEN D!(0)=S!(0)/K!(0):GOTO 410 ' sound to m3
310 IF S!(0)<H!(1) THEN D!(0)=S!(0)/K!(1): GOTO 410
320 IF S!(0)<H!(2) THEN D!(0)=S!(0)/K!(2):GOTO 410
330 IF S!(0)<H!(3) THEN D!(0)=S!(0)/K!(3):GOTO 410
340 IF S!(0)<H!(4) THEN D!(0)=S!(0)/K!(4):GOTO 410
350 IF S!(0)<H!(5) THEN D!(0)=S!(0)/K!(5):GOTO 410
360 IF S!(0)<H!(6) THEN D!(0)=S!(0)/K!(6):GOTO 410
370 IF S!(0)<H!(7) THEN D!(0)=S!(0)/K!(7):GOTO 410
380 IF S!(0)<H!(8) THEN D!(0)=S!(0)/K!(8):GOTO 410
390 IF S!(0)<=H!(9) THEN D!(0)=S!(0)/K!(9):GOTO 410
400 BEEP
410 IF S!(1)<=H!(0) THEN D!(1)=S!(1)/K!(0):GOTO 600 ' sound to m3
420 IF S!(1)<H!(1) THEN D!(1)=S!(1)/K!(1):GOTO 600
430 IF S!(1)<H!(2) THEN D!(1)=S!(1)/K!(2):GOTO 600
440 IF S!(1)<H!(3) THEN D!(1)=S!(1)/K!(3):GOTO 600
450 IF S!(1)<H!(4) THEN D!(1)=S!(1)/K!(4):GOTO 600
460 IF S!(1)<H!(5) THEN D!(1)=S!(1)/K!(5):GOTO 600
470 IF S!(1)<H!(6) THEN D!(1)=S!(1)/K!(6):GOTO 600
480 IF S!(1)<H!(7) THEN D!(1)=S!(1)/K!(7):GOTO 600
490 IF S!(1)< H!(8) THEN D!(1)=S!(1)/K!(8):GOTO 600
500 IF S!(1)<=H!(9) THEN D!(1)=S!(1)/K!(9):GOTO 600
510 BEEP:GOTO 10
600 REM ELABORAZIONE BUNKER ' main ( ) function
610 CLS:LOCATE 0,0:INPUT”Total Fill ”;FD
620 CLS:DRAW(60,0)-(125,0)-(125,14)-(60,14)-(50,0)
630 LOCATE 7,2:PRINT”P- 5 +S”:DRAW(92,0)-(92,16)
640 LOCATE 0,3:INPUT”Balance rate 0-10”;BR
650 LET BR=BR/10
660 LET T!(0)=D!(0)+FD*(1-BR):LET T!(1)=D!(1)+FD*BR
670 IF T!(0)>L!(10) THEN GOSUB 4000:IF T!(1)>L!(10) THEN GOSUB 4000
680 CLS:LOCATE 7,0:PRINT CHR$(224);” TOTALS”;CHR$(224):BEEP 1
690 LOCATE 0,1:PRINT USING”###.#”;”A “;D!(0):LOCATE 10,1:PRINT USING”###.#”;”B “;D!(1)
700 LOCATE 0,2:PRINT USING”###.#”;”N ”;T!(0):LOCATE 10,2:PRINT USING “###.#”;N ”;T!(1);”m3”
710 IF INKEY$=”” THEN 710 ' press a key to forward
720 LOCATE 0,3:INPUT”1-again 2-target “;Q$
730 IF Q$=”1” THEN GOTO 100:IF Q$=”2” THEN GOTO 740 ELSE BEEP:END
SONDE TARGET
740 REM TARGET LEVEL
750 BEEP ' that function will convert m3 to tank sound
760 IF T!(0)<L!(0) THEN T!(0)=T!(0)*K!(0):A!(0)=T!(0):GOTO 900
770 IF T!(0)<L!(1) THEN T!(0)=T!(0)*K!(0): A!(0)=T!(0): GOTO 900
780 IF T!(0)<L!(2) THEN T!(0)=T!(0)*K!(1):A!(0)=T!(0): GOTO 900
790 IF T!(0)<L!(3) THEN T!(0)=T!(0)*K!(2):A!(0)=T!(0):GOTO 900
800 IF T!(0)<L!(4) THEN T!(0)=T!(0)*K!(3):A!(0)=T!(0):GOTO 900
810 IF T!(0)<L!(5) THEN T!(0)=T!(0)*K!(4):A!(0)=T!(0)GOTO 900
820 IF T!(0)<L!(6) THEN T!(0)=T!(0)*K!(5):A!(0)=T!(0):GOTO 900
830 IF T!(0)<L!(7) THEN T!(0)=T!(0)*K!(6):A!(0)=T!(0):GOTO 900
840 IF T!(0)<L!(8) THEN T!(0)=T!(0)*K!(7):A!(0)=T!(0):GOTO 900
850 IF T!(0)<L!(9) THEN T!(0)=T!(0)*K!(8):A!(0)=T!(0):GOTO 900
860 IF T!(0)<=L!(10) THEN T!(0)=T!(0)*K!(9):A!(0)=T!(0):GOTO 900
900 IF T!(1)<L!(0) THEN T!(1)=T!(1)*K!(0):A!(1)=T!(1):GOTO 1100
910 IF T!(1)<L!(1) THEN T!(1)=T!(1)*K!(0):A!(1)=T!(1):GOTO 1100
920 IF T!(1)<L!(2) THEN T!(1)=T!(1)*K!(1):A!(1)=T!(1):GOTO 1100
930 IF T!(1)<L!(3) THEN T!(1)=T!(1)*K!(2):A!(1)=T!(1):GOTO 1100
940 IF T!(1)<L!(4) THEN T!(1)=T!(1)*K!(3):A!(1)=T!(1):GOTO 1100
950 IF T!(1)<L!(5) THEN T!(1)=T!(1)*K!(4):A!(1)=T!(1):GOTO 1100
960 IF T!(1)<L!(6) THEN T!(1)=T!(1)*K!(5):A!(1)=T!(1):GOTO 1100
970 IF T!(1)<L!(7) THEN T!(1)=T!(1)*K!(6):A!(1)=T!(1):GOTO 1100
980 IF T!(1)<L!(8) THEN T!(1)=T!(1)*K!(7):A!(1)=T!(1):GOTO 1100
990 IF T!(1)<L!(9) THEN T!(1)=T!(1)*K!(8):A!(1)=T!(1):GOTO 1100
1000 IF T!(1)<=L!(10) THEN T!(1)=T!(1)*K!(9):A!(1)=T!(1):GOTO 1100
1010 GOSUB 4000 ' if more go to overflow subroutine
1020 LET T!(1)=B:A!(1)=T!(1) ' in any case the graph will show something
1030 REM GRAPH
1100 CLS
1110 REM
1120 LOCATE 8,3:INPUT “level 7A”;A!(0)
1130 LOCATE 8,3:INPUT “level 7B”;A!(1):BEEP:CLS
1140 LET A!(0)=INT A!(0):LET A!(1)=INT A!(1) ' local array adjustment
1150 CLS:FOR I= 0 TO 1
1160 REM
1170 LOCATE 0,I
1180 PRINT “7”;CHR$(65+I);CHR$(136)
1190 FOR J=0 TO 6
1200 LET Y=I*8+J
1210 DRAW(18,Y)-(17+(A!(I)*C),Y)
1220 NEXT J
1230 LET X=17
1240 LET Y=I*8
1250 DRAW(X+1,Y)-(X+(B*C),Y)-(X+(B*C),Y+6)-(X+1,Y+6) ' ullage limit alarm
1260 IF A!(I)>0.8*B THEN LOCATE13,0+I:PRINT”!”:BEEP1:BEEP:BEEP1:BEEP
1270 LOCATE 13,0+I:PRINT USING”###”;A!(I);” “;B
1280 NEXT I
1290 IF INKEY$=”” THEN 100 ' after graph go back to start
FUEL/DIESEL COSTANT ' if you wont adapt that software to any tank all over world you need divide the tank to 10 section ( good for strange tanks not geometric as ships double bottoms, natural lake or complex design swimming pool ...eg...).
H it's the top height of each section, K it's the costant born between the level and the volume corresponding, L it's the volume of the sections.
B it's the top sound of the tank, C it's the divide costant for adapt the LCD of CASIO and the graph cycle of draw.
3000 LET B=130:C=.6
3010 LET H!(0)=13:H!(1)=26:H!(2)=39:H!(3)=52:H!(4)=65:H!(5)=78:H!(6)=91
3020 LET H!(7)=104:H!(8)=117:H!(9)=130
3030 LET K!(0)=3.33:K!(1)=3.166:K!(2)=2.93:K!(3)=2.789:K!(4)=2.649:K!(5)=2.58
3040 LET K!(6)=2.607:K!(7)=2.61:K!(8)=2.55:K!(9)=2.506
3050 LET L!(0)=1:L!(1)=3.9:L!(2)=8.66:L!(3)=13.64:L!(4)=19.12:L!(5)=25.2
3060 LET L!(6)=30.26:L!(7)=34.5:L!(8)=40.2:L!(9)=46.12:L!(10)=52.5
3070 GOTO 150
3100 LET H!(0)=63:H!(1)=126:H!(2)=190:H!(3)=250:H!(4)=315
3110 LET H!(5)=380:H!(6)=440:H!(7)=505:H!(8)=565:H!(9)=630
3120 LET K!(0)=9.03:K!(1)=7.48:K!(2)=6.07:K!(3)=5.35:K!(4)=4.92
3130 LET K!(5)=4.605:K!(6)=4.355:K!(7)=4.14:K!(8)=3.97:K!(9)=3.8
3140 LET L!(0)=1:L!(1)=8:L!(2)=19.2:L!(3)=34:L!(4)=48.8
3150 LET L!(5)=66.5:L!(6)=84.8:L!(7)=103.8:L!(8)=124.6:L!(9)=145:L!(10)=169
3160 LET B=630: LET C=.127
3179 RETURN
4000 REM OVERFLOW
4010 CLS
4020 FOR I=5 TO 16 : BEEP 1:BEEP
4025 LOCATE I,1:PRINT CHR$(240)
4030 LOCATE 5,2:PRINT”! OVERFLOW !”
4035 NEXT I
4040 RETURN
and Here the Z1 version, little different about the variable management
BUNKER PLAN V1 - Z1 version
10 CLS:CLEAR ' start and clear memory
15 FOR H=0 TO 30
16 LOCATE H,2:PRINT” *” ' star effect and logo
18 NEXT H
20 CLS:LOCATE 7,1:PRINT”BUNKER PLAN”:LOCATE 10,3:PRINT CHR$(64);”2015
V.1”
22 WAIT 300
25 BEEP1:CLS ' timer
30 DIM A(3):DIM S(3):DIM T(3):DIM D(3) ' array declarations
35 DIM H(10):DIM K(10):DIM L(11)
50 CLS:LOCATE 4,0:PRINT”1-DIESEL 7”:LOCATE 4,1:PRINT”2-FUEL 3”
55 LOCATE 4,2:INPUT”3-BUNKER PLAN”;Q$
60 IF Q$=”1” THEN B=130 :C=.6:GOTO 1100 ' sound graph
65 IF Q$=”2” THEN B=630 :C=.127:GOTO 1100
70 IF Q$=”3” THEN GOTO 100 ELSE BEEP:END ' go to plan
100 CLS:LOCATE 4,0:PRINT”BUNKER PLAN”
110 LOCATE 0,2:PRINT”DIESEL PLAN : D”
120 LOCATE 0,3:INPUT”FUEL PLAN : F”;Q$
130 IF Q$=”D” THEN GOTO 3000
140 IF Q$=”F” THEN GOSUB 3100 ELSE GOTO 10
150 REM FILLING PLAN
160 CLS:BEEP1:LOCATE 1,0:PRINT”M/V MAIOR D.O. 7 & F.O. 3”
170 LOCATE 0,1:PRINT” A-STBD B-PORT”
180 FOR I=0 TO 400
190 NEXT I ' timer
200 CLS: LOCATE 0,0:INPUT”STBD A sound”;S(0)
210 LOCATE 0,1:INPUT”PORT B sound”;S(1)
300 IF S(0)<=H(0) THEN D(0)=S(0)/K(0):GOTO 410 ' sound to m3
310 IF S(0)<H(1) THEN D(0)=S(0)/K(1): GOTO 410
320 IF S(0)<H(2) THEN D(0)=S(0)/K(2):GOTO 410
330 IF S(0)<H(3) THEN D(0)=S(0)/K(3):GOTO 410
340 IF S(0)<H(4) THEN D(0)=S(0)/K(4):GOTO 410
350 IF S(0)<H(5) THEN D(0)=S(0)/K(5):GOTO 410
360 IF S(0)<H(6) THEN D(0)=S(0)/K(6):GOTO 410
370 IF S(0)<H(7) THEN D(0)=S(0)/K(7):GOTO 410
380 IF S(0)<H(8) THEN D(0)=S(0)/K(8):GOTO 410
390 IF S(0)<=H(9) THEN D(0)=S(0)/K(9):GOTO 410
400 BEEP
410 IF S(1)<=H(0) THEN D(1)=S(1)/K(0):GOTO 600 ' sound to m3
420 IF S(1)<H(1) THEN D(1)=S(1)/K(1):GOTO 600
430 IF S(1)<H(2) THEN D(1)=S(1)/K(2):GOTO 600
440 IF S(1)<H(3) THEN D(1)=S(1)/K(3):GOTO 600
450 IF S(1)<H(4) THEN D(1)=S(1)/K(4):GOTO 600
460 IF S(1)<H(5) THEN D(1)=S(1)/K(5):GOTO 600
470 IF S(1)<H(6) THEN D(1)=S(1)/K(6):GOTO 600
480 IF S(1)<H(7) THEN D(1)=S(1)/K(7):GOTO 600
490 IF S(1)< H(8) THEN D(1)=S(1)/K(8):GOTO 600
500 IF S(1)<=H(9) THEN D(1)=S(1)/K(9):GOTO 600
510 BEEP:GOTO 10
600 REM ELABORAZIONE BUNKER ' main ( ) function
610 CLS:LOCATE 0,0:INPUT”Total Fill ”;FD
620 CLS:DRAW(110,0)-(185,0)-(185,14)-(110,14)-(110,0)
630 LOCATE 20,2:PRINT”P- “;CHR$(149):LOCATE 25,2:
PRINT “ +S”:DRAW(148,0)-(148,16)
640 LOCATE 0,3:INPUT”Balance rate 0-10”;BR
650 LET BR=BR/10
660 LET T(0)=D(0)+(FB*BR):LET T(1)=D(1)+(FD*(1-BR))
670 IF T(0)>L(10) THEN GOSUB 4000
675 IF T(1)>L(10) THEN GOSUB 4000
680 CLS:LOCATE 7,0:PRINT CHR$(61);” TOTALS”;CHR$(61):BEEP 1
690 LOCATE 1,1:PRINT”L.A”:LOCATE 5,1:PRINT USING”###.#”;D(0)
695 LOCATE 13,1:PRINT “L.B”:LOCATE 17,1:PRINT USING###.#”;D(1)
700 LOCATE 1,2:PRINT ”New”:LOCATE 5,2:PRINT USING”###.#”;T(0)
705 LOCATE 13,2:PRINT “New ”:LOCATE 17,2:
PRINT USING”###.#”;T(1):LOCATE 23,2:PRINT ”m3”
710 IF INKEY$=”” THEN 710 ' press a key to forward
720 LOCATE 0,3:INPUT”1-again 2-target “;Q$
730 IF Q$=”1” THEN GOTO 100:IF Q$=”2” THEN GOTO 740 ELSE BEEP:END
SONDE TARGET
740 REM TARGET LEVEL
750 BEEP ' that function will convert m3 to tank sound
760 IF T(0)<L(0) THEN T(0)=T(0)*K(0):A(0)=T(0):GOTO 900
770 IF T(0)<L(1) THEN T(0)=T(0)*K(0): A(0)=T(0): GOTO 900
780 IF T!(0)<L(2) THEN T(0)=T(0)*K(1):A(0)=T(0): GOTO 900
790 IF T!(0)<L(3) THEN T(0)=T(0)*K(2):A(0)=T(0):GOTO 900
800 IF T!(0)<L(4) THEN T(0)=T(0)*K(3):A(0)=T(0):GOTO 900
810 IF T(0)<L(5) THEN T(0)=T(0)*K(4):A(0)=T(0)GOTO 900
820 IF T(0)<L(6) THEN T(0)=T(0)*K(5):A(0)=T(0):GOTO 900
830 IF T(0)<L(7) THEN T(0)=T!0)*K(6):A(0)=T(0):GOTO 900
840 IF T(0)<L(8) THEN T(0)=T(0)*K(7):A(0)=T(0):GOTO 900
850 IF T(0)<L(9) THEN T(0)=T(0)*K(8):A(0)=T(0):GOTO 900
860 IF T(0)<=L(10) THEN T(0)=T(0)*K(9):A(0)=T(0):GOTO 900
870 IF T(0)>L(10) THEN T(0)=B:A(0)=B:GOTO 900
900 IF T(1)<L(0) THEN T(1)=T(1)*K(0):A(1)=T(1):GOTO *GRAPH
910 IF T(1)<L(1) THEN T(1)=T(1)*K(0):A(1)=T(1):GOTO *GRAPH
920 IF T(1)<L(2) THEN T(1)=T(1)*K(1):A(1)=T(1):GOTO *GRAPH
930 IF T(1)<L(3) THEN T(1)=T(1)*K(2):A(1)=T(1):GOTO *GRAPH
940 IF T(1)<L(4) THEN T(1)=T(1)*K(3):A(1)=T(1):GOTO *GRAPH
950 IF T(1)<L(5) THEN T(1)=T(1)*K(4):A(1)=T(1):GOTO *GRAPH
960 IF T(1)<L(6) THEN T(1)=T(1)*K(5):A(1)=T(1):GOTO *GRAPH
970 IF T(1)<L(7) THEN T(1)=T(1)*K(6):A(1)=T(1):GOTO *GRAPH
980 IF T(1)<L(8) THEN T(1)=T(1)*K(7):A(1)=T(1):GOTO *GRAPH
990 IF T(1)<L(9) THEN T(1)=T(1)*K(8):A(1)=T(1):GOTO *GRAPH
1000 IF T(1)<=L(10) THEN T(1)=T(1)*K(9):A(1)=T(1):GOTO *GRAPH
1010 IF T(1)>L(10) THEN T(1)=B:A(1)=B:GOTO *GRAPH
1020 LET T(1)=B:A(1)=T(1) ' in any case the graph will show something
1030 CLS:REM GRAPH
1100 CLS:LOCATE 8,3:INPUT “level A”;A(0)
1110 CLS:LOCATE 8,3:INPUT “level B”;A(1):BEEP1
1120 CLS
1130 *GRAPH
1140 LET A(0)=INT A(0):LET A(1)=INT A(1) ' local array adjustment
1150 FOR I= 0 TO 1
1160 REM
1170 LOCATE 0,I
1180 PRINT CHR$(32);CHR$(65+I);CHR$(62)
1190 FOR J=0 TO 6
1200 LET Y=I*8+J
1210 DRAW(18,Y)-(18+(A(I)*C),Y)
1220 NEXT J
1230 LET X=17
1240 LET Y=I*8
1250 DRAW(X+1,Y)-(X+(B*C),Y)-(X+(B*C),Y+6)-(X+1,Y+6) ' ullage limit alarm
1260 IF A(I)>0.8*B THEN LOCATE 17,0+I:PRINT”!”:BEEP1:BEEP:BEEP1:BEEP
1270 LOCATE 18,0+I:PRINT USING”###”;A(I):LOCATE 23,0+I:PRINT USING”###”;B
1275 LOCATE 28,I:PRINT CHR$(157):LOCATE 29,I:PRINT USING”##”;INT(100-(100*A(I))/B)
1280 NEXT I
1290 IF INKEY$=”” THEN 1290 ' after graph go back to start
FUEL/DIESEL COSTANT ' if you wont adapt that software to any tank all over world you need divide the tank to 10 section ( good for strange tanks not geometric as ships double bottoms, natural lake or complex design swimming pool ...eg...).
H it's the top height of each section, K it's the costant born between the level and the volume corresponding, L it's the volume of the sections.
B it's the top sound of the tank, C it's the divide costant for adapt the LCD of CASIO and the graph cycle of draw.
3000 LET B=130:C=.6
3010 LET H(0)=13:H(1)=26:H(2)=39:H(3)=52:H(4)=65:H(5)=78:H(6)=91
3020 LET H(7)=104:H(8)=117:H(9)=130
3030 LET K(0)=3.33:K(1)=3.166:K(2)=2.93:K(3)=2.789:K(4)=2.649:K(5)=2.58
3040 LET K(6)=2.607:K(7)=2.61:K(8)=2.55:K(9)=2.506
3050 LET L(0)=1:L(1)=3.9:L(2)=8.66:L(3)=13.64:L(4)=19.12:L(5)=25.2
3060 LET L(6)=30.26:L(7)=34.5:L(8)=40.2:L(9)=46.12:L(10)=52.5
3070 GOTO 150
3100 LET H(0)=63:H(1)=126:H(2)=190:H(3)=250:H(4)=315
3110 LET H(5)=380:H(6)=440:H(7)=505:H(8)=565:H(9)=630
3120 LET K(0)=9.03:K(1)=7.48:K(2)=6.07:K(3)=5.35:K(4)=4.92
3130 LET K(5)=4.605:K(6)=4.355:K(7)=4.14:K(8)=3.97:K(9)=3.8
3140 LET L(0)=1:L(1)=8:L(2)=19.2:L(3)=34:L(4)=48.8
3150 LET L(5)=66.5:L(6)=84.8:L(7)=103.8:L(8)=124.6:L(9)=145:L(10)=169
3160 LET B=630: LET C=.127
3170 RETURN
4000 REM OVERFLOW
4010 CLS
4020 FOR I=5 TO 16 : BEEP 1:BEEP
4025 LOCATE I,1:PRINT CHR$(240)
4030 LOCATE 5,2:PRINT”! OVERFLOW !”
4035 NEXT I
4040 RETURN
Wow! Many yrs later still like type BASIC lines, and you can appreciate how much it's easy to read and adapt to your computer.
for private question: officinebiaggini@libero.it