Beispiel #1
0
def generate_states(traj_name):
    global states, x0, y0, z0
    trajectory = Track()
    method_name = getattr(trajectory,
                          "gen_" + traj_name.replace(" ", "").lower())
    states = method_name()
    x0, y0, z0 = trajectory.initial_position(states)
def gen_env():
    trajectory = Track()
    states = trajectory.gen_landing()
    x0 = states[0, 0]
    y0 = states[0, 3]
    z0 = states[0, 6]
    radar = Radar(x=0, y=2000)

    radar_filter_cv = RadarFilterCV(dim_x=9,
                                    dim_z=3,
                                    q=1.,
                                    x0=x0,
                                    y0=y0,
                                    z0=z0,
                                    radar=radar)
    radar_filter_ca = RadarFilterCA(dim_x=9,
                                    dim_z=3,
                                    q=400.,
                                    x0=x0,
                                    y0=y0,
                                    z0=z0,
                                    radar=radar)
    radar_filter_ct = RadarFilterCT(dim_x=9,
                                    dim_z=3,
                                    q=350.,
                                    x0=x0,
                                    y0=y0,
                                    z0=z0,
                                    radar=radar)
    filters = [radar_filter_cv, radar_filter_ca, radar_filter_ct]
    mu = [0.33, 0.33, 0.33]
    trans = np.array([[0.998, 0.001, 0.001], [0.050, 0.900, 0.050],
                      [0.001, 0.001, 0.998]])
    imm = IMMEstimator(filters, mu, trans)

    benchmark_imm3 = Benchmark(radars=radar, radar_filter=imm, states=states)
    benchmark_imm3.launch_benchmark(with_nees=True)
from fdia_simulation.models            import Radar, PeriodRadar, Track
from fdia_simulation.filters           import (RadarFilterCA, MultipleRadarsFilterCA, MultiplePeriodRadarsFilterCA,
                                               RadarFilterCV, MultipleRadarsFilterCV, MultiplePeriodRadarsFilterCV,
                                               RadarFilterCT, MultipleRadarsFilterCT, MultiplePeriodRadarsFilterCT,
                                               RadarFilterTA, MultipleRadarsFilterTA, MultiplePeriodRadarsFilterTA)
from fdia_simulation.attackers         import (Attacker,DOSAttacker,DriftAttacker,
                                               PeriodAttacker,DOSPeriodAttacker,DriftPeriodAttacker)
from fdia_simulation.benchmarks        import Benchmark
from fdia_simulation.anomaly_detectors import MahalanobisDetector, EuclidianDetector

if __name__ == "__main__":

    # ==========================================================================
    # ================== Position generation for the aircraft ==================
    # ==========================================================================
    trajectory = Track()
    states = trajectory.gen_landing()
    x0,y0,z0 = trajectory.initial_position(states)

    # ==========================================================================
    # ========================= Radar(s) Generation ============================
    # ==========================================================================
    ## =================== Standard Radars (same data rates)
    ## Specify your own radar positions and beliefs over measurements!
    # Radar 1: Precision radar
    radar1 = Radar(x = -6000, y = 10000)

    # Radar 2: Standard radar
    radar2 = Radar(x = 1000, y = 8000,
                   r_std = 5., theta_std = 0.005, phi_std = 0.005)
Beispiel #4
0
radar2 = Radar(x=1000, y=8000)
radars = [radar1, radar2]
## Different data rates radars
dt1 = 0.1
dt2 = 0.4
fradar1 = PeriodRadar(x=-6000, y=10000, dt=dt1)
fradar2 = PeriodRadar(x=1000,
                      y=8000,
                      dt=dt2,
                      r_std=5.,
                      theta_std=0.005,
                      phi_std=0.005)
fradars = [fradar1, fradar2]

##States
trajectory = Track()
states = trajectory.gen_landing()
x0 = states[0, 0]
y0 = states[0, 3]
z0 = states[0, 6]

# Loop over every list and output + write results
for filter in FILTERS_1_RADAR:
    name = filter.__name__[-2:]
    print('=================================================================')
    print('=========================== ' + name +
          '-1 Radar ==========================')
    noise_finder = NoiseFinder1Radar(radar1, states, filter, nb_iterations=3)
    noise_finder.launch_benchmark()
    best_value = noise_finder.best_value()
    print(('Best value for ' + name + '-1Radar:{0}').format(best_value))
Created on Thu Jul 04 11:47:28 2019

@author: qde
"""

import numpy as np
import matplotlib.pyplot as plt
from filterpy.kalman import IMMEstimator
from fdia_simulation.models import Radar, Track
from fdia_simulation.filters import MultipleRadarsFilterCV, MultipleRadarsFilterCA, MultipleRadarsFilterCT
from fdia_simulation.attackers import MoAttacker
from fdia_simulation.benchmarks import Benchmark

if __name__ == "__main__":
    #================== Position generation for the aircraft =====================
    trajectory = Track()
    states = trajectory.gen_takeoff()
    x0 = states[0, 0]
    y0 = states[0, 3]
    z0 = states[0, 6]

    # ==========================================================================
    # ======================== Radars data generation ===========================
    # Radar 1: Precision radar
    radar1 = Radar(x=800, y=200)

    # Radar 2: Standard radar
    radar2 = Radar(x=0, y=1000, r_std=5., theta_std=0.005, phi_std=0.005)

    # ==========================================================================
    # ========================= IMM generation =================================