CWSNet Library

CWSNet is an open-source library for water distribution system modelling where all the various parts of the hydraulic model are completely developed in C++ using an object-oriented programming (OOP) model. The aim is to develop a library that can be easily extended while providing high computational performance.

The idea behind this software is to simplify development and testing of new hydraulic elements (specific types of valves, pumps, etc) and computational algorithms (pressure-driven approaches, etc.) by keeping logically independent parts of the code separate. This also allows the performance and accuracy of new computational methods as well as the use of advanced programming techniques to be studied without the need for extensive code refactoring.

Aims and features

  • Highly expandable:
    • Written in C++ using the object-oriented programming model (OOP).
    • The internal structure of the library is divided in three layers:
      • Network layer.
      • Hydraulic solver layer.
      • Mathematical layer.
    • Use of linear algebraic operations: implementation of new computational methodologies is easy, for example, adding a new hydraulic solver.
    • Able to apply several simulation engines (implementations of a hydraulic solver, water quality analysis etc) to the same model and combine them into an EPS.
    • The outputs of an EPS can be substantially customized.
  • High performance:
    • Runs different simulations of the same network or different networks in parallel (thread-safe).
    • Able to change the linear solver and the matrix representation used to solve the system of linear equations.
    • Ready to use with OpenMP, GPGPU (CUDA) and Vectorisation .
  • EPANET2 compatibility:
    • Reads EPANET2 input files.
    • Contains a Demand-Driven Global Gradient Algorithm (GGA) solver.
    • Produces comparable hydraulic solutions for a number of publicly available networks.
  • Widely used:
    • Open source - MIT License.
    • Runs on multiple OS and compile on multiple compilers:
      • Windows - Visual Studio C++ 2008/2010.
      • Linux - GCC.
    • Plenty of documentation available:
      • A guide to the installation, use and development of the library in Wiki format.
      • The API documentation automatically generated from the source code using Doxygen.
      • A ticket system publically available that can be used for reports of bugs and task requests.


To obtain the binary or the source code of the library, please visit the link

To obtain news and information about the project, please visit the project site on sourceforge at

To obtain the library documentation or to participate actively in its development, please visit the main web-page of the software at

To request information about the library or to keep informed about the project community, please join the project mailing list at