79 cChannel *channel = (cChannel *)source;
80 cModule *srcModule = channel->getSourceGate()->getOwnerModule();
82 cModule *destModule = channel->getSourceGate()->getNextGate()->getOwnerModule();
83 cITimestampedValue *v = check_and_cast<cITimestampedValue *>(obj);
84 if (dynamic_cast<cDatarateChannel *>(channel)) {
85 cDatarateChannel *datarateChannel = (cDatarateChannel *)channel;
86 cMessage *msg = check_and_cast<cMessage *>(v->objectValue(signalID));
87 simtime_t duration = msg->isPacket() ? ((cPacket *)msg)->getBitLength() / datarateChannel->getDatarate() : 0.0;
88 simtime_t delay = datarateChannel->getDelay();
89 simtime_t fbTx = v->getTimestamp(signalID);
90 simtime_t lbTx = fbTx + duration;
91 simtime_t fbRx = fbTx + delay;
92 simtime_t lbRx = lbTx + delay;
93 f << fbTx <<
" P " << srcModule->getId() <<
" " << destModule->getId() <<
" " << lbTx <<
" " << fbRx <<
" " << lbRx <<
"\n";
95 else if (dynamic_cast<cDelayChannel *>(channel)) {
96 cDelayChannel *delayChannel = (cDelayChannel *)channel;
97 simtime_t fbTx = v->getTimestamp(signalID);
98 simtime_t fbRx = fbTx + delayChannel->getDelay();
99 f << fbTx <<
" P " << srcModule->getId() <<
" " << destModule->getId() <<
" " << fbTx <<
" " << fbRx <<
" " << fbRx <<
"\n";
104 IMobility *mobility =
dynamic_cast<IMobility *
>(source);
106 Coord
c = mobility->getCurrentPosition();
109 f << simTime() <<
" N " << mod->getId() <<
" " << c.x <<
" " << c.y <<
"\n";
112 else if (signalID == POST_MODEL_CHANGE) {
115 if (dynamic_cast<cPostModuleAddNotification *>(obj)) {
116 cPostModuleAddNotification *notification = (cPostModuleAddNotification *)obj;
120 else if (dynamic_cast<cPostGateConnectNotification *>(obj)) {
121 cPostGateConnectNotification *notification = (cPostGateConnectNotification *)obj;
double mod(double dividend, double divisor)
Returns the rest of a whole-numbered division.
Definition: INETMath.h:108
virtual bool isRelevantModule(cModule *mod)
Definition: NetAnimTrace.cc:128
const value< double, compose< units::m, pow< units::s,-1 > > > c(299792458)
cModule * findContainingNode(const cModule *from)
Find the node containing the given module.
Definition: ModuleAccess.cc:56
static simsignal_t mobilityStateChangedSignal
Definition: NetAnimTrace.h:35
static simsignal_t messageSentSignal
Definition: NetAnimTrace.h:34
virtual void addNode(cModule *mod)
Definition: NetAnimTrace.cc:133
virtual void addLink(cGate *gate)
Definition: NetAnimTrace.cc:140
std::ofstream f
Definition: NetAnimTrace.h:36