read.inp: Read .inp file

Description Usage Arguments Details Value References Examples

Description

Read an Epanet .inp file into R

Usage

1

Arguments

file

the name of the file to read

Details

This function reads a text file in Epanet's .inp format and returns an S3 object with entries for sections of the .inp file. Sections of the .inp file that are implemented appear in the Value section.

Fields for node or link ID are stored as characters not factors or integers. However, some fields are stored as factors to allow more informative summaries. Examples include valve type and pipe status.

Sections that are absent from the .inp file are NULL in the list.

Columns of data.frames use the headings exported by the Epanet GUI.

The [OPTIONS] section in the .inp file is used to update a list of Epanet's default options. In this way if an option such as units is not specified by the .inp file, the units that would be used by default are provided.

In the [PATTERNS] and [CURVES] sections, integers used as names of list elements are backquoted according to the default behavior in R. So if the .inp file has a pattern "1" this pattern will appear as element '1' in the list that is returned. A warning is issued in this case.

Value

Returns an epanet.inp S3 object with elements of the following names and types corresponding to sections of the .inp file. Sections missing from the .inp file have a value of NULL.

Title

character

Junctions

data.frame

Tanks

data.frame

Reservoirs

data.frame

Pipes

data.frame

Pumps

data.frame

Valves

data.frame

Demands

data.frame

Status

data.frame

Emitters

data.frame

Quality

data.frame

Sources

data.frame

Reactions

character

Mixing

data.frame

Patterns

list

Curves

list

Controls

character

Rules

character

Energy

character

Times

character

Report

character

Options

list

Coordinates

data.frame

Vertices

data.frame

Labels

data.frame

Backdrop

character

Tags

character

References

Rossman, L. A. (2000). Epanet 2 users manual. US EPA, Cincinnati, Ohio.

http://nepis.epa.gov/Adobe/PDF/P1007WWU.pdf

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
# path to Net1.inp example file included with this package
inp <- file.path( find.package("epanetReader"), "extdata","Net1.inp") 

#read the network file into R
n1 <- read.inp(inp)
summary(n1)
names(n1)
summary(n1$Junctions)
summary(n1$Pipes)
plot(n1) 

Example output

Warning messages:
1: In PATTERNS(allLines) : patterns have integer IDs, see ?epanet.inp
2: In CURVES(allLines) : curves have integer IDs, see ?epanet.inp
$Title
[1] "EPANET Example Network 1"                                  
[2] "A simple example of modeling chlorine decay. Both bulk and"
[3] "wall reactions are included."                              

$entryCounts
            Number
Junctions        9
Tanks            1
Reservoirs       1
Pipes           12
Pumps            1
Quality         11
Coordinates     11
Labels           3

attr(,"class")
[1] "summary.epanet.inp"
 [1] "Title"       "Junctions"   "Tanks"       "Reservoirs"  "Pipes"      
 [6] "Pumps"       "Valves"      "Demands"     "Patterns"    "Curves"     
[11] "Controls"    "Rules"       "Energy"      "Status"      "Emitters"   
[16] "Quality"     "Sources"     "Reactions"   "Mixing"      "Times"      
[21] "Report"      "Options"     "Coordinates" "Vertices"    "Labels"     
[26] "Backdrop"    "Tags"       
      ID              Elevation         Demand      Pattern       
 Length:9           Min.   :690.0   Min.   :  0.0   Mode:logical  
 Class :character   1st Qu.:695.0   1st Qu.:100.0   NA's:9        
 Mode  :character   Median :700.0   Median :150.0                 
                    Mean   :701.1   Mean   :122.2                 
                    3rd Qu.:710.0   3rd Qu.:150.0                 
                    Max.   :710.0   Max.   :200.0                 
      ID                Node1           Node2           Length     
 Length:12          Min.   : 2.00   Min.   :11.00   Min.   :  200  
 Class :character   1st Qu.:11.00   1st Qu.:12.75   1st Qu.: 5280  
 Mode  :character   Median :12.50   Median :22.00   Median : 5280  
                    Mean   :15.67   Mean   :21.17   Mean   : 5294  
                    3rd Qu.:21.25   3rd Qu.:25.00   3rd Qu.: 5280  
                    Max.   :31.00   Max.   :32.00   Max.   :10530  
    Diameter      Roughness     MinorLoss  Status  
 Min.   : 6.0   Min.   :100   Min.   :0   Open:12  
 1st Qu.: 8.0   1st Qu.:100   1st Qu.:0            
 Median :10.0   Median :100   Median :0            
 Mean   :11.0   Mean   :100   Mean   :0            
 3rd Qu.:12.5   3rd Qu.:100   3rd Qu.:0            
 Max.   :18.0   Max.   :100   Max.   :0            

epanetReader documentation built on May 2, 2019, 2:08 p.m.