Tic Toc in wireless

775 views
Skip to first unread message

sassir

unread,
Oct 23, 2012, 10:12:02 AM10/23/12
to omn...@googlegroups.com
Hello all,

I am an student engineer in telecommunications and I am beginner on OMNeT++. In order to learn how to use OMNeT, I followed the TicToc tutorial, I achieved to do it. For a week, i am trying to do the same in wireless; But I have a problem with gate and especially the use of sendDirect.
I get:
<!> Error in module (SimpleHost) Network.host0 (id=2) during network initialization: send()/sendDelayed(): no such gate or gate vector: `out'.

I tried to use your advices of others questions but nothing.
So can anyone help me to understand my fault?

Thanks you very much!!

here is my code (I could not send the files sorry all of you)

////////////File Network.ned:
simple SimpleHost
{
    parameters:
        @display("i=device/pocketpc_s");
    gates:
        input in @loose;
}

network Network
{
    parameters:
        @display("bgi=background/terrain,s;bgb=392,233");
    types:
    submodules:
        host0: SimpleHost {
            @display("p=59,84");
        }
        host1: SimpleHost {
            @display("p=351,182");
        }
}


//////////////FILE SimpleHost.cc
#include <stdio.h>
#include <string.h>
#include <omnetpp.h>
#include "SimpleHost.h"

Define_Module(SimpleHost);

void SimpleHost::initialize()
{
    if (strcmp("host0", getName()) == 0)
    {
        ev << "I’m host 0, sending initial message" << endl;
        cMessage *msg = new cMessage("SimpleMsg");
        cModule *targetModule = getParentModule() -- > getSubmodule("host1");
        sendDirect(msg, targetModule, "in");
    }
}

void SimpleHost::handleMessage(cMessage *msg)
{
    ev << "Received message ‘" << msg-> getName() << "’" << endl;
    if (strcmp("host0", getName()) == 0)
       {
           ev << "I’m host 0, sending the message" << endl;
           cModule *targetModule = getParentModule() -> getSubmodule("host1");
           sendDirect(msg, targetModule, "in");
       }
    if (strcmp("host1", getName()) == 0)
       {
         ev << "I’m host 1, sending the message" << endl;
         cModule *targetModule = getParentModule() -> getSubmodule("host0");
         sendDirect(msg, targetModule, "in");
       }
}
 ///////File SimpleHost.h
#ifndef SIMPLEHOST_H_
#define SIMPLEHOST_H_

#include <stdio.h>
#include <string.h>
#include <omnetpp.h>

class SimpleHost : public cSimpleModule
{

protected:
// The following redefined virtual function holds the algorithm.
virtual void initialize();
virtual void handleMessage(cMessage *msg);
};

Alfonso Ariza Quintana

unread,
Oct 23, 2012, 1:06:53 PM10/23/12
to omn...@googlegroups.com
for wireless host you need to use or mixim or inet/inetmanet frameworks, the basic host that you show can’t support wireless communications
--
--
Sent from the OMNeT++ mailing list. To configure your membership,
visit http://groups.google.com/group/omnetpp
 
 
 

Rudolf Hornig

unread,
Oct 23, 2012, 6:01:00 PM10/23/12
to omn...@googlegroups.com, aari...@hotmail.com
As far as I see, he is just experimenting with direct send. No detailed wireless modeling here... I see no reason for the error the code seems to be ok so something fishy is going on. I would do the following:
- set debug-on-error to true in the INI file and run the simulation in debugger (you may need to resume several times before the sim actually starts).
- once omnet throws an error it will stop on a software breakpoint and you can see the stack trace from that point, that will show you the location where you try to access a gate named 'out'

also you may try to add

connections allowunconnected: 

at the end of your network file: that will disable all connections checking.

Rudolf

sassir

unread,
Oct 24, 2012, 7:12:33 AM10/24/12
to omn...@googlegroups.com, aari...@hotmail.com

Ok thank you very much !Rudolf and Alfonso!
@++

Ali

unread,
Feb 15, 2013, 12:42:06 AM2/15/13
to omn...@googlegroups.com, aari...@hotmail.com
Hi sassir,
i can help you in this regard.i have run your code.only one minor change is required.
while specifying gates in .ned file.you should use
gates:
        input in@directIn;
instead of using
gates:
input in @loose;
regards,
Ali

Asad Ali

unread,
Feb 15, 2013, 12:56:40 AM2/15/13
to omn...@googlegroups.com
Hi,
in the following line
cModule *targetModule = getParentModule() -- > getSubmodule("host1");
you should change the sign "-- >" to "->" i,e
cModule*targetModule = getParentModule() -> getSubmodule("host1");
 
and it will just work fine..
regards
---
You received this message because you are subscribed to the Google Groups "omnetpp" group.
To unsubscribe from this group and stop receiving emails from it, send an email to omnetpp+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

khalid...@gmail.com

unread,
Feb 15, 2013, 3:14:53 AM2/15/13
to omn...@googlegroups.com
Hello all
I  am doing my research work in IEEE802.16e . Can any body guide my that how can I use OMNet++ for my proposed simulation. which module can I use,
Reply all
Reply to author
Forward
0 new messages