def dec_wrap2(): """Declaration function. It initializes all the relevant parameters to the simulatiions """ # Broadcast parameters p = lib.SyncParams() p.zc_len = 31 # Length of the ZC sequence to use p.f_symb = 30.72e6 # "true" sampling rate p.f_samp = p.f_symb*4 # oversampling rate. SHould be an integer factor of p.f_samp. This factor is the oversampling factor p.repeat = 1 # Repeat the synchronization signal p.spacing_factor = 1 # Spacing between the raisedcosines. A factor of 1 uses the standard definition, where # one symbol is placed every p.power_weight = 2 # Exponent \gamma p.full_sim = True # Leave true p.bias_removal = False # Utilization of the bias removal algorithm p.ma_window = 1 # If bigger than 1, applies a moving average on the crosscorrelation R_yz p.train_type = 'chain' # 'single': only one ZC sequence makes up the synchronization systemm # 'chain' : pair of ZC sequence with opposite root parameter p.crosscorr_type = 'match_decimate' # don't touch p.match_decimate_fct = lib.downsample # lib.downsample corresponds to a standard idealized analog-digital sampler p.peak_detect = 'wavg' # 'wavg': Performs a weighted average on the crosscorrelation to determine the location of the # synchronization signal # 'argmax': Takes the max of the crosscorrelation instead of a weighted average p.pulse_type = 'rootraisedcosine' # Analog shaping pulse p.plen = 31 # Length of the raisedcosine pulseshape p.rolloff = 0.2 # Raisedcosine rolloff factor. A value of 0 corresponds to a normalized sinc p.central_padding = 0 # Pad zeros between the pair of ZC sequences. As a fraction of zpos length p.scfdma_precode = True # Apply SCFDMA? p.scfdma_L = 4 # SC-FDMA factor p.scfdma_sinc_len_factor = p.scfdma_L # Used for the demodulation of SC-FDMA in a decentralized setting #------------------------ # Simulation parameters ctrl = SimControls() ctrl.steps = 40 # Approximately how many T_0 synchronization steps will be executed ctrl.basephi = 40000 # How many oversamples per period T_0? T_0 = basephi*p.f_samp ctrl.nodecount = 35 # Number of nodes to simulate ctrl.display = True # Display stuff for a single simulation ctrl.static_nodes = 0 # Nodes that broadcast but do not synchronize ctrl.quiet_nodes = 0 # Nodes that synchronize but do not broadcast ctrl.quiet_selection = 'random' # How are quiet nodes assigned #ctrl.quiet_selection = 'kmeans' # Parameters specific to the contention method (sensing) ctrl.qc_threshold = 5 # As a factor of the outage threshold ctrl.qc_steps = 3 # Initialization parameters ctrl.CFO_step_wait = float('inf') # Use float('inf') to never correct for CFO. CFO CORRECTION DEPRECATED! ctrl.TO_step_wait = 4 # How many synchronization steps to wait before broadcasting. In factors of T_0 ctrl.max_start_delay = 7 # nodes are onlined between t \in [0, max_start_delay]. In factor of T_0 ctrl.use_ringarr = True # Use True unless you want to blow up your RAM ctrl.theta_bounds = [0,1] # bounds for the uniform distribution of \theta ctrl.deltaf_bound = 3e-2 # bounds for the uniform distribution of \delta f between the nodes. ctrl.rand_init = False # Randomly initiate values? ctrl.non_rand_seed = 1238819 # If rand_init = False, the 'random' values in the simulation will be initiated with this seed ctrl.epsilon_TO = 0.5 ctrl.noise_power = -101 + 9 # Reception thermal noise. -101 + 9 : thermal noise + receiver noise amplification. #ctrl.noise_power = float('-inf') # Use if you want a noiseless simulation # Multipath parameters ctrl.delay_params = lib.DelayParams(lib.delay_pdf_3gpp_exp) # corresponds to 3gpp specifications ctrl.delay_params.taps = 50 # How many multipath taps? # The next variable is badly named. it correponds to half the side of a square area # ctrl.max_dist_from_origin = 500 corresponds to an area of (1000m)^2 ctrl.max_dist_from_origin = 500 # (in meters) # Half-duplexing method. Use at your own risk ctrl.half_duplex = False ctrl.hd_slot0 = 0.3 # in terms of phi ctrl.hd_slot1 = 0.7 # in terms of phi ctrl.hd_block_during_emit = True ctrl.hd_block_extrawidth = 0 # as a factor of offset (see runsim to know what is offset) # Variable adjustement window size. Use at your own risk ctrl.var_winlen = False ctrl.vw_minsize = 5 # as a factor of len(p.analog_sig) ctrl.vw_lothreshold = 0.1 # winlen reduction threshold ctrl.vw_hithreshold = 0.1 # winlen increase threshold ctrl.vw_lofactor = 1.5 # winlen reduction factor ctrl.vw_hifactor = 2 # winlen increase factor # Outage detection. Only broadcast of "near" outage. E-mail [email protected] for more # explanation on how it works ctrl.outage_detect = False # thesis #ctrl.outage_detect = True # INTERD ctrl.outage_threshold_noisefactor = 1/(p.zc_len)*2 # COrrect propagation delay by applying some filter. # lib.highpass_avg(6) corresponds to a filter of length Q=6, as described in my thesis ctrl.prop_correction = True ctrl.pc_step_wait = 0 ctrl.pc_b, ctrl.pc_a = lib.hipass_avg(6) #THESIS ctrl.pc_avg_thresh = float('inf') # If std of N previous TOx samples is above this value, then ctrl.pc_std_thresh = float(80) # If std of N previous TOx samples is above this value, then # no PC is applied (but TOy is still calculated) # Save values to disk? ctrl.saveall = True #------------- # To run multiple simulations in bulk, a dictionary of modification to ctrl (cdict) and modifications to p # (pdict) can be used to iterate over multiple configurations # Note that any parameter to p or ctrl can be iterated this way # For example, this will iterate over 5 configurations, from right to left. Each iteration assigns # the value to the property and runs the simulations. See SimWrap for more details cdict = { 'prop_correction':[False, True , True , True , True ], } pdict = { 'scfdma_precode': [False, False, False, True , True ], 'bias_removal': [False, False, True , False, True] } #cdict = { # 'noise_power':[x for x in range(-120,-91,2)] # } #pdict = {} #cdict = { #} #pdict = {} return ctrl, p, cdict, pdict
def dec_r12(): """Single ZC sequence with Decimation""" p = lib.SyncParams() p.zc_len = 31 p.plen = 31 p.rolloff = 0.2 p.f_symb = 30.72e6 p.f_samp = p.f_symb*4 p.repeat = 1 p.spacing_factor = 1 p.power_weight = 2 p.full_sim = True p.bias_removal = False p.ma_window = 1 # number of samples to average in the crosscorr i.e. after analog modulation p.train_type = 'single' # Type of training sequence p.crosscorr_type = 'match_decimate' p.match_decimate_fct = lib.downsample p.peak_detect = 'argmax' p.pulse_type = 'rootraisedcosine' p.central_padding = 0 # As a fraction of zpos length p.scfdma_precode = False p.scfdma_L = 4 p.scfdma_sinc_len_factor = p.scfdma_L ctrl = SimControls() ctrl.steps = 20 ctrl.basephi = 6000 #Thesis #ctrl.basephi = 122880 #Interd ctrl.nodecount = 15 ctrl.display = True ctrl.static_nodes = 2 ctrl.quiet_nodes = 0 #ctrl.quiet_selection = 'kmeans' ctrl.quiet_selection = 'random' #ctrl.quiet_selection = 'contention' # Note this renders ctrl.quiet_nodes uiseless, and requires the use of outage detectection ctrl.qc_threshold = 5 # As a factor of the outage threshold ctrl.qc_steps = 3 ctrl.CFO_step_wait = float('inf') # Use float('inf') to never correct for CFO ctrl.TO_step_wait = ctrl.steps*2 ctrl.max_start_delay = 7 # In factor of basephi ctrl.use_ringarr = True ctrl.theta_bounds = [0,1] # In units of phi ctrl.deltaf_bound = 3e-2 #ctrl.deltaf_bound = 0 ctrl.rand_init = False ctrl.epsilon_TO = 1 #ctrl.non_rand_seed = 2810438 # Only used if rand_init is False ctrl.non_rand_seed = 12819 # Only used if rand_init is False #ctrl.noise_power = float('-inf') ctrl.noise_power = -101 + 9 # in dbm ctrl.delay_params = lib.DelayParams(lib.delay_pdf_3gpp_exp) ctrl.delay_params.taps = 5 #ctrl.delay_params.shadowing_fct = lambda : 0 ctrl.max_dist_from_origin = 500 # (in meters) #ctrl.max_dist_from_origin = 1000 # (in meters) #ctrl.max_dist_from_origin = 1000 # (in meters) #ctrl.max_dist_from_origin = 2000 # (in meters) ctrl.half_duplex = False ctrl.hd_slot0 = 0.3 # in terms of phi ctrl.hd_slot1 = 0.7 # in terms of phi ctrl.hd_block_during_emit = True ctrl.hd_block_extrawidth = 0 # as a factor of offset (see runsim to know what is offset) ctrl.var_winlen = False ctrl.vw_minsize = 5 # as a factor of len(p.analog_sig) ctrl.vw_lothreshold = 0.1 # winlen reduction threshold ctrl.vw_hithreshold = 0.1 # winlen increase threshold ctrl.vw_lofactor = 1.5 # winlen reduction factor ctrl.vw_hifactor = 2 # winlen increase factor #ctrl.outage_detect = False # thesis ctrl.outage_detect = True # INTERD ctrl.outage_threshold_noisefactor = 1/(p.zc_len)*2 ctrl.prop_correction = False ctrl.pc_step_wait = 0 ctrl.pc_b, ctrl.pc_a = lib.hipass_avg(6) #THESIS #ctrl.pc_b, ctrl.pc_a = lib.hipass_avg(10) #INTERD ctrl.pc_avg_thresh = float('inf') # If std of N previous TOx samples is above this value, then\ ctrl.pc_std_thresh = float(80) # If std of N previous TOx samples is above this value, then\ # no PC is applied (but TOy is still calculated) ctrl.saveall = True cdict = {} pdict = {} return ctrl, p, cdict, pdict