Exemplo n.º 1
0
    def __init__(self,
                 network,
                 output,
                 tasmax,
                 years=82,
                 timestep=60 * 60,
                 tmp_dir='data/tmp/'):
        # super().__init__(output, tasmax, years=years, timestep=timestep, tmp_dir=tmp_dir)
        self.tmp_dir = tmp_dir
        self.tasmax = tasmax
        self.pumps = list()
        self.pipes = list()
        self.nodes = list()
        self.current_time = 0
        self.current_temp = 0.0
        self.timestep = timestep
        self.time = ((48 * 60 * 60) + (years * self.year))
        self.years = years

        rmtree(self.tmp_dir, ignore_errors=True)
        makedirs(tmp_dir)
        et.ENopen(network, output, '')
        et.ENsettimeparam(0, self.time)
        network = tmp_dir + network.split('/')[-1]
        output = tmp_dir + output.split('/')[-1]
        et.ENsaveinpfile(network)
        et.ENclose()
        et.ENopen(network, output, '')
        self.network = network
Exemplo n.º 2
0
def setDiameter(id,value):
    errcode=et.ENopen(Inp,"BUFF.rpt","")
    [errcode,index]=et.ENgetlinkindex(id)
#    [errcode,diameter]=et.ENgetlinkvalue(index,et.EN_DIAMETER)
    et.ENsetlinkvalue(index,et.EN_DIAMETER,value)
    errcode=et.ENsaveinpfile(InpCopy)
    errcode=et.ENclose()
Exemplo n.º 3
0
def setElevation(id,value):
    errcode=et.ENopen(Inp,"BUFF.rpt","")
    [errcode,index]=et.ENgetnodeindex(id)
    [errcode,elevation]=et.ENgetnodevalue(index,et.EN_ELEVATION)
    et.ENsetnodevalue(index,et.EN_ELEVATION,elevation+value)
    errcode=et.ENsaveinpfile(InpCopy)
    errcode=et.ENclose()
Exemplo n.º 4
0
def saveInpfile(fileName):
    errcode = et.ENsaveinpfile(fileName)
Exemplo n.º 5
0
def copyInp(INP):
    errcode=et.ENopen(INP,"BUFF.rpt","")
    errcode=et.ENsaveinpfile(InpCopy)
    errcode=et.ENclose()
 def test_alter_with_ENset_and_check_with_a_file(self):
     self.Error(et.ENsaveinpfile("1.inp"))
     self.Error(et.ENsetlinkvalue(81, 0, 9999))
     self.Error(et.ENsaveinpfile("2.inp"))
     self.assertEqual(tt.compareFiles("1.inp", "2.inp"), '16>1e+04; ')