asselapathirana / epanettools

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

Large model inefficiencies #30

Closed tylorbayer closed 4 years ago

tylorbayer commented 5 years ago

Through testing with larger models (9000+ nodes and 10000+) I have found 2 issues with efficiency:

First of all it seems like .run() and .runq() are doing essentially the same thing twice.. they both take almost exactly the same amount of time to run which leads me to think if you could somehow combine the run and the runq into one it would really speed up run time. With the large models I described above, es.run() takes about 8 minutes and then right after that es.runq() takes another 8 minutes. I have a suspicion that combining the two would not take 16 mins to run.

Secondly, once the model has run (by this point 16 minutes have now elapsed) looping through and getting the results of each node and link takes about double that time! I'm not sure if the inefficiency is on my end of the wrapper's but it doesn't seem right that getting the results should take double the time it takes the model to run.

Here is my code for getting the node results (I get the results for links in a similar way):

node_list = es.network.nodes
nodes = {}

for node in node_list:
    node = node + 1
    node_id = node_list[node].id

    nodes[node_id] = {}
    nodes[node_id]["EN_QUALITY"] = node_list[node_id].results[12]
    nodes[node_id]["EN_PRESSURE"] = node_list[node_id].results[11]
    nodes[node_id]["EN_HEAD"] = node_list[node_id].results[10]
    nodes[node_id]["EN_DEMAND"] = node_list[node_id].results[9]

If you have any ideas on either of these problems it would be very appreciated! Thank you.