#Copyright (c) 2006 EPFL/Switzernet/Intarnet by Emin Gabrielyan reset; print "Drawing..."; commands network-config.txt; commands diagramfec-config.txt; shell "rmdir /s /q diagram"; shell "mkdir diagram"; shell "del /q diagram\*"; shell "copy randomwalk-config.txt diagram > nul"; printf "%%!PS\n" > (ps); printf " [/View [/XYZ null null 1]\n" > (ps); printf " /Page 1\n" > (ps); printf " /PageMode /FullScreen\n" > (ps); printf " /DOCVIEW pdfmark\n" > (ps); printf "/Courier findfont %f scalefont setfont\n",fontsz > (ps); table params IN "ODBC" "data/randomwalk.mdb": [], x_max, y_max, coverage, source_node, sink_node, N, T; read table params; table coordinates IN "ODBC" "data/randomwalk.mdb": [Timeframe,NODES], x,y; read table coordinates; data data/LINKS.txt; table multiflow IN "ODBC" "data/multipath.mdb": PATH <- [frame,link_entry,link_exit], flow~multiflow; read table multiflow; set Loadvalues; for{t in 1..T} { # coverages printf "gsave\n" > (ps); printf "%f 0 translate\n",page_bar > (ps); printf "%f dup translate\n",nodesz > (ps); printf "%s setrgbcolor\n","1 0.95 0.8" > (ps); for{i in NODES} { printf "newpath %f %f %f 0 360 arc fill\n",x[t,i],y[t,i],coverage/2 > (ps); } printf "grestore\n" > (ps); #information bar printf "gsave 0 %f translate\n",page_height > (ps); printf "0 %f translate 0 0 moveto (frame: %d) show\n", -fontsz,t > (ps); printf "0 %f translate 0 0 moveto (nodes: %d) show\n", -fontsz,N > (ps); printf "0 %f translate 0 0 moveto (links: %d) show\n", -fontsz,card(LINKS[t]) > (ps); printf "0 %f translate 0 0 moveto ( path: %d) show\n", -fontsz,card({(t,i,j) in PATH}) > (ps); printf "0 %f translate\n",-0.5*fontsz > (ps); let Loadvalues := setof {(t,i,j) in PATH} round(flow[t,i,j],5); for{l in 1..page_height/fontsz-4.5} { if Loadvalues within {} then break; let linkload := max{val in Loadvalues} val; let Loadvalues := Loadvalues diff {linkload}; print view > (ps); printf "0 %f moveto\n",-fontsz*l > (ps); printf "(%2d: %.5f) dup stringwidth pop\n",l,linkload > (ps); printf "0 rlineto stroke\n" > (ps); printf "0 %f moveto 0 setgray show\n",-fontsz*l > (ps); } printf "grestore\n" > (ps); printf "%f 0 translate\n",page_bar > (ps); printf "%f dup translate\n",nodesz > (ps); # not used random walk links printf "[%f %f] 0 setdash 0.5 setgray %f setlinewidth\n",linewidth*2,linewidth*3,linewidth > (ps); for{(i,j) in LINKS[t]: i (ps); } # links followed by the flow printf "[ ] 0 setdash 1 0 0 setrgbcolor %f setlinewidth\n",linewidth > (ps); for{(t,i,j) in PATH} { let linkload := flow[t,i,j]; print view > (ps); printf "%f %f moveto %f %f lineto stroke\n",x[t,i],y[t,i],x[t,j],y[t,j] > (ps); } # nodes printf "0.5 setgray\n" > (ps); for{i in NODES diff {source_node,sink_node}} { printf "newpath %f %f %f 0 360 arc fill\n",x[t,i],y[t,i],nodesz > (ps); } # parties (end nodes) printf "%s setrgbcolor\n","1 0 0" > (ps); for{i in {source_node,sink_node}} { printf "newpath %f %f %f 0 360 arc fill\n",x[t,i],y[t,i],nodesz > (ps); } printf "showpage\n" > (ps); } close (ps); table page OUT "ODBC" "data/diagram.xls": [], page_width, page_height; write table page;