src/contrib/energy/test/basic-energy-model-test.cc
changeset 6430 cfbd2029c0ce
parent 6429 5ee11b58989d
child 6535 0a90ef2b29a9
equal deleted inserted replaced
6429:5ee11b58989d 6430:cfbd2029c0ce
   130   NS_TEST_ASSERT_MSG_EQ (false, modelList.empty (), "Model list is empty!");
   130   NS_TEST_ASSERT_MSG_EQ (false, modelList.empty (), "Model list is empty!");
   131   // get pointer
   131   // get pointer
   132   Ptr<BasicRadioEnergyModel> devModel =
   132   Ptr<BasicRadioEnergyModel> devModel =
   133     DynamicCast<BasicRadioEnergyModel> (modelList[0]);
   133     DynamicCast<BasicRadioEnergyModel> (modelList[0]);
   134   // check pointer
   134   // check pointer
   135   NS_TEST_ASSERT_MSG_NE (NULL, devModel, "NULL pointer to device model!");
   135   NS_TEST_ASSERT_MSG_NE (0, devModel, "NULL pointer to device model!");
   136 
   136 
   137   // schedule change of state
   137   // schedule change of state
   138   Simulator::Schedule (Seconds (m_timeS),
   138   Simulator::Schedule (Seconds (m_timeS),
   139                        &BasicRadioEnergyModel::UpdateRemainingEnergy, devModel, state);
   139                        &BasicRadioEnergyModel::UpdateRemainingEnergy, devModel, state);
   140 
   140 
   313   /*
   313   /*
   314    * Calculate total number of callbacks invoked. Taking the ceiling instead of
   314    * Calculate total number of callbacks invoked. Taking the ceiling instead of
   315    * the floor here because initial update is at time = 0.
   315    * the floor here because initial update is at time = 0.
   316    */
   316    */
   317   double tmp = ceil (simTimeS / updateIntervalS);
   317   double tmp = ceil (simTimeS / updateIntervalS);
   318   int numOfUpdates = (tmp == 0) ? 1 : tmp;
   318   int numOfUpdates = (tmp == 0) ? 1 : static_cast<int> (tmp);
   319   /*
   319   /*
   320    * Every update will trigger *all* DeviceEnergyModels to react, therefore the
   320    * Every update will trigger *all* DeviceEnergyModels to react, therefore the
   321    * total count should be numOfUpdates * m_numOfModels ^ 2
   321    * total count should be numOfUpdates * m_numOfModels ^ 2
   322    */
   322    */
   323   int totalCallbackCount = numOfUpdates * m_numOfModels * m_numOfModels;
   323   int totalCallbackCount = numOfUpdates * m_numOfModels * m_numOfModels;