13 using namespace TTEthernetModel;
30 snprintf(strBuf,64,
"RC Priority %d Messages", i);
50 cGate *physOutGate = getParentModule()->getSubmodule(
"mac")->gate(
"phys$o");
51 outChannel = physOutGate->findTransmissionChannel();
59 std::list<IPassiveQueueListener*>::iterator it = find(
listeners.begin(),
listeners.end(), listener);
64 std::list<IPassiveQueueListener*>::iterator it = find(
listeners.begin(),
listeners.end(), listener);
71 for (std::list<IPassiveQueueListener*>::iterator it =
listeners.begin(); it !=
listeners.end(); ++it)
72 (*it)->packetEnqueued(
this);
77 if (msg->arrivedOn(
"PCFin"))
86 send(msg, gateBaseId(
"out"));
96 else if (msg->arrivedOn(
"TTin"))
103 if (dynamic_cast<TTBufferEmpty *> (msg))
118 send(msg, gateBaseId(
"out"));
122 EV <<
"There might be a configuration issue (TTBuffer not registered in Output module), or shuffling was enabled for a TTBuffer or a TTFrame was delayed by a PCF" << endl;
129 else if (msg->arrivedOn(
"RCin"))
143 send(msg, gateBaseId(
"out"));
147 int priority = msg->getSenderModule()->par(
"priority").longValue();
157 ev <<
"Priority missing!" << endl;
162 else if (msg->arrivedOn(
"in"))
168 send(msg, gateBaseId(
"out"));
181 Enter_Method(
"registerTTBuffer(%s)", ttBuffer->getName());
182 uint32_t sendWindowStart = ttBuffer->par(
"sendWindowStart");
183 for (std::vector<TTBuffer*>::iterator buffer =
ttBuffers.begin(); buffer !=
ttBuffers.end();)
185 uint32_t buf_sendWindowStart = (*buffer)->par(
"sendWindowStart").longValue();
186 if (buffer ==
ttBuffers.end() || buf_sendWindowStart > sendWindowStart)
190 for (std::vector<TTBuffer*>::iterator buffer2 =
ttBuffers.begin(); buffer2 !=
ttBuffers.end();)
192 Buffer *tmpBuffer = *buffer2;
194 if (buffer2 !=
ttBuffers.end() && (tmpBuffer->par(
"sendWindowEnd").longValue() > (*buffer2)->par(
195 "sendWindowStart").longValue()))
197 opp_error(
"Port cannot be scheduled due to overlapping schedules: %s (End: %d) and %s (Start: %d)", tmpBuffer->getName(),
198 tmpBuffer->par(
"sendWindowEnd").longValue(),
199 (*buffer2)->getName(),
200 (*buffer2)->par(
"sendWindowStart").longValue());
218 std::string ttBuffersString = par(
"tt_buffers").stdstringValue();
219 std::vector<std::string> ttBufferPaths;
220 split(ttBuffersString,
',',ttBufferPaths);
221 for(std::vector<std::string>::iterator ttBufferPath = ttBufferPaths.begin();
222 ttBufferPath!=ttBufferPaths.end();ttBufferPath++){
223 cModule* module = simulation.getModuleByPath((*ttBufferPath).c_str());
232 ev<<
"Configuration problem: Module "<<(*ttBufferPath)<<
" could not be resolved or is no TT-Buffer!"<<endl;
233 getDisplayString().setTagArg(
"i2", 0,
"status/excl3");
234 getDisplayString().setTagArg(
"tt", 0,
"WARNING: Configuration Problem outgoing TT-Buffer!");
242 Enter_Method(
"requestPacket()");
250 cMessage *msg = (cMessage*)
ttQueue.pop();
258 send(msg, gateBaseId(
"out"));
267 EtherFrame *message = (EtherFrame*)
rcQueue[i].pop();
277 send(message, gateBaseId(
"out"));
285 cMessage* message = (cMessage*)
beQueue.pop();
286 send(message, gateBaseId(
"out"));
305 SimTime sendTime =
outChannel->calculateDuration(message);
307 sendTime += (INTERFRAME_GAP_BITS + ((PREAMBLE_BYTES + SFD_BYTES) * 8)) /
outChannel->getNominalDatarate();
308 unsigned long sendTicks = ceil((sendTime / scheduler->par(
"tick")).dbl());
313 if (scheduler->
getTicks() > startTicks)
315 long cycleTicks = scheduler->par(
"cycle_ticks").longValue();
316 startTicks += cycleTicks;
317 endTicks += cycleTicks;
320 else if (scheduler->
getTicks() > endTicks)
322 endTicks += scheduler->par(
"cycle_ticks").longValue();
326 if ((scheduler->
getTicks() + sendTicks) >= startTicks)
328 ev <<
"transmission not allowed!" << endl;
341 cArray parlist = pcf->getParList();
342 unsigned long start = -1;
343 for(
int i=0;i<parlist.size();i++){
344 cMsgPar *parameter =
dynamic_cast<cMsgPar*
>(parlist.get(i));
346 if(strncmp(parameter->getName(),
"received_total",15)==0 || strncmp(parameter->getName(),
"created_total",15)==0){
347 start = parameter->longValue();