#14 Float parameters in BMacLayer

v2.2
closed-fixed
nobody
MAC (4)
5
2012-11-05
2012-03-05
No

Although BMacLayer defines some of the parameters as doubles in NED, the module itself is loading their values as integers. This is particularly problematic with parameters slotDuration, checkInterval and txPower, since they can be often set to a value between 0 to 1. Please see attached trivial patch for the details.

Discussion

  • Michael Lindig

    Michael Lindig - 2012-03-05
    • status: open --> open-invalid
     
  • Michael Lindig

    Michael Lindig - 2012-03-05

    Sorry, but the par(...) function does a implicit conversion to double (in this case not a conversion to integer), because the values are from double type.

     
  • Tobias Smolka

    Tobias Smolka - 2012-03-05

    Thank you for such a fast response. You are probably right, which means, that I didn't identify the source of this problem correctly. However, I can still reproduce it and posted patch fixes it for me.

    Steps to reproduce the problem:

    Plain installation of OMNet++ 4.2.1 and MiXiM 2.2.1, downloadable from official websites. Example "bmac". When I set parameter "slotDuration" to "0.9s" instead of default value "1s", the final value of variable slotDuration in BMacLayer module is "0". I checked it simply by printing it on EV.

    Could you please confirm this behavior?

     
  • Michael Lindig

    Michael Lindig - 2012-03-05

    Maybe a compiler issue! Can you change the line:

    slotDuration = hasPar("slotDuration") ? par("slotDuration") : 1;

    into

    slotDuration = hasPar("slotDuration") ? par("slotDuration") : 1.; // a dot after 1 ;)

    and test it again.

     
  • Tobias Smolka

    Tobias Smolka - 2012-03-05

    Good point! The value is now correct.

    I am using OMNeT++ under Windows 7 x64. I would therefore suggest applying discussed change at least for "slotDuration" and "txPower" in this module. I was not able to identify similar problem in other modules.

    Thank you for support.

     
  • Michael Lindig

    Michael Lindig - 2012-03-05

    OK, Thanks!

    I will check the code for that initializing issue and will correct it by explicit call to the requested type.

    Michael

     
  • Michael Lindig

    Michael Lindig - 2012-03-05
    • status: open-invalid --> open-fixed
     
  • Nobody/Anonymous

    xVen1y Really enjoyed this article.Thanks Again. Much obliged.

     
  • Nobody/Anonymous

    I appreciate you sharing this article post.Really looking forward to read more. Awesome.

     
  • Nobody/Anonymous

    YsPILc Thanks for the blog.Much thanks again. Want more.

     
  • Nobody/Anonymous

    lktCN0 Im grateful for the article post.Really looking forward to read more. Much obliged.

     
  • Michael Lindig

    Michael Lindig - 2012-11-05
    • status: open-fixed --> closed-fixed
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks