'Why do I get this message whenever I try to run my simulation. Simulation time limit reached -- at t=10000, events #1
Whenever I try to run my simulation in omnet++ I get the message Simulation time limit reached -- at t=10000, events #1. I can't tell what is stoping my program from properly running.
Here is my NED code:
simple rdr
{
gates:
input in[];
output out[];
}
//
network radr
{
@display("bgb=356,232");
submodules:
rdrchk1: rdr {
@display("p=49,41");
}
rdrfail1: rdr {
@display("p=207,146");
}
rdrsucess1: rdr {
@display("p=207,48");
}
connections:
rdrchk1.out++ --> { } --> rdrfail1.in++;
rdrchk1.out++ --> { } --> rdrsucess1.in++;
}
Here is my c++ code.
#include <string.h>
#include <omnetpp.h>
using namespace omnetpp;
class rdr : public cSimpleModule
{
protected:
// The following redefined virtual function holds the algorithm.
virtual void initialize() override;
virtual void handleMessage(cMessage *msg) override;
};
// The module class needs to be registered with OMNeT++
Define_Module(rdr);
void rdr::initialize()
{
int v1 = rand() % 100;
int v2 = rand() % 100;
int v3 = rand() % 100;
if (strcmp("rdrchk1.out", getName()) == 0) {
cMessage *msg = new cMessage("objectcheck");
if (v1<78|| v2 < 82 || v3 <69){
send(msg, "rdrsucess1.in");
}
else{
send(msg, "rdrfail1");
}
}
}
void rdr::handleMessage(cMessage *msg)
{
send(msg, "out");
}
Here is my ini code:
[General]
network = radr
cpu-time-limit = 1000s
real-time-limit = 1000s
sim-time-limit = 1000s
simtime-resolution = ps
My program is supposed to generate a msg at rdrchk1 and then send it out to either rdrfail1 or rdrsucess1. If anyone can show me what I am missing that would be great. Thank you for your time.
Solution 1:[1]
Removing the .out from "rdrchk1.out" allows the simulation to progress pass if (strcmp("rdrchk1.out", getName()) == 0).
Solution 2:[2]
This is what is stopping it: sim-time-limit = 1000s
as a side note, remove also cpu-time-limit and real-time-limt.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Jeremy Caney |
| Solution 2 | Rudi |
