Skip to content

Commit 61d6cd8

Browse files
committed
fix debug printout value precision to 9 decimals
1 parent 6c6fc0d commit 61d6cd8

File tree

3 files changed

+32
-32
lines changed

3 files changed

+32
-32
lines changed

DESERT_Framework/DESERT/data_link/uwtwr/uwtwr_AAUV.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ void UWTWR_AAUV::Phy2MacStartRx(const Packet *p)
157157
diff_time = received_time - gen_time;
158158
if (cmh->ptype() == PT_ACK_NODE) {
159159
if (debug_)
160-
std::cout << POLL_uid << "::" << std::setprecision(10) << NOW << "::UWTWR_AAUV(" << addr
160+
std::cout << POLL_uid << "::" <<std::fixed<< std::setprecision(9) << NOW << "::UWTWR_AAUV(" << addr
161161
<< ")::RX_ACK_PACKET::TOF::" << diff_time << std::endl;
162162
}
163163
}
@@ -175,12 +175,12 @@ void UWTWR_AAUV::Phy2MacEndRx(Packet *p)
175175
if (cmh->error()) {
176176
if (cmh->ptype_ == PT_ACK_NODE) {
177177
if (debug_)
178-
std::cout << POLL_uid << "::" << std::setprecision(10) << NOW << "::UWTWR_AAUV(" << addr
178+
std::cout << POLL_uid << "::" <<std::fixed<< std::setprecision(9) << NOW << "::UWTWR_AAUV(" << addr
179179
<< ")::PHY2MACENDRX_DROP_ACK" << std::endl;
180180
incrDroppedAckPkts();
181181
} else {
182182
if (debug_)
183-
std::cout << POLL_uid << "::" << std::setprecision(10) << NOW << "::UWTWR_AAUV(" << addr
183+
std::cout << POLL_uid << "::" <<std::fixed<< std::setprecision(9) << NOW << "::UWTWR_AAUV(" << addr
184184
<< ")::PHY2MACENDRX_DROP_POLL" << std::endl;
185185
incrErrorPktsRx();
186186
}
@@ -195,7 +195,7 @@ void UWTWR_AAUV::Phy2MacEndRx(Packet *p)
195195
}
196196
} else {
197197
if (debug_)
198-
std::cout << POLL_uid << "::" << std::setprecision(10) << NOW << "::UWTWR_AAUV(" << addr
198+
std::cout << POLL_uid << "::" <<std::fixed<< std::setprecision(9) << NOW << "::UWTWR_AAUV(" << addr
199199
<< ")::PHY2MACENDRX::DROP_ACK_WRONG_DEST_"
200200
<< mach->macDA() << std::endl;
201201
incrXCtrlPktsRx();
@@ -218,7 +218,7 @@ void UWTWR_AAUV::Mac2PhyStartTx(Packet *p)
218218
void UWTWR_AAUV::Phy2MacEndTx(const Packet *p)
219219
{
220220
// if (debug_)
221-
// std::cout << POLL_uid << "::" << std::setprecision(10) << NOW << "::UWTWR_AAUV(" << addr
221+
// std::cout << POLL_uid << "::" <<std::fixed<< std::setprecision(9) << NOW << "::UWTWR_AAUV(" << addr
222222
// << ")::PHYEndTx" << std::endl;
223223
}
224224

@@ -251,22 +251,22 @@ void UWTWR_AAUV::stateTxPoll()
251251
pollh->tof_ = diff_time;
252252

253253
if (debug_)
254-
std::cout << POLL_uid << "::" << std::setprecision(10) << NOW << "::UWTWR_AAUV(" << addr
254+
std::cout << POLL_uid << "::" <<std::fixed<< std::setprecision(9) << NOW << "::UWTWR_AAUV(" << addr
255255
<< ")::STATE_TX_POLL::NODE::" << pollh->id_
256256
<< std::endl;
257257
TxPoll();
258258
// iteratively polling node 0, 1 by counting down
259259
polling_index--;
260260
} else {
261261
if (debug_)
262-
std::cout << POLL_uid << "::" << std::setprecision(10) << NOW << "::UWTWR_AAUV(" << addr
262+
std::cout << POLL_uid << "::" <<std::fixed<< std::setprecision(9) << NOW << "::UWTWR_AAUV(" << addr
263263
<< ")::STATE_TX_POLL--->IDLE--->No node to POLL"
264264
<< std::endl;
265265
stateIdle();
266266
}
267267
} else {
268268
if (debug_)
269-
std::cerr << POLL_uid << "::" << std::setprecision(10) << NOW << "::UWTWR_AAUV(" << addr
269+
std::cerr << POLL_uid << "::" <<std::fixed<< std::setprecision(9) << NOW << "::UWTWR_AAUV(" << addr
270270
<< ")---> going in stateTxPoll from WRONG STATE---> "
271271
"current_state: "
272272
<< status_info[curr_state] << std::endl;
@@ -276,7 +276,7 @@ void UWTWR_AAUV::stateTxPoll()
276276
void UWTWR_AAUV::TxPoll()
277277
{
278278
// if(debug_)
279-
// std::cout << POLL_uid << "::" << std::setprecision(10) << NOW << "::UWTWR_AAUV(" << addr << ")::TX_POLL"
279+
// std::cout << POLL_uid << "::" <<std::fixed<< std::setprecision(9) << NOW << "::UWTWR_AAUV(" << addr << ")::TX_POLL"
280280
// << std::endl;
281281
incrCtrlPktsTx();
282282
incrPollTx();
@@ -305,7 +305,7 @@ void UWTWR_AAUV::stateIdle()
305305
{
306306
refreshState(UWTWR_AAUV_STATUS_IDLE);
307307
// if (debug_)
308-
// std::cout << POLL_uid << "::" << std::setprecision(10) << NOW << "::UWTWR_AAUV(" << addr << ")::IDLE STATE "
308+
// std::cout << POLL_uid << "::" <<std::fixed<< std::setprecision(9) << NOW << "::UWTWR_AAUV(" << addr << ")::IDLE STATE "
309309
// << std::endl;
310310
TxEnabled = true;
311311
stateTxPoll();
@@ -327,7 +327,7 @@ void UWTWR_AAUV::stateWaitAck()
327327
TxEnabled = false;
328328
RxAckEnabled = true;
329329
// if (debug_)
330-
// std::cout << POLL_uid << "::" << std::setprecision(10) << NOW << "::UWTWR_AAUV(" << addr
330+
// std::cout << POLL_uid << "::" <<std::fixed<< std::setprecision(9) << NOW << "::UWTWR_AAUV(" << addr
331331
// << ")::scheduling_ACK_TIMER_T= " << T_ack_timer << std::endl;
332332
ack_timer.schedule(T_ack_timer);
333333
}
@@ -336,7 +336,7 @@ void UWTWR_AAUV::stateRxAck()
336336
{
337337
if(RxAckEnabled) {
338338
// if (debug_)
339-
// std::cout << POLL_uid << "::" << std::setprecision(10) << NOW << "::UWTWR_AAUV(" << addr
339+
// std::cout << POLL_uid << "::" <<std::fixed<< std::setprecision(9) << NOW << "::UWTWR_AAUV(" << addr
340340
// << ")::stateRxAck()ACK received" << std::endl;
341341
refreshState(UWTWR_AAUV_STATUS_RX_ACK);
342342
RxAckEnabled = false;

DESERT_Framework/DESERT/data_link/uwtwr/uwtwr_NODE.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ void UWTWR_NODE::initInfo()
147147
void UWTWR_NODE::BackOffTimer::expire(Event *e)
148148
{
149149
if (module->debug_)
150-
std::cout << module->ACK_uid << "::" << std::setprecision(10) << NOW << "::UWTWR_NODE(" << module->addr
150+
std::cout << module->ACK_uid << "::" <<std::fixed<< std::setprecision(9) << NOW << "::UWTWR_NODE(" << module->addr
151151
<< ")::BACKOFF_TIMER::EXPIRED" << std::endl;
152152
timer_status = UWTWR_NODE_EXPIRED;
153153
if (module->polled) {
@@ -161,7 +161,7 @@ void UWTWR_NODE::BackOffTimerExpired()
161161
stateTxAck();
162162
} else {
163163
if (debug_) {
164-
std::cout << std::setprecision(10) << NOW << "UWTWR_NODE(" << addr
164+
std::cout <<std::fixed<< std::setprecision(9) << NOW << "UWTWR_NODE(" << addr
165165
<< ") Backoff timer expired but node not polled"
166166
<< std::endl;
167167
}
@@ -171,15 +171,15 @@ void UWTWR_NODE::BackOffTimerExpired()
171171
void UWTWR_NODE::Mac2PhyStartTx(Packet *p)
172172
{
173173
if (debug_)
174-
std::cout << ACK_uid << "::" << std::setprecision(10) << NOW << "::UWTWR_NODE(" << addr
174+
std::cout << ACK_uid << "::" <<std::fixed<< std::setprecision(9) << NOW << "::UWTWR_NODE(" << addr
175175
<< ")::MAC2PHYSTARTTX::ACK_PACKET" << std::endl;
176176
MMac::Mac2PhyStartTx(p);
177177
}
178178

179179
void UWTWR_NODE::Phy2MacEndTx(const Packet *p)
180180
{
181181
if (debug_)
182-
std::cout << ACK_uid << "::" << std::setprecision(10) << NOW << "::UWTWR_NODE(" << addr
182+
std::cout << ACK_uid << "::" <<std::fixed<< std::setprecision(9) << NOW << "::UWTWR_NODE(" << addr
183183
<< ")::MAC2PHYENDTX::ACK_PACKET" << std::endl;
184184
stateIdle();
185185
}
@@ -189,7 +189,7 @@ void UWTWR_NODE::Phy2MacStartRx(const Packet *p)
189189
hdr_cmn *cmh = hdr_cmn::access(p);
190190
if (cmh->ptype() == PT_POLL) {
191191
if (debug_)
192-
std::cout << ACK_uid << "::" << std::setprecision(10) << NOW << "::UWTWR_NODE(" << addr
192+
std::cout << ACK_uid << "::" <<std::fixed<< std::setprecision(9) << NOW << "::UWTWR_NODE(" << addr
193193
<< ")::PHY2MACSTARTRX::POLL_PACKET" << std::endl;
194194
}
195195
}
@@ -203,7 +203,7 @@ void UWTWR_NODE::Phy2MacEndRx(Packet *p)
203203
if (ch->error()) {
204204
if (ch->ptype() == PT_POLL) {
205205
if (debug_)
206-
std::cout << ACK_uid << "::" << std::setprecision(10) << NOW << "::UWTWR_NODE(" << addr
206+
std::cout << ACK_uid << "::" <<std::fixed<< std::setprecision(9) << NOW << "::UWTWR_NODE(" << addr
207207
<< ")::PHY2MACENDRX::DROP_POLL" << std::endl;
208208
incrPollDropped();
209209
}
@@ -212,7 +212,7 @@ void UWTWR_NODE::Phy2MacEndRx(Packet *p)
212212
if (ch->ptype() == PT_POLL) {
213213
hdr_POLL *pollh = HDR_POLL(p);
214214
if (debug_)
215-
std::cout << ACK_uid << "::" << std::setprecision(10) << NOW << "::UWTWR_NODE(" << addr
215+
std::cout << ACK_uid << "::" <<std::fixed<< std::setprecision(9) << NOW << "::UWTWR_NODE(" << addr
216216
<< ")::PHY2MACENDRX::RX_POLL::POLLED_NODE= "
217217
<< pollh->id_ << std::endl;
218218
curr_poll_pkt = p->copy();
@@ -225,7 +225,7 @@ void UWTWR_NODE::Phy2MacEndRx(Packet *p)
225225
incrXCtrlPktsRx();
226226
if (ch->ptype() == PT_POLL) {
227227
if (debug_)
228-
std::cout << ACK_uid << "::" << std::setprecision(10) << NOW << "::UWTWR_NODE(" << addr
228+
std::cout << ACK_uid << "::" <<std::fixed<< std::setprecision(9) << NOW << "::UWTWR_NODE(" << addr
229229
<< ")::PHY2MACENDRX::WARNING!!POLL packet not in "
230230
"broadcast!!"
231231
<< std::endl;
@@ -265,7 +265,7 @@ void UWTWR_NODE::stateTxAck()
265265
// ACK_uid++;
266266
// ackh->ACK_uid_ = ACK_uid;
267267
if (debug_)
268-
std::cout << ACK_uid << "::" << std::setprecision(10) << NOW << "::UWTWR_NODE(" << addr
268+
std::cout << ACK_uid << "::" <<std::fixed<< std::setprecision(9) << NOW << "::UWTWR_NODE(" << addr
269269
<< ")::STATE_TX_ACK_ID_" << ACK_uid
270270
<< std::endl;
271271
TxAck();
@@ -291,7 +291,7 @@ void UWTWR_NODE::stateRxPoll()
291291
// Save the RX POLL id as the corresponding ACK id
292292
ACK_uid = pollh->POLL_uid_;
293293
if (debug_)
294-
std::cout << ACK_uid << "::" << std::setprecision(10) << NOW << "::UWTWR_NODE(" << addr
294+
std::cout << ACK_uid << "::" <<std::fixed<< std::setprecision(9) << NOW << "::UWTWR_NODE(" << addr
295295
<< ")::STATE_RX_POLL::Node_POLLED = " << pollh->id_
296296
<< " rx from MAC=" << AUV_mac_addr <<std::endl;
297297

@@ -304,7 +304,7 @@ void UWTWR_NODE::stateRxPoll()
304304
incrTimesPolled();
305305
// schedule backoff time
306306
if (debug_)
307-
std::cout << ACK_uid << "::" << std::setprecision(10) << NOW << "::UWTWR_NODE(" << addr
307+
std::cout << ACK_uid << "::" <<std::fixed<< std::setprecision(9) << NOW << "::UWTWR_NODE(" << addr
308308
<< ")::scheduling_BACKOFF_TIMER_T= " << T_backoff << std::endl;
309309
backoff_timer.schedule(T_backoff);
310310
RxPollEnabled = false;
@@ -314,7 +314,7 @@ void UWTWR_NODE::stateRxPoll()
314314
}
315315
} else {
316316
if (debug_)
317-
std::cout << ACK_uid << "::" << std::setprecision(10) << NOW << "::UTWR_NODE(" << addr
317+
std::cout << ACK_uid << "::" <<std::fixed<< std::setprecision(9) << NOW << "::UTWR_NODE(" << addr
318318
<< ")::STATE_RX_POLL::NODE_NOT_POLLED" << std::endl;
319319
drop(curr_poll_pkt, 1, UWTWR_NODE_DROP_REASON_WRONG_STATE);
320320
}
@@ -323,7 +323,7 @@ void UWTWR_NODE::stateRxPoll()
323323
void UWTWR_NODE::stateIdle()
324324
{
325325
if (debug_)
326-
std::cout << ACK_uid << "::" << std::setprecision(10) << NOW << "::UWTWR_NODE(" << addr << ")::IDLE_STATE"
326+
std::cout << ACK_uid << "::" <<std::fixed<< std::setprecision(9) << NOW << "::UWTWR_NODE(" << addr << ")::IDLE_STATE"
327327
<< std::endl;
328328
refreshState(UWTWR_NODE_STATUS_IDLE);
329329
polled = false;

DESERT_Framework/DESERT/data_link/uwtwr/uwtwr_PAUV.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ void UWTWR_PAUV::Phy2MacStartRx(const Packet *p)
123123
if (ch->ptype() == PT_POLL) {
124124
hdr_POLL *pollh = HDR_POLL(p);
125125
if (debug_) {
126-
std::cout << pollh->POLL_uid_ << "::" << std::setprecision(10) << NOW << "::UWTWR_PAUV(" << addr
126+
std::cout << pollh->POLL_uid_ << "::" <<std::fixed<< std::setprecision(9) << NOW << "::UWTWR_PAUV(" << addr
127127
<< ")::PHY2MACSTARTRX::RX_POLL::POLLED_NODE::"
128128
<< pollh->id_ << "::LAST_TOF::" << pollh->tof_
129129
<< "::AAUV_POS_X::" << NOW << "::AAUV_POS_Y::" << NOW <<std::endl; // post-processing using NOW to calculate AAUV position
@@ -132,7 +132,7 @@ void UWTWR_PAUV::Phy2MacStartRx(const Packet *p)
132132
hdr_ACK_NODE *ackh = HDR_ACK_NODE(p);
133133
ACK_uid = ackh->ACK_uid_;
134134
if (debug_) {
135-
std::cout << ACK_uid << "::" << std::setprecision(10) << NOW << "::UWTWR_PAUV(" << addr
135+
std::cout << ACK_uid << "::" <<std::fixed<< std::setprecision(9) << NOW << "::UWTWR_PAUV(" << addr
136136
<< ")::PHY2MACSTARTRX::RX_ACK::ACK_NODE::"
137137
<< ackh->id_node() << "::NONE::" << 0
138138
<< "::NONE::" << 0 << "::NONE::" << 0 << std::endl;
@@ -148,20 +148,20 @@ void UWTWR_PAUV::Phy2MacEndRx(Packet *p)
148148
if (ch->error()) {
149149
if (ch->ptype() == PT_POLL) {
150150
if (debug_)
151-
std::cout << getEpoch() << "::" << std::setprecision(10) << NOW << "::UWTWR_PAUV(" << addr
151+
std::cout << getEpoch() << "::" <<std::fixed<< std::setprecision(9) << NOW << "::UWTWR_PAUV(" << addr
152152
<< ")::PHY2MACENDRX_DROP_POLL" << std::endl;
153153
incrPollDropped();
154154
} else {
155155
if (debug_)
156-
std::cout << getEpoch() << "::" << std::setprecision(10) << NOW << "::UWTWR_PAUV(" << addr
156+
std::cout << getEpoch() << "::" <<std::fixed<< std::setprecision(9) << NOW << "::UWTWR_PAUV(" << addr
157157
<< ")::PHY2MACENDRX_DROP_ACK" << std::endl;
158158
incrDroppedAckPkts();
159159
}
160160
} else {
161161
if (ch->ptype() == PT_POLL) {
162162
hdr_POLL *pollh = HDR_POLL(p);
163163
// if (debug_) {
164-
// std::cout << getEpoch() << "::" << std::setprecision(10) << NOW << "::UWTWR_PAUV(" << addr
164+
// std::cout << getEpoch() << "::" <<std::fixed<< std::setprecision(9) << NOW << "::UWTWR_PAUV(" << addr
165165
// << ")::PHY2MACENDRX::RX_POLL::POLLED_NODE= "
166166
// << pollh->id_ << std::endl;
167167
// }
@@ -170,7 +170,7 @@ void UWTWR_PAUV::Phy2MacEndRx(Packet *p)
170170
} else {
171171
hdr_ACK_NODE *ackh = HDR_ACK_NODE(p);
172172
// if (debug_) {
173-
// std::cout << getEpoch() << "::" << std::setprecision(10) << NOW << "::UWTWR_PAUV(" << addr
173+
// std::cout << getEpoch() << "::" <<std::fixed<< std::setprecision(9) << NOW << "::UWTWR_PAUV(" << addr
174174
// << ")::PHY2MACENDRX::RX_ACK::ACK_NODE= "
175175
// << ackh->id_node() << std::endl;
176176
// }
@@ -195,7 +195,7 @@ void UWTWR_PAUV::stateRxAck()
195195
void UWTWR_PAUV::stateIdle()
196196
{
197197
// if (debug_)
198-
// std::cout << getEpoch() << "::" << std::setprecision(10) << NOW << "::UWTWR_PAUV(" << addr << ")::IDLE_STATE"
198+
// std::cout << getEpoch() << "::" <<std::fixed<< std::setprecision(9) << NOW << "::UWTWR_PAUV(" << addr << ")::IDLE_STATE"
199199
// << std::endl;
200200
refreshState(UWTWR_PAUV_STATUS_IDLE);
201201
}

0 commit comments

Comments
 (0)