sd_tot = [] for k in range(cfg.N): for j in range(len(cfg.position)): # The mobile station position mobile = [cfg.position[j][0], cfg.position[j][1]] # Calculate distance between APs to MS # [0: x, 1: y, 2: direction, 3: distance] aps_dist = copy.deepcopy(cfg.aps) n_ap = len(aps_dist) for i in range(n_ap): aps_dist[i].append(math.sqrt((aps_dist[i][0] - mobile[0]) ** 2 + (aps_dist[i][1] - mobile[1]) ** 2)) # remove AP if it is saturated aps = fn.remove_sat(aps_dist) # Find valid crossings # [0: ap_1, 1: ap_2] ap_cross = fn.find_crossings(aps) # Number of access points n_ap = len(aps) # Calculate global angles from APs to the MS # [0: x, 1: y, 2: direction, 3: distance, 4: global_angle] aps = fn.global_angle(aps, mobile) # Calculate local angles from APs to the MS # [0: x, 1: y, 2: direction, 3: distance, 4: global_angle, 5: local_angle] for i in range(n_ap):
import config as cfg import functions as fn import matplotlib.pyplot as plt import math # The mobile station position [0:x, 1:y] mobile = [40, 20] # Calculate distance between APs to MS # [0: x, 1: y, 2: direction, 3: distance] n_ap = len(cfg.aps) for i in range(n_ap): cfg.aps[i].append(math.sqrt((cfg.aps[i][0] - mobile[0]) ** 2 + (cfg.aps[i][1] - mobile[1]) ** 2)) # remove AP if it is saturated aps = fn.remove_sat(cfg.aps) # Number of access points n_ap = len(aps) # Find valid crossings # [0: ap_1, 1: ap_2] ap_cross = fn.find_crossings(aps) # Calculate global angles from APs to the MS # [0: x, 1: y, 2: direction, 3: distance, 4: global_angle] aps = fn.global_angle(aps, mobile) # Calculate local angles from APs to the MS # [0: x, 1: y, 2: direction, 3: distance, 4: global_angle, 5: local_angle] for i in range(n_ap):