Ejemplo n.º 1
0
    def __init__(self, instance_time, destruct_time, name, engine_name,
                 storage, schedule, outp):
        BehaviorModelExecutor.__init__(self, instance_time, destruct_time,
                                       name, engine_name)

        self.init_state("IDLE")
        self.insert_state("IDLE", Infinite)
        self.insert_state("INITAL_APPROACH", TRUCK_INITIAL)
        self.insert_state("REQUEST", 0)
        self.insert_state("APPROACH", TRUCK_CYCLE)

        self.insert_input_port("start")
        self.insert_input_port("end")

        self.garbage_id_map = {}
        self.garbage_port_map = {}
        self.truck_storage = storage
        self.extended_storage = storage  # 2 * storage
        self.original_storage = storage
        self.truck_current_storage = 0

        # for analysis
        self.accummulated_garbage = 0

        self.schedule = schedule
        # schedule = [(current_can_id, next_can_delay)]
        self.cur_index = 0
        # for file save
        self.outname = outp
Ejemplo n.º 2
0
 def __init__(self, instance_time, destruct_time, name, engine_name):
     BehaviorModelExecutor.__init__(self, instance_time, destruct_time,
                                    name, engine_name)
     self.init_state("IDLE")
     self.insert_state("IDLE", Infinite)
     self.insert_state("SEND", 1)
     self.insert_input_port("start")
Ejemplo n.º 3
0
 def __init__(self, instance_time, destruct_time, name, engine_name):
     BehaviorModelExecutor.__init__(self, instance_time, destruct_time,
                                    name, engine_name)
     self.init_state("IDLE")
     self.insert_state("IDLE", Infinite)
     self.insert_state("PROC", CRAWLING_TIME)
     #in,output 포트 설정
     self.insert_input_port("process")
     self.insert_output_port("alert")
Ejemplo n.º 4
0
    def __init__(self, instance_time, destruct_time, name, engine_name):
        BehaviorModelExecutor.__init__(self, instance_time, destruct_time, name, engine_name)

        # Open CSV
        self.init_state("IDLE")
        self.insert_state("IDLE", Infinite)
        self.insert_state("MOVE", 1)

        self.insert_input_port("assess")
        self.insert_output_port("done")
Ejemplo n.º 5
0
    def __init__(self, instance_time, destruct_time, name, engine_name):
        BehaviorModelExecutor.__init__(self, instance_time, destruct_time,
                                       name, engine_name)

        self.init_state("IDLE")
        self.insert_state("IDLE", Infinite)
        self.insert_state("PROCESS", 0)

        self.insert_input_port("recv_report")  #민원 발생시 받는 포트
        self.reported = {}
Ejemplo n.º 6
0
    def __init__(self, instance_time, destruct_time, name, engine_name):
        BehaviorModelExecutor.__init__(self, instance_time, destruct_time, name, engine_name)

        # Open CSV
        self.init_state("IDLE")
        self.insert_state("IDLE", Infinite)
        self.insert_state("PROCESS", REQUEST_FREQ)

        self.insert_input_port("report")
        self.insert_output_port("alert")
        self.airdata = []
Ejemplo n.º 7
0
        def __init__(self, instance_time, destruct_time, name, engine_name,
                     regions):
            BehaviorModelExecutor.__init__(self, instance_time, destruct_time,
                                           name, engine_name)

            # Open CSV
            self.init_state("REPORT")
            self.insert_state("REPORT", REPORT_FREQ)

            self.regions = regions
            self.engine = SystemSimulator().get_engine(engine_name)
Ejemplo n.º 8
0
    def __init__(self, instance_time, destruct_time, name, engine_name):
        BehaviorModelExecutor.__init__(self, instance_time, destruct_time, name, engine_name)

        # Open CSV
        self.init_state("IDLE")
        self.insert_state("IDLE", Infinite)
        self.insert_state("PROCESS", 1)

        self.insert_input_port("process")
        self.insert_output_port("assess")

        self._event_recv = ""
Ejemplo n.º 9
0
    def __init__(self, instance_time, destruct_time, name, engine_name):
        BehaviorModelExecutor.__init__(self, instance_time, destruct_time, name, engine_name)

        # Open CSV
        self.init_state("IDLE")
        self.insert_state("IDLE", Infinite)
        self.insert_state("MOVE", 1)

        self.insert_input_port("start")
        self.insert_output_port("process")

        self.student_list = []
Ejemplo n.º 10
0
        def __init__(self, instance_time, destruct_time, name, engine_name,
                     region):
            BehaviorModelExecutor.__init__(self, instance_time, destruct_time,
                                           name, engine_name)

            # Open CSV
            self.init_state("REPORT")
            self.insert_state("REPORT", NETWORK_UPDATE_FREQ)

            self.region = region
            self.agents_to_process = []

            self.engine = SystemSimulator().get_engine(engine_name)
Ejemplo n.º 11
0
    def __init__(self, instance_time, destruct_time, name, engine_name, human):
        BehaviorModelExecutor.__init__(self, instance_time, destruct_time,
                                       name, engine_name)
        self.human = human
        self.init_state("IDLE")
        self.insert_state("IDLE", Infinite)
        unit_t = self.human.get_out().get_unit_time()
        self.insert_state("WAIT", unit_t)
        #self.insert_state("WAIT", 1)

        self.insert_input_port("start")
        self.insert_input_port("end")

        self.insert_output_port("trash")  #쓰레기 배출포트?
Ejemplo n.º 12
0
    def __init__(self, instance_time, destruct_time, name, engine_name,
                 region):
        BehaviorModelExecutor.__init__(self, instance_time, destruct_time,
                                       name, engine_name)

        # Open CSV
        self.init_state("SCHEDULE")
        self.insert_state("IDLE", Infinite)
        self.insert_state("PROCESS", 0)
        self.insert_state("SCHEDULE", MODEL_TIME_REQ)

        self.region = region

        self.prev_state = "IDLE"
        self.agents_to_process = []
Ejemplo n.º 13
0
    def __init__(self, instance_time, destruct_time, name, engine_name,
                 region):
        BehaviorModelExecutor.__init__(self, instance_time, destruct_time,
                                       name, engine_name)

        # Open CSV
        self.init_state("IDLE")
        self.insert_state("IDLE", Infinite)
        self.insert_state("PROCESS", 0)

        self.insert_input_port("active_agents")
        #self.insert_output_port("agent_out")

        self.region = region

        self.agents_to_process = []
Ejemplo n.º 14
0
    def __init__(self, instance_time, destruct_time, name, engine_name):
        BehaviorModelExecutor.__init__(self, instance_time, destruct_time, name, engine_name)

        # Open CSV
        self.init_state("IDLE")
        self.insert_state("IDLE", Infinite)
        self.insert_state("PROCESS", 0)

        self.insert_input_port("agent_in")

        self.prev_state = "IDLE"
        self.agents_to_process = []

        self.tot_agent_map = {}
        self.evac_agent_lst = []
        self.early_exit = False
Ejemplo n.º 15
0
    def __init__(self, instance_time, destruct_time, name, engine_name,
                 family_type):
        BehaviorModelExecutor.__init__(self, instance_time, destruct_time,
                                       name, engine_name)

        self.init_state("IDLE")
        self.insert_state("IDLE", Infinite)
        self.insert_state("FLUSH", 0)

        #self.insert_input_port("start")
        self.insert_input_port(
            "receive_membertrash")  #trash input port from human
        self.insert_output_port(
            "takeout_trash")  #trash output port -> garbage can

        self.family_type = family_type
Ejemplo n.º 16
0
    def __init__(self, instance_time, destruct_time, name, engine_name):
        BehaviorModelExecutor.__init__(self, instance_time, destruct_time,
                                       name, engine_name)

        # Open CSV
        self.init_state("IDLE")
        self.insert_state("IDLE", Infinite)
        self.insert_state("PROCESS", 20)

        self.insert_input_port("report")

        # telegram
        self.updater = Updater(TELEGRAM_TOKEN, use_context=True)

        self.conn = pymongo.MongoClient('mongodb://localhost:27017')
        self.db = self.conn.get_database('mongo_db')
        self.collection = self.db.get_collection('Hisnet')
Ejemplo n.º 17
0
    def __init__(self, instance_time, destruct_time, name, engine_name, size,
                 outp):
        BehaviorModelExecutor.__init__(self, instance_time, destruct_time,
                                       name, engine_name)

        self.init_state("IDLE")
        self.insert_state("IDLE", Infinite)
        self.insert_state("PROCESS", 0)
        self.insert_state("PROC_TRUCK", 0)

        #checker port
        #self.insert_output_port("res_check") #checker에게 garbage 값 리턴
        #self.insert_input_port("check_garbage") #checker 에게  garbage 비율 요청 메세지를 받는 포트

        #trash input from family
        self.insert_input_port("recv_garbage")  #family가 garbage 배출할때 받는 포트

        #garbage truck port
        self.insert_input_port("req_empty")  #garbage_truck에서 입력받는 포트
        self.insert_output_port("res_garbage")  # garbgage_truck output port

        self.can_size = size
        self.cur_amount = 0

        self.avaliable_amount = 0

        self.human_id_map = {}
        self.human_port_map = {}

        self.family_id_map = {}
        self.family_port_map = {}

        self.recv_checker_port = []
        self.name = name
        self.outp = outp

        if self.outp is not None:
            """ To implement verbose mode """
            self.dlist = {}
            self.alist = {}
            self.a_fileout = open(
                "{0}/can_output{1}_checker.csv".format(outp, self.name), "w")
            self.fileout = open(
                "{0}/can_output{1}.csv".format(outp, self.name), "w")
Ejemplo n.º 18
0
    def __init__(self, instance_time, destruct_time, name, engine_name, htype):
        BehaviorModelExecutor.__init__(self, instance_time, destruct_time,
                                       name, engine_name)

        self.init_state("IDLE")
        self.insert_state("IDLE", Infinite)
        self.insert_state("CHECK", 0)
        self.insert_state("REPORT", 0)

        self.insert_input_port("request")
        self.insert_input_port("checked")  # from garbage can

        self.insert_output_port("check")  # to garbage can
        self.insert_output_port("gov_report")
        self.htype = htype
        #print(self.htype.get_id()+RANDOM_SEED,file=sys.__stdout__)
        from UI.config import RANDOM_SEED
        self.stat = Statistic(RANDOM_SEED + self.htype.get_id(), 20,
                              4)  # Satisfaction mean and stddev