j=Node.node_types['TANK'] sorted([y.id for x,y in n.items() if ( max(y.results[h])>0 and y.node_type==j )]) ''' Changing the network Currently the new (object-based) interface above only supports read access to the underlying network. To change the values of the network, it is recommended to use the Legacy interface calls. Legacy calls can be accessed from within the new interface. The steps in changing network: Create an object of EPANetSimulation with the network file Change needed values using ENsetxxxx calls (just changing the attributes of EPANetSimulation will not work!) Save the changed data to a new file using ENsaveinpfile. Create an object of EPANetSimulation with the new saved file. ''' d=Link.value_type['EN_DIAMETER'] e=Node.value_type['EN_ELEVATION'] es.network.links[81].results[d] # new interface es.ENgetnodevalue(55,e)[1] # low level interface es.network.nodes[55].results[e] #new interface r=es.ENsetlinkvalue(81,d,99) # now let's change values - link r # zero means no error! r=es.ENsetnodevalue(55,e,18.25) # change elevation of node r #zero means no error # Note: the original network is not changed! Only the low level values changed. This is a limitation of current implementation es.network.links[81].results[d], es.ENgetlinkvalue(81,d)[1], es.network.nodes[55].results[e], es.ENgetnodevalue(55,e)[1] # to permanantly change values, the changed network has to be written to a new file import tempfile, os f=os.path.join(tempfile.gettempdir(),"temp.inp") es.ENsaveinpfile(f) # save the changed file e2=EPANetSimulation(f) e2.network.links[81].results[d], e2.ENgetlinkvalue(81,d)[1], e2.network.nodes[55].results[e], e2.ENgetnodevalue(55,e)[1] # now in both high level and low level interfaces, we have the right value.