21.05.2015 Views

Estimación de marcas en redes RFID - Posgrado en Ciencias y ...

Estimación de marcas en redes RFID - Posgrado en Ciencias y ...

Estimación de marcas en redes RFID - Posgrado en Ciencias y ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

APÉNDICE A. CÓDIGO CSMA P -PERSISTENTE 48<br />

%p a r t i r d e l primer CI v a c i ó . Cuando se t i e n e n 2 CI se termina e l<br />

%proceso <strong>de</strong> i d e n t i f i c a c i ó n .<br />

%% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %<br />

i f (sum( numberEmpty==z e r o s ( s i z e ( numberEmpty)))==NTimeranura )<br />

nEmpty=nEmpty+1;<br />

prob =1;<br />

%% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %<br />

%Calculamos e l numero <strong>de</strong> b y t e s para un comando <strong>de</strong><br />

%r e c o l e c c i ó n d e l l e c t o r a l a s <strong>marcas</strong> <strong>de</strong>bido a un c i v a c i ó<br />

%% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %<br />

[ bytesRea<strong>de</strong>rtoTagCI , bytesTagtoRea<strong>de</strong>rCI ]=<br />

<strong>RFID</strong>calcData ( commandRequest , NI<strong>de</strong>nt ) ;<br />

bytesRea<strong>de</strong>rtoTag=bytesRea<strong>de</strong>rtoTag+bytesRea<strong>de</strong>rtoTagCI ;<br />

bytesTagtoRea<strong>de</strong>r=bytesTagtoRea<strong>de</strong>r+bytesTagtoRea<strong>de</strong>rCI ;<br />

<strong>en</strong>d ;<br />

%% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %<br />

%Esta p a r t e simula e l comando ACK−C o l l e c t i o n , <strong>en</strong> e l que se l e<br />

%i n d i c a a una marca que ha s i d o i d e n t i f i c a d a y a l mismo tiempo se<br />

%s o l i c i t a n más datos<br />

%% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %<br />

% Si NI<strong>de</strong>nt=0 q u i e r e d e c i r que o c u r r i ó una c o l i s i ó n antes <strong>de</strong> que<br />

% una marca <strong>en</strong>viara su i d e n t i f i c a d o r<br />

%% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %<br />

totalTag=totalTag−NI<strong>de</strong>nt ;<br />

%% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %<br />

%Contamos l a s <strong>marcas</strong> i d e n t i f i c a d a s h a t s e l mom<strong>en</strong>to<br />

%% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %<br />

numberTags=numberTags+NI<strong>de</strong>nt ;<br />

%% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %<br />

%El número <strong>de</strong> ranuras u t i l i z a d o s por e l p r o t o c o l o es e l último que se<br />

%ejecutó , es <strong>de</strong>cir , <strong>en</strong> e l c u a l o bi<strong>en</strong> se t i e n e una s o l a transmisión<br />

%o bi<strong>en</strong> se t i e n e una c o l i s i ó n<br />

%% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %<br />

NTimeranuraTotalCI=NTimeranuraTotalCI+n ;<br />

%% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %<br />

%En e s t a p a r t e calculamos e l tiempo u t i l i z a d o <strong>en</strong> e l c i c l o <strong>de</strong><br />

%i d e n t i f i c a c i ó n a c t u a l .<br />

%% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %<br />

%Hay que recordar que s i no se u t i l i z a n todos l o s ranuras , s o l o hay<br />

%que contemplar e l v a l o r <strong>de</strong> ’n ’ como e l número <strong>de</strong> micro ranuras<br />

%u t i l i z a d o s <strong>en</strong> e l c i c l o <strong>de</strong> i d e n t i f i c a c i ó n a c t u a l<br />

%% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %<br />

time=<strong>RFID</strong>calcTime (n , NI<strong>de</strong>nt , N C o l l i s i o n ) ;<br />

totalTime=totalTime+time ;<br />

%Calculamos e l tiempo por r e p e t i c i ó n<br />

atime=atime+time ;<br />

<strong>en</strong>d ;

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!