def output(self): #temp = "[%f]" % (SystemSimulator().get_engine(self.engine_name).get_global_time()) student = self.student_list.pop(0) msg = SysMessage(self.get_name(), "process") #print(str(datetime.datetime.now()) + " Human Object:") msg.insert(student) return msg
def output(self): msg = SysMessage(self.get_name(), "takeout_trash") msg.insert(copy.deepcopy(self.family_type.get_members())) #print(self.family_type.get_stack_amount()) self.family_type.empty_stack() return msg
def output(self): if self._cur_state == "PROCESS": #print('[check]$') #print(self.human_port_map[self.recv_checker_port]) port = self.recv_checker_port.pop(0) msg = SysMessage(self.get_name(), self.human_port_map[port]) if self.can_size != 0: msg.insert(float(self.cur_amount / self.can_size)) else: msg.insert(1.0) #print("$") #print("[gc] " + str(float(self.cur_amount/self.can_size))) return msg if self._cur_state == "PROC_TRUCK": #print("!@@") # if self.avaliable_amount < 0: # self.avaliable_amount = 0 msg = SysMessage(self.get_name(), "res_garbage") if self.cur_amount < self.avaliable_amount: msg.insert(self.cur_amount) self.cur_amount = 0 elif self.avaliable_amount == 0: msg.insert(0) elif self.cur_amount >= self.avaliable_amount: self.cur_amount -= self.avaliable_amount msg.insert(self.avaliable_amount) return msg return None
def output(self): if self._cur_state == "WAIT": #print("[human] " + self.get_name(), self.human.get_trash(),SystemSimulator().get_engine("sname").get_global_time(),file=sys.__stdout__) msg = SysMessage(self.get_name(), "trash") msg.insert(self.human) return msg
def output(self): if self._cur_state == "PROCESS": url = PUBLIC_DATA_REQUEST_URL.format(quote(STATION), PUBLIC_DATA_SERVICE_KEY) request = urllib.request.Request(url) response = urllib.request.urlopen(request) rescode = response.getcode() if (rescode == 200): try: response_body = response.read() except (http.client.IncompleteRead) as e: response_body = e.partial parse = json.loads(response_body) for ret in parse['list']: print(type(ret)) values = list(ret.values()) wks = sh.worksheet('title', GOOGLE_WORKSHEET) wks.insert_rows(row=1, values=values) #e_mail.send_email("*****@*****.**", "Current Air Stat", "email/inform", list=values[1:40]) else: print("Error Code:" + rescode) # select the first sheet if int(values[6]) > 50: msg = SysMessage(self.get_name(), "alert") msg.insert(values) return msg else: return None
def output(self): if self._cur_state == "REQUEST": msg = SysMessage( self.get_name(), self.garbage_id_map[self.schedule[self.cur_index][0]]) msg.insert(self.truck_storage - self.truck_current_storage) return msg return None
def output(self): #temp = "[%f]" % (SystemSimulator().get_engine(self.engine_name).get_global_time()) #print(temp) msg = SysMessage(self.get_name(), "assess") #print(str(datetime.datetime.now()) + " Assess Object:") msg.insert(self._event_recv) self._event_recv = "" return msg
def output(self): if self._cur_state == "CHECK": if self.htype.is_vacation(): self.htype.satisfaction = None return None else: msg = SysMessage(self.get_name(), "check") msg.insert(self.htype) return msg if self._cur_state == "REPORT": #print('[check]#') msg = SysMessage(self.get_name(), "gov_report") msg.insert(self.htype) return msg return None
def output(self): if self.agents_to_process: message_to_handle = [] self.region.execution() exits = self.region.post_execution() if exits: for agent in exits: msg = SysMessage( self.get_name(), self.region.find_exit_port(agent.get_cell_idx())) msg.insert(agent) message_to_handle.append(msg) self.agents_to_process.clear() return message_to_handle else: return None