OMNeT++/OMNEST Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0000051OMNeT++IDE / C++ developmentpublic2009-02-27 10:252009-03-09 13:04
Reporterahyasar 
Assigned Toandras 
PrioritynormalSeveritycrashReproducibilityalways
StatusresolvedResolutionno change required 
PlatformOSOS Version
Product Version4.0rc1 
Target VersionFixed in Version 
Summary0000051: Error in method cDataRateChannel
DescriptionWhenever I use the following piece of code in my simulation it builds properly but during the simulation runtime it gives errors like parameter disabled, delay, datarate and ber not found.
********************************************************
        // cDatarateChannel *channel1 = new cDatarateChannel("channel");
        // channel1->setDisabled(true);
        // channel1->setDelay(0.001);
        // channel1->setDatarate(10000);
        // channel1->setBitErrorRate(0.001);
        // cDatarateChannel *channel2 = new cDatarateChannel("channel");
        // channel2->setDisabled(true);
        // channel2->setDelay(0.001);
        // channel2->setDatarate(10000);
        // channel2->setBitErrorRate(0.001);
*******************************************************************

Can anyone please help? Thank you.

Ansar
Katholieke Universiteit Leuven
Belgium
TagsNo tags attached.
Attached Files? file icon network.cc [^] (20,670 bytes) 2009-02-27 10:25
? file icon Error [^] (227,480 bytes) 2009-03-09 10:55 [Show Content]

- Relationships

-  Notes
(0000120)
ahyasar (reporter)
2009-02-27 10:26

I am running OMNET++4 on Ubuntu 8.10.
(0000122)
andras (administrator)
2009-03-08 17:40

Channel objects need to be created via their cChannelType objects (they add the parameters). Do either

cDatarateChannel *ch = cChannelType::createDatarateChannel("channel");

or

cChannelType *type = cChannelType::getDatarateChannelType();
cDatarateChannel *ch = type->create("channel");

which is equivalent to (but faster than) this:

cChannelType *type = cChannelType::get("ned.DatarateChannel");
cDatarateChannel *ch = type->create("channel");
(0000123)
ahyasar (reporter)
2009-03-08 18:44

Thank you very much for your reply.

I tried it again but the problem still remains which occurs when I use any of the following:

        ch->setDelay(0.001);
        ch->setDatarate(10000);
        ch->setBitErrorRate(0.001);

It builds successfully but during run time a popup windows appears saying that e.g. no paramater delay or datarate or ber.

Please comment. Thank you.
(0000124)
ahyasar (reporter)
2009-03-08 18:46

I want to set it up dynamically from the *.cc file rather than from the ned file in order to set different datarate and ber for each channel.
(0000125)
andras (administrator)
2009-03-09 08:17

I cannot reproduce this with 4.0rc2. The following code executes correctly:

    cDatarateChannel *ch = cChannelType::createDatarateChannel("channel");
    ch->setDelay(0.001);
    ch->setDatarate(10000);
    ch->setBitErrorRate(0.001);

    cModule *node2 = getParentModule()->getSubmodule("node2");
    gate("out")->connectTo(node2->gate("in"), ch);
(0000126)
ahyasar (reporter)
2009-03-09 10:54

When I do this I get a different error this time which you can see in the screen shot I have taken and attached as a reference to this forum.

I hope that you can see and help me. thank you very much.

cDatarateChannel *channel1 = cChannelType::createDatarateChannel("channel");
 // channel1->setDisabled(true);
        channel1->setDelay(0.001);
         channel1->setDatarate(10000);
         channel1->setBitErrorRate(0.01);

         cDatarateChannel *channel2 = cChannelType::createDatarateChannel("channel");
        
        // channel2->setDisabled(true);
         channel2->setDelay(0.001);
         channel2->setDatarate(10000);
        channel2->setBitErrorRate(0.01);

        ev << "Node " << getIndex() << ": Connect node " << getIndex() << " to node " << idx << ".\n";
        gate("out", outidx)->connectTo(parent->getSubmodule("n", idx)->gate("in", inidx), channel1, true);
        ev << "Node " << getIndex() << ": Connect node " << idx << " to node " << getIndex() << ".\n";
        parent->getSubmodule("n", idx)->gate("out", inidx)->connectTo(gate("in", outidx), channel2, true);
(0000127)
ahyasar (reporter)
2009-03-09 10:55

The file name is error.
(0000128)
ahyasar (reporter)
2009-03-09 10:57

I am also attaching the complete code of this function which is causing this error inside my simulation when i ported it from 3.4 to 4.0 version.

***********************************

void Txc::connectTo(int idx)
{
    int n = gateSize("out");
    int outidx = -1;
    int inidx = -1;
   // double ber=0.1;

    cModule *parent = getParentModule();

    for (int i=0; i < n; i++) {
        cGate *out = gate("out", i);
        if ((out != NULL) && (!(out->isConnected()))) {
            outidx = i;
        }
    }

    n = parent->getSubmodule("n", idx)->gateSize("in");
    for (int i=0; i < n; i++) {
        cGate *in = parent->getSubmodule("n", idx)->gate("in", i);
        if ((in != NULL) && (!(in->isConnected()))) {
            inidx = i;
        }
    }
    
     if ((outidx >= 0) && (inidx >= 0)) {
        

         cDatarateChannel *channel1 = cChannelType::createDatarateChannel("channel");
        // channel1->setDisabled(true);
         channel1->setDelay(0.001);
         channel1->setDatarate(10000);
        channel1->setBitErrorRate(0.01);

         cDatarateChannel *channel2 = cChannelType::createDatarateChannel("channel");
    
        // channel2->setDisabled(true);
         channel2->setDelay(0.001);
         channel2->setDatarate(10000);
        channel2->setBitErrorRate(0.01);

        ev << "Node " << getIndex() << ": Connect node " << getIndex() << " to node " << idx << ".\n";
        gate("out", outidx)->connectTo(parent->getSubmodule("n", idx)->gate("in", inidx), channel1, true);
       
        ev << "Node " << getIndex() << ": Connect node " << idx << " to node " << getIndex() << ".\n";
        parent->getSubmodule("n", idx)->gate("out", inidx)->connectTo(gate("in", outidx), channel2, true);


       
    } else {
        ev << "Could not connect node " << getIndex() << " to node " << idx << ".\n";
    }
}
(0000129)
ahyasar (reporter)
2009-03-09 11:16

Actually my plan is to have different channel for each node having different parameters like datarate, ber, delay, etc.

I have around 50-100 node depending on the type of experiment I perform.

Can you please comment on this as well? I am sorry to disturb you. Thank you for your support.
(0000130)
andras (administrator)
2009-03-09 13:03

I read the error message, the text is quite clear about what's wrong.
And you call connectTo() with "true" as the third parameter; the parameter's name is "leaveUninitialized" (!). If you remove that, it will work fine.

> Actually my plan is to have different channel for each node having different
> parameters like datarate, ber, delay, etc.

That is OK; however, that question should have been asked on the mailing list. The bugtracker is for tracking bugs.

- Issue History
Date Modified Username Field Change
2009-02-27 10:25 ahyasar New Issue
2009-02-27 10:25 ahyasar Assigned To => andras
2009-02-27 10:25 ahyasar File Added: network.cc
2009-02-27 10:26 ahyasar Note Added: 0000120
2009-03-08 17:40 andras Note Added: 0000122
2009-03-08 17:41 andras Status new => resolved
2009-03-08 17:41 andras Resolution open => no change required
2009-03-08 18:44 ahyasar Note Added: 0000123
2009-03-08 18:44 ahyasar Status resolved => feedback
2009-03-08 18:44 ahyasar Resolution no change required => reopened
2009-03-08 18:46 ahyasar Note Added: 0000124
2009-03-09 08:17 andras Note Added: 0000125
2009-03-09 10:54 ahyasar Note Added: 0000126
2009-03-09 10:55 ahyasar File Added: Error
2009-03-09 10:55 ahyasar Note Added: 0000127
2009-03-09 10:57 ahyasar Note Added: 0000128
2009-03-09 11:16 ahyasar Note Added: 0000129
2009-03-09 13:03 andras Note Added: 0000130
2009-03-09 13:04 andras Status feedback => resolved
2009-03-09 13:04 andras Resolution reopened => no change required


Copyright © 2000 - 2019 MantisBT Team
Powered by Mantis Bugtracker