def setConfiguration(self, msg, **kwargs): DispatchAgent.setConfiguration(self, msg, **kwargs) '''From simple_client > client.py''' from magi.testbed import testbed if self.clientId == None: self.hostname = testbed.nodename log.info("Hostname: %s", self.hostname) self.clientId = self.hostname # The clientId can be set programmatically to append the hostname . self.setClientid() self.commClient = None '''Parsing for Parameters''' # create list of strings with open("/users/rning/magi-modules/SmartGridSchool/Parameters.conf", "r") as paramFile: self.paramList = paramFile.read().splitlines() # define the global parameters self.day = float(self.paramList[0][len("day:"):]) self.panelEff = float(self.paramList[1][len("panelEff:"):]) # define the parameters unique to the building # UNTIL SERVER PARAMS ARE IMPLEMENTED: if self.hostname != "server": index = self.paramList.index(self.hostname) self.area = float(self.paramList[index+1][len("area:"):]) self.volume = float(self.paramList[index+2][len("volume:"):]) self.panelArea = float(self.paramList[index+3][len("panelArea:"):]) # set panelTracking to false as default, if true, then set self.panelTracking = False if self.paramList[index+4][len("panelTracking:"):] == "True": self.panelTracking = True self.pAZA = float(self.paramList[index+5][len("pAZA:"):]) self.pELA = float(self.paramList[index+6][len("pELA:"):]) self.lightDraw = float(self.paramList[index+7][len("lightDraw:"):]) self.baselineCe = float(self.paramList[index+8][len("baselineCe:"):]) self.outlets = float(self.paramList[index+9][len("outlets:"):]) self.applianceDraw = float(self.paramList[index+10][len("applianceDraw:"):]) self.tempAC = float(self.paramList[index+11][len("tempAC:"):]) self.timeAC = self.paramList[index+12][len("timeAC:"):] # convert string from param file to list self.timeAC = [] # list: [ day start, day end, time of day start, time of day end ] ACList = self.paramList[index+12][len("timeAC:"):] timeACIndex = 0 endIndex = 0 for letter in ACList: if letter == "," or letter == "[": endIndex = timeACIndex + 1 while ACList[endIndex] != "," and ACList[endIndex] != "]": endIndex += 1 self.timeAC.append(float(ACList[timeACIndex + 1: endIndex])) timeACIndex = endIndex self.thermalLeakCe = float(self.paramList[index+13][len("thermalLeak:"):]) self.thermalPower = float(self.paramList[index+14][len("thermalPower:"):])
def setConfiguration(self, msg, **kwargs): DispatchAgent.setConfiguration(self, msg, **kwargs) from magi.testbed import testbed if self.clientId == None: self.hostname = testbed.nodename log.info("Hostname: %s", self.hostname) self.clientId = self.hostname # The clientId can be set programmatically to append the hostname . self.setClientid() self.commClient = None
def setConfiguration(self, msg, **kwargs): DispatchAgent.setConfiguration(self, msg, **kwargs) from magi.testbed import testbed if self.clientId == None: self.hostname = testbed.nodename log.info("Hostname: %s", self.hostname) self.clientId = self.hostname # The clientId can be set programmatically to append the hostname . self.setClientid() self.commClient = None