[Tinyos-2-commits] CVS: tinyos-2.x/apps/tests/TestFtsp FtspDataAnalyzer.m, NONE, 1.1 README.txt, 1.1, 1.2
kusy
kusy at users.sourceforge.net
Wed Jul 23 13:34:45 PDT 2008
Update of /cvsroot/tinyos/tinyos-2.x/apps/tests/TestFtsp
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv27314
Modified Files:
README.txt
Added Files:
FtspDataAnalyzer.m
Log Message:
added matlab script that calculates mean timesync error and updated doc
--- NEW FILE: FtspDataAnalyzer.m ---
%load file written out by FtspDataLogger.java class
%arg0 - filename, e.g. '1205543689171.report'
function FTSPDataAnalyzer(file, varargin)
[c1 c2 c3 c4 c5]= textread(file, '%u %u %u %u %u', 'commentstyle', 'shell');
data = [c2 c3 c4 c5]; %skipping the first column (java time)
data1 = sortrows(sortrows(data,1),2);
newdata = [];
row=1;
newrow=1;
unsynced=0;
while (row<=size(data1,1))
seqnum=data1(row,2);
data2=[];
row2=1;
tmprow1=row;
while (row <= size(data1,1) && data1(row,2)==seqnum)
if (data1(row,4)==0)
data2(row2,1)=data1(row,3);
row2= row2+ 1;
else
unsynced=unsynced+1;
end
row = row + 1;
end
if (row2>1)
row2size=row2-1;
rcvdsize=row-tmprow1;
newdata(newrow,1) = seqnum;
newdata(newrow,2) = mad(data2(1:row2size,1));
newdata(newrow,3) = mean(data2(1:row2size,1));
newdata(newrow,4) = row2size/rcvdsize;
newrow = newrow + 1;
end
end
if (length(newdata)==0)
disp('no data found (at least one data point from a synchronized mote is required)!');
else
newsize=newrow-1;
subplot(3,1,1);
plot(newdata(1:newsize,1),newdata(1:newsize,2));
title(sprintf('TimeSync Errors'));
subplot(3,1,2);
plot(newdata(1:newsize,1),newdata(1:newsize,3));
title(sprintf('Avg Glob Time'));
subplot(3,1,3);
plot(newdata(1:newsize,1),newdata(1:newsize,4),'b-');
title(sprintf('%% Synced Motes'));
disp(sprintf('total unsycned num %d (all %d)',unsynced,newsize));
disp(sprintf('avg %0.3f',mean(newdata(1:newsize,2))));
disp(sprintf('max %d',max(newdata(1:newsize,2))));
savedata = newdata(1:newsize,:);
save data.out savedata -ASCII;
end
Index: README.txt
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/apps/tests/TestFtsp/README.txt,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** README.txt 2 Jul 2008 17:42:42 -0000 1.1
--- README.txt 23 Jul 2008 20:34:41 -0000 1.2
***************
*** 87,88 ****
--- 87,93 ----
1214516498285 1 10964 445707 0
1214516498521 1 10965 445964 0
+
+ This output is also saved in a file named 'current_timestamp.report'.
+ '.report' files can be used with the FtspDataAnalyzer.m Matlab
+ application. Mean absolute timesync error, global time, and % of
+ synced motes will be plotted.
More information about the Tinyos-2-commits
mailing list