#!/usr/bin/perl $num = 0; $override_range = $ARGV[0]; # Go through the .csc file; find the transmission range and all the # nodes' x and y coordinates. while() { if(/\([\d.]+)\<\//) { $range = $1; } if(/\([\d.]+)\<\//) { $success_ratio_rx = $1; } if(/\([\d.]+)\([\d.]+)\ 1) { $reception_probability = 0; } else { $reception_probability = 1 - $ratio * (1 - $success_ratio_rx); } $reception_probability_sum += $reception_probability; } } } if($neighbors == 0) { $no_neighbors++; } if($neighbors == $num - 1) { $all_neighbors++; } $total_neighbors += $neighbors; } print "$num $range " . ($total_neighbors / $num) . " " . ($no_neighbors / $num) . " " . ($all_neighbors / $num) . " " . ($reception_probability_sum / $total_neighbors) . "\n"; print "# Range $range number of nodes $num override range $override_range\n"; print "# Num nodes $num, average neighbors " . ($total_neighbors / $num) . ", $no_neighbors nodes (" . (100 * $no_neighbors / $num) . "%) have no neighbors, $all_neighbors (" . (100 * $all_neighbors / $num) . "%) have all other nodes as neighbors\n"; print "# Average reception probability " . ($reception_probability_sum / $total_neighbors) . "\n";