Hi everyone,
I'm working on a project for school on Omnet++. I'm trying to simulate Lincoln Tunnel (or at least a close representation).
There are 4 modules: source, ezpass_sink, cash_sink and tunnel_sink.
Currently I have two sources that have 5 outputs each. Each output connects to a separate sink (10 sinks for 10 toll booths). All the sinks then connect to a final sink for the Lincoln tunnel. The issue I'm having is having the source keep sending messages and have the messages queue up at the sink. I don't know if I used the right term (queue) but I just want the sinks (booths) to wait and then send the message to the lincoln tunnel after a set delay. This is simulating the time it would take for the car to either go through with an ezpass or the time it takes to pay in cash.
The code for the network description is relatively long so I'll post that if it helps. Currently this is my ezpass_sink.cc
void ezpass_sink::activity()
{
int delay = 5000;
cMessage *msg = receive();
cMessage *newmsg = queue1->pop();
waitAndEnqueue(delay, queue1);
send(newmsg, "out");
}
the cash_sink.cc has the same code. I put this code in activity as opposed to the handleMessage function because I cannot cause I delay. I just want to get an estimate of how long the average cars take from source to lincoln tunnel.
Any help would be greatly appreciated, thanks!