Closed alemanuel995 closed 6 months ago
HI @alemanuel995, could you provide a complete example using a network you provide or one of WNTR's example networks?
Hi @kbonney,
I'm going to attach here the inp file (in text format) I'm using for this concrete example: Red_prueba-GPM-DW 1.txt
Thank you!
@alemanuel995 Thank you. Please also provide a script which reproduces the problem you are encountering.
@alemanuel995 can you let us know the wntr version you are using? I loaded the INP file you sent and it pulled in the two different demands, and wrote them out properly, with the current WNTR version. Thanks!
In [16]: wn = wntr.network.WaterNetworkModel('Red_prueba-GPM-DW.1.txt')
In [17]: wn.nodes['6'].to_dict()
Out[17]:
{'name': '6',
'node_type': 'Junction',
'coordinates': (4414.716, 8015.608),
'demand_timeseries_list': [{'base_val': 0.0009999941867753685,
'pattern_name': 'P1',
'category': 'Usuario 1'},
{'base_val': 0.0019999884366409333,
'pattern_name': 'P2',
'category': 'Usuario 2'}],
'elevation': 10.00000032,
'emitter_coefficient': None,
'initial_quality': 0.0,
'minimum_pressure': None,
'pressure_exponent': None,
'required_pressure': None,
'tag': None}
In [18]: wn.nodes['15'].to_dict()
Out[18]:
{'name': '15',
'node_type': 'Junction',
'coordinates': (5518.395, 4593.088),
'demand_timeseries_list': [{'base_val': 0.0019999884366409333,
'pattern_name': 'P2',
'category': 'Usuario 3'},
{'base_val': 0.003749978247725279,
'pattern_name': 'P1',
'category': 'Usuario 4'}],
'elevation': 7.999994160000001,
'emitter_coefficient': None,
'initial_quality': 0.0,
'minimum_pressure': None,
'pressure_exponent': None,
'required_pressure': None,
'tag': None}
In [20]: wntr.__version__
Out[20]: '1.1.0'
@dbhart, I'm using the same version as you: 1.1.0. There must be something wrong in my code and I'll try to figure out.
Thank you!
@alemanuel995 you're welcome! Just to check, if you run the same code I put in my comment, are you seeing the two different demands also in the dictionaries?
@dbhart, yes. I see the two different demands. Thank you!
@alemanuel995 Glad to help!
Summary When creating a water network object and send it to a new inp file, the values in the [DEMANDS] section are repeated twice and there are values missing in this section from the original inp file.
Example [DEMANDS] ;ID Demand Pattern
6 31.700463 P2 ;Usuario 2 6 31.700463 P2 ;Usuario 2 15 59.438367 P1 ;Usuario 4 15 59.438367 P1 ;Usuario 4
In the original inp file, the [DEMANDS] section looks like this:
[DEMANDS] ;Junction Demand Pattern Category 6 15.850231 P1 ;Usuario 1
6 31.700463 P2 ;Usuario 2
15 31.700463 P2 ;Usuario 3
15 59.438367 P1 ;Usuario 4
I'm doing it like this:
wn variable is the instance of the water network. After adding a junction, I'm acessing that same node to add the demand. If not, the [DEMANDS] section remains empty, wich is worse.
Any sugesstion? Thank you!