Anonymous | Login | 2022-08-19 00:08 UTC | ![]() |
My View | View Issues | Change Log | Roadmap |
View Issue Details [ Jump to Notes ] | [ Issue History ] [ Print ] | ||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||
0000793 | OMNeT++ | simulation kernel | public | 2014-11-28 13:22 | 2014-11-30 07:29 | ||||
Reporter | andras | ||||||||
Assigned To | andras | ||||||||
Priority | normal | Severity | minor | Reproducibility | always | ||||
Status | resolved | Resolution | fixed | ||||||
Platform | OS | OS Version | |||||||
Product Version | 4.5 | ||||||||
Target Version | Fixed in Version | 4.6 | |||||||
Summary | 0000793: NED: local parameters cannot be used to initialize an inherited parameter | ||||||||
Description | In 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; } omnetpp.ini: [General] 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. | ||||||||
Tags | No tags attached. | ||||||||
Attached Files | |||||||||
![]() |
|
(0000951) 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 { gates: inout g; connections allowunconnected: } network Net { submodules: a: Node; b: Node; connections: a.g <--> C <--> b.g; } omnetpp.ini: [General] network = Net **.foo = 42 |
(0000952) 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. |
(0000954) 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. |
![]() |
|||
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 |