On 04/01/2014 06:13 PM, ling li wrote:
> it did not work,"Invalid value for attribute set (OnTime) on
> ns3::OnOffApplication"
Ah, that was a bad suggestion on my part. This value takes a string so
there cannot be a variable name embedded in it. You must instead build
the string that you want at runtime and pass it in; e.g.
#include <sstream>
std::ostringstream stream;
stream << "ns3::ConstantRandomVariable[Constant=" << m_totalTime << "]";
and then later use it such as:
StringValue (stream.str())
- Tom
> <mailto:
to...@tomh.org>>:
> <mailto:
amelie...@gmail.com> wrote:
>
> the old code is
> RandomVariableValue (ConstantVariable (0))
> the new code is
> StringValue("ns3::__ConstantRandomVariable[__Constant=0]")
>
> but when i meet this code
> RandomVariableValue (ConstantVariable (m_totalTime))
> i do not know how to change it.
> could you help me?
> thanks a lot !
>
>
> Have you tried:
>
> StringValue("ns3::__ConstantRandomVariable[__Constant=m_totalTime]")
>
> - Tom
>
>