Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot set initial quality value to achieve a hot start for a quality analysis of type Trace #818

Open
pierreAuck opened this issue Nov 4, 2024 · 3 comments

Comments

@pierreAuck
Copy link

We are trying to run a trace analysis on a large network and update it regularly as new data arrives, using the EPANET toolkit. In order to do that efficiently, we would like store the values at the end of a run, and initialize the initial trace value at each node using the values stored (i.e. hot-start the model).

We were hoping to use EN_INITQUAL, but it seemed do be ignored when doing a trace analysis (and only then, it seems to work fine on water age and chemical analysis). After looking at the code, we saw that indeed setting the initial quality value in that case is explicitely prevented in the source code:

EPANET/src/quality.c

Lines 137 to 138 in fbd005d

if (qual->Qualflag == TRACE) qual->NodeQual[i] = 0.0;
else qual->NodeQual[i] = net->Node[i].C0;

Do you know why this limitation has been added? Is there another way to achieve the desired result? I don't understand why EPANET would allow setting initial quality value for chemical simulation and not for trace, to me both seem very similar.

@LRossman
Copy link
Collaborator

LRossman commented Nov 4, 2024

A possible work around is to set up your model to simulate a conservative (non-reactive) chemical whose concentration is a constant value of 100 at the source node. If that node is a Reservoir node then you simply set its initial concentration to 100. If it is a Junction or Tank node then you add a SETPOINT source to it whose baseline value is 100. The simulated concentration results would be interpreted as percent of water from the source node, not as an actual concentration.

@pierreAuck
Copy link
Author

Thank you for the fast answer! We were thinking of such a workaround but it is reassuring to hear it from you, we will try that.

I still wonder about the reason for this limitation, we would not want to stumble across an issue that was already dealt with in the past. Is it something that could be removed ideally or is there a good reason for it?

@samhatchett
Copy link
Member

not sure if this is exactly what's being asked, but it is absolutely possible to set network-wide quality conditions on-the-fly using the API.

My use case was making a long-running simulation to be resilient to process lifecycle interruptions (powercycle / container restart etc.). So when the process executes it will check for existing state saved somewhere and load it back into the epanet model. Snippet here:

https://github.com/OpenWaterAnalytics/epanet-rtx/blob/dev/src/EpanetModel.cpp#L1087-L1117

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants