예제 #1
0
 def test_pickle(self):
     test = residential.Household('Example')
     test.simulate()
     test.pickle()
     bistest = cPickle.load(open('Example.p', 'rb'))
     self.assertTrue(len(bistest.occ) != 0)
     print '\n'
예제 #2
0
 def test_creation_2(self):
     test = residential.Household(self.name, members=['FTE', 'PTE'])
     self.assertEqual(test.name, self.name)
     self.assertTrue(len(test.apps) != 0)
     self.assertTrue(len(test.members) != 0)
     self.assertTrue(len(test.clustersList) != 0)
     print '\n'
예제 #3
0
 def simulate(self, path):
     '''
     Simulate all households in the depicted feeder
     '''
     #######################################################################
     # we loop through all households for creation, simulation and pickling.
     # whereas the output is done later-on.
     cwd = os.getcwd()
     for i in range(self.nBui):
         hou = residential.Household(str(self.name) + '_' + str(i))
         hou.simulate()
         os.chdir(path)
         hou.pickle()
         os.chdir(cwd)
예제 #4
0
    for app in appliances:
        n.update({app: 0})  # total cycles
        n.update({app + '_n':
                  0})  # amount of household that have the appliance

    for flow in flows:
        n.update({flow: 0})
        n.update({flow + '_n': 0})

    n.update({'Eload': 0})  # annual electricity load in kWh
    n.update({'QCon': 0})  # annual convective internal heat gains in kWh

    for i in range(N):
        print('##############################################Test house ' +
              str(i) + ' created, repetition ' + str(j))
        test = residential.Household('Test_' + str(i))
        test.simulate()
        ###########  to save time & space, don't save individual simulation results
        #        os.chdir(cwd + '\\Calibration')
        #        test.pickle()
        #        os.chdir(cwd)

        # fill dictionary with data from calibration simulations
        #    for i in range(N):
        #        if i in range(0,N,10) : print('Test house '+str(i) + ' being processed')
        #        test = cPickle.load(open('Calibration\\Test_'+str(i)+'.p','rb'))
        n.update({'Eload': n['Eload'] + int(np.sum(test.P) / 60 / 1000)
                  })  # annual electricity load in kWh
        n.update({'QCon': n['QCon'] + int(np.sum(test.QCon) / 60 / 1000)
                  })  # annual convective internal heat gains in kWh
        for app in appliances:
예제 #5
0
 def test_simulation(self):
     test = residential.Household('Example')
     test.simulate()
     self.assertTrue(len(test.occ) != 0)
     print '\n'