Home » Archimedes archive » Archimedes World » AW-1991-03.adf » !AWMar91/Goodies/5Alive/WATER_TANK
!AWMar91/Goodies/5Alive/WATER_TANK
This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.
Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.
Tape/disk: | Home » Archimedes archive » Archimedes World » AW-1991-03.adf |
Filename: | !AWMar91/Goodies/5Alive/WATER_TANK |
Read OK: | ✔ |
File size: | 081D bytes |
Load address: | FFFFFB42 |
Exec address: | 843C1CC4 |
File contents
10REM > WATER_TANK 20REM Production system demonstration 30REM Jonathan Evans, July 1990 40 50PROCinit 60REPEAT 70PROCproduce 80UNTIL finished 90PROCdraw_graph(graph(),limit,0,200,0,60,"temp_graph") 100END 110 120DEFPROCinit 130room_temp=15:water_temp=room_temp 140temp_inc=0.5: cool_rate=0.005 150thermostat_temp=50:variation=2 160burner=0 170count=0:limit=400 180DIM graph(2,limit) 190finished=FALSE 200ENDPROC 210 220DEFPROCproduce 230REM Finishing rule 240IF count=limit THEN finished=TRUE:ENDPROC 250REM Instant events 260IF water_temp < (thermostat_temp-3*variation) AND burner <> 2 THEN burner=2:ENDPROC 270IF water_temp >= (thermostat_temp-3*variation) AND burner=2 THEN burner=1:ENDPROC 280IF water_temp >= (thermostat_temp+variation) AND burner=1 THEN burner=0:ENDPROC 290IF water_temp < (thermostat_temp-variation) AND burner=0 THEN burner=2:ENDPROC 300IF burner=0 AND RND(40)=1 THEN PROCdraw_water:ENDPROC 310REM Time consuming events 320IF burner=1 THEN water_temp += temp_inc:PROCcount:ENDPROC 330IF burner=2 THEN water_temp += 3*temp_inc:PROCcount:ENDPROC 340IF burner=0 THEN water_temp-=(water_temp-room_temp)*cool_rate:PROCcount:ENDPROC 350ENDPROC 360 370DEFPROCcount 380count+=1 390PRINT "Time = ";count;" Water temperature = ";water_temp;", burner = ";burner 400graph(1,count)=count:graph(2,count)=water_temp 410REM REPEAT UNTIL GET 420ENDPROC 430 440DEFPROCdraw_water 450LOCAL temp_diff,temp_drop 460PRINT "Hot water drawn" 470temp_diff=water_temp-room_temp 480temp_drop = 10+RND((temp_diff-10)*0.6) 490water_temp-=temp_drop 500ENDPROC 510 520REM Library Graph Drawing Procedure 530 540DEFPROCdraw_graph(graph(),size,minx,maxx,miny,maxy,file$) 550LOCAL point,s_minx,s_miny,s_maxx,s_maxy,sfx,sfy 560s_minx=100:s_maxx=1200:s_miny=100:s_maxy=1000 570REM Set scale factors 580sfx=(s_maxx-s_minx)/(maxx-minx):sfy=(s_maxy-s_miny)/(maxy-miny) 590REM Draw Axes 600MODE 18: REM MultiScan MODE 0. Creates extra resolution in sprite file 610COLOUR 1,0,0,0:COLOUR 0,255,255,255 620REM Draw Axes 630MOVE s_minx,s_miny:DRAW s_maxx,s_miny:MOVE s_minx,s_miny:DRAW s_minx,s_maxy 640REM Draw Line Graph 650MOVE s_minx+sfx*(graph(1,1)-minx),s_miny+sfy*(graph(2,1)-miny) 660FOR point = 2 TO size 670DRAW s_minx+sfx*(graph(1,point)-minx),s_miny+sfy*(graph(2,point)-miny) 680NEXT point 690IF file$ >"" THEN 700OSCLI "SCREENSAVE "+file$ 710ENDPROC 720 730
� > WATER_TANK %� Production system demonstration � Jonathan Evans, July 1990 ( 2 �init <� F�produce P� finished Z6�draw_graph(graph(),limit,0,200,0,60,"temp_graph") d� n x ��init �%room_temp=15:water_temp=room_temp �!temp_inc=0.5: cool_rate=0.005 �"thermostat_temp=50:variation=2 �burner=0 �count=0:limit=400 �� graph(2,limit) �finished=� �� � � ��produce �� Finishing rule � � count=limit � finished=�:� �� Instant events K� water_temp < (thermostat_temp-3*variation) � burner <> 2 � burner=2:� I� water_temp >= (thermostat_temp-3*variation) � burner=2 � burner=1:� G� water_temp >= (thermostat_temp+variation) � burner=1 � burner=0:� "F� water_temp < (thermostat_temp-variation) � burner=0 � burner=2:� ,(� burner=0 � �(40)=1 � �draw_water:� 6� Time consuming events @0� burner=1 � water_temp += temp_inc:�count:� J2� burner=2 � water_temp += 3*temp_inc:�count:� TF� burner=0 � water_temp-=(water_temp-room_temp)*cool_rate:�count:� ^� h r��count |count+=1 �M� "Time = ";count;" Water temperature = ";water_temp;", burner = ";burner �2graph(1,count)=count:graph(2,count)=water_temp �� REPEAT UNTIL GET �� � ���draw_water �� temp_diff,temp_drop �� "Hot water drawn" �"temp_diff=water_temp-room_temp �(temp_drop = 10+�((temp_diff-10)*0.6) �water_temp-=temp_drop �� � %� Library Graph Drawing Procedure 8��draw_graph(graph(),size,minx,maxx,miny,maxy,file$) &/� point,s_minx,s_miny,s_maxx,s_maxy,sfx,sfy 01s_minx=100:s_maxx=1200:s_miny=100:s_maxy=1000 :� Set scale factors DCsfx=(s_maxx-s_minx)/(maxx-minx):sfy=(s_maxy-s_miny)/(maxy-miny) N� Draw Axes XE� 18: � MultiScan MODE 0. Creates extra resolution in sprite file b� 1,0,0,0:� 0,255,255,255 l� Draw Axes vC� s_minx,s_miny:� s_maxx,s_miny:� s_minx,s_miny:� s_minx,s_maxy �� Draw Line Graph �?� s_minx+sfx*(graph(1,1)-minx),s_miny+sfy*(graph(2,1)-miny) �� point = 2 � size �G� s_minx+sfx*(graph(1,point)-minx),s_miny+sfy*(graph(2,point)-miny) �� point �� file$ >"" � �� "SCREENSAVE "+file$ �� � � �
00000000 0d 00 0a 12 f4 20 3e 20 57 41 54 45 52 5f 54 41 |..... > WATER_TA| 00000010 4e 4b 0d 00 14 25 f4 20 50 72 6f 64 75 63 74 69 |NK...%. Producti| 00000020 6f 6e 20 73 79 73 74 65 6d 20 64 65 6d 6f 6e 73 |on system demons| 00000030 74 72 61 74 69 6f 6e 0d 00 1e 1f f4 20 4a 6f 6e |tration..... Jon| 00000040 61 74 68 61 6e 20 45 76 61 6e 73 2c 20 4a 75 6c |athan Evans, Jul| 00000050 79 20 31 39 39 30 0d 00 28 04 0d 00 32 09 f2 69 |y 1990..(...2..i| 00000060 6e 69 74 0d 00 3c 05 f5 0d 00 46 0c f2 70 72 6f |nit..<....F..pro| 00000070 64 75 63 65 0d 00 50 0e fd 20 66 69 6e 69 73 68 |duce..P.. finish| 00000080 65 64 0d 00 5a 36 f2 64 72 61 77 5f 67 72 61 70 |ed..Z6.draw_grap| 00000090 68 28 67 72 61 70 68 28 29 2c 6c 69 6d 69 74 2c |h(graph(),limit,| 000000a0 30 2c 32 30 30 2c 30 2c 36 30 2c 22 74 65 6d 70 |0,200,0,60,"temp| 000000b0 5f 67 72 61 70 68 22 29 0d 00 64 05 e0 0d 00 6e |_graph")..d....n| 000000c0 04 0d 00 78 0a dd f2 69 6e 69 74 0d 00 82 25 72 |...x...init...%r| 000000d0 6f 6f 6d 5f 74 65 6d 70 3d 31 35 3a 77 61 74 65 |oom_temp=15:wate| 000000e0 72 5f 74 65 6d 70 3d 72 6f 6f 6d 5f 74 65 6d 70 |r_temp=room_temp| 000000f0 0d 00 8c 21 74 65 6d 70 5f 69 6e 63 3d 30 2e 35 |...!temp_inc=0.5| 00000100 3a 20 63 6f 6f 6c 5f 72 61 74 65 3d 30 2e 30 30 |: cool_rate=0.00| 00000110 35 0d 00 96 22 74 68 65 72 6d 6f 73 74 61 74 5f |5..."thermostat_| 00000120 74 65 6d 70 3d 35 30 3a 76 61 72 69 61 74 69 6f |temp=50:variatio| 00000130 6e 3d 32 0d 00 a0 0c 62 75 72 6e 65 72 3d 30 0d |n=2....burner=0.| 00000140 00 aa 15 63 6f 75 6e 74 3d 30 3a 6c 69 6d 69 74 |...count=0:limit| 00000150 3d 34 30 30 0d 00 b4 14 de 20 67 72 61 70 68 28 |=400..... graph(| 00000160 32 2c 6c 69 6d 69 74 29 0d 00 be 0e 66 69 6e 69 |2,limit)....fini| 00000170 73 68 65 64 3d a3 0d 00 c8 05 e1 0d 00 d2 04 0d |shed=...........| 00000180 00 dc 0d dd f2 70 72 6f 64 75 63 65 0d 00 e6 14 |.....produce....| 00000190 f4 20 46 69 6e 69 73 68 69 6e 67 20 72 75 6c 65 |. Finishing rule| 000001a0 0d 00 f0 20 e7 20 63 6f 75 6e 74 3d 6c 69 6d 69 |... . count=limi| 000001b0 74 20 8c 20 66 69 6e 69 73 68 65 64 3d b9 3a e1 |t . finished=.:.| 000001c0 0d 00 fa 14 f4 20 49 6e 73 74 61 6e 74 20 65 76 |..... Instant ev| 000001d0 65 6e 74 73 0d 01 04 4b e7 20 77 61 74 65 72 5f |ents...K. water_| 000001e0 74 65 6d 70 20 3c 20 28 74 68 65 72 6d 6f 73 74 |temp < (thermost| 000001f0 61 74 5f 74 65 6d 70 2d 33 2a 76 61 72 69 61 74 |at_temp-3*variat| 00000200 69 6f 6e 29 20 80 20 62 75 72 6e 65 72 20 3c 3e |ion) . burner <>| 00000210 20 32 20 8c 20 62 75 72 6e 65 72 3d 32 3a e1 0d | 2 . burner=2:..| 00000220 01 0e 49 e7 20 77 61 74 65 72 5f 74 65 6d 70 20 |..I. water_temp | 00000230 3e 3d 20 28 74 68 65 72 6d 6f 73 74 61 74 5f 74 |>= (thermostat_t| 00000240 65 6d 70 2d 33 2a 76 61 72 69 61 74 69 6f 6e 29 |emp-3*variation)| 00000250 20 80 20 62 75 72 6e 65 72 3d 32 20 8c 20 62 75 | . burner=2 . bu| 00000260 72 6e 65 72 3d 31 3a e1 0d 01 18 47 e7 20 77 61 |rner=1:....G. wa| 00000270 74 65 72 5f 74 65 6d 70 20 3e 3d 20 28 74 68 65 |ter_temp >= (the| 00000280 72 6d 6f 73 74 61 74 5f 74 65 6d 70 2b 76 61 72 |rmostat_temp+var| 00000290 69 61 74 69 6f 6e 29 20 80 20 62 75 72 6e 65 72 |iation) . burner| 000002a0 3d 31 20 8c 20 62 75 72 6e 65 72 3d 30 3a e1 0d |=1 . burner=0:..| 000002b0 01 22 46 e7 20 77 61 74 65 72 5f 74 65 6d 70 20 |."F. water_temp | 000002c0 3c 20 28 74 68 65 72 6d 6f 73 74 61 74 5f 74 65 |< (thermostat_te| 000002d0 6d 70 2d 76 61 72 69 61 74 69 6f 6e 29 20 80 20 |mp-variation) . | 000002e0 62 75 72 6e 65 72 3d 30 20 8c 20 62 75 72 6e 65 |burner=0 . burne| 000002f0 72 3d 32 3a e1 0d 01 2c 28 e7 20 62 75 72 6e 65 |r=2:...,(. burne| 00000300 72 3d 30 20 80 20 b3 28 34 30 29 3d 31 20 8c 20 |r=0 . .(40)=1 . | 00000310 f2 64 72 61 77 5f 77 61 74 65 72 3a e1 0d 01 36 |.draw_water:...6| 00000320 1b f4 20 54 69 6d 65 20 63 6f 6e 73 75 6d 69 6e |.. Time consumin| 00000330 67 20 65 76 65 6e 74 73 0d 01 40 30 e7 20 62 75 |g events..@0. bu| 00000340 72 6e 65 72 3d 31 20 8c 20 77 61 74 65 72 5f 74 |rner=1 . water_t| 00000350 65 6d 70 20 2b 3d 20 74 65 6d 70 5f 69 6e 63 3a |emp += temp_inc:| 00000360 f2 63 6f 75 6e 74 3a e1 0d 01 4a 32 e7 20 62 75 |.count:...J2. bu| 00000370 72 6e 65 72 3d 32 20 8c 20 77 61 74 65 72 5f 74 |rner=2 . water_t| 00000380 65 6d 70 20 2b 3d 20 33 2a 74 65 6d 70 5f 69 6e |emp += 3*temp_in| 00000390 63 3a f2 63 6f 75 6e 74 3a e1 0d 01 54 46 e7 20 |c:.count:...TF. | 000003a0 62 75 72 6e 65 72 3d 30 20 8c 20 77 61 74 65 72 |burner=0 . water| 000003b0 5f 74 65 6d 70 2d 3d 28 77 61 74 65 72 5f 74 65 |_temp-=(water_te| 000003c0 6d 70 2d 72 6f 6f 6d 5f 74 65 6d 70 29 2a 63 6f |mp-room_temp)*co| 000003d0 6f 6c 5f 72 61 74 65 3a f2 63 6f 75 6e 74 3a e1 |ol_rate:.count:.| 000003e0 0d 01 5e 05 e1 0d 01 68 04 0d 01 72 0b dd f2 63 |..^....h...r...c| 000003f0 6f 75 6e 74 0d 01 7c 0c 63 6f 75 6e 74 2b 3d 31 |ount..|.count+=1| 00000400 0d 01 86 4d f1 20 22 54 69 6d 65 20 3d 20 22 3b |...M. "Time = ";| 00000410 63 6f 75 6e 74 3b 22 20 57 61 74 65 72 20 74 65 |count;" Water te| 00000420 6d 70 65 72 61 74 75 72 65 20 3d 20 22 3b 77 61 |mperature = ";wa| 00000430 74 65 72 5f 74 65 6d 70 3b 22 2c 20 62 75 72 6e |ter_temp;", burn| 00000440 65 72 20 3d 20 22 3b 62 75 72 6e 65 72 0d 01 90 |er = ";burner...| 00000450 32 67 72 61 70 68 28 31 2c 63 6f 75 6e 74 29 3d |2graph(1,count)=| 00000460 63 6f 75 6e 74 3a 67 72 61 70 68 28 32 2c 63 6f |count:graph(2,co| 00000470 75 6e 74 29 3d 77 61 74 65 72 5f 74 65 6d 70 0d |unt)=water_temp.| 00000480 01 9a 16 f4 20 52 45 50 45 41 54 20 55 4e 54 49 |.... REPEAT UNTI| 00000490 4c 20 47 45 54 0d 01 a4 05 e1 0d 01 ae 04 0d 01 |L GET...........| 000004a0 b8 10 dd f2 64 72 61 77 5f 77 61 74 65 72 0d 01 |....draw_water..| 000004b0 c2 19 ea 20 74 65 6d 70 5f 64 69 66 66 2c 74 65 |... temp_diff,te| 000004c0 6d 70 5f 64 72 6f 70 0d 01 cc 17 f1 20 22 48 6f |mp_drop..... "Ho| 000004d0 74 20 77 61 74 65 72 20 64 72 61 77 6e 22 0d 01 |t water drawn"..| 000004e0 d6 22 74 65 6d 70 5f 64 69 66 66 3d 77 61 74 65 |."temp_diff=wate| 000004f0 72 5f 74 65 6d 70 2d 72 6f 6f 6d 5f 74 65 6d 70 |r_temp-room_temp| 00000500 0d 01 e0 28 74 65 6d 70 5f 64 72 6f 70 20 3d 20 |...(temp_drop = | 00000510 31 30 2b b3 28 28 74 65 6d 70 5f 64 69 66 66 2d |10+.((temp_diff-| 00000520 31 30 29 2a 30 2e 36 29 0d 01 ea 19 77 61 74 65 |10)*0.6)....wate| 00000530 72 5f 74 65 6d 70 2d 3d 74 65 6d 70 5f 64 72 6f |r_temp-=temp_dro| 00000540 70 0d 01 f4 05 e1 0d 01 fe 04 0d 02 08 25 f4 20 |p............%. | 00000550 4c 69 62 72 61 72 79 20 47 72 61 70 68 20 44 72 |Library Graph Dr| 00000560 61 77 69 6e 67 20 50 72 6f 63 65 64 75 72 65 0d |awing Procedure.| 00000570 02 12 04 0d 02 1c 38 dd f2 64 72 61 77 5f 67 72 |......8..draw_gr| 00000580 61 70 68 28 67 72 61 70 68 28 29 2c 73 69 7a 65 |aph(graph(),size| 00000590 2c 6d 69 6e 78 2c 6d 61 78 78 2c 6d 69 6e 79 2c |,minx,maxx,miny,| 000005a0 6d 61 78 79 2c 66 69 6c 65 24 29 0d 02 26 2f ea |maxy,file$)..&/.| 000005b0 20 70 6f 69 6e 74 2c 73 5f 6d 69 6e 78 2c 73 5f | point,s_minx,s_| 000005c0 6d 69 6e 79 2c 73 5f 6d 61 78 78 2c 73 5f 6d 61 |miny,s_maxx,s_ma| 000005d0 78 79 2c 73 66 78 2c 73 66 79 0d 02 30 31 73 5f |xy,sfx,sfy..01s_| 000005e0 6d 69 6e 78 3d 31 30 30 3a 73 5f 6d 61 78 78 3d |minx=100:s_maxx=| 000005f0 31 32 30 30 3a 73 5f 6d 69 6e 79 3d 31 30 30 3a |1200:s_miny=100:| 00000600 73 5f 6d 61 78 79 3d 31 30 30 30 0d 02 3a 17 f4 |s_maxy=1000..:..| 00000610 20 53 65 74 20 73 63 61 6c 65 20 66 61 63 74 6f | Set scale facto| 00000620 72 73 0d 02 44 43 73 66 78 3d 28 73 5f 6d 61 78 |rs..DCsfx=(s_max| 00000630 78 2d 73 5f 6d 69 6e 78 29 2f 28 6d 61 78 78 2d |x-s_minx)/(maxx-| 00000640 6d 69 6e 78 29 3a 73 66 79 3d 28 73 5f 6d 61 78 |minx):sfy=(s_max| 00000650 79 2d 73 5f 6d 69 6e 79 29 2f 28 6d 61 78 79 2d |y-s_miny)/(maxy-| 00000660 6d 69 6e 79 29 0d 02 4e 0f f4 20 44 72 61 77 20 |miny)..N.. Draw | 00000670 41 78 65 73 0d 02 58 45 eb 20 31 38 3a 20 f4 20 |Axes..XE. 18: . | 00000680 4d 75 6c 74 69 53 63 61 6e 20 4d 4f 44 45 20 30 |MultiScan MODE 0| 00000690 2e 20 43 72 65 61 74 65 73 20 65 78 74 72 61 20 |. Creates extra | 000006a0 72 65 73 6f 6c 75 74 69 6f 6e 20 69 6e 20 73 70 |resolution in sp| 000006b0 72 69 74 65 20 66 69 6c 65 0d 02 62 1d fb 20 31 |rite file..b.. 1| 000006c0 2c 30 2c 30 2c 30 3a fb 20 30 2c 32 35 35 2c 32 |,0,0,0:. 0,255,2| 000006d0 35 35 2c 32 35 35 0d 02 6c 0f f4 20 44 72 61 77 |55,255..l.. Draw| 000006e0 20 41 78 65 73 0d 02 76 43 ec 20 73 5f 6d 69 6e | Axes..vC. s_min| 000006f0 78 2c 73 5f 6d 69 6e 79 3a df 20 73 5f 6d 61 78 |x,s_miny:. s_max| 00000700 78 2c 73 5f 6d 69 6e 79 3a ec 20 73 5f 6d 69 6e |x,s_miny:. s_min| 00000710 78 2c 73 5f 6d 69 6e 79 3a df 20 73 5f 6d 69 6e |x,s_miny:. s_min| 00000720 78 2c 73 5f 6d 61 78 79 0d 02 80 15 f4 20 44 72 |x,s_maxy..... Dr| 00000730 61 77 20 4c 69 6e 65 20 47 72 61 70 68 0d 02 8a |aw Line Graph...| 00000740 3f ec 20 73 5f 6d 69 6e 78 2b 73 66 78 2a 28 67 |?. s_minx+sfx*(g| 00000750 72 61 70 68 28 31 2c 31 29 2d 6d 69 6e 78 29 2c |raph(1,1)-minx),| 00000760 73 5f 6d 69 6e 79 2b 73 66 79 2a 28 67 72 61 70 |s_miny+sfy*(grap| 00000770 68 28 32 2c 31 29 2d 6d 69 6e 79 29 0d 02 94 16 |h(2,1)-miny)....| 00000780 e3 20 70 6f 69 6e 74 20 3d 20 32 20 b8 20 73 69 |. point = 2 . si| 00000790 7a 65 0d 02 9e 47 df 20 73 5f 6d 69 6e 78 2b 73 |ze...G. s_minx+s| 000007a0 66 78 2a 28 67 72 61 70 68 28 31 2c 70 6f 69 6e |fx*(graph(1,poin| 000007b0 74 29 2d 6d 69 6e 78 29 2c 73 5f 6d 69 6e 79 2b |t)-minx),s_miny+| 000007c0 73 66 79 2a 28 67 72 61 70 68 28 32 2c 70 6f 69 |sfy*(graph(2,poi| 000007d0 6e 74 29 2d 6d 69 6e 79 29 0d 02 a8 0b ed 20 70 |nt)-miny)..... p| 000007e0 6f 69 6e 74 0d 02 b2 11 e7 20 66 69 6c 65 24 20 |oint..... file$ | 000007f0 3e 22 22 20 8c 0d 02 bc 19 ff 20 22 53 43 52 45 |>"" ...... "SCRE| 00000800 45 4e 53 41 56 45 20 22 2b 66 69 6c 65 24 0d 02 |ENSAVE "+file$..| 00000810 c6 05 e1 0d 02 d0 04 0d 02 da 04 0d ff |.............| 0000081d