def connectToDB(): #----- Connect to the Database MySql = MySQLdb.connect(host='localhost', user='******', passwd='tom.tom', db='einstein') Status.SQL = MySql Status.DB = pSQL.pSQL(MySql, 'einstein') print "data base connected ",Status.SQL,Status.DB
self.HCGTEfficiency.setEstimate(5.0,limits=(2.0,8.0)) elif self.EquipeClass in ["CHP"]: self.HCGTEfficiency.setEstimate(0.55,limits=(0.4,0.9)) self.HCGEEfficiency.setEstimate(0.35,limits=(0.1,0.6)) self.PartLoad.setEstimate(0.5,limits=(0.1,0.9)) #============================================================================== if __name__ == "__main__": # direct connecting to SQL database w/o GUI. for testing only stat = Status("testCheckProc") Status.SQL = MySQLdb.connect(user="******", db="einstein") Status.DB = pSQL.pSQL(Status.SQL, "einstein") Status.PId = 41 Status.ANo = -1 #.............................................................................. screen = CCScreen() ccEq = CheckEq(1) # creates an instance of class CCheck ccEq.check() ccEq.exportData(1) ccEq.screen() screen.show() #==============================================================================
Status.int.QWHEqTotal_Tt = Status.int.createQ_Tt() equipments = Status.prj.getEquipments() for equipe in equipments: j = equipe.EqNo - 1 for iT in range(Status.NT+2): for it in range(Status.Nt): Status.int.QWHEqTotal_Tt[iT][it] += Status.int.QWHj_Tt[j][iT][it] Status.int.QWHEqTotal_t = copy.deepcopy(Status.int.QWHEqTotal_Tt[0]) Status.int.QWHEqTotal_T = Status.int.calcQ_T(Status.int.QWHEqTotal_Tt) Status.int.QWHEqTotal = Status.int.QWHEqTotal_T[0] #============================================================================== if __name__ == "__main__": print "Testing moduleEnergy" import einstein.GUI.pSQL as pSQL, MySQLdb from einstein.modules.myInterfaces import * sql = MySQLdb.connect(user="******", db="einstein") DB = pSQL.pSQL(sql, "einstein") stat = Status("testModuleEnergy") Status.DB = DB interf = Interfaces(80,8760) print "instantiating moduleEnergy" mod = ModuleEnergy() mod.runSimulation()