Пример #1
0
   // ----------------------------------------------------------------------
   void
   SimulationTaskLocalizationEvaluation::Results::
   collect_information( SimulationController& sc, const SimulationTaskLocalizationEvaluation& stle )
      throw()
   {
      LocalizationObserver observer;

      if ( sc.world().communication_model().exists_communication_upper_bound() )
         comm_range = sc.world().communication_model().communication_upper_bound();

      set_seed( sc, stle );

      for( World::node_iterator
               it = sc.world_w().begin_nodes_w();
               it != sc.world_w().end_nodes_w();
               ++it )
      {
         Node& v = *it;
         LocalizationProcessor* lp =
            v.get_processor_of_type_w<LocalizationProcessor>();

         if ( lp == NULL || lp->is_anchor() ) continue;
         observer.set_owner( *lp );

         if ( v.has_est_position() )
         {
            ++has_pos_cnt;
            double distance = euclidean_distance( v.real_position(), v.est_position() );

            stat_abs_position += distance;
         }
         else
         {
            ++no_pos_cnt;
         }

         stat_known_anchors += observer.anchor_cnt();
         stat_valid_known_anchors += observer.valid_anchor_cnt();

         observer.fill_stat_rel_anchor_distance(
            stat_real_err_anchor_dist,
            stat_comm_err_anchor_dist );

         observer.fill_stat_rel_neighbor_distance(
            stat_real_neighbor_dist,
            stat_comm_neighbor_dist );

         stat_neighbor_cnt += (double)observer.neighbor_cnt();
      }// for all nodes
   }
Пример #2
0
 // ----------------------------------------------------------------------
 void
     MovementResetTask::
     run( SimulationController& sc )
     throw( std::runtime_error )
 {
    if (sc.environment_w().optional_string_param("reset", "")=="true")
       sc.world_w().reset();
 }
Пример #3
0
   // ----------------------------------------------------------------------
   void
   SimulationTaskLocalizationEvaluation::HeaderInfo::
   collect_information( SimulationController& sc, const SimulationTaskLocalizationEvaluation& stle )
      throw()
   {
      LocalizationObserver observer;

      if ( sc.world().communication_model().exists_communication_upper_bound() )
         comm_range = sc.world().communication_model().communication_upper_bound();

      world_width = sc.world().upper_right().x() - sc.world().lower_left().x();
      world_height = sc.world().upper_right().y() - sc.world().lower_left().y();

      set_placement( sc, stle );

      for( World::node_iterator
              it = sc.world_w().begin_nodes_w();
           it != sc.world_w().end_nodes_w();
           ++it )
      {
         Node& v = *it;
         LocalizationProcessor* lp =
            v.get_processor_of_type_w<LocalizationProcessor>();

         if ( lp == NULL ) continue;

         if ( lp->is_anchor() )
            ++anchor_cnt;
         else
            ++unknown_cnt;

         observer.set_owner( *lp );

         startup_anchor_frac = observer.startup_anchor_frac();
         dist_algo = observer.distance_algorithm();
         pos_algo = observer.position_algorithm();
         ref_algo = observer.refinement_algorithm();
         floodlimit = observer.floodlimit();
         idle_time = observer.idle_time();
      }
   }