Monday, September 26, 2016

The Impact of the yCrown Taper equation in #SWMM5 on Surcharged Nodes

The Impact of the yCrown Taper equation in #SWMM5

We are looking at three ranges of depth in the node:
1.  Node depths below yCrown using the node continuity equation to compute the new node depth,
2. Node Depths above 1.25 * yCrown use the point iteration solution for the node in which there is no node area and the program iterates until the sum of flows is zero for the timestep.
3.  Node Depths between yCrown and 1.25 * yCrown use the taper equation in which the node area decreases from the area at 0.96 Full Depth to a value of zero area at 1.25 yCrown.

If the current depth in the node is below 1.25 * yCrown

Where,  yCrown is the depth till the highest connecting conduit crown elevation

There is a tapered equation based on the sum of the  flow at the node and the surface area from the last non-surcharged condition which will influence dqdh if depth close to crown depth

F = yLast/yCrown – 1

Denom = Sum DQDH for all connecting links to the node

Denom = Denom + (Old Surface Area (at last non-surcharged condition) / dt (time step) – Sum DQDH term for connecting links ) * exp (-15*f)

This has the effect of quickly tapering the impact of the Old Surface Area between yCrown and 1.25 * yCrown (Figure 1 and Table 1).  It starts out at the value of Old Surface Area and by a depth of 1.25*yCrown the impact of Old Surface Area is zero.


Figure .  Values of the yCrown Taper from 1 to 1.25*yCrown in #SWMM5





Ycrown
exp(-15.0 * f)  Taper Value
            f = (yLast - yCrown) / yCrown or yLast/yCrown - 1
exp(-15.0 * f) Taper Value

1
1.0000
0
1.0000



1.01
0.8607
0.01
0.8607

1.02
0.7408
0.02
0.7408

1.03
0.6376
0.03
0.6376

1.04
0.5488
0.04
0.5488
1.05
0.4724
0.05
0.4724
1.06
0.4066
0.06
0.4066
1.07
0.3499
0.07
0.3499
1.08
0.3012
0.08
0.3012
1.09
0.2592
0.09
0.2592
1.1
0.2231
0.1
0.2231
1.11
0.1920
0.11
0.1920
1.12
0.1653
0.12
0.1653
1.13
0.1423
0.13
0.1423
1.14
0.1225
0.14
0.1225
1.15
0.1054
0.15
0.1054
1.16
0.0907
0.16
0.0907
1.17
0.0781
0.17
0.0781
1.18
0.0672
0.18
0.0672
1.19
0.0578
0.19
0.0578
1.2
0.0498
0.2
0.0498
1.21
0.0429
0.21
0.0429
1.22
0.0369
0.22
0.0369
1.24
0.0273
0.24
0.0273
1.25
0.0235
0.25
0.0235
 Table 1.  Values of the Taper Equation between 1 and 1.25*yCrown

Spatial Databases in #InfoSWMM and #InfoSewer using ArcCatalog™

Spatial Databases in #InfoSWMM and #InfoSewer using ArcCatalog™

With ArcCatalog™ , you can explore and manage geographic data stored in an RDBMS through ArcSDE™ . Similarly, SDE for Coverages lets you access coverage, ArcInfo™ LIBRARIAN, and ArcStorm™ databases the same way you access data from an RDBMS. To access these spatial databases, you must add a spatial database connection to the Catalog.
Refer to the section on Database Connections folder -> Spatial Database Connection link in the ArcGIS help file to learn more.

Pump as a Node In Water and System Head Curve

System Head Curve


Note:  This is a feature often asked for in InfoSWMM and SWMM5.  Pumps are links in the SWMM5 engine.
The dialog box for system head curve is shown below. Click here for the methodology of system head curve.

Input for system head curve:

 Flow Unit – Select the desired flow unit.
 Head Loss Equation – Select from Manning, Darcy-Weisbach (Colebrook-White), or Hazen–Williams formula.
 Pipe 1 – The pipe that connects the upstream reservoir with the pump (i.e., pipe on the suction side of the pump).
 Pipe 2 – The pipe that connects the pump with the downstream reservoir (i.e., pipe on the discharge side of the pump).
 Coefficient – Roughness coefficient.
 Head at Position 1 – Head at the upstream reservoir.
 Head at Position 2 – Head at the downstream reservoir.
 Length – Length of the pipe (i.e., pipe 1 or pipe 2).
 Diameter – Diameter of the pipe (i.e., pipe 1 or pipe 2).
 Sum of Minor Loss Coefficients – Sum of minor loss coefficients for the pipe (i.e., pipe 1 or pipe 2).
 Maximum Flow – Maximum flow for use in constructing the system head curve. The maximum flow is divided into ten equal intervals and the head corresponding to each of the ten flows is computed to construct the system head curve. Therefore, it is advisable to use a maximum flow that is divisible by ten.

Output for system head curve:

 Graphical System Curve – Presents the system head curve graphically.
 Tabular System Curve – Presents the system head curve in tabular form.  


#SWMM6 - A Sustainable Center for Crowd-Sourced Water Infrastructure Modeling



Friday, September 16, 2016

How to add a new view variable to SWMM 5.1.011

How to add a new view variable to SWMM 5.1.011

If you want to add a new view variable to the graphs of SWMM 5 – this is the steps you have to take (3 in the Delphi GUI and 3 in the SWMM 5 C Engine code).

This example will add a new view variable called NodeXTRA at the end of the Node list of view variables (Figure 1).  You add it to three locations in the Delphi XE7 code (Figure 3) and three locations in the SWMM 5 Engine code (Figure 3).  The purpose of this note is for students and as a reminder to myself.

Figure 1 - New view variable called NodeXtra

Figure 2 - We need to make a few additions to the Delphi GUI code to see the Name NodeXtra when we run SWMM 5.1.011



Figure 3 - SWMM 5 C code - We need to add the NodeXtra variable to the code to see some numbers and results.

How to Add Extra Output Files to SWMM 5.1.011

How to Add Extra Output Files to #SWMM 5.1.011 – the goal here is to automatically make calibration files for InfoSWMM, H2OMap SWMM, SWMM 5 and other programs based on the name of the Outflows file in SWMM 5.

Step 1.   Add names to globals.h

EXTERN TFile
                  Finp,                     // Input file
                  Fout,                     // Output file
                  Frpt,                     // Report file
                  Fclimate,                 // Climate file
                  Frain,                    // Rainfall file
                  Frunoff,                  // Runoff file
                  Frdii,                    // RDII inflow file
                  Fhotstart1,               // Hot start input file
                  Fhotstart2,               // Hot start output file
                  Finflows,                 // Inflows routing file
                  Foutflows,                // Outflows routing file
                  FcalibrationS,            // Calibration file Innovyze RED 2016  // Storage Volume in a Storage Node
                  FcalibrationR,            // Calibration file Innovyze RED 2016   Runoff
                  FcalibrationE,            // Calibration file Innovyze RED 2016   Groundwater Elevation
                  FcalibrationG,            // Calibration file Innovyze RED 2016   Groundwater Q
                  FcalibrationH,            // Calibration file Innovyze RED 2016   Node Depth
                  FcalibrationL,            // Calibration file Innovyze RED 2016   Node Lateral Q
                  FcalibrationQ,            // Calibration file Innovyze RED 2016  Link Q
                  FcalibrationV,            // Calibration file Innovyze RED 2016  Link V
                  FcalibrationD;            // Calibration file Innovyze RED 2016  Link D

Step 2. Name them in iface.c
      case OUTFLOWS_FILE:
        if ( k != SAVE_FILE ) return error_setInpError(ERR_ITEMS, "");
        Foutflows.mode = k;
        sstrncpy(Foutflows.name, tok[2], MAXFNAME);
        // SWMM 5 Calibration File // Innovyze RED - 2016
        sstrncpy(FcalibrationS.name, tok[2], MAXFNAME);
        sstrncpy(FcalibrationR.name, tok[2], MAXFNAME);
        sstrncpy(FcalibrationG.name, tok[2], MAXFNAME);
        sstrncpy(FcalibrationE.name, tok[2], MAXFNAME);
        sstrncpy(FcalibrationH.name, tok[2], MAXFNAME);
        sstrncpy(FcalibrationL.name, tok[2], MAXFNAME);
        sstrncpy(FcalibrationQ.name, tok[2], MAXFNAME);
        sstrncpy(FcalibrationV.name, tok[2], MAXFNAME);
        sstrncpy(FcalibrationD.name, tok[2], MAXFNAME);
            FcalibrationS.mode = k;
             FcalibrationR.mode = k;
             FcalibrationG.mode = k;
             FcalibrationE.mode = k;
             FcalibrationH.mode = k;
             FcalibrationL.mode = k;
             FcalibrationQ.mode = k;
             FcalibrationV.mode = k;
             FcalibrationD.mode = k;
             strcat(FcalibrationS.name,".SWMM5_S_CALIBRATION.DAT");
             strcat(FcalibrationR.name,".SWMM5_R_CALIBRATION.DAT");
             strcat(FcalibrationG.name,".SWMM5_G_CALIBRATION.DAT");
             strcat(FcalibrationE.name,".SWMM5_E_CALIBRATION.DAT");
             strcat(FcalibrationH.name,".SWMM5_H_CALIBRATION.DAT");
             strcat(FcalibrationL.name,".SWMM5_L_CALIBRATION.DAT");
             strcat(FcalibrationQ.name,".SWMM5_Q_CALIBRATION.DAT");
             strcat(FcalibrationV.name,".SWMM5_V_CALIBRATION.DAT");
             strcat(FcalibrationD.name,".SWMM5_D_CALIBRATION.DAT");
           break;

Step 3. Open them in iface.c

void openFileForOutput()
//
//  Input:   none
//  Output:  none
//  Purpose: opens a routing interface file for writing.
//
{
    int i, n;

    // --- open the routing file for writing text
    Foutflows.file = fopen(Foutflows.name, "wt");
       FcalibrationS.file  = fopen(FcalibrationS.name, "wt");                        // Innovyze RED 2016
       FcalibrationR.file = fopen(FcalibrationR.name, "wt");                        // Innovyze RED 2016
       FcalibrationG.file = fopen(FcalibrationG.name, "wt");                        // Innovyze RED 2016
       FcalibrationE.file = fopen(FcalibrationE.name, "wt");                        // Innovyze RED 2016
       FcalibrationH.file = fopen(FcalibrationH.name, "wt");                        // Innovyze RED 2016
       FcalibrationL.file = fopen(FcalibrationL.name, "wt");                        // Innovyze RED 2016
       FcalibrationQ.file = fopen(FcalibrationQ.name, "wt");                        // Innovyze RED 2016
       FcalibrationV.file = fopen(FcalibrationV.name, "wt");                        // Innovyze RED 2016
       FcalibrationD.file = fopen(FcalibrationD.name, "wt");                        // Innovyze RED 2016
    if ( Foutflows.file == NULL )
    {
        report_writeErrorMsg(ERR_ROUTING_FILE_OPEN, Foutflows.name);
        return;
    }

Step 5.   Alter Report.c to save data to the Extra Output files

I will leave out these details as they are too tedious. 


    if ( Nobjects[SUBCATCH] == 0 ) return;
    WRITE(";Subcatchment Results");
     k = 0;
    for (j = 0; j < Nobjects[SUBCATCH]; j++)
    {
        if ( Subcatch[j].rptFlag == TRUE )
        {
            fprintf(FcalibrationR.file,"\n%s", Subcatch[j].ID);   
               //fprintf(FcalibrationG.file,"\n%s", Subcatch[j].ID);   
               //Fprintf(FcalibrationE.file,"\n%s", Subcatch[j].ID);          
                    report_SubcatchHeader(Subcatch[j].ID);
            for ( period = 1; period <= Nperiods; period++ )
            {
                output_readDateTime(period, &days);
                datetime_dateToStr(days, theDate);
                datetime_timeToStr(days, theTime);
                output_readSubcatchResults(period, k);
                        datetime_decodeDate(days, &year, &month, &day);               
                 fprintf(FcalibrationR.file, "\n%02d/%02d/%4d %4s %9.3f R",   
                   month,day,year, theTime, SubcatchResults[SUBCATCH_RUNOFF]) ;
            }
            k++;
        }
    }

Step 5.  Close them in iface.c

void iface_closeRoutingFiles()
//
//  Input:   none
//  Output:  none
//  Purpose: closes routing interface files.
//
{
    FREE(IfacePolluts);
    FREE(IfaceNodes);
    if ( OldIfaceValues != NULL ) project_freeMatrix(OldIfaceValues);
    if ( NewIfaceValues != NULL ) project_freeMatrix(NewIfaceValues);
    if ( Finflows.file )  fclose(Finflows.file);
    if ( Foutflows.file ) fclose(Foutflows.file);
    if ( FcalibrationS.file )  fclose(FcalibrationS.file);  //  Innovyze RED - 2016
    if ( FcalibrationR.file ) fclose(FcalibrationR.file);   //  Innovyze RED - 2016
    if ( FcalibrationG.file ) fclose(FcalibrationG.file);   //  Innovyze RED - 2016
    if ( FcalibrationE.file ) fclose(FcalibrationE.file);   //  Innovyze RED - 2016
    if ( FcalibrationH.file ) fclose(FcalibrationH.file);   //  Innovyze RED - 2016
    if ( FcalibrationL.file ) fclose(FcalibrationL.file);   //  Innovyze RED - 2016
    if ( FcalibrationQ.file ) fclose(FcalibrationQ.file);   //  Innovyze RED - 2016
    if ( FcalibrationV.file ) fclose(FcalibrationV.file);   //  Innovyze RED - 2016
    if ( FcalibrationD.file ) fclose(FcalibrationD.file);   //  Innovyze RED - 2016
}

Other Links

If you just want to read you do not need to sign in but if you want to add a discussion or blog then you need to sign in as a Ning user. If you do not want to do either then you can send me an email to robert.dickinson@gmail.com or robert.dickinson@innovyze.com and I will do my best to answer your questions. Thanks for visiting and I hope you found something useful! Read here for reasons you should make a profile.

We also have a blogspot blog for SWMM5, InfoSWMM and InfoSewer which has a local and Google Search option so it is easier to find tagged information on SWMM5.NET and the Wordpress Site SWMM5.ORG You can also see my recent posts on Twitter and the Official Innovyze Blog which also has great information on ICM and IWCS.