Simul¶
-
class
pylayers.simul.simultraj.
Simul
(source='simulnet_TA-Office.h5', verbose=False)[source]¶ Bases:
pylayers.util.project.PyLayers
Link oriented simulation
A simulation requires :
A Layout
A Person
A Trajectory
or a CorSer instance
dpersons : dictionnary of persons (agent) dap : dictionnary of access points
load_simul : load configuration file load_Corser : load a Corser file _gen_net : generate network and asociated links show : show layout and network evaldeter : run simulation over time
Methods Summary
check_exist
(df)check if a dataframe df already exists in self.data
evaldeter
(na, nb, wstd[, fmod, nf, fGHz])deterministic evaluation of a link
evalstat
(na, nb)statistical evaluation of a link
get_df_from_link
(id_a, id_b[, wstd])Return a restricted data frame for a specific link
get_link
(**kwargs)retrieve a Link specific time from a simultraj
get_sim_time
(t)retrieve closest time value in regard of passed t value in parameter
get_value
(**kwargs)retrieve output parameter at a specific time
load_CorSer
(source)load CorSer file for simulation
load_simul
(source)load a simultraj configuration file
loadpd
()load data from previous simulations
replace_data
(df)check if a dataframe df already exists in self.data
run
(**kwargs)run the link evaluation along a trajectory
savepd
(df)save data information of a simulation
settime
(t)set current time
show
()show actual simlulation configuration
tocsv
(ut, ida, idb, wstd[, init])update_pos
(t)update positions of devices and bodies for a given time index
Methods Documentation
-
check_exist
(df)[source]¶ check if a dataframe df already exists in self.data
df : pd.DataFrame
- boolean
True if already exists False otherwise
-
evaldeter
(na, nb, wstd, fmod='force', nf=10, fGHz=[], **kwargs)[source]¶ deterministic evaluation of a link
- nastring:
node a id in self.N (Network)
- nbstring:
node b id in self.N (Network)
- wstdstring:
wireless standard used for commmunication between na and nb
- fmodestring (‘center’|’band’|’force’)
mode of frequency evaluation center : single frequency (center frequency of a channel) band : nf points on the whole band force : takes directly fGHz
- nfint:
number of frequency points (if fmode = ‘band’)
**kwargs : argument of DLink
(a, t )
- andarray
alpha_k
- tndarray
tau_k
pylayers.simul.link.DLink
-
evalstat
(na, nb)[source]¶ statistical evaluation of a link
- nastring:
node a id in self.N (Netwrok)
- nbstring:
node b id in self.N (Netwrok)
(a, t, eng)
- andarray
alpha_k
- tndarray
tau_k
- engfloat
engagement
-
get_df_from_link
(id_a, id_b, wstd='')[source]¶ Return a restricted data frame for a specific link
- id_astr
node id a
- id_b: str
node id b
- wstd: str
optionnal :wireslees standard
-
get_link
(**kwargs)[source]¶ retrieve a Link specific time from a simultraj
- typlist
list of parameters to be retrieved (ak | tk | R |C)
- links: list
dictionnary of link to be evaluated (key is wtsd and value is a list of links) (if [], all link are considered)
- t: int or np.array
list of timestamp to be evaluated | singlr time instant
DL : DLink
>>> from pylayers.simul.simultraj import * >>> from pylayers.measures.cormoran import * >>> C=CorSer(serie=6,day=11,layout=True) >>> S = Simul(C,verbose=False) >>> DL = S.get_link(typ=['R','C','H'])
-
get_value
(**kwargs)[source]¶ retrieve output parameter at a specific time
- typlist
list of parameters to be retrieved (R | C |H | ak | tk | rss )
- links: list
dictionnary of link to be evaluated (key is wtsd and value is a list of links) (if [], all link are considered)
- t: int or np.array
list of timestamp to be evaluated | singlr time instant
- output: dict
- [link_key][‘t’]
[‘ak’]
…
-
load_CorSer
(source)[source]¶ load CorSer file for simulation
- source :
name of simulation file to be loaded
-
load_simul
(source)[source]¶ load a simultraj configuration file
- sourcestring
name of simulation file to be loaded
-
replace_data
(df)[source]¶ check if a dataframe df already exists in self.data
df : pd.DataFrame
- boolean
True if already exists False otherwise
-
run
(**kwargs)[source]¶ run the link evaluation along a trajectory
- OB: boolean
perform on body statistical link evaluation
- B2B: boolean
perform body to body deterministic link evaluation
- B2I: boolean
perform body to infrastructure deterministic link evaluation
- I2I: boolean
perform infrastructure to infrastructure deterministic link eval.
- links: dict
dictionnary of link to be evaluated (key is wtsd and value is a list of links) (if [], all link are considered)
- wstd: list
list of wstd to be evaluated (if [], all wstd are considered)
- t: np.array
list of timestamp to be evaluated (if [], all timestamps are considered)
- tbrboolean
time in bit reverse order (tmin,tmax,N) Npoints=2**N
- replace_data: boolean (True)
- if True , reference id of all already simulated link will be erased
and replace by new simulation id
- fGHznp.array
frequency in GHz
>>> from pylayers.simul.simultraj import * >>> from pylayers.measures.cormoran import * >>> C=CorSer(layout=True) >>> S=Simul(C,verbose=True) >>> link={'ieee802154':[]} >>> link['ieee802154'].append(S.N.links['ieee802154'][0]) >>> lt = [0,0.2,0.3,0.4,0.5] >>> S.run(links=link,t=lt)