SUBROUTINE ERLTRA C C This module of the ERLANG program calculates the amount of C traffic which may be carried by a given number of trunks for C a given percentage of blocking. This must be done iteratively. C C B. Z. Lederman I.T.T. World Communications C BYTE ANS LOGICAL GREAT C 400 WRITE (5, 405) 405 FORMAT ( / '$ Enter % BLocking, Number of trunks: ') READ (5, 210, END=260) BLOCK, N 210 FORMAT (F10.2, I4) C C Check for improper data. C IF (BLOCK .GT. 100.) GO TO 810 IF (BLOCK .LE. 0.0) GO TO 810 IF (N .LE. 0 ) GO TO 810 C C Convert Blocking from percentage, set traffic to first guess. C BLOCK = 0.01 * BLOCK A = FLOAT(N) GREAT = .TRUE. AINC = 0.2 C C Start Iteration C 410 BPER = ERLB(N,A) DIFF = BLOCK - BPER C C If the calculated amount is within the acceptable C Error from the desired amount, print the answers. C If not, adjust the guess and try again. C The iteration can converge from either side by halving C the amount of the iteration each time it crosses over C the desired answer. C IF (ABS(DIFF) .LE. 0.00005) GO TO 430 IF (DIFF .GT. 0) GO TO 420 IF (GREAT) AINC = 0.5 * AINC A = A - AINC GREAT = .FALSE. GO TO 410 420 IF (.NOT.GREAT) AINC = 0.5 * AINC A = AINC + A GREAT = .TRUE. GO TO 410 C 430 BPER = 100. * BPER WRITE (5, 230) A, N, BPER 230 FORMAT ('0 Erlangs = ', F7.2, ', Trunks = ', I4, 1', Blocking = ', F6.2, '%' / 1X / 2'$ Another Traffic problem [Y/N] ?: ') READ (5, 250, END=260) ANS 250 FORMAT (A1) IF ((ANS .EQ. 'Y') .OR. (ANS .EQ. 'y')) GO TO 400 C 260 RETURN C C Tell the user the data is bad. C 810 WRITE (5, 820) 820 FORMAT (' Data incorrect, please re-enter.') GO TO 400 C END