31 double rn = normal(NULL, a+(b-a)/2, (b-a)/6);
32 if(rn < a) { rn = a; }
33 if(rn > b) { rn = b; }
58 startAt = simTime() + par(
"startAt");
59 stopAt = simTime() + par(
"stopAt");
68 dstApName = par(
"dstApName").stringValue();
70 dstAeName = par(
"dstAeName").stringValue();
74 EV <<
"Destination AEName is set to default which is AeErr. AeErr is for special testing purposes. Are you sure that it is right?" << endl;
79 scheduleAt(
startAt,
new cMessage(
"StartCommunication"));
81 scheduleAt(
stopAt,
new cMessage(
"StopCommunication"));
89 maxSize = par(
"maxPDUsize").longValue();
100 recTimes = par(
"recTimes").boolValue();
115 if(par(
"printAtEnd").boolValue()){
116 EV <<
"At "<<this->
getApni()<<endl;
127 EV <<
"-----------------"<<endl;
128 for(std::map<double, int>::iterator it =
times.begin(); it!=
times.end(); it++) {
129 EV <<
" " << it->first <<
" " << it->second <<endl;
131 EV <<
"-----------------"<<endl;
133 EV <<
"-----------------"<<endl;
140 if ( !strcmp(msg->getName(),
"StartCommunication") ) {
147 scheduleAt(simTime()+
sendAfter,
new cMessage(
"MakeCommunication"));
148 }
else if ( !strcmp(msg->getName(),
"StopCommunication") ) {
150 }
else if ( !strcmp(msg->getName(),
"EndCommunication") ) {
152 }
else if ( !strcmp(msg->getName(),
"MakeCommunication") ) {
160 if ( msg->isSelfMessage() ) {
161 if(
_AESInt_self * smsg = dynamic_cast<_AESInt_self*>(msg)){
170 if(
_PingMsg* ping = dynamic_cast<_PingMsg*>(msg)){
176 if(
_PongMsg* pong = dynamic_cast<_PongMsg*>(msg)){
180 simtime_t delay = simTime() - pong->pingAt;
187 double dl =
dround(delay.dbl(), 3);
200 msg->setByteLength(size);
205 msg->setByteLength(size);
213 sendMsg(pong, ping->getByteLength());
220 int exp_base10 = round(log10(a));
221 double man_base10 = a*pow(10.0,-exp_base10);
222 double factor = pow(10.0,-ndigits+1);
223 double truncated_man_base10 = man_base10 - fmod(man_base10,factor);
224 double rounded_remainder = fmod(man_base10,factor)/factor;
226 rounded_remainder = rounded_remainder > 0.5 ? 1.0*factor : 0.0;
228 return (truncated_man_base10 + rounded_remainder)*pow(10.0,exp_base10) ;
Class representing flow object with attributes from specs.
void setQosRequirements(const QoSReq &qosReqs)
Sets QoS parameters wanted by flow initiator.
virtual void processMsg(_AESInt_self *)
CDAPConnectionState connectionState
Application Process Name class.
double minMaxNormal(double a, double b, int rng)
const APNamingInfo & getApni() const
std::string getQoSId() const
Getter of selected QoS-cube identifier.
virtual void processMReadR(CDAPMessage *msg)
std::map< double, int > times
APNamingInfo holds complete naming info for particular application process.
void initQoSRequiremets()
void sendMsg(_PingMsg *, int)
std::string dstApInstance
std::string dstAeInstance
void handleSelfMessage(cMessage *msg)
void sendDeallocationRequest(Flow *flow)
virtual void handleMessage(cMessage *msg)
const ConnectionId & getConId() const
Gets read-only Flow's ConnectionId.
const QoSReq & getQoSRequirements() const
void initSignalsAndListeners()
virtual void initialize()
virtual void processMRead(CDAPMessage *msg)
double dround(double a, int ndigits)
_PongMsg(simtime_t pingAt)
void sendData(Flow *flow, CDAPMessage *msg)
void sendAllocationRequest(Flow *flow)