USEPA / WNTR

An EPANET compatible python package to simulate and analyze water distribution networks under disaster scenarios.
Other
312 stars 181 forks source link

Feature request: US customary units support #30

Open kevbroch opened 6 years ago

kevbroch commented 6 years ago

Then wouldn't have to do the conversion on wntr.add_* or on the results. Something like: wn = wntr.network.WaterNetworkModel(units='USC') Gets me EPANET inp files defaults. (If only the US would have switched over with the Brit's these thoughts wouldn't even cross my mind :) )

kaklise commented 6 years ago

We decided to use SI units throughout WNTR to simplify the code base and avoid confusion about units. WNTR supports building models from EPANET inp files using all 10 EPANET systems of units (CFS, GPM, ect). However, if you are building a model from scratch, input values must be in SI units. This requires that input is converted each time add_* is called. We suggest using the Sympy package (or simple multiplier) to customize that process. The Results DataFrame can also be converted in a similar manner. It's possible that a limited set of these features could be embedded in WNTR. I suggest we keep the feature request open and get input from other users.

N-abdel commented 6 years ago

Hi, I'm having an issue with the units right now too. When I use the PDD, the results make sense (though I'm not sure what units the output is in). When I use the wntr demand driven approach, the node pressures are all negative (for the same exact network) and seem to be in pascals. I don't know how to check what units my results are in (this is the biggest issue). Can anyone help me with this?

I am using pressure units of meters per head to query my results, and so I'm also not sure if it should be in pascals instead. Any help is much appreciated!

michaelbynum commented 6 years ago

I believe all pressures in WNTR have units of meters. The online documentation (http://wntr.readthedocs.io/en/latest/units.html) is a good resource for this. @kaklise However, I think this brings up an issue with the documentation on that page. "Water pressure" is correctly labeled as having units of meters. However, we also list "pressure" as having units of Pa. I could be mistaken, but I don't think we use Pa anywhere within WNTR. I also don't know of a reason to list "pressure" separate from "water pressure" since every pressure in WNTR is "water pressure".

N-abdel commented 6 years ago

Thank you so much for the quick response!

michaelbynum commented 6 years ago

No problem. Did I answer your question?

On Jan 21, 2018 1:11 PM, "N-abdel" notifications@github.com wrote:

Thank you so much for the quick response!

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/USEPA/WNTR/issues/30#issuecomment-359276804, or mute the thread https://github.com/notifications/unsubscribe-auth/ATdOLjgVO563B9NcshmGG1HPJk0NkAd5ks5tM5oLgaJpZM4PhuA1 .

N-abdel commented 6 years ago

Yes, but I do still have to figure out why using wntr simulator is giving my pressures in the negative thousands for an intact network, but if I run the .inp file through epanet, the the pressures are alright.

michaelbynum commented 6 years ago

Can you share your model?

On Jan 21, 2018 3:12 PM, "N-abdel" notifications@github.com wrote:

Yes, but I do still have to figure out why using wntr simulator is giving my pressures in the negative thousands for an intact network, but if I run the .inp file through epanet, the the pressures are alright.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/USEPA/WNTR/issues/30#issuecomment-359285850, or mute the thread https://github.com/notifications/unsubscribe-auth/ATdOLs1dEQMp1CuSXLUdQENLm_sQPraxks5tM7YygaJpZM4PhuA1 .

N-abdel commented 6 years ago

The units are set to Ft, GPM and CFS, but when I save as .txt to upload to GitHub that section is cut off; just wanted to let you know. Also, the headless formula is set to Hazen Williams.

kaklise commented 6 years ago

I ran the model with the EpanetSimulator and the WNTRSimulator (demand driven). The results are very similar and pressures are not negative. Are you using the latest version of WNTR (0.1.4)?

I'll update the documentation to remove Pa. All pressure data is in meter (water pressure).

N-abdel commented 6 years ago

I am using v. 1.3. Do you think that may be the issue? I will download 1.4 and run on that version, hopefully it will run alright since you were able to run it. Thank you, this is a great tool!

On Mon, Jan 22, 2018 at 5:23 PM, Katherine Klise notifications@github.com wrote:

I ran the model with the EpanetSimulator and the WNTRSimulator (demand driven). The results are very similar and pressures are not negative. Are you using the latest version of WNTR (0.1.4)?

I'll update the documentation to remove Pa. All pressure data is in meter (water pressure).

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/USEPA/WNTR/issues/30#issuecomment-359591052, or mute the thread https://github.com/notifications/unsubscribe-auth/Af8inJxEpMT4qyly39SCWMT9c9vIRlhxks5tNQpZgaJpZM4PhuA1 .

-- -Noha

michaelbynum commented 6 years ago

PR #37 has updated documentation on units which should clear up the question about units of pressure. @N-abdel If you would like to continue the discussion of negative pressures with the WNTRSimulator, let's do so offline. We are getting off topic for this issue. You can email Kate at kaklise@sandia.gov.

N-abdel commented 6 years ago

Hi, I just wanted to update you that when I switched to v. 1.4, I get meters of head that do make sense, thank you! The simulations work fine for the demand driven wntr simulator, but for pressure driven demand, for the same network, I get the following error:

"RuntimeWarning: divide by zero encountered in power last_segment = (-0.5)j_d/(nomP-minP)((P-minP)/(nomP-minP))(-0.5) /Users/noha/Downloads/WNTR-master/wntr/sim/hydraulics.py:722: RuntimeWarning: invalid value encountered in multiply last_segment = (-0.5)j_d/(nomP-minP)((P-minP)/(nomP-minP))(-0.5) /Users/noha/Downloads/WNTR-master/wntr/sim/hydraulics.py:1006: RuntimeWarning: invalid value encountered in sqrt last_segment = (Dact - j_d*((P-minP)/(nomP-minP))0.5) /Users/noha/Downloads/WNTR-master/wntr/sim/hydraulics.py:722: RuntimeWarning: invalid value encountered in power last_segment = (-0.5)j_d/(nomP-minP)((P-minP)/(nomP-minP))(-0.5) Traceback (most recent call last):

File "", line 1, in results = sim.run_sim()

File "/Users/noha/Downloads/WNTR-master/wntr/sim/core.py", line 239, in run_sim raise RuntimeError('Simulation did not converge!')

RuntimeError: Simulation did not converge!"

I am not sure what would cause this (especially for the in tact network)? To be able to run any fragility analyses I think I have to figure out a way to use the pressure driven simulator. I really appreciate your help!

Thank you in advance,

On Mon, Jan 22, 2018 at 5:23 PM, Katherine Klise notifications@github.com wrote:

I ran the model with the EpanetSimulator and the WNTRSimulator (demand driven). The results are very similar and pressures are not negative. Are you using the latest version of WNTR (0.1.4)?

I'll update the documentation to remove Pa. All pressure data is in meter (water pressure).

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/USEPA/WNTR/issues/30#issuecomment-359591052, or mute the thread https://github.com/notifications/unsubscribe-auth/Af8inJxEpMT4qyly39SCWMT9c9vIRlhxks5tNQpZgaJpZM4PhuA1 .

-- -Noha

michaelbynum commented 6 years ago

I'm glad to hear the demand driven simulation is working well. Can we continue the conversation about the pressure driven simulation via email? I think it will be easier that way, and I'm not sure this issue is the correct place for that conversation. You can reach @kaklise at kaklise@sandia.gov. She will then add me into the conversation.

Evelyn0123 commented 1 year ago

Hi, I just wanted to update you that when I switched to v. 1.4, I get meters of head that do make sense, thank you! The simulations work fine for the demand driven wntr simulator, but for pressure driven demand, for the same network, I get the following error: "RuntimeWarning: divide by zero encountered in power last_segment = (-0.5)j_d/(nomP-minP)((P-minP)/(nomP-minP))(-0.5) /Users/noha/Downloads/WNTR-master/wntr/sim/hydraulics.py:722: RuntimeWarning: invalid value encountered in multiply last_segment = (-0.5)j_d/(nomP-minP)((P-minP)/(nomP-minP))(-0.5) /Users/noha/Downloads/WNTR-master/wntr/sim/hydraulics.py:1006: RuntimeWarning: invalid value encountered in sqrt last_segment = (Dact - j_d*((P-minP)/(nomP-minP))0.5) /Users/noha/Downloads/WNTR-master/wntr/sim/hydraulics.py:722: RuntimeWarning: invalid value encountered in power last_segment = (-0.5)j_d/(nomP-minP)((P-minP)/(nomP-minP))(-0.5) Traceback (most recent call last): File "", line 1, in results = sim.run_sim() File "/Users/noha/Downloads/WNTR-master/wntr/sim/core.py", line 239, in run_sim raise RuntimeError('Simulation did not converge!') RuntimeError: Simulation did not converge!" I am not sure what would cause this (especially for the in tact network)? To be able to run any fragility analyses I think I have to figure out a way to use the pressure driven simulator. I really appreciate your help! Thank you in advance, On Mon, Jan 22, 2018 at 5:23 PM, Katherine Klise @.***> wrote: I ran the model with the EpanetSimulator and the WNTRSimulator (demand driven). The results are very similar and pressures are not negative. Are you using the latest version of WNTR (0.1.4)? I'll update the documentation to remove Pa. All pressure data is in meter (water pressure). — You are receiving this because you commented. Reply to this email directly, view it on GitHub <#30 (comment)>, or mute the thread https://github.com/notifications/unsubscribe-auth/Af8inJxEpMT4qyly39SCWMT9c9vIRlhxks5tNQpZgaJpZM4PhuA1 . -- -Noha

Hi, I also encountered this problem when using version 0.1.3 of WNTR for my water network model. It gives me the same RuntimeWarning, but I can still get results. Could anyone tell me why this is happening? Thank you.

kaklise commented 1 year ago

I suggest that you update WNTR to the latest version (0.5.0). If you are still seeing this issue after updating the code, please open a new ticket related to the simulation RuntimeWarning.