Exemplo n.º 1
0
    def update_initial_values(self, x, y, altitude, heading, speed):
        self.x = x
        self.y = y
        self.altitude = altitude
        self.heading = heading
        self.speed = speed

        initial = {
            "callsign": "viper",
            "id": 0,
            "side": 1,
            "metric": "Imperial/Nautical",
            "x": self.x,
            "y": self.y,
            "z": self.altitude,
            "psi": self.heading,
            "theta": 0.0,
            "phi": 0.0,
            "v": self.speed,
            "weight": 100.0,
            "fuel": 100.0,
            "v_min": 100,
            "v_max": 1000,
            "v_K": 0.1,
            "theta_K": 0.005,
            "psi_K": 10.0
        }
        helpers.save_chromosome_to_file(initial, (os.path.dirname(__file__)) +
                                        r"\ace_zero-v09\ace0\data\blue.json")
Exemplo n.º 2
0
    def load_ecu_chromosome(self, parameters):
        step = 18
        offset = 18
        temp = []
        for i in xrange(42):
            temp.append(parameters[step - offset:step])
            step += offset

        chromosome = {
            "EcuConverting": {
                "PARAMETER_SET_ONE": temp[0],
                "PARAMETER_SET_TWO": temp[1],
                "PARAMETER_SET_THREE": temp[2]
            },
            "EcuFlyRelativeBearing": {
                "PARAMETER_SET_ONE": temp[3],
                "PARAMETER_SET_TWO": temp[4],
                "PARAMETER_SET_THREE": temp[5]
            },
            "EcuFlyingOffset": {
                "PARAMETER_SET_ONE": temp[6],
                "PARAMETER_SET_TWO": temp[7],
                "PARAMETER_SET_THREE": temp[8]
            },
            "EcuPureIntercept": {
                "PARAMETER_SET_ONE": temp[9],
                "PARAMETER_SET_TWO": temp[10],
                "PARAMETER_SET_THREE": temp[11]
            }
        }

        helpers.save_chromosome_to_file(
            chromosome, (os.path.dirname(__file__)) +
            r"\ace_zero-v09\ace0\data\ecu_blue_tactics.json")
Exemplo n.º 3
0
    def update_red_chromosome(self, turn_range, turn_angle, displacement,
                              conversion_range, no_close_range):
        self.turn_range = turn_range
        self.turn_angle = turn_angle
        self.displacement = displacement
        self.conversion_range = conversion_range
        self.no_close_range = no_close_range

        chromosome = {
            'PureIntercept': {
                'TURN_RANGE': self.turn_range
            },
            'FlyRelativeBearing': {
                'TURN_ANGLE': self.turn_angle,
                'DESIRED_DISPLACEMENT': self.displacement
            },
            'FlyingOffset': {
                'CONVERSION_RANGE': self.conversion_range
            },
            'Converting': {
                'NO_CLOSER_RANGE': self.no_close_range
            }
        }

        helpers.save_chromosome_to_file(
            chromosome, (os.path.dirname(__file__)) +
            r"\ace_zero-v09\ace0\data\red_tactics.json")
Exemplo n.º 4
0
    def save_initial_default_values():
        initial = {
            "callsign": "viper",
            "id": 0,
            "side": 1,
            "metric": "Imperial/Nautical",
            "x": 0.0,
            "y": 5.0,
            "z": 15000.0,
            "psi": 0.0,
            "theta": 0.0,
            "phi": 0.0,
            "v": 400.0,
            "weight": 100.0,
            "fuel": 100.0,
            "v_min": 100,
            "v_max": 1000,
            "v_K": 0.1,
            "theta_K": 0.005,
            "psi_K": 10.0
        }

        helpers.save_chromosome_to_file(initial, (os.path.dirname(__file__)) +
                                        r"\ace_zero-v09\ace0\data\blue.json")
Exemplo n.º 5
0
    def update_ecu_basic_chromosome(self, parameters):
        step = 18
        offset = 18
        temp = []
        param = list(parameters)
        param_values = []

        for gene in param:
            param_values.append(gene.value)

        for i in xrange(42):
            temp.append(param_values[step - offset:step])
            step += offset

        chromosome = {
            "LeftDown": {
                "PARAMETER_SET_ONE": temp[0],
                "PARAMETER_SET_TWO": temp[1],
                "PARAMETER_SET_THREE": temp[2],
                "PARAMETER_SET_FOUR": temp[3],
                "PARAMETER_SET_FIVE": temp[4],
                "PARAMETER_SET_SIX": temp[5]
            },
            "LeftUp": {
                "PARAMETER_SET_ONE": temp[6],
                "PARAMETER_SET_TWO": temp[7],
                "PARAMETER_SET_THREE": temp[8],
                "PARAMETER_SET_FOUR": temp[9],
                "PARAMETER_SET_FIVE": temp[10],
                "PARAMETER_SET_SIX": temp[11]
            },
            "PullUp": {
                "PARAMETER_SET_ONE": temp[12],
                "PARAMETER_SET_TWO": temp[13],
                "PARAMETER_SET_THREE": temp[14],
                "PARAMETER_SET_FOUR": temp[15],
                "PARAMETER_SET_FIVE": temp[16],
                "PARAMETER_SET_SIX": temp[17]
            },
            "LevelFlight": {
                "PARAMETER_SET_ONE": temp[18],
                "PARAMETER_SET_TWO": temp[19],
                "PARAMETER_SET_THREE": temp[20],
                "PARAMETER_SET_FOUR": temp[21],
                "PARAMETER_SET_FIVE": temp[22],
                "PARAMETER_SET_SIX": temp[23]
            },
            "PushDown": {
                "PARAMETER_SET_ONE": temp[24],
                "PARAMETER_SET_TWO": temp[25],
                "PARAMETER_SET_THREE": temp[26],
                "PARAMETER_SET_FOUR": temp[27],
                "PARAMETER_SET_FIVE": temp[28],
                "PARAMETER_SET_SIX": temp[29]
            },
            "RightUp": {
                "PARAMETER_SET_ONE": temp[30],
                "PARAMETER_SET_TWO": temp[31],
                "PARAMETER_SET_THREE": temp[32],
                "PARAMETER_SET_FOUR": temp[33],
                "PARAMETER_SET_FIVE": temp[34],
                "PARAMETER_SET_SIX": temp[35]
            },
            "RightDown": {
                "PARAMETER_SET_ONE": temp[36],
                "PARAMETER_SET_TWO": temp[37],
                "PARAMETER_SET_THREE": temp[38],
                "PARAMETER_SET_FOUR": temp[39],
                "PARAMETER_SET_FIVE": temp[40],
                "PARAMETER_SET_SIX": temp[41]
            }
        }

        helpers.save_chromosome_to_file(
            chromosome, (os.path.dirname(__file__)) +
            r"\ace_zero-v09\ace0\data\ecu_basic_blue_tactics.json")