How to change ErrorRate overtime in channel?

37 views
Skip to first unread message

phil Lin

unread,
Jul 30, 2019, 9:16:07 AM7/30/19
to ns-3-users
Hi all,

I have a problem:

I want to change the ErrorRate starting from 10s. 

This is my way to change the errorrate which is in the RateErrorModel.
It doesn't work
void errorchange(){
   Config::Set("/NodeList/0/DeviceList/0/$ns3::PointToPointNetDevice/ReceiveErrorModel/$ns3::RateErrorModel/ErrorRate", DoubleValue(0.1));
}
Ptr<UniformRandomVariable> uv = CreateObject<UniformRandomVariable> ();
  uv->SetStream (50);
  RateErrorModel error_model;
  error_model.SetRandomVariable (uv);
  error_model.SetUnit (RateErrorModel::ERROR_UNIT_PACKET);

 
  PointToPointHelper pointToPoint;
  pointToPoint.SetDeviceAttribute ("DataRate", StringValue ("8Mbps"));
  pointToPoint.SetChannelAttribute ("Delay", StringValue ("20ms"));
  pointToPoint.SetDeviceAttribute ("ReceiveErrorModel", PointerValue (&error_model));
  Simulator::Schedule (Seconds(10) , &errorchange);
I can't change the ErrorRate and it still maintained the default value.

Do you have any advice ? Thank you so much!
Reply all
Reply to author
Forward
0 new messages