def __init__(self):
        """Initialize the sections of an EPANET input file.
           Any sections not initialized here will be handled by the generic core.project_base.Section class."""
        self.title = Title()
        self.junctions = SectionAsList("[JUNCTIONS]")  # (list of Junction)
        self.reservoirs = SectionAsList("[RESERVOIRS]")  # (list of Reservoir)
        self.tanks = SectionAsList("[TANKS]")  # (list of Tank)
        self.pipes = SectionAsList("[PIPES]")  # (list of Pipe)
        self.pumps = SectionAsList("[PUMPS]")  # (list of Pump)
        self.valves = SectionAsList("[VALVES]")  # (list of Valve)
        # self.emitters = [(Junction, "emitter_coefficient")]
        self.patterns = SectionAsList("[PATTERNS]")  # (list of Pattern)
        self.curves = SectionAsList("[CURVES]")  # (list of Curve)
        self.energy = EnergyOptions()
        self.status = SectionAsList("[STATUS]")  # (list of Status)
        self.controls = Control()
        self.rules = Rule()
        self.demands = SectionAsList("[DEMANDS]")  # (list of Demand)
        self.reactions = Reactions()
        self.sources = SectionAsList("[SOURCES]")  # (list of Source)
        # self.options = MapOptions,
        self.options = Options()
        self.times = TimesOptions()
        self.report = ReportOptions()
        self.labels = SectionAsList("[LABELS]")  # (list of Label)
        self.backdrop = BackdropOptions()
        self.calibrations = SectionAsList(
            "[CALIBRATIONS]")  # (list of Calibration)

        ProjectBase.__init__(
            self
        )  # Do this after setting attributes so they will all get added to sections[]
示例#2
0
    def __init__(self):
        """Initialize the sections of an EPANET input file.
           Any sections not initialized here will be handled by the generic core.project_base.Section class."""
        ProjectBase.__init__(self)

        self.title = Title()
        self.backdrop = BackdropOptions()       # BACKDROP      bounding rectangle and file name of backdrop image
        self.map = MapOptions()                 # MAP           map's bounding rectangle and units
        self.junctions = SectionAsList("[JUNCTIONS]")  # (list of Junction)
        self.reservoirs = SectionAsList("[RESERVOIRS]")  # (list of Reservoir)
        self.tanks = SectionAsList("[TANKS]")  # (list of Tank)
        self.pipes = SectionAsList("[PIPES]")  # (list of Pipe)
        self.pumps = SectionAsList("[PUMPS]")  # (list of Pump)
        self.valves = SectionAsList("[VALVES]")  # (list of Valve)
        # self.emitters = [(Junction, "emitter_coefficient")]
        self.patterns = SectionAsList("[PATTERNS]")  # (list of Pattern)
        self.curves = SectionAsList("[CURVES]")  # (list of Curve)
        self.energy = EnergyOptions()
        self.status = SectionAsList("[STATUS]")  # (list of Status)
        self.controls = Control()
        self.rules = Rule()
        self.demands = SectionAsList("[DEMANDS]")  # (list of Demand)
        self.reactions = Reactions()
        self.sources = SectionAsList("[SOURCES]")  # (list of Source)
        # self.options = MapOptions,
        self.options = Options()
        self.times = TimesOptions()
        self.report = ReportOptions()
        self.labels = SectionAsList("[LABELS]")  # (list of Label)
        self.backdrop = BackdropOptions()
        self.calibrations = SectionAsList("[CALIBRATIONS]") # (list of Calibration)

        self.sections = [
            self.title,
            self.options,
            self.report,
            self.junctions,
            self.tanks,
            self.reservoirs,
            self.pipes,
            self.pumps,
            self.valves,
            self.controls,
            self.patterns,
            self.curves,
            self.backdrop,
            self.map,
            self.labels]  # Start with a sensible order of sections.
        self.add_sections_from_attributes()  # Add any sections not added in the line above, should not be any left.
示例#3
0
 def read(new_text):
     backdrop_options = BackdropOptions()
     for line in new_text.splitlines():
         try:
             line = SectionReader.set_comment_check_section(backdrop_options, line)
             fields = line.split()
             if len(fields) > 1:
                 if fields[0].lower() == "dimensions" and len(fields) > 4:
                     backdrop_options.dimensions = fields[1:5]
                 elif fields[0].lower() == "offset" and len(fields) > 2:
                     backdrop_options.offset = (fields[1], fields[2])
                 else:
                     backdrop_options.setattr_keep_type(ProjectBase.format_as_attribute_name(fields[0]), fields[1])
         except:
             print("BackdropOptions skipping input line: " + line)
     return backdrop_options
    def __init__(self):
        """Define the fields of a SWMM Project by creating an empty placeholder for each section"""

        ProjectBase.__init__(self)

        self.title = Title()  # TITLE         project title
        self.options = General()  # OPTIONS       analysis options
        self.report = Report()  # REPORT        output reporting instructions
        self.files = Files()  # FILES         interface file options
        self.backdrop = BackdropOptions(
        )  # BACKDROP      bounding rectangle and file name of backdrop image
        self.map = MapOptions(
        )  # MAP           map's bounding rectangle and units
        self.raingages = SectionAsList(
            "[RAINGAGES]"
        )  # (list of RainGage)  # RAINGAGES  rain gage information

        self.hydrographs = SectionAsList(
            "[HYDROGRAPHS]")  # (list of UnitHydrograph)
        # unit hydrograph data used to construct RDII inflows

        self.evaporation = Evaporation()  # EVAPORATION   evaporation data
        self.temperature = Temperature(
        )  # TEMPERATURE   air temperature and snow melt data
        self.adjustments = Adjustments(
        )  # ADJUSTMENTS   monthly climate adjustments
        self.subcatchments = SectionAsList(
            "[SUBCATCHMENTS]")  # (list of Subcatchment)
        # basic subcatchment information

        # self.subareas = [Section]               # SUBAREAS      subcatchment impervious/pervious sub-area data

        self.infiltration = SectionAsList("[INFILTRATION]")  # (list of str)
        # subcatchment infiltration parameters

        self.lid_controls = SectionAsList(
            "[LID_CONTROLS]")  # (list of LIDControl)
        # low impact development control information

        self.lid_usage = SectionAsList("[LID_USAGE]")  # (list of LIDUsage)
        # assignment of LID controls to subcatchments

        self.aquifers = SectionAsList("[AQUIFERS]")  # (list of Aquifer)
        # groundwater aquifer parameters

        self.groundwater = SectionAsList(
            "[GROUNDWATER]")  # (list of Groundwater)
        # subcatchment groundwater parameters

        self.snowpacks = SectionAsList("[SNOWPACKS]")  # (list of SnowPack)
        # subcatchment snow pack parameters

        self.junctions = SectionAsList("[JUNCTIONS]")  # (list of Junction)
        # junction node information

        self.outfalls = SectionAsList("[OUTFALLS]")  # (list of Outfall)
        #  outfall node information

        self.dividers = SectionAsList("[DIVIDERS]")  # (list of Divider)
        #  flow divider node information

        self.storage = SectionAsList("[STORAGE]")  # (list of StorageUnit)
        #  storage node information

        self.conduits = SectionAsList("[CONDUITS]")  # (list of Conduit)
        # conduit link information

        self.pumps = SectionAsList("[PUMPS]")  # (list of Pump)
        # pump link information

        self.orifices = SectionAsList("[ORIFICES]")  # (list of Orifice)
        # orifice link information

        self.weirs = SectionAsList("[WEIRS]")  # (list of Weir)
        # weir link information

        self.outlets = SectionAsList("[OUTLETS]")  # (list of Outlet)
        # outlet link information

        self.xsections = SectionAsList("[XSECTIONS]")  # (list of CrossSection)
        # conduit, orifice, and weir cross-section geometry

        self.transects = Transects(
        )  # transect geometry for conduits with irregular cross-sections

        self.controls = Controls()
        # rules that control pump and regulator operation

        self.events = SectionAsList("[EVENTS]")  # (list of Events)

        self.landuses = SectionAsList(
            "[LANDUSES]")  # (list of Landuse)     # land use categories

        self.buildup = SectionAsList("[BUILDUP]")  # (list of Buildup)
        # buildup functions for pollutants and land uses

        self.washoff = SectionAsList("[WASHOFF]")  # (list of Washoff)
        # washoff functions for pollutants and land uses

        self.pollutants = SectionAsList("[POLLUTANTS]")  # (list of Pollutant)
        # pollutant information

        self.coverages = Coverages(
        )  # COVERAGES   assignment of land uses to subcatchments
        self.treatment = SectionAsList("[TREATMENT]")  # (list of Treatment)
        # pollutant removal functions at conveyance system nodes

        self.inflows = SectionAsList("[INFLOWS]")  # (list of DirectInflow)
        # INFLOWS # external hydrograph/pollutograph inflow at nodes

        self.dwf = SectionAsList("[DWF]")  # (list of DryWeatherInflow)
        # baseline dry weather sanitary inflow at nodes

        self.patterns = SectionAsList("[PATTERNS]")  # (list of Pattern)
        # periodic variation in dry weather inflow

        self.rdii = SectionAsList("[RDII]")  # (list of RDIInflow)
        # rainfall-dependent I/I information at nodes

        self.loadings = InitialLoadings()
        # initial pollutant loads on subcatchments

        self.curves = SectionAsList("[CURVES]")  # (list of Curve)
        # CURVES        x-y tabular data referenced in other sections

        self.timeseries = SectionAsList("[TIMESERIES]")  # (list of TimeSeries)
        # time series data referenced in other sections

        self.labels = SectionAsList("[LABELS]")  # (list of Label)
        # X, Y coordinates and text of labels

        self.subcentroids = SectionAsList(
            "[SUBCENTROIDS]")  # (list of subcentroids)
        # X, Y coordinates and text of subcentroids

        self.sublinks = SectionAsList("[SUBLINKS]")  # (list of sublinks)
        # sublinks information

        self.sections = [
            self.title, self.options, self.evaporation, self.raingages,
            self.subcatchments, self.infiltration, self.junctions,
            self.dividers, self.storage, self.outfalls, self.conduits,
            self.pumps, self.orifices, self.weirs, self.outlets,
            self.xsections, self.landuses, self.coverages, self.pollutants,
            self.timeseries, self.patterns, self.curves, self.dwf, self.rdii,
            self.loadings, self.buildup, self.washoff, self.report,
            self.events, self.files, self.backdrop, self.map, self.hydrographs,
            self.temperature, self.adjustments, self.lid_controls,
            self.lid_usage, self.aquifers, self.groundwater, self.snowpacks,
            self.transects, self.controls, self.treatment, self.inflows,
            self.labels, self.subcentroids, self.sublinks
        ]  # Start with a sensible order of sections.
        self.add_sections_from_attributes(
        )  # Add any sections not added in the line above, should not be any left.