Compucolor.org – Virtual Media

Listing of file='QUE.BAS;01' on disk='vmedia/pert_planner-sector.ccvf'

1 PLOT 12,3,22,1,14,6,38
2 PRINT " QUEUING THEORY ":REM  PROGRAM FROM 'PRACTICAL BASIC PROGRAMS', MODIFIED FOR COMPUCOLOR BY EIKE MUELLER
3 PLOT 6,2,15
4 PLOT 27,18,4:AA= 3
5 PRINT "TO GENERATE A PRINTOUT (PAPERTIGER) OF A SPECIFIC PAGE OF"
6 PRINT "THE DISPLAY HIT:
7 PRINT :PRINT "                <HOME>"
8 PRINT :PRINT "                POSITION CURSOR TO LINE FROM WHERE THE"
9 PRINT "                  PRINTOUT SHALL START VIA THE UP/DOWN ARROW"
10 PRINT :PRINT "          & HIT:<CONTROL> <X>"
15 GOSUB 6100:GOSUB 6000
20 REM     CHANGE DIMENSION OF Q( ) TO MAX. NUMBER OF UNITS + 1
30 DIM  Q(300)
40 PRINT
50 INPUT  "ENTER NUMBER OF MACHINES; COUNT MUST EXCEED ONE. ";N
70 INPUT  "ENTER THE UNIT MEAN TIME BETWEEN FAILURES ";F1
90 F= 1/ F1
100 INPUT "NUMBER OF MAINTENANCE PERSONNEL AVAILABLE ";M
120 INPUT "MEAN REPAIR TIME PER UNIT PER MAN ";R1
130 R= 1/ R1
150 PRINT
160 REM  INITIALIZE VARIABLES
170 FOR I= 1TO N+ 1:Q(I)= 0:NEXT I
200 Q(1)= 1:E1= 0:E2= 0:E3= 0:P0= 0
250 REM  LOOP TO CALCULATE PROBABILITIES FOR EACH MACHINE
260 S= Q(1)
270 FOR J= 0TO N- 1:REM  K=MIN(J+1,M)
280 K= M
300 IF J+ 1> MTHEN 320
310 K= J+ 1
320 Q(J+ 2)= (N- J)* F* Q(J+ 1)/ K/ R
330 S= S+ Q(J+ 2):NEXT J
350 IF Q(1)< > 1THEN 380
360 Q(1)= 1/ S
370 GOTO 260
380 PRINT
390 PRINT "THE SYSTEM IS 'IN STATE J' IF J UNITS ARE BROKEN DOWN"
400 PRINT "THE STATIONARY PROBABILITY DISTRIBUTION OVER THE POSSIBLE"
410 PRINT "STATES, 0 THROUGH";N;" AND OTHER CHARACTERISTICS FOLLOW"
430 CT= 0:PRINT
440 PRINT "STATE   PROBABILITY   # MACHINES   # MACHINES   # MAINT."
450 PRINT "                        OPERATING    WAITING      PERSONNEL"
455 PRINT "____________________________________________________________":PRINT
460 FOR J= 1TO N+ 1
470 O= N- J+ 1
480 W= J- M- 1
490 IF W> 0THEN 520
500 W= 0
510 P0= P0+ Q(J)
520 I= M- J+ 1
530 IF I> 0THEN 550
540 I= 0
550 IF I< MTHEN 570
560 I= M
570 PRINT "";J- 1;TAB( 8)"";Q(J)TAB( 23)"";OTAB( 36)"";WTAB( 49)"";I
575 CT= CT+ 1:IF CT> 9THEN CT= 0:GOSUB 6100:AA= 18:GOSUB 6000
580 E1= E1+ W* Q(J)
590 E2= E2+ I* Q(J)
600 E3= E3+ O* Q(J)
610 NEXT J
620 GOSUB 6100
630 REM
640 REM

650 AA= 3:GOSUB 6000
660 PRINT TAB( 15)"SYSTEM CHARACTERISTICS"
680 PRINT :PRINT "# OF MACHINES= ";N
690 PRINT "MEAN TIME BETWEEN FAILURES PER MACHINE= ";F1;" TIME UNITS"
700 PRINT "# OF REPAIRMEN= ";M
710 PRINT "MEAN REPAIR-TIME PER REPAIRMAN= ";R1;" TIME UNITS"
720 PRINT "NUMBER OF MACHINES PER REPAIRMAN= ";N/ M
730 PRINT
740 PRINT "PROB. (SERVICE SYSTEM IS EMPTY)= ";Q(1)
750 PRINT "PROB. (NO MACHINES ARE WAITING FOR SERVICE)= ";P0
760 PRINT
770 PRINT "EXP. # OF MACHINES OPERATING= ";E3
780 PRINT "EXP. # OF INACTIVE MACHINES= ";N- E3
790 PRINT "EXP. # OF MACHINES IN WAITING LINE= ";E1
800 PRINT "EXP. # OF MACHINES IN A NON-EMPTY 'WAITING LINE'= ";E1/ (1- P0)
810 PRINT "MEAN DOWN-TIME PER MACHINE= ";(N- E3)* F1/ E3;" TIME UNITS"
820 PRINT "MEAN WAITING TIME PER MACHINE= ";E1* F1/ E3;" TIME UNITS"
830 PRINT "EXP. # OF REPAIRMEN IDLE= ";E2
840 PRINT
870 PRINT "COEFFICIENT OF LOSS FOR MACHINES = FRACTION OF TIME A MACHINE"
880 PRINT "  IS DOWN AS A CONSEQUENCE OF THE SYSTEM CHARACTERISTICS"
890 PRINT "  = ";E1/ N
900 PRINT
910 PRINT "COEFFICIENT OF LOSS FOR REPAIRMEN = FRACTION OF TIME A REPAIR-"
920 PRINT "  MAN IS IDLE AS A CONSEQUENCE OF THE SYSTEM CHARACTERISTICS"
930 PRINT "  = ";E2/ M
940 PRINT
950 GOSUB 6100
960 PLOT 28:PRINT TAB( 8):INPUT "DO YOU WANT TO GET A CASH FLOW ANALYSIS? ";Q1$
970 IF LEFT$ (Q1$,1)< > "Y"THEN 1300:REM  END
980 GOSUB 6000
990 PRINT "THIS ANALYSIS ASSUMES THAT REPAIRMEN ARE PAID 'A' MONETARY"
1000 PRINT "UNITS PER TIME UNIT, THAT THE FIXED COST OF POSSESSING"
1010 PRINT "EACH MACHINE IS 'B' MONETARY UNITS PER UNIT TIME, AND THAT"
1020 PRINT "A MACHINE, WHEN OPERATING, IS CAPABLE OF PRODUCING 'C' UNITS"
1030 PRINT "OF REVENUE PER TIME UNIT."
1040 PRINT
1050 INPUT "ENTER THE REPAIRMAN-COST PER TIME UNIT, 'A': ";A
1060 PRINT :PRINT "ENTER THE FIXED COST PER TIME UNIT, 'B' OF POSSESSING"
1070 INPUT "A MACHINE: ";B
1080 PRINT :PRINT "ENTER THE AMOUNT OF REVENUE A WORKING MACHINE PRODUCES"
1090 INPUT "PER OPERATING TIME UNIT: ";C
1100 REM 

1150 PRINT
1160 D= C* E3- A* M- B* N
1170 PRINT "THE AVERAGE CASH FLOW GENERATED BY THE COMBINATION OF ";N
1180 PRINT "MACHINE(S) MAINTAINED BY ";M;" REPAIR";
1190 IF M> 1THEN PRINT "MEN";
1200 IF M= 1THEN PRINT "MAN";
1210 PRINT " IS ";D;" MONETARY"
1220 PRINT "UNITS PER TIME UNIT."
1230 GOSUB 6100
1240 PRINT TAB( 15):INPUT "TRY ANOTHER EXAMPLE? ";AE$
1250 IF LEFT$ (AE$,1)= "Y"THEN RUN
1300 REM  END
1310 PLOT 12,3,15,15:PRINT "A U F   W I E D E R S E H E N"
1320 PLOT 3,0,0:INPUT "";EN
1330 RUN
6000 REM  
6010 FOR XX= 30TO AASTEP - 1:PLOT 3,0,XX,11:NEXT XX
6020 RETURN
6100 REM
6110 PLOT 3,15,30:INPUT "PRESS ENTER TO CONTINUE ";EN
6120 RETURN