% Import fileXX.lvm and go through the power trace annotating the starting % points of each experiment: % d1 to d5 for the downloads % u1 to u5 for the uploads % ps1 to psX for the small pings (check how many available) % pl1 to plX for the large pings (check how many available) % Then, add them into arrays: % d, l, ps, pl importTrace('file50.lvm') power=data; p50=moving(power,10); plot(p50) filtered=moving(power,50); %Used for the threshold based analysis later %%----------------------------------- %%Fill in the pointer arrays %%----------------------------------- d=[d1 d2 d3b d4 d5]; u=[u1 u2 u3 u4 u5]; %Automatic filling of ps and pl given the available ones %ps=[ps1 ... psN] n=1; while exist(sprintf('ps%d', n),'var')==1 ps(n)=eval(sprintf('ps%d', n)); n=n+1; end %pl=[pl1 .. plN] n=1; while exist(sprintf('pl%d', n),'var')==1 pl(n)=eval(sprintf('pl%d', n)); n=n+1; end %%----------------------------------- %%Analyse the downloads %%----------------------------------- % Parameters dchthreshold=0.8;% 1 Power (Watt) fachthreshold=0.3; %Power (Watt) t1=4100; %DCH Tail time assumed: 4100 ms points=[start pchdch dchtx dchtail dchfach fachpch pch]; %takes filtered states and finds the cutting points (MAKE THEM IN %VECTOR) powerchunk=filtered(d(1).DataIndex:d(2).DataIndex-2000); plot(powerchunk) points(1)=0; points(2) = find(powerchunk > dchthreshold,1); points(4) = find(powerchunk(points(2)+1:end) < dchthreshold,1) + points(2); %+1 to avoid same point points(7) = find( powerchunk(points(2)+points(4):end) < fachthreshold,1) + points(2)+points(4); points(3)=points(4)-t1; %wait -get manually fach1 and fach2 points(5)=fach1; points(6)=fach2; %do the check and fix pchdch1=0; pchdch2=dch1; dchtx1=dch1; dchtx2=dch2; dchtime=dch2-dch1; dchfach=dch2; dchtx=dch2-t1;%transmission time. otherwise dch2 - tailtime %The check of the values check=filtered; check(:)=0; check(dch1)=2; check(dch2)=2; check(pch)=2; check(dchfach)=2; check(fachpch)=2; check(dchtx)=2; x=[1:1:size(filtered,1)]; plot(x,filtered) hold on plot(check) hold off