OMNeT++/OMNEST Bug Tracker - OMNeT++
View Issue Details
0000521OMNeT++simulation kernelpublic2012-01-15 13:322012-01-15 17:36
andras 
 
normalminorhave not tried
newopen 
4.2 
 
0000521: channel parameters cannot be set with pattern assignments in NED
Channel parameters cannot be set with pattern assignments in NED

Example:

module Node
{
    gates:
        input in;
        output out;
    connections allowunconnected:
}

network FifoNet
{
    parameters:
        **.datarate = 444 Mbps; // <---- THIS LINE IS INEFFECTIVE
    submodules:
        a: Node;
        b: Node;
    connections allowunconnected:
        a.out --> ned.DatarateChannel --> b.in;
}

The datarate setting line does not take effect. At the same time, a **.datarate=... line in omnetpp.ini is OK.


No tags attached.
Issue History
2012-01-15 13:32andrasNew Issue
2012-01-15 16:36andrasNote Added: 0000688
2012-01-15 17:36andrasNote Added: 0000689

Notes
(0000688)
andras   
2012-01-15 16:36   
Pattern assignments are supposed to be applied to channels in same way as to submodules, in

  void cNEDNetworkBuilder::assignParametersFromPatterns(cComponent *component)

invoked indirectly from

  cChannelType::create(const char *name);

This method calls getParentModule() repeatedly until it reaches the top, and applies pattern assignments it finds at each level. This works fine for modules,
but a channel's getParentModule() returns NULL, because the parent module is not know yet! (cChannel::getParentModule() computes it from the source gate, which is unset at this point). Modules work because cModuleType::create() requires the parent module pointer too, in addition to the name string.

Options:

1. add the "cModule *parentmodule" arg to cChannelType::create() too; this will make it symmetric with cModuleType. connectTo() will need to ensure that the channel object is indeed used for a connection that has the previously specified parent.

2. change the code so that parameter reading is delayed until the channel object is used for a connection.
(0000689)
andras   
2012-01-15 17:36   
Only 2) works, because the srcgat/srcmodule is also part of the channel fullpath, parentmodule is not enough.

Plan:
- {cModuleType|cChannelType}::create() should only apply the parameter values that come from the NED *type* of component (regardless of the place of instantiation)
- local assignments (from submodule/connection NED element), NED pattern assignments and inifile assignments should be done within finalizeParameters(). finalizeParameters() already calls ev.readParameter(); it should also call a new cComponentType::assignParameters() method first, which would perform the local assignments and pattern assignments from NED. This should not touch parameters already set.

Between the two, the user could manually set parameters; user's assignments would not be overwritten by later local/pattern assignments.