Trailing-Edge
-
PDP-10 Archives
-
decus_20tap1_198111
-
decus/20-0020/e179s1.eng
There are 2 other files named e179s1.eng in the archive. Click here to see a list.
100' NAME--E179S1
110'
120' DESCRIPTION--AN EXAMPLE USED IN FRANKEL'S ENGG 179 TO DEMONSTRATE
130' A SIMULATION OF A RELATIVELY SIMPLE SYSTEM WITH SIX
140' LEVELS AND SIX RATES AND ONLY ONE FEEDBACK LOOP.
150'
160' SOURCE--UNKNOWN
170'
180' INSTRUCTIONS--PENCILS ARE ORDERED ACCORDING TO USE. AFTER A
190' A DELAY, THEY ARE WITHDRAWN FROM STORE AND PUT INTO A BOX.
200' AS ACTIVITY DEMANDS, THEY ARE PUT INTO USE, AND AFTER ANOTHER
210' DELAY ARE WORN OR BROKEN AND THROWN INTO THE WASTEBASKET.
220' THE VARIABLES ARE DEFINED AS FOLLOWS:
230' S=NUMBER OF PENCILS IN STORE
240' B=NUMBER IN BOX
250' U=NUMBER IN USE
260' W=NUMBER IN WASTEBASKET
270' P=NUMBER OF UNFILLED ORDERS
280' C=INDEX OF ACTIVITY
290' F1=RATE OF WITHDRAWL FROM STORE
300' F2=RATE OF ADDING TO BOX
310' F3=RATE OF WITHFRAWL FROM STORE
320' F4=RATE OF PUTTING INTO USE
330' F5=RATE OF LOSS DUE TO WEAR AND BREAKAGE
340' F6=RATE OF DISPOSAL INTO WASTEBASKET
350' SET INITIAL VALUES (S,B,U,W,C,F1,F2,F3,F4,F5,F6,P) AS DATA IN 420.
360' ALL RATES (F) PER WEEK
370'
380'
390' * * * * * * * MAIN PROGRAM * * * * * * * * * * *
400'
410 READ S,B,U,W,C,F1,F2,F3,F4,F5,F6,P
420 DATA 1E6,1E3,0,0,0,0,0,0,0,0,0,1E3
430 PRINT "WHAT VALUES FOR TIME INTERVAL, TOTAL TIME, PRINT INTERVAL,"
440 PRINT "AND PLOT INTERVAL (ALL IN UNITS OF TIME, NOT NO. OF STEPS)";
450 INPUT T1, T9, O9, P9
460 LET N9=INT(T9/P9)+1
470 DIM A(100)
480 PRINT" "
490 PRINT "TIME","IN STORE","IN BOX","IN USE","UNF ORDERS"
500 PRINT "----","---------","----------","----------","----------"
510 PRINT " "
520 REM START MODEL
530 FOR T=0 TO T9 STEP T1
540 LET U=U+(F4-F5)*T1
550 LET B=B+(F2-F3)*T1
560 LET W=W+F6*T1
570 LET P=P+(F5-F1)*T1
580 LET S=S-F1*T1
590 LET F2=F1
600 REM BUSINESS ACTIVITY IS A RANDOM NUMBER BETW. 0 AND 1
610 LET C=RND
620 LET F4=500+C*500
630 REM POLICY: NEVER DISPENSE MORE THAN 1/2 STORES
640 IF F4>B/2 THEN 660
650 GO TO 670
660 LET F4=B/2
670 LET F3=F4
680 REM SETTING VALUES FOR DELAY BETW USE AND LOSS:
690 LET D=3
700 LET K=3
710 LET I=1 + INT(2*K*T1/D)
720 LET R1=F4
730 IF T>0 THEN 800
740 REM ASSIGN INITIAL VALUES TO INTERMEDIATE RATES:
750 FOR J=1 TO K
760 LET O(J)=F5/I
770 NEXT J
780 GO TO 830
790 REM RESTORE PREVIOUS VALUES TO INTRMDTE RATES:
800 FOR J=1 TO K
810 LET O(J)=Q(J)
820 NEXT J
830 GO SUB 1210
840 REM STORE VALUES OF INTRMDTE RATES FOR NEXT T-PASS:
850 LET F5=R2
860 FOR J=1 TO K
870 LET Q(J)=O(J)
880 NEXT J
890 LET F6=F5
900 REM SET VALUES FOR THE DELAY IN ORDERING
910 LET K=3
920 LET D=1
930 LET I=1+INT(2*K*T1/D)
940 LET R1=F5
950 IF T>0 THEN 1020
960 REM ASSIGN INITIAL VALUES TO INTERMEDIATE RATES
970FOR J=1 TO K
980 LET O(J)=F1/I
990 NEXT J
1000 GO TO 1050
1010 REM RESTORE PREVIOUS VALUES TO INTRMDTE RATES:
1020 FOR J=1 TO K
1030 LET O(J)=P(J)
1040 NEXT J
1050 GO SUB 1210
1060 REM STORE VALUES OF INTRMDTE RATES FOR NEXT T-PASS:
1070 FOR J=1 TO K
1080 LET P(J)=O(J)
1090 NEXT J
1100 LET F1=R2
1110 IF T/O9-INT(T/O9)<>0 THEN 1140
1120 PRINT T,
1130 PRINT S,B,U,P
1140 IF T/P9-INT(T/P9)<>0 THEN 1170
1150 LET A(T/P9)=B
1160 REM (THUS PREPARING TO PLOT B (NO. OF PENCILS IN BOX) )
1170 NEXT T
1180 IF P9>T9 THEN 1960
1190 GO SUB 1340
1200 REM ***SUBROUTINE DELDT***
1210 LET D1=D*I/K/T1
1220 LET R2=0
1230 FOR J=1 TO I
1240 LET R3=R1/I
1250 FOR M=1 TO K
1260 LET A=O(M)
1270 LET O(M)=A+(R3-A)/D1
1280 LET R3=A
1290 NEXT M
1300 LET R2=R2+O(K)
1310 NEXT J
1320 RETURN
1330 REM ***SUBROUTINE SCAPLT***
1340 FOR I9=1 TO 6
1350 PRINT
1360 NEXT I9
1370 LET B9=A(0)
1380 LET A9=A(0)
1390 FOR C9=1 TO N9
1400 IF A(C9)>B9 THEN 1710
1410 IF A(C9)<A9 THEN 1730
1420 NEXT C9
1430 LET D9=B9-A9
1440 LET E9=10^INT(.434294482*LOG(520/D9))
1450 IF D9*E9>65 THEN 1750
1460 LET F9=INT(A9*E9)
1470 LET G9=25+25*INT(F9/25)
1480 LET H9=G9+25
1490 LET I9=H9+25
1500 LET J9=G9-F9
1510 FOR C9=0 TO N9
1520 LET K9=INT(A(C9)*E9)-F9
1530 IF K9<0 THEN 1610
1540 IF K9>65 THEN 1620
1550 FOR L9=1 TO INT(K9/3)
1560 PRINT " ";
1570 NEXT L9
1580 IF K9=3*INT(K9/3) THEN 1770
1590 IF K9=3*INT(K9/3)+1 THEN 1790
1600 PRINT " +";
1610 IF K9>62 THEN 1630
1620 PRINT
1630 NEXT C9
1640 LET M9=0
1650 IF M9>21 THEN 1810
1660 IF M9<INT(J9/3) THEN 1850
1670 IF J9=3*INT(J9/3) THEN 1880
1680 IF J9=3*INT(J9/3)+1 THEN 1910
1690 PRINT "..^";
1700 GOTO 1890
1710 LET B9=A(C9)
1720 GOTO 1420
1730 LET A9=A(C9)
1740 GOTO 1420
1750 LET E9=E9/2
1760 GOTO 1450
1770 PRINT "+ ";
1780 GOTO 1610
1790 PRINT " + ";
1800 GOTO 1610
1810 REM
1820 IF G9-F9<15 THEN 1930
1830 PRINT " ",G9/E9," ",H9/E9
1840 RETURN
1850 PRINT "...";
1860 LET M9=M9+1
1870 GOTO 1650
1880 PRINT "^..";
1890 LET J9=25+J9
1900 GOTO 1860
1910 PRINT ".^.";
1920 GOTO 1890
1930 PRINT G9/E9," ",H9/E9," ",I9/E9
1940 RETURN
1950
1960 END