def _get_NetSize(self):
        """
        Populates object attributes with the water object counts
        """
        _lib.ENR_getNetSize(self.enrapi, _lib.ENR_nodeCount, byref(cint))
        self.nodeCount = cint.value

        _lib.ENR_getNetSize(self.enrapi, _lib.ENR_tankCount, byref(cint))
        self.tankCount = cint.value

        _lib.ENR_getNetSize(self.enrapi, _lib.ENR_linkCount, byref(cint))
        self.linkCount = cint.value

        _lib.ENR_getNetSize(self.enrapi, _lib.ENR_pumpCount, byref(cint))
        self.pumpCount = cint.value

        _lib.ENR_getNetSize(self.enrapi, _lib.ENR_valveCount, byref(cint))
        self.valveCount = cint.value
Esempio n. 2
0
def getnumvalves(addr):
    count= ctypes.c_int()
    errcheck(_lib.ENR_getNetSize(addr, _lib.ENR_valveCount, ctypes.byref(count)) )
    return count.value
from Externals.epanet.outputapi import outputapi as _lib

label  = _lib.String( (_lib.MAXID+1)*'\0')
errmsg = _lib.String( (_lib.MAXMSG+1)*'\0')
k=ctypes.c_int()
x= ctypes.c_float()

addr=ctypes.c_void_p()
filename= "Net1.bin"
if _lib.ENR_open(ctypes.byref(addr), filename) ==0 :
    print "\nfile {0} successfuly opened\n".format(filename)
else:
    exit()

if _lib.ENR_getNetSize(addr, _lib.ENR_nodeCount, ctypes.byref(k)) ==0 :
    print "nodes:     {0}".format(k.value)

if _lib.ENR_getNetSize(addr, _lib.ENR_tankCount, ctypes.byref(k)) ==0 :
    print "tanks:     {0}".format(k.value)

if _lib.ENR_getNetSize(addr, _lib.ENR_linkCount, ctypes.byref(k)) ==0 :
    print "links:     {0}".format(k.value)

if _lib.ENR_getNetSize(addr, _lib.ENR_pumpCount, ctypes.byref(k)) ==0 :
    print "pumps:     {0}".format(k.value)

if _lib.ENR_getNetSize(addr, _lib.ENR_valveCount, ctypes.byref(k)) ==0 :
    print "valves:     {0}".format(k.value)