asselapathirana / epanettools

EPANET calling API for python.
Other
16 stars 13 forks source link

Comparison of node output pressure Epanet vs Python #21

Open iespinosa opened 7 years ago

iespinosa commented 7 years ago

Hello, good afternoon, I have used example3 for this test. After running the code (below), I am comparing the graphs on node pressure from EPANET and Python, to check that they match. I am getting one different value on pressure (also on demand), for all nodes (as said, just for one specific hour, the other values seem to be all ok/shifted after the wrong value). Do you know what the error could be? Thank you Best regards

CODE: import os, pprint pp=pprint.PrettyPrinter() # we'll use this later. from epanettools.epanettools import EPANetSimulation, Node, Link, Network, Nodes, Links, Patterns, Pattern, Controls, Control # import all elements needed from epanettools.examples import simple # this is just to get the path of standard examples import matplotlib.pyplot as plt file = os.path.join(os.path.dirname(simple.file),'Net3.inp') # open an example es=EPANetSimulation(file)

hours=range(0,25)

indexes of nodes and pipes

n=es.network.nodes m=es.network.links

ids of nodes and pipes

n_id=(es.network.nodes[x].id for x in n) m_id=(es.network.links[x].id for x in m)

es.run() p=Node.value_type['EN_PRESSURE'] d=Node.value_type['EN_DEMAND']

p1=[] for i in range(0,25): p1.append(n[57].results[p][i] )

d1.append(n[70].results[d][i] )

plt.plot(hours,p1) plt.xticks(range(0,25)) plt.grid(True) plt.show()

asselapathirana commented 7 years ago

Hi,

Thank you for reporting this. I'll try to have a look at this when I have some time (which could be in a week or two - sorry).

Regards,

Assela

Assela Pathirana, UNESCO-IHE Institute for Water Education T: +31(0)15 215 1854 Westvest 7, 2611 AX Delft, The Netherlands

On 19 January 2017 at 12:05, iespinosa notifications@github.com wrote:

Hello, good afternoon, I have used example3 for this test. After running the code (below), I am comparing the graphs on node pressure from EPANET and Python, to check that they match. I am getting one different value on pressure (also on demand), for all nodes (as said, just for one specific hour, the other values seem to be all ok/shifted after the wrong value). Do you know what the error could be? Thank you Best regards

CODE: import os, pprint pp=pprint.PrettyPrinter() # we'll use this later. from epanettools.epanettools import EPANetSimulation, Node, Link, Network, Nodes, Links, Patterns, Pattern, Controls, Control # import all elements needed from epanettools.examples import simple # this is just to get the path of standard examples import matplotlib.pyplot as plt file = os.path.join(os.path.dirname(simple.file),'Net3.inp') # open an example es=EPANetSimulation(file)

hours=range(0,25) indexes of nodes and pipes

n=es.network.nodes m=es.network.links ids of nodes and pipes

n_id=(es.network.nodes[x].id for x in n) m_id=(es.network.links[x].id for x in m)

es.run() p=Node.value_type['EN_PRESSURE'] d=Node.value_type['EN_DEMAND']

p1=[] for i in range(0,25): p1.append(n[57].results[p][i] )

d1.append(n[70].results[d][i] )

plt.plot(hours,p1) plt.xticks(range(0,25)) plt.grid(True) plt.show()

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/asselapathirana/epanettools/issues/21, or mute the thread https://github.com/notifications/unsubscribe-auth/AAT7VzsUO-JrjWqpInPgXlZvxQUoDennks5rT0NigaJpZM4Ln-Sg .

Qingshuai commented 4 years ago

@iespinosa Hello, I think we have the same error. Have you fixed this?

I find when code: print(np.array(es.network.time)/3600)

Get result: [ 0. 1. 2. 3. 4. 4.22583333

          1. 10.
            1. 16.
            1. 21.3275
        1. ]

SO,it actually get 27 pressure(any node_value),not accord to 24 hours.

Thank you Best regards