Skip to main content

EpanetWrapper

Overview​

EpanetWrapper is a .NET wrapper for EPANET's native functions, providing a managed interface to the EPANET simulation engine within the HydroTrek DWD Suite.

Technical Specifications​

  • Target Framework: .NET 8.0
  • Platform: x64
  • Architecture: Class Library
  • EPANET Version: 2.2

Dependencies​

Internal Project References​

  • HTLogger (Internal logging system)

Native Dependencies​

  • EPANET native libraries (epanet2.dll)

Core Features​

1. EPANET Integration​

  • Native function wrapping
  • Memory management
  • Error handling
  • Type-safe interfaces

2. Simulation Control​

  • Hydraulic calculations
  • Water quality simulations
  • Network element management
  • Time-step control

3. Data Management​

  • Network model handling
  • Results processing
  • Memory optimization
  • Resource cleanup

Key Components​

Native Interface​

  • P/Invoke declarations
  • Memory management
  • Error handling
  • Type conversions

Simulation Engine​

  • Hydraulic solver interface
  • Water quality solver interface
  • Network topology management
  • Results collection

Resource Management​

  • Memory allocation
  • Resource cleanup
  • Error recovery
  • Performance optimization

Technical Implementation​

Native Function Wrapping​

  • P/Invoke declarations for EPANET functions
  • Memory management for unmanaged resources
  • Error handling and propagation
  • Type-safe interfaces

Simulation Control​

  • Hydraulic calculations
  • Water quality simulations
  • Network element management
  • Time-step control

Best Practices​

Memory Management​

  • Proper resource disposal
  • Memory leak prevention
  • Efficient allocation
  • Cleanup procedures

Error Handling​

  • Exception management
  • Error propagation
  • Recovery procedures
  • Logging integration

Performance​

  • Native call optimization
  • Memory usage optimization
  • Resource management
  • Thread safety

Integration Guidelines​

Usage Patterns​

  • Initialization sequence
  • Resource management
  • Error handling
  • Cleanup procedures

Best Practices​

  • Proper resource disposal
  • Error handling
  • Performance optimization
  • Thread safety

Future Considerations​

Enhancements​

  • Additional EPANET features
  • Performance optimizations
  • Memory management improvements
  • Error handling enhancements

Integration​

  • Additional simulation engines
  • Extended functionality
  • Enhanced error handling
  • Improved performance

Documentation​

  • API documentation
  • Usage examples
  • Best practices
  • Performance guidelines