So I'm trying create a simple simulation in omnetpp, and I am having trouble with module parameters.
I have provided a simple example to demonstrate my problem. If I leave the commented sections in all the code commented, the simulation runs fine. If I un-comment the commented sections in all the code, my program compiles fine, but the simulation won't run. The debug output prints the following message:
Error in module (omnetpp::cModule) net (id=1) during network setup: (transceiver): unknown parameter `what'.
I don't know what the issue is, since 'what' is defined in my .ini file and my .ned. Here is my code:
transceiver.cc
#include <omnetpp.h>
using namespace omnetpp;
class transceiver : public cSimpleModule
{
private:
//int what;
public:
transceiver();
virtual ~transceiver();
protected:
virtual void initialize() override;
virtual void handleMessage(cMessage* msg) override;
};
Define_Module(transceiver);
transceiver::transceiver() {
//what = par("what");
}
transceiver::~transceiver() {
}
void transceiver::initialize() {
cMessage* msg = new cMessage("Message");
send(msg, "out");
}
void transceiver::handleMessage(cMessage* msg) {
EV << "We got a message!" << endl;
delete msg;
}
package.ned
package packetgenerator;
@license(omnetpp);
omnetpp.ini
[General]
network = transceiver.net
#net.transceiver.what = 5
transceiver.ned
package transceiver;
simple transceiver
{
parameters:
//int what = default(2);
gates:
input in;
output out;
}
network net
{
submodules:
transceiver: transceiver;
connections:
transceiver.out --> transceiver.in;
}