Sunday, July 2, 2017

How Calibration Plots were made in #SWMM4 and #SWMM3

How Calibration Plots were made in #SWMM4 and #SWMM3 - I remember these being very useful in SWMM classes with Wayne Huber at UF.

      SUBROUTINE GRAPH
C     GRAPH BLOCK
C=======================================================================
C     THIS ROUTINE PREPARES SIMULATED AND MEASURED HYDROGRAPHS,
C     POLLUTOGRAPHS  AND LOADOGRAPHS FOR PLOTTING BY SUBROUTINE CURVE.
C     SIMULATED AND/OR MEASURED DATA MAY BE PLOTTED.  IT IS NO LONGER
C     POSSIBLE TO PLOT MORE THAN ONE LOCATION ON ONE GRAPH.
C     THIS ROUTINE LAST UPDATED BY W. HUBER, AUGUST 1993.
C     SCRATCH FILE 1 NOT USED.  DON'T OPEN.  WCH, 4/18/94.
C     Change NQP to NQPP to avoid confusion cim 9/9/00
C     Add error message for E3 lines, WCH, 9/14/00.
C     Fix metric conversion error.  Inflows on interface file from
C       all blocks will be in cms if metric is used.  WCH, 9/14/00.
C     Uses nscrat(8) for MFILE input file, added features for FREE 
c     formatted input - RED, 9/15/00
C     Add more error messages, WCH, 9/16/00.
C=======================================================================
      INCLUDE 'TAPES.INC'
      INCLUDE 'INTER.INC'
      INCLUDE 'LAB.INC'
C=======================================================================
C#### WCH (CDM), 8/93. REMOVE NEWFIL*60
      CHARACTER KPRED(20)*10,KMEAS(20)*10,JMEAS(20)*10
      CHARACTER PNDUM*8,PUDUM*8,VER1*10,VER2*10,VER3*10,VER4*10,
     +          PRIN(3)*14,FIRMAT*80,DEFMT*16,HORIZG(2)*30,
     +          VERM(4)*10,USE*4,PPNAME*8,PPUNIT*8,ZX(2)*20,BMJ*4
      DIMENSION X(401,2),Y(401,2),NPT(2),JPLOT(20),
     1          YT(401,6),ITAB(20),IPLOT(20),MTAB(20),KPLOT(20),
     2          TIMX(16),YVAL(16),QQT(200),PPT(10,200),IPOLX(11),
     3          NNDIM(MQUAL),PPNAME(MQUAL),PPUNIT(MQUAL),NLOAD(11)
      LOGICAL NOTEND
C=======================================================================
      DATA PRIN/'HYDROGRAPH   ','POLLUTOGRAPH ','LOADOGRAPH '/
      DATA HORIZG/'      TIME OF DAY IN HOURS    ',
     +            ' PREDICTED = *    MEASURED = +'/
      DATA VER1/'   FLOW   '/,VER2/'    IN    '/,
     +     VER3/'    CFS   '/,VER4/' CU M/SEC '/
      DATA VERM/'  POUNDS  ','   PER   ','  SECOND  ','MILLIGRAMS'/
      DATA DEFMT/'(2X,F8.0,7F10.0)'/,BMJ/'    '/
      DATA ZX/'  PLOT CONCENTRATION','  PLOT LOADOGRAPH'/
C=======================================================================
C#### WCH, 8/5/93.  ADD NO-QUOTE OPTION.
C=======================================================================
      IF(NOQ.EQ.0) THEN
                   WRITE(*,10)
                   WRITE(N6,10)
                   ELSE
                   WRITE(*,12)
                   WRITE(N6,12)
                   ENDIF
C#######################################################################
C WCH, 8/5/93. INCREMENT THE JIN/JOUT COUNTERS.
C=======================================================================
      INCNT  = INCNT + 1
      IOUTCT = IOUTCT + 1
C=======================================================================
C     Open all input/output files for the Graph Block.
C=======================================================================
      IF(JIN(INCNT).GT.0.AND.(FFNAME(INCNT).EQ.'JOT.UF'.OR.
     +      FFNAME(INCNT).EQ.'JIN.UF'))
     +      OPEN(JIN(INCNT),FORM='UNFORMATTED',STATUS='SCRATCH')
      IF(JIN(INCNT).GT.0.AND.FFNAME(INCNT).NE.'JOT.UF'.AND.
     +      FFNAME(INCNT).NE.'JIN.UF')
     +      OPEN(JIN(INCNT),FILE=FFNAME(INCNT),FORM='UNFORMATTED',
     +      STATUS='UNKNOWN')
C=======================================================================
C     DON'T NEED JOUT BUT OPEN OUT OF HABIT IF JOUT > 0.
C=======================================================================
      IF(JOUT(IOUTCT).GT.0.AND.(FFNAME(25+IOUTCT).EQ.'JOT.UF'.OR.
     +      FFNAME(25+IOUTCT).EQ.'JIN.UF'))
     +      OPEN(JOUT(IOUTCT),FORM='UNFORMATTED',STATUS='SCRATCH')
      IF(JOUT(IOUTCT).GT.0.AND.FFNAME(25+IOUTCT).NE.'JOT.UF'.AND.
     +      FFNAME(25+IOUTCT).NE.'JIN.UF')
     +      OPEN(JOUT(IOUTCT),FILE=FFNAME(25+IOUTCT),FORM='UNFORMATTED',
     +      STATUS='UNKNOWN')
C=======================================================================
C=======================================================================
C#### WCH, 4/18/94.  DON'T OPEN THIS IF DON'T USE IT.
C#### (DON'T) OPEN FORMATTED SCRATCH FILE
C##=====================================================================
Cred     need this file for measured data on an external file - 9/14/00
cred     change to nscrat(8) because the first scratch file is used by 
cred     runoff and transport - 9/15/00
         IF(NSCRAT(8).GT.0.AND.FFNAME(58).NE.'SCRT1.UF') OPEN(NSCRAT(8),
     +             FILE=FFNAME(58),FORM='FORMATTED',STATUS='UNKNOWN')
C##      IF(NSCRAT(1).GT.0.AND.FFNAME(51).EQ.'SCRT1.UF') OPEN(NSCRAT(1),
C##     +             FORM='FORMATTED',STATUS='SCRATCH')
C##                    NOUT = NSCRAT(1)
C##      IF(NOUT.GT.0) REWIND NOUT
C=======================================================================
C>>>>>>>>>>>> READ DATA GROUP A1 <<<<<<<<<<<<
C=======================================================================
      READ(N5,*,ERR=888) CC,NTAPE,NPLOT,MEAS,
     +                       MFILE,MPLOT,NQPP,METRIC,MCTH
      NLP    = NQPP+1
      IF(MFILE.LE.0) MFILE = N5
      WRITE(N6,30) NTAPE,METRIC,NQPP,NPLOT,MEAS,MFILE,MPLOT,MCTH
      METRIC = METRIC + 1
      IF(METRIC.EQ.1) THEN
                      CFACT1 = 28.31605/453592.0
                      CFACT2 = 28.31605
                      ELSE
                      CFACT1 = 1000.0 / 1.0E06
                      CFACT2 = 1000.0
                      ENDIF
      IF(NPLOT.EQ.0.AND.MEAS.EQ.0) RETURN
                    NUNIT = N5
cold  IF(MEAS.EQ.2) NUNIT = MFILE
      IF(MEAS.EQ.2) THEN
Cwch, 9/16/00.  Add error check for MFILE = NSCRAT8
 IF(MFILE.NE.NSCRAT(8)) THEN
WRITE(*,3800) MFILE,NSCRAT(8)
WRITE(N6,3810)MFILE,NSCRAT(8)
IF(NSCRAT(8).GT.0) THEN
MFILE = NSCRAT(8)
ELSE
STOP ' MUST HAVE E3 INPUT ON NSCRAT(8). RUN ST
     1OPPED FROM GRAPH.'
                   ENDIF
                ENDIF
                    NUNIT = MFILE
                    REWIND NUNIT
                    ENDIF
      IF(NPLOT.LT.1.OR.NTAPE.LT.1) GO TO 4000
C=======================================================================
C     INTERFACING MECHANISM FOR QUANTITY AND QUALITY OF RUNOFF
C=======================================================================
C#### WCH, 8/5/93.  ADD ERROR MESSAGE.
      IF(NTAPE.NE.JIN(INCNT)) THEN
         WRITE(N6,9500) NTAPE, JIN(INCNT), INCNT
         WRITE(*,9500)  NTAPE, JIN(INCNT), INCNT
         STOP
         ENDIF
      CALL INFACE(1,NTAPE)
      IF(NQUAL.GT.0) THEN
                     DO 110 K  = 1,NQUAL
                     PPNAME(K) = PNAME(K)
                     PPUNIT(K) = PUNIT(K)
                     NNDIM(K)  = NDIM(K)
  110                CONTINUE
                     ENDIF
C=======================================================================
C     INPUT INFORMATION FOR QUALITY PARAMETERS.
C=======================================================================
 4000 IF(NQPP.LE.0) GO TO 4200
      WRITE (N6,4090)
C=======================================================================
C>>>>>>>>>>>> READ DATA GROUP B1 <<<<<<<<<<<<
C=======================================================================
      DO 4140 K = 1,NQPP
      READ(N5,*,ERR=888) CC,KPOL,NLOAD(K+1),PNDUM,PUDUM,NDUM
C=======================================================================
C     HERE, USER INPUT DEFINES POLLUTANTS.
C=======================================================================
      K1        = K + 1
      IF(KPOL.EQ.0.OR.NPLOT.EQ.0) THEN
                                  IPOLX(K1) = K1
                                  NDIM(K1)  = NDUM
                                  PNAME(K1) = PNDUM
                                  PUNIT(K1) = PUDUM
                                  ELSE
                                  IPOLX(K1) = KPOL
                                  NDIM(K1)  = NNDIM(KPOL)
                                  PNAME(K1) = PPNAME(KPOL)
                                  PUNIT(K1) = PPUNIT(KPOL)
                                  ENDIF
      KK1 = NLOAD(K1) + 1
      WRITE(N6,4150) K,PNAME(K1),PUNIT(K1),NDIM(K1),KPOL,ZX(KK1)
 4140 CONTINUE
C=======================================================================
C>>>>>>>>>>>> READ DATA GROUP C1 <<<<<<<<<<<<
C=======================================================================
 4200 IF(NPLOT.GT.0) THEN
                     IF(JCE.EQ.0) THEN
                         READ(N5,*,ERR=888) CC,(IPLOT(N),N=1,NPLOT)
                         WRITE(N6,40) NPLOT,(IPLOT(N),N=1,NPLOT)
                         ELSE
                         READ(N5,*,ERR=888) CC,(KPRED(N),N=1,NPLOT)
                         WRITE(N6,41) NPLOT,(KPRED(N),N=1,NPLOT)
                         ENDIF
                     ENDIF
C=======================================================================
C>>>>>>>>>>>> READ DATA GROUP C2 <<<<<<<<<<<<
C=======================================================================
      IF(MPLOT.GT.0) THEN
                     IF(JCE.EQ.0) THEN
                        READ(N5,*,ERR=888) CC,(KPLOT(N),N=1,MPLOT)
                        WRITE(N6,55) MPLOT,(KPLOT(N),N=1,MPLOT)
                        ELSE
                        READ(N5,*,ERR=888) CC,(KMEAS(N),N=1,MPLOT)
                        WRITE(N6,56) MPLOT,(KMEAS(N),N=1,MPLOT)
                        ENDIF
                     ENDIF
C=======================================================================
C>>>>>>>>>>>> READ DATA GROUP D1 <<<<<<<<<<<<
C=======================================================================
      READ(N5,*,ERR=888) CC,TITLE(1)
      HTITLE(1) = TITLE(1)
      HTITLE(2) = BMJ
      DO 100 J  = 1,20
  100 MTAB(J)   = 0
      HORIZ(1)  = HORIZG(1)
      HORIZ(2)  = HORIZG(2)
      NNN       = 0
C=======================================================================
C     ITAB = SUBSCRIPT OF LOCATION OF MEASURED GRAPH WHEN MEASURED
C            LOCATION MATCHES DESIRED PLOT LOCATION.
C=======================================================================
      IF(MPLOT.GT.0) THEN
                     DO 180 M  = 1,MPLOT
                     NNN       = NNN + 1
                     DO 160 J  = 1,LOCATS
                     IF(JCE.EQ.0.AND.KPLOT(M).EQ.NLOC(J)) GO TO 170
                     IF(JCE.EQ.1.AND.KMEAS(M).EQ.KAN(J))  GO TO 170
  160                CONTINUE
                     ITAB(M) = 0
                     MTAB(M) = M
                     GO TO 180
  170                ITAB(M) = J
                     MTAB(M) = M
  180                CONTINUE
                     ENDIF
C=======================================================================
C     CHECK FOR MATCHING LOCATIONS TO BE PLOTTED FROM SWMM FILE.
C     MTAB EQ 0, NO MATCH BETWEEN IPLOT AND KPLOT.
C     MTAB NE 0, MTAB = SUBSCRIPT OF IPLOT.
C=======================================================================
      IF(NPLOT.GT.0) THEN
                     DO 210 J = 1,NPLOT
                     IF(MPLOT.EQ.0) GO TO 201
                     DO 200 M = 1,MPLOT
                     IF(JCE.EQ.0) JPLOT(M) = KPLOT(M)
                     IF(JCE.EQ.1) JMEAS(M) = KMEAS(M)
                     IF(JCE.EQ.0.AND.IPLOT(J).EQ.KPLOT(M)) GO TO 205
                     IF(JCE.EQ.1.AND.KPRED(J).EQ.KMEAS(M)) GO TO 205
  200                CONTINUE
  201                DO 206 N  = 1,LOCATS
                     IF(JCE.EQ.0.AND.IPLOT(J).EQ.NLOC(N)) GO TO 203
                     IF(JCE.EQ.1.AND.KPRED(J).EQ.KAN(N))  GO TO 203
  206                CONTINUE
                     IF(JCE.EQ.0) WRITE(N6,9020) IPLOT(J)
                     IF(JCE.EQ.1) WRITE(N6,9021) KPRED(J)
                     STOP
  203                NNN        = NNN + 1
                     IF(JCE.EQ.0) JPLOT(NNN) = IPLOT(J)
                     IF(JCE.EQ.1) JMEAS(NNN) = KPRED(J)
                     ITAB(NNN)  = N
                     MTAB(NNN)  = 0
                     GO TO 210
  205                MTAB(M)   = M
  210                CONTINUE
                     END IF
C=======================================================================
C     FROM PREDICTED OUTPUT, STORE EVERY MCTH DATA POINT
C     PROGRAM THEN INTERPOLATES TO PLOT 100 POINTS AT MOST.
C     FIRST PLOTTED POINT IS ALWAYS ZERO AT TZERO.
C=======================================================================
      IF(MCTH.LE.0) MCTH = 1
      WRITE(*,34)   NNN
      DO 800 MT = 1,NNN
      IBACK     = 0
      NOTEND    = .FALSE.
      WRITE(*,35) MT
      IF(NPLOT.EQ.0)                    GO TO 7000
      IF(MT.LE.MPLOT.AND.ITAB(MT).EQ.0) GO TO 7000
C=======================================================================
C     READ INTERFACE FILE HEADERS
C=======================================================================
      CALL INFACE(0,NTAPE)
      TTME     = TZERO
      N        = 0
 5000 DO 250 K = 1,100000,MCTH
      N        = N+1
      DO 230 J = 1,MCTH
C=======================================================================
C     READ TIME STEP VALUES FROM INTERFACE FILE.
C     STORE IN TEMPORARY FILE AND PULL OUT DESIRED VALUES.
C=======================================================================
      IF(NQUAL.EQ.0) THEN
               READ(NTAPE,END=251) JDAY,TMDAY,DELTA,(QQT(I),I=1,LOCATS)
               ELSE
               READ(NTAPE,END=251) JDAY,TMDAY,DELTA,(QQT(I),
     +                             (PPT(L,I),L=1,NQUAL),I=1,LOCATS)
              END IF
      TTME   = TTME + DELTA
  230 CONTINUE
      X(N,1) = TTME/3600.0
      ITB      = ITAB(MT)
      DO 240 J = 1,NLP
      IF(J.EQ.1) THEN
                 YT(N,J) = QQT(ITB)
                 ELSE
                 KP = IPOLX(J)
                 IF(KP.GT.0) THEN
                             YT(N,J) = PPT(KP,ITB)
                             ELSE
                             YT(N,J) = 0.0
                             ENDIF
                 ENDIF
  240 CONTINUE
      IF(N.GE.401) THEN
                   IBACK = IBACK + 1
                   GO TO 252
                   ENDIF
  250 CONTINUE
  251 NOTEND = .FALSE.
      N      = N - 1
      IBACK  = IBACK + 1
      IF(N.LE.0) GO TO 800
      GO TO 253
  252 NOTEND = .TRUE.
  253 NPT(1) = N
C=======================================================================
C     OUTER LOOP ON HYDROGRAPH PLUS NUMBER OF POLLUTANTS.
C     ONLY READ MEASURED DATA FOR FIRST 200 PREDICTED DATA POINTS.
C=======================================================================
 7000 DO 820 J  = 1,NLP
      IF(IBACK.GT.1) GO TO 6000
             IF(J.EQ.1) THEN
                        VERT1 = VER1
                        VERT2 = VER2
                        IF(METRIC.EQ.1) VERT3 = VER3
                        IF(METRIC.EQ.2) VERT3 = VER4
                        ELSE IF(NLOAD(J).EQ.0) THEN
                             JJ        = IPOLX(J)
                             HTITLE(1) = TITLE(1)
                             VERT1     = PNAME(JJ)
                             VERT2     = VER2
                             VERT3     = PUNIT(JJ)
                             ELSE
                             JJ        = IPOLX(J)
                             HTITLE(1) = PNAME(JJ)
                             VERT2     = VERM(2)
                             VERT3     = VERM(3)
                             IF(METRIC.EQ.1) VERT1 = VERM(1)
                             IF(METRIC.EQ.2) VERT1 = VERM(4)
                             ENDIF
             IF(NPLOT.GT.0) THEN
                            IF(NLOAD(J).EQ.1) GO TO 6000
                            IF(MTAB(MT).EQ.0) GO TO 6000
                            IF(MPLOT.EQ.0)    GO TO 6000
                            ENDIF
             KK = 0
C=======================================================================
C     LOOP ON NUMBER OF MEASURED LOCATIONS TO BE PLOTTED.
C=======================================================================
C     READ PARAMETERS FOR MEASURED INPUT FOR EACH LOCATION FOR EACH
C        MEASURED HYDROGRAPH AND POLLUTOGRAPH.
C=======================================================================
C>>>>>>>>>>>> READ DATA GROUP E1 <<<<<<<<<<<<
C=======================================================================
      READ(N5,*,ERR=888) CC,MDATA,LCARD,MTIME,
     +                   MUNIT,TMZERO,TQUIT,DTMHR
      WRITE(N6,310) PRIN(1),KPLOT(MT),
     +              MDATA,LCARD,MTIME,MUNIT,TMZERO,TQUIT,DTMHR
      IF(MDATA.EQ.0) GO TO 6000
C=======================================================================
C     READ IN VARIABLE FORMAT FOR EACH MEASURED DATA INPUT.
C=======================================================================
C>>>>>>>>>>>> READ DATA GROUP E2 <<<<<<<<<<<<
C=======================================================================
      READ(N5,*,ERR=888) CC,FIRMAT
      IF(FIRMAT.EQ.' ')     FIRMAT = DEFMT
      WRITE(N6,360) FIRMAT
C=======================================================================
C>>>>>>>>>>>> READ DATA GROUP E3 <<<<<<<<<<<<
C=======================================================================
C                    MUNIT = 0  TIME IS IN MINUTES.
C                    MUNIT = 1  TIME IS IN HOURS.MINUTES.
C                    MUNIT = 2  TIME IS IN HOURS.
C=======================================================================
      IF(MTIME.EQ.0) THEN
                     KSTOP = 0
                     KK    = 0
Cwch 9/14/00  Add error message.
cred                 rearrange the next few lines - 9/14/00
370                  continue
cold370              READ(NUNIT,FIRMAT) (TIMX(LL),YVAL(LL),LL=1,LCARD)
cred                 allow for a free formatted file - 9/14/00
                     if(FIRMAT.EQ.'FREE') then
                        READ(NUNIT,*,end=510,err=385) 
     +                   (TIMX(LL),YVAL(LL),LL=1,LCARD)
                        else
                        READ(NUNIT,FIRMAT,END=510,ERR=385) 
     1                   (TIMX(LL),YVAL(LL),LL=1,LCARD)
                        endif
cred                 end of 9/14/00 change
                     DO 380 LL = 1,LCARD
                     IF(TIMX(LL).GE.TQUIT) THEN
                                           KKX   = LL-1
                                           KSTOP = 1
                                           GO TO 390
                                           END IF
  380                CONTINUE
                     KKX = LCARD
Cwch, 9/14/00
  GO TO 390
  385   WRITE(N6,3885) (KK+1)/LCARD
                     STOP ' ERROR READING E3 LINES. SEE OUTPUT FILE. RUN
     1 STOPPED FROM GRAPH.'
  390                IF(KKX.LE.0) GO TO 500
                     DO 490 LL = 1,KKX
                     LX        = KK+LL
                     IF(MUNIT-1.LT.0) THEN
                                X(LX,2) = TIMX(LL)/60.+TMZERO
                                ELSE
                                IF(MUNIT-1.EQ.0) THEN
                                   TIM     = IFIX(TIMX(LL))
                                   X(LX,2) = TIM+(TIMX(LL)-TIM)/0.6+
     +                                            TMZERO
                                   ELSE
                                   X(LX,2)  = TIMX(LL)+TMZERO
                                   ENDIF
                                ENDIF
  490                Y(LX,2) = YVAL(LL)
  500                KK      = KK+KKX
                     IF(KK.LT.401.AND.KSTOP.EQ.0) GO TO 370
Cred                 get out of this loop, use the END statement - 9/15/00
  510                IF(KK.GT.401) KK = 401
cold                 IF(KK.GT.201) KK = 201
                     NPT(2) = KK
                     WRITE(N6,505) KK
                     ENDIF
C=======================================================================
C     HERE, COMPUTE TIME USING CONSTANT TIME INCREMENT, DTMHR, IN HOURS.
C=======================================================================
C>>>>>>>>>>>> READ DATA GROUP E3 <<<<<<<<<<<<
C=======================================================================
      IF(MTIME.GT.0)      THEN
         IF(MTIME.GT.401) THEN
                             WRITE(N6,520) MTIME
                             MTIME = 401
                             ENDIF
         IF(MTIME.GT.0)   THEN
cold                      READ(N5,FIRMAT) (Y(LL,2),LL=1,MTIME)
cred                      allow for a free formatted file - 9/14/00
Cwch, 9/16/00. Put read in DO-loop since documentation says read
C     LCARD values per line. 
DO JJ = 1,MTIME,LCARD
LLSTOP = LCARD
                       IF(MTIME-JJ+1.LT.LCARD) LLSTOP=MTIME-JJ+1
                       KL = JJ
                          if(FIRMAT.EQ.'FREE') then
                            READ(N5,*,ERR=545) (Y(LL,2),LL=KL,LLSTOP)
                             else
                          READ(N5,FIRMAT,ERR=545) (Y(LL,2),LL=KL,LLSTOP)
                             endif
                   END DO
Cwch, 9/16/00.  Include error message here too.
GO TO 547
  545   WRITE(N6,3885) JJ
                     STOP ' ERROR READING E3 LINES. SEE OUTPUT FILE. RUN
     1 STOPPED FROM GRAPH.'
  547                     DO 550 LX  = 1,MTIME
  550                     X(LX,2)    = TMZERO+FLOAT(LX-1)*DTMHR
                          NPT(2)     = MTIME
                          ENDIF
                          ENDIF
C=======================================================================
C     CONVERT PREDICTED FLOWS TO APPROPRIATE UNITS
C=======================================================================
                     NN = NPT(1)
      IF(NPLOT.EQ.0) NN = NPT(2)
      DO 630 N = 2,NN
      IF(J.EQ.1) THEN
Cwch, 9/14/00.  Interface file flows already metric, from Runoff & Transp.
C                 Y(N,1) = YT(N,J)/CMET(1,METRIC)**3.0
                 Y(N,1) = YT(N,J)
                 GO TO 630
                 ENDIF
C=======================================================================
C     CONVERT PREDICTED AND MEASURED
C             POLLUTOGRAPHS TO CONCENTRATION FROM CFS*CONC.
C=======================================================================
      IF(NLOAD(J).EQ.0) THEN
                  IF(YT(N,1).GT.0.0) Y(N,1) = YT(N,J)/YT(N,1)
                  ELSE
                  IF(NDIM(J).EQ.0) THEN
                                   Y(N,1) = YT(N,J)*CFACT1
                                   Y(N,2) =  Y(N,2)*CFACT1
                                   ELSE
                                   Y(N,1) = YT(N,J)*CFACT2
                                   Y(N,2) =  Y(N,2)*CFACT2
                                   ENDIF
                  ENDIF
  630 CONTINUE
      CALL CURVE(X,Y,NPT,2,KPLOT(MT),KMEAS(MT))
      IF(J.EQ.1) THEN
                 USE = 'FLOW'
                 ELSE
                 IF(NLOAD(J).EQ.0) USE = 'CONC'
                 IF(NLOAD(J).EQ.1) USE = 'LOAD'
                 ENDIF
      KP = IPOLX(J)
      IF(KP.EQ.0) KP = 1
      CALL HYSTAT(X,Y,NPT,2,KPLOT(MT),KMEAS(MT),TRIBA,METRIC,
     +                                USE,PUNIT(KP),PNAME(KP))
C=======================================================================
C     PLOT PREDICTED GRAPHS ONLY.
C     CONVERT PREDICTED POLLUTOGRAPHS TO CONCENTRATION FROM CFS*CONC.
C=======================================================================
      IF(ITAB(MT).EQ.0) GO TO 820
 6000 IF(MTAB(MT).EQ.0.OR.(J.GT.1.AND.NLOAD(J).GT.0)) THEN
                        IF(J.EQ.1) THEN
                                   USE = 'FLOW'
                                   ELSE
                                   IF(NLOAD(J).EQ.0) USE = 'CONC'
                                   IF(NLOAD(J).EQ.1) USE = 'LOAD'
                                   ENDIF
                        NN       = NPT(1)
                        SUMFLW   = 0.0
                        DO 930 N = 1,NN
                        IF(J.EQ.1) THEN
Cwch, 9/14/00.  Interface file flows already metric, from Runoff & Transp.
C                                  Y(N,1) = YT(N,J)/CMET(1,METRIC)**3.0
                                   Y(N,1) = YT(N,J)
                                   SUMFLW = SUMFLW + Y(N,1)
                                   GO TO 930
                                   ENDIF
                        IF(NLOAD(J).EQ.0) THEN
                           IF(YT(N,1).GT.0.0) Y(N,1) = YT(N,J)/YT(N,1)
                           ELSE
                           IF(NDIM(J).EQ.0) THEN
                                      Y(N,1) = YT(N,J)*CFACT1
                                      Y(N,2) =  Y(N,2)*CFACT1
                                      ELSE
                                      Y(N,1) = YT(N,J)*CFACT2
                                      Y(N,2) =  Y(N,2)*CFACT2
                                      ENDIF
                           ENDIF
  930                   CONTINUE
C=======================================================================
C                       PLOT ONLY THE PREDICTED DATA USING CURVE
C=======================================================================
                        IF(J.EQ.1.AND.SUMFLW.EQ.0.0) THEN
                        IF(JCE.EQ.0) WRITE(N6,9040) JPLOT(MT),NPT(1)
                        IF(JCE.EQ.1) WRITE(N6,9041) JMEAS(MT),NPT(1)
                        ELSE
                        CALL CURVE(X,Y,NPT,1,JPLOT(MT),JMEAS(MT))
                        IF(J.EQ.1) THEN
                                   USE = 'FLOW'
                                   ELSE
                                   IF(NLOAD(J).EQ.0) USE = 'CONC'
                                   IF(NLOAD(J).EQ.1) USE = 'LOAD'
                                   ENDIF
                        KP = IPOLX(J)
                        IF(KP.EQ.0) KP = 1
                        CALL HYSTAT(X,Y,NPT,1,JPLOT(MT),JMEAS(MT),TRIBA,
     +                       METRIC,USE,PUNIT(KP),PNAME(KP))
                        ENDIF
                        ENDIF
  820 CONTINUE
C=======================================================================
C     IF MORE THAN 201 DATA POINTS ARE ON THE INTERFACE FILE
C     RETURN AND CONTINUE PLOTTING THE HYDROGRAPHS AND POLLUTOGRAPHS
C=======================================================================
      IF(IBACK.GE.1.AND.NOTEND) THEN
                                N = 0
                                GO TO 5000
                                ENDIF
  800 CONTINUE
C=======================================================================
   10 FORMAT(/,
     +' ***************************************************',/,
     +' * ENTRY TO GRAPH BLOCK. LAST UPDATED AUGUST 1993. *',/,
     +' * "All art is quite useless."                     *',/,
     +' *                             Oscar Wilde (1891)  *',/,
     +' ***************************************************',/)
C#### WCH, 8/5/93
   12 FORMAT(/,
     +' ***************************************************',/,
     +' * ENTRY TO GRAPH BLOCK. LAST UPDATED AUGUST 1993. *',/,
     +' ***************************************************',/)
   30 FORMAT(/,' INPUT PARAMETER SUMMARY:',//,
     1 ' NUMBER OF OFF-LINE FILE OF PREDICTED DATA(NTAPE)....',I3,/,
     2 ' FLOW ORDINATE IN CFS (=0) OR CU M/S (=1) (METRIC)...',I3,/,
     3 ' NUMBER OF POLLUTOGRAPHS TO BE PLOTTED (NQP).........',I3,/,
     4 ' NUMBER OF LOCATIONS FOR PREDICTED PLOTS(NPLOT)......',I3,/,
     5 ' INDICATING MEASURED DATA AND THEIR STORAGE(MEAS)....',I3,/,
     6 ' FILE NUMBER FOR RETRIEVAL OF MEASURED DATA(MFILE)...',I3,/,
     7 ' NUMBER OF LOCATIONS FOR MEASURED DATA(MPLOT)........',I3,/,
     8 ' SKIP MCTH VALUES ON INTERFACE FILE..................',I3)
   34 FORMAT(/,' PLOTTING ',I5,' LOCATIONS',/,' PLOTTING GRAPH # ',/)
   35 FORMAT('+',I16)
   40 FORMAT(//,' PREDICTED GRAPHS ARE TO BE PLOTTED FOR THE FOLLOWING
     1 ',I4,' LOCATIONS :',//,10I11,/,10I11)
   41 FORMAT(//,' PREDICTED GRAPHS ARE TO BE PLOTTED FOR THE FOLLOWING
     1 ',I4,' LOCATIONS :',//,10A11,/,10A11)
   55 FORMAT(/,' MEASURED GRAPHS ARE TO BE PLOTTED FOR THE FOLLOWING ',
     1I4,' LOCATIONS :',//,10I11,/,10I11)
   56 FORMAT(/,' MEASURED GRAPHS ARE TO BE PLOTTED FOR THE FOLLOWING ',
     1I4,' LOCATIONS :',//,10A11,/,10A11)
  310 FORMAT(//,1X,A14,
     1 ' DATA GROUP E1 INPUT PARAMETERS FOR LOCATION ',I5,' ARE:',/,
     2' MDATA = ',I10,'     LCARD = ',I10,  '    MTIME = ',I10,/,
     2' MUNIT = ',I10,'    TMZERO = ',F10.4,'    TQUIT = ',F10.4,/,
     3' DTMHR = ',F10.4)
  360 FORMAT(/,' INPUT FORMAT FOR THESE DATA IS: ',A80)
  505 FORMAT(I6,' MEASURED DATA POINTS READ IN.')
  520 FORMAT(/,' ===> WARNING! MTIME=',I5,', GT 401. NOT ALLOWED.',
     1 '  MTIME WILL BE SET = 401.')
Cwch, 9/16/00
 3800 FORMAT(' ERROR. MFILE =',I4,' NSCRAT(8) =',I4,'. SHOULD BE EQUAL.'
     1,/,' WILL TRY SETTING MFILE = NSCRAT(8), IF NON-ZERO.',/,
     2   ' OTHERWISE, RUN WILL STOP, BELOW.')
 3810 FORMAT(' ERROR. MFILE =',I4,' NSCRAT(8) =',I4,'. SHOULD BE EQUAL.'
     1,/,' WILL TRY SETTING MFILE = NSCRAT(8), IF NON-ZERO.',/,
     2   ' OTHERWISE, CANNOT READ E3 DATA AND RUN WILL STOP.')
Cwch, 9/14/00.  
 3885 FORMAT(/,' ERROR READING E3 LINES.  RUN STOPPED.',/,
     1 ' OFFENDING E3 LINE IS NUMBER',I6)
 4090 FORMAT(/,
     1' ****************************************',/,
     1' *  QUALITY CONSTITUENTS TO BE GRAPHED  *',/,
     1' ****************************************',//,
     1 '                       TYPE OF   INTERFACE FILE',/,
     3 ' NO.  NAME     UNITS    UNITS   POSITION (IF ANY) PLOT',
     3 ' DESCRIPTION',/,
     4 ' --- -----     -----    -----   ----------------------',
     5 '------------')
 4150 FORMAT(I3,2X,A8,2X,A8,I6,I13,A30)
 9020 FORMAT(/,' ===> ERROR  LOCATION: ',I10,' WAS NOT FOUND ON THE ',
     +                                      'INTERFACE FILE.')
 9021 FORMAT(/,' ===> ERROR  LOCATION: ',A10,' WAS NOT FOUND ON THE ',
     +                                      'INTERFACE FILE.')
 9040 FORMAT(/,' ===> HYDROGRAPH FOR LOCATION ',I10,' WITH ',I5,
     + ' POINTS',/,'      WAS NOT PLOTTED BECAUSE THE FLOW WAS ZERO.')
 9041 FORMAT(/,' ===> HYDROGRAPH FOR LOCATION ',A10,' WITH ',I5,
     + ' POINTS', /,'      WAS NOT PLOTTED BECAUSE THE FLOW WAS ZERO.')
C#### WCH, 8/5/93
 9500 FORMAT(/,' ===> ERROR. FOR NTAPE > 0, NTAPE MUST EQUAL JIN.',/,
     + '     NTAPE =',I5,'  JIN =',I5,'  COUNTER (INCNT) =',I5)
C=======================================================================
      RETURN
  888 CALL IERROR
      END

Saturday, July 1, 2017

#Inside_SWMM5 A look at the three Froude Numbers in a #SWMM5 Link

Introduction – the reason for these series of blogs are as an expanded view of the input, engine and output of #SWMM5  It is a companion to the EPA Documentation which I describe here:

I have noticed based on email questions and postings to the SWMM List Sever (a great resource hosted by CHI, Inc.) that many SWMM 5 users do not know about the really outstanding documentation on SWMM 5 posted on the EPA Website https://www.epa.gov/water-research/storm-water-management-model-swmm It consists of two now and in the near future three volumes on Hydrology, Water Quality, LID's and SuDs and Hydraulics. The documentation is fantastically complete with detailed background on the theory, process parameters and completely worked out examples for all of the processes in SWMM5. It is truly an outstanding aid to modelers and modellers worldwide. It would benefit you to read them (if you have not already downloaded the PDF files)

This blog shows the three Froude Numbers in a link in SWMM5.  The Froude number is computed at the middle of the link but there are actually three computation points in a SWMM5 link – upstream, middle and downstream.

The Froude number is computed at the middle of the link but there are actually three computation points in a SWMM5 link – upstream, middle and downstream


Wednesday, June 28, 2017

#SWMM5 Embarcadero® Delphi XE7 Options #1

If you want to change the number of recent files in the #SWMM5 Embarcadero® Delphi XE7 code go to Uglobals.pas and change the number of files

MAXMRUINDEX   = 25; //Max. index of Most Recently Used files

MAXMRUINDEX   = 25; //Max. index of Most Recently Used files

Sunday, June 25, 2017

How to Model Tracers for RDII, Runoff, GW and DWF in #SWMM5, #InfoSWMM and #PCSWMM

A quick note:  A really nice feature of the way #SWMM5 models water quality is the easy ability to model tracers for the contribution of the major processes.  You can set up a concentration of 100 (for example) for DWF, RDII Flow, Runoff and Groundwater to find the percentage contribution of the process in link flow.  For example, if you model RDII using the RTK UH procedure the percentage of the RDII Water Quality Constituent is the flow from the upstream RDII nodes.  This technique can be used to show how important DWF, Separate Sewersheds and Combined Sewersheds to the WWTP flow or Outfall flow.

The following two images are from the Innovyze Products InfoSWMM and InfoSWMM SA

Figure 1.  How to add a Tracer Concentration for RDII, DWF, GW and Runoff


Figure 2.  RDII Concentration is the Percentage Contribution from RDII for the Linke Flow.

Happy International Women in Engineering Day via @PCSWMM


How to approximate a Steady State Model in SWMM5 and InfoSWMM using the Full Dynamic Wave Solution

How  to approximate a Steady State Model in #SWMM5 and InfoSWMM using the Full Dynamic Wave Solution
The five core components of making this work correctly are:
  1. Short Period of Time,
  2. Constant inflow
  3. Either use a hot start file or delay the results by time period in the Run Manger
  4. Graph the Results
  5. The link and node components should be constant as shown in this image


World Class Software Documentation for SWMM5 from Lew Rossman and Wayne Huber (Hydrology)

I posted this on the SWMM Group on LinkedIn
I have noticed based on email questions and postings to the SWMM LIst Sever (a great resource hosted by CHI, Inc.) that many SWMM 5 users do not know about the really outstanding documentation on SWMM 5 posted on the EPA Website https://www.epa.gov/water-research/storm-water-management-model-swmm It consists of two now and in the near future three volumes on Hydrology, Water Quality, LID’s and SuDs and Hydraulics. The documentation is fantastically complete with detailed background on the theory, process parameters and completely worked out examples for all of the processes in SWMM5. It is truly an outstanding aid to modelers and modellers worldwide. It would benefit you to read them (if you have not already downloaded the PDF files). Thanks for reading this post

Tuesday, June 6, 2017

Innovyze Releases RDII Analyst Generation V14.5

Innovyze Releases RDII Analyst Generation V14.5,
Setting New Standard for Managing and Operating Sewer Systems

New Version Fully Supports Sewer Condition and Rehabilitation Priorities and Sewer Capacity Assessment

Broomfield, Colorado, USA, June 6, 2017 – Innovyze, a leading global innovator of business analytics software and technologies for smart wet infrastructure, today announced the release of RDII Analyst (Rainfall-Derived Inflow and Infiltration) Generation V14.5 for InfoSWMM and InfoSWMM SA. The new version delivers both new and expanded functionalities for the quantification of RDII and help capacity analysis and the condition assessment of sewer systems. The release confirms Innovyze’s commitment to giving the world the most complete toolset for managing, operating and sustaining high-performing sewer systems.
 
Excessive wet weather flow from rainfall-derived manhole and pipe defect inflow and infiltration is a major source of sanitary and combined sewer overflows. Controlling these overflows is vital in reducing risks to public health and protecting the environment from water pollution. Computer modeling plays an important role in determining optimal remedial solutions that reduce RDII; improve system integrity, reliability and performance; and avoid overflows.

The processes for converting rainfall to RDII flow in sanitary sewer systems are very complicated. In addition to rainfall and antecedent moisture conditions, factors in controlling RDII responses include depth to groundwater, depth to bedrock, land slope, number and size of sewer system defects, type of storm drainage system, soil characteristics, and type of sewer backfill. Given this degree of complexity, flow-monitoring data must be combined with mathematical modeling and analytics to provide accurate results. The wastewater flow monitoring data obtained by sewer collection systems consists of dry-weather flow components, ground water flow and eighteen (18) RDII flow components. A crucial step in successfully modeling sewer collection systems is the ability to decompose flow-monitoring data into RDII flow, ground water flow and dry weather flow and its flow patterns (both weekday and weekend).

RDII Analyst is significantly superior to the EPA Sanitary Sewer Overflow Analysis and Planning (SSOAP) program. Powered by advanced GA optimization and comprehensive data analytics and scenario management, it is able to quickly and reliably perform these types of advanced flow decomposition data monitoring. V14.5 has been expanded with a simple and interactive visual curve fitting to facilitate determination of the unit hydrograph parameters. R, T, K and associated monthly storage parameters can now be determined by graphically comparing the total RDII hydrographs generated by users’ defined R, T, K parameters with the RDII hydrographs from the monitored data. Numerical comparison of total RDII volume with the sum of volume under each of the unit hydrographs confirms the success of curve fitting. V14.5 has also been expanded to allow:
  • Assessment of the given unit hydrograph data on selective month or annual average
  • Coverage of the full range of standard unit hydrograph property data during the analysis process
  • Comparison graphing of any RDII variables
  • Comparison graphing of multiple analysis results to enable users to analyze runs from various sewershed areas
V14.5 also features an enhanced version of the latest USEPA SWMM5 engine with greatly improved performance and capabilities. It enables users to analyze and rank solutions using various statistical methods and provides the ten best (optimal) solution sets for result ranking and selection. It also allows users to conduct multiple runs within an analysis for parameter and criteria evaluation as well as multiple analyses for different sewershed areas and rainfalls within an RDII-Analyst project for scenario comparison. Users now have the ability to filter out a period of flow and rainfall data for the RDII analysis, dynamically eliminate any storms/events prior to analysis, and save and load analysis results. These comprehensive capabilities offer an effective means for designing a focused sewer condition assessment program and maximizing the success of field investigation efforts. They also provide an effective means for assessing the post-rehabilitation performance of the sewer system using the pre- and post-sewer capacity analysis. 

“Innovyze continues to listen to our customers, invest very heavily in R&D, and deliver the advanced tools they need to effectively support their wastewater and urban drainage modeling and management challenges,” said Paul F. Boulos, Ph.D., BCEEM, Hon.D.WRE, Dist.D.NE, Dist.M.ASCE, NAE, Chief Executive Officer of Innovyze. “We are very excited that our vast worldwide customer base will now be able to use the powerful new features in RDII Analyst to enhance their modeling experiences, wrap better projects faster, and strengthen our communities’ sewer systems.” 

Pricing and Availability
Upgrade to RDII Analyst is now available worldwide by subscription to the Executive program. Subscription members can immediately download the new version free of charge directly from www.innovyze.com. The Innovyze Subscription Program is a friendly customer support and software maintenance program that ensures the longevity and usefulness of Innovyze products. It gives subscribers instant access to new functionality as it is developed, along with automatic software updates and upgrades. For the latest information on the Innovyze Subscription Program, visit www.innovyze.com. or contact your local Innovyze Channel Partner.

About Innovyze
Innovyze is a leading global provider of wet infrastructure business analytics software solutions designed to meet the technological needs of water/wastewater utilities, government agencies, and engineering organizations worldwide. Its clients include the majority of the largest UK, Australasian, East Asian and North American cities, foremost utilities on all five continents, and ENR top-rated design firms. Backed by unparalleled expertise and offices in North America, Europe, and Asia Pacific, the Innovyze connected portfolio of best-in-class product lines empowers thousands of engineers to competitively plan, manage, design, protect, operate, and sustain highly efficient and reliable infrastructure systems, and provides an enduring platform for customer success. For more information, call Innovyze at +1 626-568-6868, or visit www.innovyze.com.
 

Innovyze Contact:
Rajan Ray
Director of Marketing and Client Service Manager
Rajan.Ray@innovyze.com
+1 626-568-6868

AI Rivers of Wisdom about ICM SWMM

Here's the text "Rivers of Wisdom" formatted with one sentence per line: [Verse 1] 🌊 Beneath the ancient oak, where shadows p...