def __init__(self, _fileini='coverage.ini'): """ object constructor Parameters ---------- _fileini : string name of the configuration file Notes ----- Coverage is described in an ini file. Default file is coverage.ini and is placed in the ini directory of the current project. """ self.config = ConfigParser.ConfigParser(allow_no_value=True) self.config.read(pyu.getlong(_fileini, pstruc['DIRSIMUL'])) # section layout self.layoutopt = dict(self.config.items('layout')) # section sector self.gridopt = dict(self.config.items('grid')) # section ap (access point) self.apopt = dict(self.config.items('ap')) # section receiver parameters self.rxopt = dict(self.config.items('rx')) # section receiver parameters self.showopt = dict(self.config.items('show')) # get the Layout filename = self.layoutopt['filename'] if filename.endswith('lay'): self.typ = 'indoor' self.L = Layout(filename) # get the receiving grid self.nx = eval(self.gridopt['nx']) self.ny = eval(self.gridopt['ny']) if 'zgrid' in self.gridopt: self.zgrid = eval(self.gridopt['zgrid']) else: self.zgrid = 1.0 self.mode = self.gridopt['mode'] assert self.mode in ['file', 'full', 'zone'], "Error reading grid mode " self.boundary = eval(self.gridopt['boundary']) self.filespa = self.gridopt['file'] # # create grid # self.creategrid(mode=self.mode, boundary=self.boundary, _fileini=self.filespa) self.dap = {} for k in self.apopt: kwargs = eval(self.apopt[k]) ap = std.AP(**kwargs) self.dap[eval(k)] = ap try: self.L.Gt.nodes() except: pass try: self.L.dumpr() except: self.L.build() self.L.dumpw() else: self.typ = 'outdoor' self.E = ez.Ezone(filename) self.E.loadh5() self.E.rebase() # The frequency is fixed from the AP nature self.fGHz = np.array([]) #self.fGHz = eval(self.txopt['fghz']) #self.tx = np.array((eval(self.txopt['x']),eval(self.txopt['y']))) #self.ptdbm = eval(self.txopt['ptdbm']) #self.framelengthbytes = eval(self.txopt['framelengthbytes']) # receiver section #self.rxsens = eval(self.rxopt['sensitivity']) self.temperaturek = eval(self.rxopt['temperaturek']) self.noisefactordb = eval(self.rxopt['noisefactordb']) # show section self.bshow = str2bool(self.showopt['show']) self.sinr = False self.snr = False self.best = False self.egd = False self.Pr = False self.capacity = False self.pr = False self.loss = False
def __init__(self,_fileini='coverage.ini'): """ object constructor Parameters ---------- _fileini : string name of the configuration file Notes ----- Coverage is described in an ini file. Default file is coverage.ini and is placed in the ini directory of the current project. """ self.config = ConfigParser.ConfigParser() self.config.read(pyu.getlong(_fileini,pstruc['DIRSIMUL'])) self.layoutopt = dict(self.config.items('layout')) self.gridopt = dict(self.config.items('grid')) self.apopt = dict(self.config.items('ap')) self.rxopt = dict(self.config.items('rx')) self.showopt = dict(self.config.items('show')) # get the Layout self.L = Layout(self.layoutopt['filename']) # get the receiving grid self.nx = eval(self.gridopt['nx']) self.ny = eval(self.gridopt['ny']) self.mode = self.gridopt['mode'] self.boundary = eval(self.gridopt['boundary']) self.filespa = self.gridopt['file'] # # create grid # self.creategrid(mode=self.mode,boundary=self.boundary,_fileini=self.filespa) self.dap = {} for k in self.apopt: kwargs = eval(self.apopt[k]) ap = std.AP(**kwargs) self.dap[eval(k)] = ap self.fGHz = np.array([]) #self.fGHz = eval(self.txopt['fghz']) #self.tx = np.array((eval(self.txopt['x']),eval(self.txopt['y']))) #self.ptdbm = eval(self.txopt['ptdbm']) #self.framelengthbytes = eval(self.txopt['framelengthbytes']) # receiver section #self.rxsens = eval(self.rxopt['sensitivity']) self.temperaturek = eval(self.rxopt['temperaturek']) self.noisefactordb = eval(self.rxopt['noisefactordb']) # show section self.bshow = str2bool(self.showopt['show']) try: self.L.Gt.nodes() except: pass try: self.L.dumpr() except: self.L.build() self.L.dumpw()