osd-contiki/doc/lqi-pdr/plot.asy

32 lines
734 B
Plaintext
Raw Normal View History

2010-10-25 23:05:55 +02:00
import graph;
size(350,250,IgnoreAspect);
file fin=input("./1000pkt-64len.csv");
real[][] A=dimension(csv(fin),0,2);
real[][] pdr=transpose(A);
2010-10-25 23:29:25 +02:00
int[] lqi = sequence(100);
2010-10-25 23:05:55 +02:00
2010-10-25 23:29:25 +02:00
int f (int lqi)
{
2010-10-27 17:18:56 +02:00
if(lqi <= 6) {
return (int)((real)lqi*.8);
} else if(lqi <= 11) {
2010-10-25 23:29:25 +02:00
return (lqi-6)*18;
2010-10-27 17:18:56 +02:00
} else if (lqi <= 30) {
2010-10-25 23:29:25 +02:00
return (int)((real)(lqi-11) * 0.5 + 90);
} else {
return 100;
}
}
int[] f_lqi = map(f,lqi);
draw(graph(pdr[1],pdr[0]/10));
draw(graph(lqi,f_lqi), red);
ylimits(0,100);
2010-10-25 23:05:55 +02:00
xlimits(0,100);
2010-10-27 17:18:56 +02:00
xaxis("\rm LQI",BottomTop,LeftTicks("$%.1f$",10,begin=false,end=false,extend=true,pTick=dotted));
yaxis("\rm Packet Deliver Ratio (\%)",LeftRight,RightTicks("$%#.1f$",8,begin=false,end=false,extend=true,pTick=dotted, ptick=dotted));