Esempio n. 1
0
    def __init__(self, file_name):
        config = configparser.ConfigParser()
        config.read(file_name)

        time_step = float(config['Configuration']['RunningTimeStep'])

        # Readin different person generators
        gtype = config['PersonGenerator']['PersonGeneratorType']
        person_generator = PersonGenerator(gtype)
        person_generator.configure(config['PersonGenerator'])

        self._config = MansionConfig(
            dt=time_step,
            number_of_floors=int(config['MansionInfo']['NumberOfFloors']),
            floor_height=float(config['MansionInfo']['FloorHeight']))

        if ('LogLevel' in config['Configuration']):
            self._config.set_logger_level(config['Configuration']['LogLevel'])
        if ('Lognorm' in config['Configuration']):
            self._config.set_std_logfile(config['Configuration']['Lognorm'])
        if ('Logerr' in config['Configuration']):
            self._config.set_err_logfile(config['Configuration']['Logerr'])

        self._mansion = MansionManager(
            int(config['MansionInfo']['ElevatorNumber']), person_generator,
            self._config, config['MansionInfo']['Name'])
Esempio n. 2
0
    def __init__(self, file):
        # parser = argparse.ArgumentParser(description='Run elevator simulation')
        # parser.add_argument('configfile', type=str, default = '../config.ini',
        #                         help='configuration file for running elevators')
        # args = parser.parse_args()
        config = configparser.ConfigParser()
        config.read(file)

        person_generators = dict()

        time_step = float(config['General_Info']['RunningTimeStep'])
        mansion_type = config['General_Info']['MansionType']

        #Readin different person generators
        for i in range(int(config['General_Info']['PersonGeneratorNumber'])):
            key = 'Person_Generator_%d' % (i + 1)
            name = config[key]['PersonGeneratorName']
            gtype = config[key]['PersonGeneratorType']
            person_generators[name] = PersonGenerator(gtype)
            person_generators[name].configure(config[key])

        self.mansion_dict = {}
        for i in range(int(config['General_Info']['MansionNumber'])):
            key = 'Mansion_Info_%d' % (i + 1)
            name = config[key]['MansionName']
            gen_name = config[key]['MansionPersonGenerator']
            mansion_config = MansionConfig(
                dt=time_step,
                number_of_floors=int(config[key]['MansionFloors']),
                floor_height=float(config[key]['MansionFloorHeight']))
            self.mansion_dict[name] = MansionManager(
                int(config[key]['MansionElevatorNumber']),
                person_generators[gen_name], mansion_config, name)

        key = 'Mansion_Info_Fixed'
        name = config[key]['MansionName']
        gen_name = config[key]['MansionPersonGenerator']
        std_mansion_config = MansionConfig(
            dt=time_step,
            number_of_floors=int(config[key]['MansionFloors']),
            floor_height=float(config[key]['MansionFloorHeight']))
        standard_mansion = MansionManager(
            int(config[key]['MansionElevatorNumber']),
            person_generators[gen_name], std_mansion_config, name)
        # TODO: is iteration needed in environment?
        self.iterations = float(
            config['General_Info']['DurationDays']) * 86400 / time_step

        if (mansion_type == 'Fixed'):
            self.mansion_sim = standard_mansion
            self.state = self.mansion_sim.reset_env()
            self.mansion_sim._config.set_logger_level(
                config['General_Info']['LogLevel'])
        # elif(mansion_type == 'Diversified'):
        #     pass #TODO:
        else:
            raise Exception("No such type: %s" % mansion_type)
Esempio n. 3
0
    def test_dispatch_invalid(self, mock_uniformgenerator):
        '''
        ignore the invalid dispatch (cannot stop at the dispatch)
        and decelerate when needed (test velocity_planner)
        '''
        max_floors = 8
        # mansion_config
        world = MansionConfig(dt=0.50,
                              number_of_floors=max_floors,
                              floor_height=4.0)

        # test_elevator
        test_elevator = Elevator(start_position=0.0,
                                 mansion_config=world,
                                 name="test_eleavtor")
        test_elevator._direction = 1
        test_elevator._current_velocity = 2.0
        test_elevator._current_position = 8.0  # currently at 3 floor
        test_elevator._target_floors = [5, 8]  # target 5 floor
        test_elevator._loaded_person = [
            list() for i in range(test_elevator._number_of_floors)
        ]
        test_elevator._loaded_person[4].append(
            PersonType(6, 40, 1, 5, world.raw_time))
        test_elevator._loaded_person[7].append(
            PersonType(7, 40, 1, 8, world.raw_time))
        test_elevator._load_weight = 80

        # test_mansion
        tmp_uniform_generator = UniformPersonGenerator()

        ret_person = []
        person_generators.uniform_generator.UniformPersonGenerator.generate_person = mock.Mock(
            return_value=(ret_person))

        test_mansion = MansionManager(elevator_number=1,
                                      person_generator=tmp_uniform_generator,
                                      mansion_config=world,
                                      name="test_mansion")
        test_mansion._elevators = [test_elevator]
        dispatch = []
        dispatch.append(ElevatorAction(3, 1))

        test_mansion.run_mansion(dispatch)
        state = test_mansion.state
        self.assertAlmostEqual(state.ElevatorStates[0].Velocity, 2.0)

        test_mansion.run_mansion(dispatch)
        state = test_mansion.state
        self.assertAlmostEqual(state.ElevatorStates[0].Velocity,
                               2.0)  # ignore the invalid dispatch

        for i in range(5):
            test_mansion.run_mansion(dispatch)
        test_mansion.run_mansion(dispatch)
        test_mansion.run_mansion(dispatch)
        test_mansion.run_mansion(dispatch)
        state = test_mansion.state
        self.assertAlmostEqual(state.ElevatorStates[0].Velocity, 0.0)
Esempio n. 4
0
    def test_no_dispatch(self, mock_uniformgenerator):
        '''
        arrive at the target, no dispatch, hold still
        '''
        max_floors = 8
        # mansion_config
        world = MansionConfig(dt=0.50,
                              number_of_floors=max_floors,
                              floor_height=4.0)

        # test_elevator
        test_elevator = Elevator(start_position=0.0,
                                 mansion_config=world,
                                 name="test_eleavtor")
        test_elevator._direction = 1
        test_elevator._current_velocity = 0
        test_elevator._current_position = 8.0  # currently at 3 floor
        test_elevator._target_floors = [3]  # target 3 floor
        test_elevator._loaded_person = [
            list() for i in range(test_elevator._number_of_floors)
        ]
        test_elevator._loaded_person[2].append(
            PersonType(0, 40, 1, 3, world.raw_time))
        test_elevator._load_weight = 40

        # test_mansion
        tmp_uniform_generator = UniformPersonGenerator()

        ret_person = []
        person_generators.uniform_generator.UniformPersonGenerator.generate_person = mock.Mock(
            return_value=(ret_person))

        test_mansion = MansionManager(elevator_number=1,
                                      person_generator=tmp_uniform_generator,
                                      mansion_config=world,
                                      name="test_mansion")
        test_mansion._elevators = [test_elevator]
        dispatch = []
        dispatch.append(ElevatorAction(-1, 0))

        test_mansion.run_mansion(dispatch)
        test_mansion.run_mansion(dispatch)  # open the door

        for i in range(4):
            test_mansion.run_mansion(dispatch)  # unload person 0

        test_mansion.run_mansion(dispatch)
        test_mansion.run_mansion(dispatch)  # close the door

        test_mansion.run_mansion(dispatch)
        test_mansion.run_mansion(dispatch)
        state = test_mansion.state
        self.assertAlmostEqual(state.ElevatorStates[0].DoorState, 0.0)
        self.assertAlmostEqual(state.ElevatorStates[0].Velocity, 0.0)
        self.assertAlmostEqual(state.ElevatorStates[0].Floor, 3.0)
        self.assertAlmostEqual(state.ElevatorStates[0].Direction, 0)
Esempio n. 5
0
    def test_dispatch_twice(self, mock_uniformgenerator):
        '''
        no target, dispatch (3, 1) first, then (8, -1)
        decelerate then accelerate
        not accelerate immediately
        '''
        max_floors = 8
        # mansion_config
        world = MansionConfig(dt=0.50,
                              number_of_floors=max_floors,
                              floor_height=4.0)

        # test_elevator
        test_elevator = Elevator(start_position=0.0,
                                 mansion_config=world,
                                 name="test_elevator")
        test_elevator._direction = 1
        test_elevator._current_velocity = 2.0
        test_elevator._current_position = 9.0
        test_elevator._target_floors = list()
        test_elevator._loaded_person = [
            list() for i in range(test_elevator._number_of_floors)
        ]
        test_elevator._load_weight = 0

        # mansion
        tmp_uniform_generator = UniformPersonGenerator()
        ret_person = []
        person_generators.uniform_generator.UniformPersonGenerator.generate_person = mock.Mock(
            return_value=(ret_person))
        test_mansion = MansionManager(elevator_number=1,
                                      person_generator=tmp_uniform_generator,
                                      mansion_config=world,
                                      name="test_mansion")
        test_mansion._elevators = [test_elevator]
        # first, dispatch to 8 floor
        dispatch = []
        dispatch.append(ElevatorAction(4, 1))
        test_mansion.run_mansion(dispatch)
        test_mansion.run_mansion(dispatch)
        test_mansion.run_mansion(dispatch)
        dispatch = []
        dispatch.append(ElevatorAction(8, -1))
        test_mansion.run_mansion(dispatch)  # accelerate at once
        test_mansion.run_mansion(dispatch)
        state = test_mansion.state
        self.assertAlmostEqual(state.ElevatorStates[0].Velocity, 2.0)
Esempio n. 6
0
    def test_cancel_dispatch(self, mock_uniformgenerator):
        '''
        no target, dispatch first, accelerate, then cancel dispatch, decelerate
        '''
        max_floors = 8
        # mansion_config
        world = MansionConfig(dt=0.50,
                              number_of_floors=max_floors,
                              floor_height=4.0)

        # test_elevator
        test_elevator = Elevator(start_position=0.0,
                                 mansion_config=world,
                                 name="test_elevator")
        test_elevator._direction = 0
        test_elevator._current_velocity = 0.0
        test_elevator._current_position = 8.0
        test_elevator._target_floors = list()
        test_elevator._loaded_person = [
            list() for i in range(test_elevator._number_of_floors)
        ]
        test_elevator._load_weight = 0

        # mansion
        tmp_uniform_generator = UniformPersonGenerator()
        ret_person = []
        person_generators.uniform_generator.UniformPersonGenerator.generate_person = mock.Mock(
            return_value=(ret_person))
        test_mansion = MansionManager(elevator_number=1,
                                      person_generator=tmp_uniform_generator,
                                      mansion_config=world,
                                      name="test_mansion")
        test_mansion._elevators = [test_elevator]
        dispatch = []
        dispatch.append(ElevatorAction(6, 1))
        test_mansion.run_mansion(dispatch)
        test_mansion.run_mansion(dispatch)  # t = 1.0
        dispatch = []
        dispatch.append(ElevatorAction(0, -1))
        for i in range(10):
            test_mansion.run_mansion(dispatch)

        state = test_mansion.state
        self.assertAlmostEqual(state.ElevatorStates[0].DoorState, 0.0)
        self.assertAlmostEqual(state.ElevatorStates[0].Velocity, 0.0)
Esempio n. 7
0
def run_main(args):
    parser = argparse.ArgumentParser(description='Run elevator simulation')
    parser.add_argument(
        'configfile',
        type=str,  #default='../config.ini',
        help='configuration file for running elevators')
    args = parser.parse_args(args)
    config = configparser.ConfigParser()
    config.read(args.configfile)

    person_generators = dict()

    time_step = float(config['General_Info']['RunningTimeStep'])
    mansion_type = config['General_Info']['MansionType']

    #Readin different person generators
    for i in range(int(config['General_Info']['PersonGeneratorNumber'])):
        key = 'Person_Generator_%d' % (i + 1)
        name = config[key]['PersonGeneratorName']
        gtype = config[key]['PersonGeneratorType']
        person_generators[name] = PersonGenerator(gtype)
        person_generators[name].configure(config[key])

    mansion_dict = {}
    for i in range(int(config['General_Info']['MansionNumber'])):
        key = 'Mansion_Info_%d' % (i + 1)
        name = config[key]['MansionName']
        gen_name = config[key]['MansionPersonGenerator']
        mansion_config = MansionConfig(
            dt=time_step,
            number_of_floors=int(config[key]['MansionFloors']),
            floor_height=float(config[key]['MansionFloorHeight']))
        mansion_dict[name] = MansionManager(
            int(config[key]['MansionElevatorNumber']),
            person_generators[gen_name], mansion_config, name)

    key = 'Mansion_Info_Fixed'
    name = config[key]['MansionName']
    gen_name = config[key]['MansionPersonGenerator']
    std_mansion_config = MansionConfig(
        dt=time_step,
        number_of_floors=int(config[key]['MansionFloors']),
        floor_height=float(config[key]['MansionFloorHeight']))
    standard_mansion = MansionManager(
        int(config[key]['MansionElevatorNumber']), person_generators[gen_name],
        std_mansion_config, name)

    iterations = float(
        config['General_Info']['DurationDays']) * 86400 / time_step
    dispatcher = Dispatcher()

    if (mansion_type == 'Fixed'):
        run_mansion_main(standard_mansion, dispatcher, iterations,
                         config['General_Info']['LogLevel'])
    elif (mansion_type == 'Diversified'):
        for key in mansion_dict:
            run_mansion_main(mansion_dict[key], dispatcher, iterations,
                             config['General_Info']['LogLevel'])
    else:
        raise Exception("No such type: %s" % mansion_type)

    return 0
Esempio n. 8
0
class IntraBuildingEnv():
    '''
    IntraBuildingTransportation Environment
    '''
    def __init__(self, file_name):
        config = configparser.ConfigParser()
        config.read(file_name)

        time_step = float(config['Configuration']['RunningTimeStep'])

        # Readin different person generators
        gtype = config['PersonGenerator']['PersonGeneratorType']
        person_generator = PersonGenerator(gtype)
        person_generator.configure(config['PersonGenerator'])

        self._config = MansionConfig(
            dt=time_step,
            number_of_floors=int(config['MansionInfo']['NumberOfFloors']),
            floor_height=float(config['MansionInfo']['FloorHeight']))

        if ('LogLevel' in config['Configuration']):
            self._config.set_logger_level(config['Configuration']['LogLevel'])
        if ('Lognorm' in config['Configuration']):
            self._config.set_std_logfile(config['Configuration']['Lognorm'])
        if ('Logerr' in config['Configuration']):
            self._config.set_err_logfile(config['Configuration']['Logerr'])

        self._mansion = MansionManager(
            int(config['MansionInfo']['ElevatorNumber']), person_generator,
            self._config, config['MansionInfo']['Name'])

    def seed(self, seed=None):
        set_seed(seed)

    def step(self, action):
        time_consume, energy_consume, given_up_persons, info = self._mansion.run_mansion(
            action)
        reward = -(time_consume + 0.01 * energy_consume +
                   1000 * given_up_persons) * 1.0e-5

        info = {
            'energy_consume_reward':
            np.array(info['each_energy_consume']) * -0.01,
            'time_consume_reward': time_consume * -1,
            'given_up_reward': given_up_persons * -1000
        }
        return (self._mansion.state, reward, False, info)

    def reset(self):
        self._mansion.reset_env()
        return self._mansion.state

    def render(self):
        raise NotImplementedError()

    def close(self):
        pass

    @property
    def attribute(self):
        return self._mansion.attribute

    @property
    def state(self):
        return self._mansion.state

    @property
    def statistics(self):
        return self._mansion.get_statistics()

    @property
    def log_debug(self):
        return self._config.log_debug

    @property
    def log_notice(self):
        return self._config.log_notice

    @property
    def log_warning(self):
        return self._config.log_warning

    @property
    def log_fatal(self):
        return self._config.log_fatal
Esempio n. 9
0
    def test_dispatch_when_closing(self, mock_uniformgenerator):
        '''
        dispatch the current floor when the door is closing
        '''
        max_floors = 8
        # mansion_config
        world = MansionConfig(dt=0.50,
                              number_of_floors=max_floors,
                              floor_height=4.0)

        # test_elevator
        test_elevator = Elevator(start_position=0.0,
                                 mansion_config=world,
                                 name="test_elevator")

        test_elevator._direction = 1
        test_elevator._current_position = 8.0
        test_elevator._target_floors = [4, 5]
        test_elevator._loaded_person = [
            list() for i in range(test_elevator._number_of_floors)
        ]
        test_elevator._loaded_person[3].append(
            PersonType(6, 40, 1, 4, world.raw_time))
        test_elevator._loaded_person[4].append(
            PersonType(7, 40, 1, 5, world.raw_time))
        test_elevator._load_weight = 80

        # test_mansion
        tmp_uniform_generator = UniformPersonGenerator()

        ret_person = []
        ret_person.append(PersonType(0, 50, 3, 5, world.raw_time))
        ret_person.append(PersonType(1, 50, 3, 1, world.raw_time))
        ret_person.append(PersonType(2, 60, 6, 4, world.raw_time))
        person_generators.uniform_generator.UniformPersonGenerator.generate_person = mock.Mock(
            return_value=(ret_person))

        test_mansion = MansionManager(elevator_number=1,
                                      person_generator=tmp_uniform_generator,
                                      mansion_config=world,
                                      name="test_mansion")
        test_mansion._elevators = [test_elevator]
        dispatch = []
        dispatch.append(ElevatorAction(3, 1))

        # run_mansion
        test_mansion.run_mansion(dispatch)

        ret_person = []
        person_generators.uniform_generator.UniformPersonGenerator.generate_person = mock.Mock(
            return_value=(ret_person))

        test_mansion.run_mansion(dispatch)  # the door is open, t = 1.0
        # print(test_mansion.state, "\nworld time is", world.raw_time)

        dispatch = []
        dispatch.append(ElevatorAction(-1, 0))
        for i in range(4):
            test_mansion.run_mansion(dispatch)  # load person 0, t = 3.0

        # the door is closing, the door state = 0.5, t = 3.5
        test_mansion.run_mansion(dispatch)

        # come two more passengers
        ret_person = []
        ret_person.append(PersonType(4, 55, 3, 4, world.raw_time))
        ret_person.append(PersonType(5, 65, 3, 6, world.raw_time))
        person_generators.uniform_generator.UniformPersonGenerator.generate_person = mock.Mock(
            return_value=(ret_person))

        dispatch = []
        dispatch.append(ElevatorAction(3, 1))

        # the door is open, door_state = 1.0, time = 4.0
        test_mansion.run_mansion(dispatch)
        state = test_mansion.state
        self.assertAlmostEqual(state.ElevatorStates[0].DoorState, 1.0)

        ret_person = []
        person_generators.uniform_generator.UniformPersonGenerator.generate_person = mock.Mock(
            return_value=(ret_person))

        dispatch = []
        dispatch.append(ElevatorAction(-1, 0))
        for i in range(4):
            test_mansion.run_mansion(dispatch)  # load the two passengers
        state = test_mansion.state
        self.assertAlmostEqual(state.ElevatorStates[0].LoadWeight, 250)
Esempio n. 10
0
    def test_door_load_unload(self, mock_uniformgenerator):
        '''
        stop at the target, load and unload corresponding passengers, open and close the door properly
        '''
        max_floors = 8
        world = MansionConfig(dt=0.50,
                              number_of_floors=max_floors,
                              floor_height=4.0)

        test_elevator = Elevator(start_position=0.0,
                                 mansion_config=world,
                                 name="test_elevator")
        test_elevator._direction = 1
        test_elevator._current_position = 8.0
        test_elevator._target_floors = [3, 5]
        test_elevator._loaded_person = [
            list() for i in range(test_elevator._number_of_floors)
        ]
        test_elevator._loaded_person[2].append(
            PersonType(6, 40, 1, 3, world.raw_time))
        test_elevator._loaded_person[4].append(
            PersonType(7, 35, 1, 5, world.raw_time))
        test_elevator._load_weight = 80

        tmp_uniform_generator = UniformPersonGenerator()

        ret_person = []
        ret_person.append(PersonType(0, 50, 3, 5, world.raw_time))
        ret_person.append(PersonType(1, 30, 3, 1, world.raw_time))
        ret_person.append(PersonType(2, 60, 6, 4, world.raw_time))
        ret_person.append(PersonType(4, 55, 3, 4, world.raw_time))
        ret_person.append(PersonType(5, 65, 3, 6, world.raw_time))
        person_generators.uniform_generator.UniformPersonGenerator.generate_person = mock.Mock(
            return_value=(ret_person))

        test_mansion = MansionManager(elevator_number=1,
                                      person_generator=tmp_uniform_generator,
                                      mansion_config=world,
                                      name="test_mansion")
        test_mansion._elevators = [test_elevator]
        dispatch = []
        dispatch.append(ElevatorAction(3, 1))

        test_mansion.run_mansion(dispatch)
        # print(test_mansion.state, "\nworld time is", world.raw_time)
        state = test_mansion.state
        self.assertAlmostEqual(state.ElevatorStates[0].DoorState, 0.5)

        # mock generate_person again
        ret_person = []
        person_generators.uniform_generator.UniformPersonGenerator.generate_person = mock.Mock(
            return_value=(ret_person))

        test_mansion.run_mansion(dispatch)  # Door fully open, t = 1.0
        state = test_mansion.state
        self.assertAlmostEqual(state.ElevatorStates[0].DoorState, 1.0)

        for i in range(4):
            test_mansion.run_mansion(dispatch)
        state = test_mansion.state  # passenger 6 is unloaded, t = 3.0
        self.assertAlmostEqual(state.ElevatorStates[0].LoadWeight, 40)

        dispatch = []
        dispatch.append(ElevatorAction(-1, 0))

        for i in range(4):
            test_mansion.run_mansion(dispatch)
            # print(test_mansion.state, "\nworld time is", world.raw_time)
        state = test_mansion.state  # passenger 0 and 4 are loaded, t = 5.0
        self.assertAlmostEqual(state.ElevatorStates[0].LoadWeight, 145)

        for i in range(4):
            test_mansion.run_mansion(dispatch)
        state = test_mansion.state  # passenger 5 is loaded, t = 7.0
        self.assertAlmostEqual(state.ElevatorStates[0].LoadWeight, 210)

        for i in range(4):
            test_mansion.run_mansion(dispatch)
        state = test_mansion.state  # the door is closed, going up, t = 9.0
        self.assertAlmostEqual(state.ElevatorStates[0].Velocity, 1.0)
Esempio n. 11
0
    def test_stop_at_dispatch(self, mock_uniformgenerator):
        '''
        stop at the dispatch floor, open and close the door, then keep going to the target floor
        '''
        max_floors = 8
        # mansion_config
        world = MansionConfig(dt=0.50,
                              number_of_floors=max_floors,
                              floor_height=4.0)

        # test_elevator
        test_elevator = Elevator(start_position=0.0,
                                 mansion_config=world,
                                 name="test_elevator")
        test_elevator._direction = 1
        test_elevator._current_velocity = 2.0
        test_elevator._current_position = 4.0  # currently at 2 floor
        test_elevator._target_floors = [5]
        test_elevator._loaded_person = [
            list() for i in range(test_elevator._number_of_floors)
        ]
        test_elevator._loaded_person[5].append(
            PersonType(0, 50, 1, 6, world.raw_time))
        test_elevator._load_weight = 50

        # test_mansion
        tmp_uniform_generator = UniformPersonGenerator()

        ret_person = []
        person_generators.uniform_generator.UniformPersonGenerator.generate_person = mock.Mock(
            return_value=(ret_person))

        test_mansion = MansionManager(elevator_number=1,
                                      person_generator=tmp_uniform_generator,
                                      mansion_config=world,
                                      name="test_mansion")
        test_mansion._elevators = [test_elevator]

        # test
        dispatch = []
        dispatch.append(ElevatorAction(3, 1))

        # TODO: should stop within 6 steps
        for i in range(7):
            test_mansion.run_mansion(dispatch)  # stop at the dispatched floor
        # print(test_mansion.state, "\nworld time is", world.raw_time)
        # dispatch = []
        # dispatch.append(ElevatorAction(-1, 0))
        for i in range(2):
            # the door is fully open, t = 4.5
            test_mansion.run_mansion(dispatch)
        state = test_mansion.state
        self.assertAlmostEqual(state.ElevatorStates[0].DoorState, 1.0)

        dispatch = []
        dispatch.append(ElevatorAction(-1, 0))

        for i in range(6):
            # finish time open lag and close the door
            test_mansion.run_mansion(dispatch)
        state = test_mansion.state
        self.assertAlmostEqual(state.ElevatorStates[0].DoorState, 0.0)

        for i in range(4):
            test_mansion.run_mansion(dispatch)  # then keep going up
        state = test_mansion.state
        self.assertAlmostEqual(state.ElevatorStates[0].Velocity, 2.0)
Esempio n. 12
0
    def test_overload(self, mock_uniformgenerator):
        '''
        overload, two people enter together, check who can enter the elevator one by one
        after overload, if the dispatcher still dispatches the elevator to the current floor, ignore the dispatch
        '''
        max_floors = 8
        world = MansionConfig(dt=0.50,
                              number_of_floors=max_floors,
                              floor_height=4.0)

        test_elevator = Elevator(start_position=0.0,
                                 mansion_config=world,
                                 name="test_elevator")
        test_elevator._direction = 1
        test_elevator._current_position = 8.0
        test_elevator._target_floors = [5]
        test_elevator._loaded_person = [
            list() for i in range(test_elevator._number_of_floors)
        ]
        test_elevator._loaded_person[5].append(
            PersonType(6, 750, 1, 6, world.raw_time))
        test_elevator._loaded_person[7].append(
            PersonType(7, 750, 1, 8, world.raw_time))
        test_elevator._load_weight = 1500

        tmp_uniform_generator = UniformPersonGenerator()

        ret_person = []
        ret_person.append(PersonType(0, 150, 3, 5, world.raw_time))
        ret_person.append(PersonType(1, 50, 3, 1, world.raw_time))
        ret_person.append(PersonType(2, 60, 5, 6, world.raw_time))
        ret_person.append(PersonType(4, 65, 3, 8, world.raw_time))
        ret_person.append(PersonType(5, 65, 3, 6, world.raw_time))
        person_generators.uniform_generator.UniformPersonGenerator.generate_person = mock.Mock(
            return_value=(ret_person))

        test_mansion = MansionManager(elevator_number=1,
                                      person_generator=tmp_uniform_generator,
                                      mansion_config=world,
                                      name="test_mansion")
        test_mansion._elevators = [test_elevator]
        dispatch = []
        dispatch.append(ElevatorAction(3, 1))

        test_mansion.run_mansion(dispatch)

        # mock generate_person again
        ret_person = []
        person_generators.uniform_generator.UniformPersonGenerator.generate_person = mock.Mock(
            return_value=(ret_person))

        test_mansion.run_mansion(dispatch)  # Door fully open, t = 1.0

        dispatch = []
        dispatch.append(ElevatorAction(-1, 0))

        for i in range(4):
            test_mansion.run_mansion(dispatch)  # upload person 4, t = 3.0

        dispatch = []
        dispatch.append(ElevatorAction(3, 1))

        test_mansion.run_mansion(dispatch)
        state = test_mansion.state
        self.assertAlmostEqual(state.ElevatorStates[0].LoadWeight, 1565)

        test_mansion.run_mansion(dispatch)
        test_mansion.run_mansion(dispatch)  # t = 4.5
        state = test_mansion.state
        self.assertGreater(state.ElevatorStates[0].Velocity, 0.0)