Error using ENinitH(1), but not ENinitH(0)


#1

I am currently carrying out an analysis that involves many thousand Epanet simulations for the same system. The first several thousand work fine, but after a certain number (always the same number), ENinitH(1) starts to return error code 305. If I change the code to use ENinitH(0) I have no such problem. Is anyone able to suggest what could be causing this? I need to use ENinitH(1) as I want to follow the hydraulic simulation with a quality one.

I do use ENopen and ENopenH at the start of every simulation and ENcloseH and ENclose at the end of each.

Thanks in advance for any suggestions.


#2

Chris, the number of simulations you are able to run is probably exactly equal to the macro TMP_MAX - right? You are running into a file limit issue. You can probably get around this by generating your own temp names (perhaps sequentially numbered), saving hydraulics to those files, and using ENusehydfile when you want to run quality.


#3

Ahah, that was just the explanation I was after, thank you very much. I knew I had to be hitting some sort of limit. I’ll have a go at doing what you suggested. Thanks again!


#4

Please let us know how it goes. I kept thinking that this issue has come up before, but all my searching turned up nil - would be nice to document the workaround. We also have a development version of the toolkit that allows for “in-flight” quality simulation (i.e., without saving hydraulics) but I wouldn’t call it ready for prime-time just yet. It will be included in the v2.2 release of the toolkit once our list of issues gets some attention.


#5

Sorted. I found the simplest solution was to add a HYDRAULICS SAVE filename line to the [OPTIONS] section. This means that the same file is overwritten in each subsequent simulation, but that is not a problem for what I’m doing.

I found the same issue had been discussed in the context of multiple runs for optimisation, which might have been what you were thinking of: Optimization with genetic algorithm