set the sendinterval in pingApp.cc

38 kali dilihat
Langsung ke pesan pertama yang belum dibaca

Mohammadreza sahebi

belum dibaca,
25 Agu 2014, 03.43.0225/08/14
kepadaomn...@googlegroups.com
I can change the sendInterval paramater in omnetpp.ini or pingApp.ned... but based on my scenario I should change it based on some conditions on PingApp.cc. Hence would you please let me know, how can I change the delay of sendInterval paramater in pingApp.cc.

Mohammadreza

Michael Kirsche

belum dibaca,
25 Agu 2014, 07.23.3425/08/14
kepadaomn...@googlegroups.com
Well why don't you simply take a look inside pingApp.cc?

Check the lines 44 and 62. A parameter sendIntervalPar is initialized there and it's getting the value of the NED parameter "sendInterval" assigned (in line 62).
You can work with sendIntervalPar inside pingApp.cc just like with any other normal C++ data type.

Mohammadreza sahebi

belum dibaca,
25 Agu 2014, 11.06.4025/08/14
kepadaomn...@googlegroups.com
Dear Michael

I set the sendinterval=5s in omnetpp.ini. Now I want to change it in pingApp.cc to 2s. I used the following comments, but shows the error about type.

sendIntervalPar=2;

Best Regard
Mohammadreza




--
You received this message because you are subscribed to a topic in the Google Groups "omnetpp" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/omnetpp/O1On_rpC4yo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to omnetpp+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Michael Kirsche

belum dibaca,
26 Agu 2014, 03.42.4026/08/14
kepadaomn...@googlegroups.com
You did not check the source code!
sendIntervalPar is a cPar value (check the header file).

From the comments of cObject:

/**
 * Represents a module or channel parameter.
 *
 * When a module or channel is created, parameter objects are added
 * automatically, based on the NED declaration of the module/channel.
 * It is not possible to create further parameters (or to remove parameters)
 * at runtime. This is enforced by the cPar constructor being private.
 *
 * Parameters get their initial values automatically, from the NED
 * declarations and the configuration. It is possible to change the
 * parameter value during runtime (see various setter methods and
 * operator='s), but not the type of the parameter (see getType()).
 * The type correspond to NED types (bool, double, long, string, xml),
 * and cannot be changed at runtime.
 *
 * The module or channel object can get notified when a parameter is
 * changed; one has to override cComponent::handleParameterChange()
 * for that.
 */

Mohammadreza sahebi

belum dibaca,
27 Agu 2014, 05.50.2527/08/14
kepadaomn...@googlegroups.com
thank you Michael... Now I can do it with " sendIntervalPar->setDoubleValue(0.2);"

Best regard
Mohammadreza

Balas ke semua
Balas ke penulis
Teruskan
0 pesan baru