Giter Site home page Giter Site logo

epynet's Introduction

Epynet Logo

EPYNET is an object oriented wrapper around the EPANET 2.1 community edition hydraulic network solver.

Features

  • Hydraulic calculations
  • Object oriented access to Nodes, Junctions, Reservoirs, Tanks, Links, Pipes, Valves and Pumps
  • Convienent access to simulation results such as flow, velocity and pressure through class properties
  • Manipulation of valve and pump settings
  • Manipulation of pipe, junction, reservoir and tank settings
  • Support for time series
  • Pattern and Curve creation and manipulation
  • Create and remove nodes and links
  • Work on multiple networks at the same time
  • [TODO] Chemical calculations

Example Usage

# load a network
from epynet import Network
network = Network('network.inp')
# solve network
network.solve()
# properties
print(network.pipes['4'].flow)
print(network.nodes['1'].demand)
# valve manipulation
network.valves['12'].setting = 10
# convinience properties
print(network.pipes['5'].downstream_node.pressure)
print(network.nodes['1'].upstream_links[0].velocity)
# pandas integration
print(network.pipes.flow)
print(network.pipes.length[network.pipes.velocity > 1])
print(network.nodes.demand[network.nodes.pressure < 10].max())
# network manipulaton
network.add_tank('tankid', x=10, y=10, elevation=10)
network.add_junction('junctionid', x=20, y=10, elevation=5)
network.add_pipe('tankid', 'junctionid', length=10, diameter=200, roughness=0.1)

Installation

  • Clone or download repository
  • python setup.py install

Requirements

  • 64 bit Python 2.7 or 3
  • Windows, OSX or Linux

Unit Tests

Mac/Linux Windows
Build Status Build status

Acknowledgements

This project makes use of the EPANET 2.1 community version and is (partly) derived from the epanettools package (Assela Pathirana) and the epanet-python library (Maurizio Cingi)

About Vitens

Vitens is the largest drinking water company in The Netherlands. We deliver top quality drinking water to 5.6 million people and companies in the provinces Flevoland, Fryslân, Gelderland, Utrecht and Overijssel and some municipalities in Drenthe and Noord-Holland. Annually we deliver 350 million m³ water with 1,400 employees, 100 water treatment works and 49,000 kilometres of water mains.

One of our main focus points is using advanced water quality, quantity and hydraulics models to further improve and optimize our treatment and distribution processes.

Licence

Copyright 2016 Vitens

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

epynet's People

Contributors

abelheinsbroek avatar lmangani avatar michaeltan91 avatar vdwees avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

epynet's Issues

Is it possible to change the total head at a reservoir instead of its elevation?

Good morning,

I am working at VORtech on a project in a collaboration with Deltares and Vitens.
I am trying to simulate the flow of water using a model (for the gemeente Culemborg) at different times of the day.

I would like to change the total head at the reservoir. I saw that this can (effectively) be done by changing the elevation (static) property of the reservoir node, like this:

nw.reservoirs[reservoir_name].set_static_property(EN_ELEVATION, value)

but if my interpretation of the code is correct, I would ideally rather have:

nw.reservoirs[reservoir_name].set_property(EN_HEAD, value)

I also tried:
nw.reservoirs[reservoir_name].properties['head'] = value

but this has no effect on the simulations (I guess because the self.set_object_value(code, value)) is not called.

Issue while opening INPs

Hello,
I got problem with opening some of input files. While opening some of inp's i got following traceback:

Exception in Tkinter callback
Traceback (most recent call last):
  File "C:\DEV\Python\lib\tkinter\__init__.py", line 1699, in __call__
    return self.func(*args)
  File "D:/DEV/Work Directory/APP.py", line 655, in load_network
    self.network = Network(self.network_filepath)
  File "C:\DEV\Python\lib\site-packages\epynet-0.1-py3.6.egg\epynet\network.py", line 20, in __init__
    self.ep.ENopen(self.inputfile, self.rptfile, self.binfile)
  File "C:\DEV\Python\lib\site-packages\epynet-0.1-py3.6.egg\epynet\epanet2.py", line 76, in ENopen
    raise ENtoolkitError(self, ierr)
epynet.epanet2.ENtoolkitError: File Error 302: cannot open input file.

Process finished with exit code 0

I know its related with the Programmers Toolkit, could you please give me some hints how to solve this as a novice to programming? Thank you very much in advance :)

EDIT: For all you guys, who might deal with that kind of error, the reason may be related to the name of the file or .inp file, for instance when name contains some diacritics like ę, ś, ą etc. But some .inps do not work anyway for no reason.

epynet assumes IDs to be encoded using UTF-8

epanet2.py makes extensive use of str.decode()/encode() to convert between string representations. Since no character set argument is provided, decode() will try to parse the provided bytes as UTF-8 and vice versa.

I am finding that the use of UTF-8 in EPANET files is certainly not universal. It would therefore be good if the character set would be configurable.

Doesn't allow to change Node (reservoir) head.

Hi,

I am wondering why the function ENsetnodevalue (epynet/epynet/epanet2.py) doesn't allow to change the head of the node?
I have a reservoir in my network and I want to change its total head value from epynet.

Thanks

Issue - traceback

Hello, I'm trying to run epynet (I'm kinda new to python). I got following issue after trying to solve network (PyCharm). Would you please be so kind and help me to make it work? Thank you in advance.

Traceback (most recent call last):
File "C:/DEV/1_EDU/epynet/try_epynet.py", line 3, in
dupa = Network('network.inp')
File "C:\DEV\Python\lib\site-packages\epynet-0.1-py3.6.egg\epynet\network.py", line 14, in init
self.ep = epanet2.EPANET2()
File "C:\DEV\Python\lib\site-packages\epynet-0.1-py3.6.egg\epynet\epanet2.py", line 26, in init
self.lib = ctypes.CDLL(dll_path)
File "C:\DEV\Python\lib\ctypes_init
.py", line 348, in init
self._handle = _dlopen(self._name, mode)
OSError: [WinError 193] %1 is not a valid Win32 system app

Documentation

Hi Everybody,

I love the pythonic interface for dealing with epanet simulations, but will there be a documentation available soon?

I think a simple list of what properties can be retrieved from the result and which properties of the network can be manipulated (with their units) would already do the trick.

regards from germany

Chris

error on patterns

trying to access the indices of the patters (the *.inp file has already a pattern)
running the code below will result an error,

network.patterns.index

AttributeError: 'bytes' object has no attribute 'encode'

when i try to print the patterns, this is the result

network.patterns

{b'demand': <epynet.pattern.Pattern at 0x22917498c88>,
b'head': <epynet.pattern.Pattern at 0x22917498be0>}

need help on accessing existing patterns in the *.inp file, thank you

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.