WNTR icon indicating copy to clipboard operation
WNTR copied to clipboard

Results and Control updates for testing and stepwise.

Open kbonney opened this issue 1 year ago • 2 comments

Summary

  • Extended functionality of the results object by adding the ability to perform operations such as addition between two results objects.
  • Added _shift method to Control base class and implemented on some sub classes- "Shift any SimTimeConditions within larger condition rules by value seconds (backward)."
  • set_initial_conditions() method added to water network model class which "Sets the initial conditions of the network based on prior simulation results." This method utilized the _shift method defined above.
  • Updates the link_status conversions performed during inp file reading to reflect conditions more accurately.

Tests and documentation

Updates to result object are used to restructure test_multiple_simuluations.py, which has been split into the following files:

  • test_stop_start_sim.py: tests the use of set_initial_conditions to perform a simulation in multiple steps. (EpanetSim and WNTRSim).
  • test_pickle_reset: tests that results are consistent when pickling a water network and using reset_initial_conditions
  • test_reset_initial_values: tests that reset_initial_values gives approximately the same results before and after its use.

Additionally, a test for the new results object was added in test_results.py

Acknowledgement

By contributing to this software project, I acknowledge that I have reviewed the software quality assurance guidelines and that my contributions are submitted under the Revised BSD License.

kbonney avatar Aug 31 '23 16:08 kbonney

Coverage Status

coverage: 84.553% (+0.1%) from 84.404% when pulling 29fa5c9db44a4e3632d639f7ca305768ef3a47ea on kbonney:results into 435d505e2299cb47e1664169bbc9ebc051114897 on USEPA:main.

coveralls avatar Aug 31 '23 18:08 coveralls

TODO:

  • Check reset_initial_values function to make sure it is working properly and add a test.
  • Make sure WNTR resets after running sim so that it is aligned with EPANET.

kbonney avatar Oct 23 '23 17:10 kbonney