OMNeT++/OMNEST Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0000793OMNeT++simulation kernelpublic2014-11-28 13:222014-11-30 07:29
Assigned Toandras 
PlatformOSOS Version
Product Version4.5 
Target VersionFixed in Version4.6 
Summary0000793: NED: local parameters cannot be used to initialize an inherited parameter
DescriptionIn NED, local parameters cannot be used to initialize an inherited parameter. Moreover, the result will be incorrect (0) instead of an error message.

This can be best demonstrated on channels. See the following code:

channel C extends ned.DatarateChannel {
    double foo @unit(Gbps);
    datarate = foo;

network = <a network that contains channels of type C>
**.foo = 42

The result will be datarate=0.

The same effect can be reproduced with module inheritance.
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
andras (administrator)
2014-11-28 13:24
edited on: 2014-11-28 13:34

Full code for reproducing the bug:

channel C extends ned.DatarateChannel {
    int foo @unit(Gbps);
    datarate = foo;

module Node {
    inout g;
  connections allowunconnected:

network Net {
    a: Node;
    b: Node;
    a.g <--> C <--> b.g;

network = Net
**.foo = 42

andras (administrator)
2014-11-28 13:33

Problem is twofold:

(1) parameters are initialized in the order of declaration, basetype-to-subtype, and top-down (within a type) order. Then, datarate=x should cause a "parameter x not yet initialized" error. This doesn't happen due to another issue:

(2) during in the parameter initialization stage, it is not checked that a referenced variable has indeed been already initialized. Therefore the construction-time value of x (zero) is used for datarate. (Note that this can no longer happen when module initialize() is called, as all parameters are guaranteed to be initialized by that time.)

Issue (2) can be easily fixed. (1) is more difficult, as the parameter initialization strategy itself has to be modified to be more flexible.
andras (administrator)
2014-11-30 07:29

Fixed. Parameters of the same module/channel can freely cross-reference each other, as long as they are no cycles. Cycles are reported as errors.

- Issue History
Date Modified Username Field Change
2014-11-28 13:22 andras New Issue
2014-11-28 13:24 andras Note Added: 0000951
2014-11-28 13:33 andras Note Added: 0000952
2014-11-28 13:34 andras Note Edited: 0000951 View Revisions
2014-11-30 07:29 andras Note Added: 0000954
2014-11-30 07:29 andras Status new => resolved
2014-11-30 07:29 andras Fixed in Version => 4.6
2014-11-30 07:29 andras Resolution open => fixed
2014-11-30 07:29 andras Assigned To => andras
2015-10-12 09:28 ammmar1988 Issue cloned: 0000875

Copyright © 2000 - 2022 MantisBT Team
Powered by Mantis Bugtracker