57 : TclClass(
"Module/UW/UFETCH/AUV")
82std::map<uwUFetch_AUV::UWUFETCH_AUV_STATUS, std::string>
84std::map<uwUFetch_AUV::UWUFETCH_AUV_STATUS_CHANGE, std::string>
86std::map<uwUFetch_AUV::UWUFETCH_AUV_PACKET_TYPE, std::string>
88std::map<uwUFetch_AUV::UWUFETCH_TIMER_STATUS, std::string>
99 , DATA_timer_first_pck(this)
103 , NUM_MAX_DATA_AUV_WANT_RX(0)
104 , T_START_PROC_TRIGGER(0)
110 , tx_TRIGGER_start_time(0)
111 , tx_TRIGGER_finish_time(0)
112 , rx_RTS_start_time(0)
113 , rx_RTS_finish_time(0)
114 , tx_CTS_start_time(0)
115 , tx_CTS_finish_time(0)
116 , rx_DATA_start_time(0)
117 , rx_DATA_finish_time(0)
118 , n_tot_TRIGGER_tx_by_AUV(0)
119 , n_tot_RTS_rx_by_AUV(0)
120 , n_tot_RTS_rx_corr_by_AUV(0)
121 , n_tot_CTS_tx_by_AUV(0)
122 , n_tot_DATA_rx_by_AUV(0)
123 , n_tot_DATA_rx_corr_by_AUV(0)
124 , number_data_pck_AUV_rx_exact(0)
125 , mac_addr_HN_ctsed(0)
130 , mac_addr_HN_in_data(0)
133 , mac_addr_hn_triggered(0)
140 txTRIGGEREnabled(false)
141 , rxRTSEnabled(false)
142 , txCTSEnabled(false)
143 , rxDATAEnabled(false)
146 n_TRIGGER_tx_by_AUV(0)
149 , n_DATA_rx_by_AUV(0)
152 curr_TRIGGER_pck_tx(NULL)
153 , curr_RTS_pck_rx(NULL)
154 , curr_CTS_pck_tx(NULL)
155 , curr_DATA_pck_rx(NULL)
157 mac2phy_delay_ = 1e-19;
158 bind(
"T_min_RTS_", (
double *) &T_MIN_RTS);
159 bind(
"T_max_RTS_", (
double *) &T_MAX_RTS);
160 bind(
"T_guard_", (
double *) &T_GUARD);
161 bind(
"t_RTS_", (
double *) &T_RTS);
162 bind(
"MAX_PAYLOAD", (
double *) &MAX_PAYLOAD);
163 bind(
"num_max_DATA_AUV_want_receive_", (
int *) &NUM_MAX_DATA_AUV_WANT_RX);
164 bind(
"TIME_BEFORE_TX_TRIGGER_PCK_", (
double *) &T_START_PROC_TRIGGER);
165 bind(
"MY_DEBUG_", (
int *) &debugMio_);
166 bind(
"NUMBER_OF_RUN_", (
int *) &N_RUN);
167 bind(
"HEAD_NODE_1_", (
int *) &HEAD_NODE_1);
168 bind(
"HEAD_NODE_2_", (
int *) &HEAD_NODE_2);
169 bind(
"HEAD_NODE_3_", (
int *) &HEAD_NODE_3);
170 bind(
"HEAD_NODE_4_", (
int *) &HEAD_NODE_4);
171 bind(
"MODE_COMM_", (
int *) &mode_comm_hn_auv);
172 bind(
"NUM_HN_NETWORK_", (
int *) &NUM_HN_NET);
179 Tcl &tcl = Tcl::instance();
182 if (strcasecmp(argv[1],
"initialize") == 0) {
186 fout.open(
"/tmp/uwUFetch_AUV_stateTransitions.txt",
190 std::stringstream file_logging;
191 file_logging <<
"uwUFetch_AUV_" << addr <<
"_N_RUN_" <<
N_RUN
194 file_logging.str().c_str(), std::ios_base::app);
198 }
else if (strcasecmp(argv[1],
"printTransitions") == 0) {
202 }
else if (strcasecmp(argv[1],
"getTRIGGERtxByAUV") == 0) {
206 }
else if (strcasecmp(argv[1],
"getRTSrxByAUV") == 0) {
210 }
else if (strcasecmp(argv[1],
"getRTSCorruptedRxByAUV") == 0) {
214 }
else if (strcasecmp(argv[1],
"getCTStxByAUV") == 0) {
218 }
else if (strcasecmp(argv[1],
"getDataRxByAUV") == 0) {
222 }
else if (strcasecmp(argv[1],
"getDataCorruptedRxByAUV") == 0) {
226 }
else if (strcasecmp(argv[1],
"AUVNodeStart") == 0) {
230 }
else if (argc == 3) {
231 if (strcasecmp(argv[1],
"setMacAddr") == 0) {
232 addr = atoi(argv[2]);
234 std::cout <<
"UWFETCH_AUV MAC address is:" << addr << std::endl;
240 return MMac::command(argc, argv);
248 return MMac::crLayCommand(m);
259 hdr_cmn *cmh = hdr_cmn::access(p);
260 hdr_mac *mach = HDR_MAC(p);
265 std::cout << NOW <<
" uwUFetch_AUV (" << addr
266 <<
") ::Mac2PhyStartTx() ---->MAC layer of the AUV "
268 <<
" packet to his physical layer." << std::endl;
270 if (mach->macDA() == -1) {
273 <<
")::Mac2PhyStartTx()______________________"
274 "Start_tx_of_TRIGGER_pck_in_BROADCAST."
279 <<
")::Mac2PhyStartTx()______________________"
280 "Start_tx_of_TRIGGER_pck_to_HN("
281 << mach->macDA() <<
")." << std::endl;
292 MMac::Mac2PhyStartTx(p);
296 std::cout << NOW <<
" uwUFetch_AUV (" << addr
297 <<
") ::Mac2PhyStartTx() ---->MAC layer of the AUV "
299 <<
" packet to his physical layer." << std::endl;
303 <<
")::Mac2PhyStartTx()______________________"
304 "Start_tx_of_CTS_pck_to_HN("
305 << mach->macDA() <<
")." << std::endl;
309 MMac::Mac2PhyStartTx(p);
317 hdr_cmn *cmh = hdr_cmn::access(p);
318 hdr_mac *mach = HDR_MAC(p);
329 std::cout << NOW <<
" uwUFetch_AUV (" << addr
330 <<
") ::Phy2MacEndTx() ---->Physical layer of AUV "
332 <<
" to transmit a TRIGGER packet to the AUVs in "
333 "broadcast, now the AUV is waiting for"
334 <<
" the reception of RTS packets from the HNs."
337 if (mach->macDA() == -1) {
340 <<
")::Phy2MacEndTx()_____________________"
341 "___End_tx_of_TRIGGER_pck_in_BROADCAST."
346 <<
")::Phy2MacEndTx()_____________________"
347 "___End_tx_of_TRIGGER_pck_to_the_HN("
348 << mach->macDA() <<
")." << std::endl;
366 << NOW <<
" uwUFetch_AUV (" << addr
367 <<
") ::Phy2MacEndTx() ---->Physical layer of the AUV has "
369 <<
" to transmit a CTS packet to the AUV with MAC address: "
371 <<
" the DATA packets from the HN and disable the "
372 "reception of other CTS"
377 <<
")::Phy2MacEndTx()________________________End_"
378 "tx_of_CTS_pck_to_the_HN("
379 << mach->macDA() <<
")." << std::endl;
403 hdr_cmn *cmh = hdr_cmn::access(p);
404 hdr_mac *mach = HDR_MAC(p);
405 int src_mac_addr = mach->macSA();
410 std::cout << NOW <<
" uwUFetch_AUV (" << addr
411 <<
") ::Phy2MacStartRx() ---->AUV is starting to "
413 <<
" BEACON packet from the HN with MAC address: "
414 << src_mac_addr << std::endl;
423 std::cout << NOW <<
" uwUFetch_AUV (" << addr
424 <<
") ::Phy2MacStartRx() ---->AUV is starting to "
426 <<
" POLL packet from the HN with MAC address: "
427 << src_mac_addr << std::endl;
436 std::cout << NOW <<
" uwUFetch_AUV (" << addr
437 <<
") ::Phy2MacStartRx() ---->AUV is starting to "
439 <<
" CBEACON packet from the HN with MAC address: "
440 << src_mac_addr << std::endl;
449 std::cout << NOW <<
" uwUFetch_AUV (" << addr
450 <<
") ::Phy2MacStartRx() ---->AUV is starting to "
452 <<
" PROBE packet from the NODE with MAC address: "
453 << src_mac_addr << std::endl;
462 std::cout << NOW <<
" uwUFetch_AUV (" << addr
463 <<
") ::Phy2MacStartRx() ---->AUV is starting to "
465 <<
" TRIGGER packet from the AUV with MAC address: "
466 << src_mac_addr << std::endl;
475 std::cout << NOW <<
" uwUFetch_AUV (" << addr
476 <<
") ::Phy2MacStartRx() ---->AUV is starting to "
478 <<
" RTS packet from the HN with MAC address: "
479 << src_mac_addr << std::endl;
482 <<
")::Phy2MacStartRx()______________________"
483 "Start_to_rx_RTS_pck"
484 <<
"_from_HN(" << src_mac_addr <<
")."
492 std::cout << NOW <<
" uwUFetch_AUV (" << addr
493 <<
") ::Phy2MacStartRx() ---->AUV is starting to "
495 <<
" DATA packet from the HN with MAC address: "
496 << src_mac_addr << std::endl;
504 <<
")::Phy2MacStartRx()______________________"
505 "Start_to_rx_DATA_pck"
506 <<
"_from_HN(" << src_mac_addr <<
")."
524 hdr_cmn *cmh = hdr_cmn::access(p);
525 hdr_mac *mach = HDR_MAC(p);
526 int src_mac_addr = mach->macSA();
527 int dest_mac_addr = mach->macDA();
532 if ((dest_mac_addr == addr) || (dest_mac_addr == MAC_BROADCAST)) {
537 std::cout << NOW <<
" uwUFetch_AUV (" << addr
538 <<
") ::Phy2MacEndRx() ---->AUV has finished to "
540 <<
" BEACON packet from the HN with MAC address: "
541 << src_mac_addr <<
" .IGNORE IT" << std::endl;
546 std::cout << NOW <<
" uwUFetch_AUV (" << addr
547 <<
") ::Phy2MacEndRx() ---->AUV has finished to "
549 <<
" POLL packet from the HN with MAC address: "
550 << src_mac_addr <<
" .IGNORE IT" << std::endl;
556 << NOW <<
" uwUFetch_AUV (" << addr
557 <<
") ::Phy2MacEndRx() ---->AUV has finished to "
559 <<
" CBEACON packet from the HN with MAC address: "
560 << src_mac_addr <<
" .IGNORE IT." << std::endl;
566 << NOW <<
" uwUFetch_AUV (" << addr
567 <<
") ::Phy2MacEndRx() ---->AUV has finished to "
569 <<
" PROBE packet from the NODE with MAC address: "
570 << src_mac_addr <<
" .IGNORE IT." << std::endl;
576 << NOW <<
" uwUFetch_AUV (" << addr
577 <<
") ::Phy2MacEndRx() ---->AUV has finished to "
579 <<
" TRIGGER packet from the AUV with MAC address: "
580 << src_mac_addr <<
" .IGNORE IT." << std::endl;
588 <<
")::Phy2MacEndRx()_____________________"
589 "___Finished_to_rx_RTS_pck"
590 <<
"_from_HN(" << src_mac_addr <<
")."
598 std::cout << NOW <<
" uwUFetch_AUV (" << addr
599 <<
") ::Phy2MacEndRx() ---->RTS packet "
600 "received by the AUV"
601 <<
" is corrupted: DROP IT, and continue "
602 "with the processing."
606 <<
")::Phy2MacEndRx()_____________"
607 "___________RTS_pck_rx"
608 <<
"_from HN(" << src_mac_addr
609 <<
")_It_s_in_ERROR." << std::endl;
619 std::cout << NOW <<
" uwUFetch_AUV (" << addr
620 <<
") ::Phy2MacEndRx() ---->AUV has "
621 "finished to receive a"
622 <<
" RTS packet from the HN with MAC "
624 << src_mac_addr <<
", but it's not "
625 <<
" enabled to receive It, so DROP the "
626 "packet and continue the processing."
630 <<
")::Phy2MacEndRx()_____________"
631 "___________RTS_pck_rx"
632 <<
"_from_HN(" << src_mac_addr
633 <<
")_NOT_ENABLED_to_rx_It."
642 << NOW <<
" uwUFetch_AUV (" << addr
643 <<
") ::Phy2MacEndRx() ---->AUV has finished "
645 <<
" RTS packet from the HN with MAC address: "
646 << src_mac_addr <<
"." << std::endl;
650 <<
")::Phy2MacEndRx()_________________"
652 <<
"_from_HN(" << src_mac_addr
653 <<
")_It_s_CORRECT." << std::endl;
685 std::cout << NOW <<
" uwUFetch_AUV (" << addr
686 <<
") ::Phy2MacEndRx() ---->AUV has finished to "
688 <<
" DATA packet from the HEAD NODE with MAC "
690 << src_mac_addr << std::endl;
694 <<
")::Phy2MacEndRx()_____________________"
695 "___Finished_to_rx_DATA_pck"
696 <<
"_from_HN(" << src_mac_addr <<
")."
707 std::cout << NOW <<
" uwUFetch_AUV (" << addr
708 <<
") ::Phy2MacEndRx() ---->DATA packet "
709 "received by the AUV"
710 <<
" is corrupted: DROP IT and continue "
711 "with the actual processing."
723 <<
")::Phy2MacEndRx()_____________"
724 "___________DATA_pck_rx_by_AUV("
725 << addr <<
")_from_HN("
727 <<
")_id_pck:" << cbrh->
sn() <<
""
728 <<
"_It_s_in_ERROR." << std::endl;
737 std::cout << NOW <<
" uwUFetch_AUV (" << addr
738 <<
") ::Phy2MacEndRx() ---->AUV is not "
739 "enabled to receive the DATA"
740 <<
" packet from HN(" << mach->macSA()
741 <<
"): DROP IT." << std::endl;
749 << NOW <<
"uwUFetch_AUV(" << addr
750 <<
")::Phy2MacEndRx()______________________"
751 "__DATA_pck_rx_by_AUV("
752 << addr <<
")_from_HN(" << mach->macSA()
753 <<
")_id_pck:" << cbrh->
sn() <<
""
754 <<
"_NOT_ENABLED_TO_RX_IT." << std::endl;
761 std::cout << NOW <<
" uwUFetch_AUV (" << addr
762 <<
") ::Phy2MacEndRx() ---->Physical layer "
764 <<
" address: " << dest_mac_addr
765 <<
" has finished to receive a DATA packet"
767 <<
" from the HEAD NODE with MAC address: "
768 << src_mac_addr << std::endl;
778 <<
")::Phy2MacEndRx()_________________"
779 "_______DATA_pck_rx_by_AUV("
780 << addr <<
")_from_HN("
782 <<
")_id_pck:" << cbrh->
sn() <<
""
783 <<
"_IT_S_CORRECT." << std::endl;
795 std::cout << NOW <<
" uwUFetch_AUV (" << addr
796 <<
") ::Phy2MacEndRx() ---->The packet received is "
798 <<
" DROP IT" << std::endl;
852 std::cout << NOW <<
" uwUFetch_AUV (" << addr
853 <<
") ::stateIdle_AUV() ---->AUV is in IDLE state."
858 <<
")::stateIdle_AUV()_______________________AUV_is_"
870 std::cout << NOW <<
" uwUFetch_AUV (" << addr
871 <<
") ::stateIdle_AUV() ---->AUV start immediately the "
872 "transmission of TRIGGER packet"
873 <<
" to a specific HN." << std::endl;
877 <<
")::stateIdle_AUV()_______________________"
878 "Start_immediately_the_tx_of_TRIGGER_pck."
886 std::cout << NOW <<
" uwUFetch_AUV (" << addr
887 <<
") ::stateIdle_AUV() ---->AUV before to transmit a "
889 <<
" to a specific HNs waits an interval time equal to: "
894 <<
")::stateIdle_AUV()_______________________Wait_"
895 "an_interval_time_equal_to:_"
897 <<
"_before_to_tx_TRIGGER_pck." << std::endl;
900 << NOW <<
"uwUFetch_AUV(" << addr
901 <<
")::stateIdle_AUV()_______________________.......Waiting"
905 << NOW <<
"uwUFetch_AUV(" << addr
906 <<
")::stateIdle_AUV()_______________________.......Waiting"
910 << NOW <<
"uwUFetch_AUV(" << addr
911 <<
")::stateIdle_AUV()_______________________.......Waiting"
925 std::cout << NOW <<
" uwUFetch_AUV (" << addr
926 <<
") ::TriggerTOExpired() --->AUV now can start the "
927 "transmission of the"
928 <<
" TRIGGER packet in broadcast to the HNs." << std::endl;
932 <<
")::TriggerTOExpired()____________________Start_"
933 "the_communication_with_HNs."
959 std::cout << NOW <<
" uwUFetch_AUV (" << addr
960 <<
") ::state_TRIGGER_tx() ---->AUV is initializing the "
961 "TRIGGER packet that"
962 <<
" will then transmitted to the HNs in broadcast. Only "
963 "after the end of transmission of TRIGGER"
964 <<
" the AUV will enabled to receive a RTS packet."
967 Packet *p = Packet::alloc();
968 hdr_cmn *cmh = hdr_cmn::access(p);
969 hdr_mac *mach = HDR_MAC(p);
974 mach->set(MF_CONTROL, addr, MAC_BROADCAST);
978 mach->macSA() = addr;
979 mach->macDA() = MAC_BROADCAST;
993 cmh->size() =
sizeof(
998 <<
")::state_TRIGGER_tx()____________________"
999 "PARAMETERS_of_TRIGGER_PACKET."
1003 <<
")::state_TRIGGER_tx()____________________"
1005 << mach->macSA() << std::endl;
1006 if (mach->macDA() == -1) {
1009 <<
")::state_TRIGGER_tx()____________________"
1010 "Destination_Address:_BROADCAST."
1015 <<
")::state_TRIGGER_tx()____________________"
1016 "Destination_Address:_"
1017 << mach->macDA() << std::endl;
1021 <<
")::state_TRIGGER_tx()____________________MIN_"
1022 "backoff_time_DATA_pck:_"
1026 <<
")::state_TRIGGER_tx()____________________MAX_"
1027 "backoff_time_DATA_pck:_"
1031 <<
")::state_TRIGGER_tx()____________________MAX_"
1032 "DATA_pck_want_rx_from_HN:_"
1037 <<
")::state_TRIGGER_tx()____________________Size_"
1039 << cmh->size() <<
"[byte]." << std::endl;
1072 std::cout << NOW <<
" uwUFetch_AUV (" << addr
1073 <<
") ::state_wait_RTS() ---->The waiting time for RTS "
1074 "packets is negative"
1075 <<
" so set the default value: 10[s]." << std::endl;
1080 std::cout << NOW <<
" uwUFetch_AUV (" << addr
1081 <<
") ::state_wait_RTS() ---->AUV is scheduling RTS TIMER T= "
1083 <<
"[s]. In this interval AUV waiting the RTS packets."
1092 << NOW <<
"uwUFetch_AUV(" << addr
1093 <<
")::state_wait_RTS()______________________Waiting_RTS_pck."
1097 <<
")::state_wait_RTS()______________________Timeout_"
1098 "within_rx_RTS_pck:_"
1099 <<
T_RTS <<
"[s]." << std::endl;
1102 <<
")::state_wait_RTS()______________________........"
1107 <<
")::state_wait_RTS()______________________........"
1112 <<
")::state_wait_RTS()______________________........"
1137 double bck_time_choice_rts_by_HN = (double) rtsh->
backoff_time_RTS() / 1000;
1153 <<
")::RTS_rx()______________________________"
1154 "PARAMETERS_of_RTS_PACKET."
1158 << NOW <<
"uwUFetch_AUV(" << addr
1159 <<
")::RTS_rx()______________________________Source_address:_"
1160 << mach->macSA() <<
"." << std::endl;
1163 <<
")::RTS_rx()______________________________"
1164 "Destination_address:_"
1165 << mach->macDA() <<
"." << std::endl;
1168 <<
")::RTS_rx()______________________________RTS_"
1169 "backoff_time_choice_by_HN:_"
1170 << bck_time_choice_rts_by_HN <<
"[s]." << std::endl;
1173 <<
")::RTS_rx()______________________________Number_"
1174 "of_pck_HN_would_like_to_tx: "
1186 <<
")::RTS_rx()______________________________"
1187 "RESET_RTS_timeout."
1203 <<
")::RTS_rx()______________________________"
1204 "RESET_RTS_timeout."
1220 std::cout << NOW <<
" uwUFetch_AUV (" << addr
1221 <<
") ::RtsTOExpired() ---->RTS timeout is expired: other"
1222 <<
" RTS packets can not be received by the AUV."
1227 <<
")::RtsTOExpired()________________________RTS_"
1228 "timeout_is_expired."
1232 std::cout << NOW <<
" uwUFetch_AUV (" << addr
1233 <<
") ::RtsTOExpired() ---->AUV has received 0 RTS packets "
1234 "within the interval"
1235 <<
" time pre-established, so return in IDLE STATE."
1256 std::cout << NOW <<
" uwUFetch_AUV (" << addr
1257 <<
") ::state_CTS_tx() ---->AUV is creating a CTS packet that"
1258 <<
" will then transmit at the first node of the queue that "
1259 "contain the RTS'received."
1266 Packet *p = Packet::alloc();
1267 hdr_cmn *cmh = hdr_cmn::access(p);
1268 hdr_mac *mach = HDR_MAC(p);
1275 mach->macSA() = addr;
1303 <<
")::state_CTS_tx()________________________"
1304 "PARAMETERS_OF_CTS_PCK."
1308 << NOW <<
"uwUFetch_AUV(" << addr
1309 <<
")::state_CTS_tx()________________________Source_address:_"
1310 << mach->macSA() << std::endl;
1313 <<
")::state_CTS_tx()________________________"
1314 "Destination_address:_"
1315 << mach->macDA() << std::endl;
1318 <<
")::state_CTS_tx()________________________DATA_pck_"
1324 << NOW <<
"uwUFetch_AUV(" << addr
1325 <<
")::state_CTS_tx()________________________Size_of_CTS_pck:_"
1326 << cmh->size() <<
"[byte]." << std::endl;
1356 << NOW <<
"uwUFetch_AUV(" << addr
1357 <<
")::state_wait_first_DATA()_______________Waiting_DATA"
1369 std::cout << NOW <<
" uwUFetch_AUV (" << addr
1370 <<
") ::state_wait_first_DATA() ---->AUV want to receive "
1371 "all the DATA packets"
1374 <<
" [s]." << std::endl;
1378 <<
")::state_wait_first_DATA()_______________"
1379 "Timeout_within_rx_all_DATA"
1384 <<
")::state_wait_first_DATA()_______________....."
1389 <<
")::state_wait_first_DATA()_______________....."
1394 <<
")::state_wait_first_DATA()_______________....."
1424 std::cout << NOW <<
" uwUFetch_AUV (" << addr
1425 <<
") ::DATA_Rx() ---->AUV has received the DATA packet"
1445 << NOW <<
"uwUFetch_AUV(" << addr
1446 <<
")::DATA_RX()____________________________DATA_pck_rx_by_AUV("
1448 <<
")_id_pck:" << cbrh->
sn() <<
""
1449 <<
"_IS_PASSED_TO_APP_LAYER." << std::endl;
1454 std::cout << NOW <<
" uwUFetch_AUV (" << addr
1455 <<
") ::DATA_Rx() ----> The DATA packet is passed to the "
1457 <<
" layer of the AUV." << std::endl;
1484 std::cout << NOW <<
" uwUFetch_AUV (" << addr
1485 <<
") ::state_Wait_DATA() ---->AUV is waiting to receive the "
1493 << NOW <<
"uwUFetch_AUV(" << addr
1494 <<
")::state_wait_DATA()____________________Waiting_DATA"
1500 << NOW <<
"uwUFetch_AUV(" << addr
1501 <<
")::state_wait_DATA()____________________.......Waiting_DATA"
1505 << NOW <<
"uwUFetch_AUV(" << addr
1506 <<
")::state_wait_DATA()____________________.......Waiting_DATA"
1510 << NOW <<
"uwUFetch_AUV(" << addr
1511 <<
")::state_wait_DATA()____________________.......Waiting_DATA"
1521 std::cout << NOW <<
" uwUFetch_AUV (" << addr
1522 <<
") ::DataTOExpired() ---->AUV has not received the first "
1524 <<
" within the time interval pre-established, so return in "
1530 <<
")::DataTOExpired_first()_______________________"
1531 "DATA_timeout_expired."
1535 <<
")::DataTOExpired_first()_______________________"
1536 "Total_DATA_pck_rx_from_HN("
1565 std::cout << NOW <<
" uwUFetch_AUV (" << addr
1566 <<
") ::DataTOExpired() ---->AUV has not received all the "
1568 <<
" within the time interval pre-established, so return in "
1574 <<
")::DataTOExpired()_______________________DATA_"
1579 <<
")::DataTOExpired()_______________________Total_"
1580 "DATA_pck_rx_from_HN("
1623 std::cout << NOW <<
" uwUFetch_AUV (" << addr
1624 <<
") ::getDataTimerValue() ----> AUV is computing the "
1626 <<
" within it want to receive all DATA packets from the "
1641 double data_timeout_cnt =
1644 return data_timeout_cnt;
1648 std::cout << NOW <<
" uwUFetch_AUV (" << addr
1649 <<
") ::getDataTimerValue() ----> AUV is computing the "
1651 <<
" within it want to receive all DATA packets from the "
1666 double data_timeout_cnt =
1669 return data_timeout_cnt;
1700 std::cout << NOW <<
" uwUFetch_AUV (" << addr
1701 <<
") ::updateQueueRTS() ---->AUV remove the HN from the "
1703 <<
" node from which it has received the RTS packets."
1721 std::cout << NOW <<
" uwUFetch_AUV (" << addr
1722 <<
") ::another_DATA_received() ---->AUV has received "
1723 "all the DATA packets from HN"
1725 <<
", so return in IDLE STATE." << std::endl;
1729 <<
")::another_DATA_received()_______________ALL_"
1737 std::cout << NOW <<
" uwUFetch_AUV (" << addr
1738 <<
") ::another_DATA_received() ---->AUV reset DATA "
1743 <<
")::another_DATA_received()_______________"
1744 "Reset_DATA_timeout."
1763 std::cout << NOW <<
" uwUFetch_AUV (" << addr
1764 <<
") ::another_DATA_received() ---->AUV can receive "
1765 "another DATA packet from the "
1767 <<
" The DATA packet number: "
1788 std::cout << NOW <<
" uwUFetch_AUV (" <<
module->addr
1789 << ")::UWUFetch_TRIGGER_timer::expire() ---->TRIGGER timeout "
1794 module->TriggerTOExpired();
1802 << NOW <<
" uwUFetch_AUV (" <<
module->addr
1803 << ") ::UWUFetch_RTS_timer::expire() ---->RTS timeout expired."
1807 module->RtsTOExpired();
1815 << NOW <<
" uwUFetch_AUV (" <<
module->addr
1816 << ")::UWUFetch_DATA_timer::expire() ---->DATA timeout expired"
1820 module->DataTOExpired();
1827 std::cout << NOW <<
" uwUFetch_AUV (" <<
module->addr
1828 << ")::UWUFetch_FIRST_DATA_timer::expire() ---->FIRST DATA "
1833 module->DataTOExpired_first();
1839 fout << NOW <<
"uwUFetch(" << addr <<
")::printStateInfo() "
1851 system(
"rm -f /tmp/uwUFetch_AUV_stateTransitions.txt");
1852 system(
"touch /tmp/uwUFetch_AUV_stateTransitions.txt");
1857 "AUV is transmitting a TRIGGER packet ";
1859 "AUV is waiting a RTS packet from HN ";
1861 "AUV has received a RTS packet ";
1863 "AUV is transmitting a CTS packet ";
1865 "AUV is waiting DATA packet from HN ";
1867 "AUV has receive a DATA packet from HN ";
1870 "Trigger TO is expired, so the AUV start the transmission of "
1873 "AUV has finished to initialize the TRIGGER packet, so pass "
1874 "the packet to the physical layer";
1876 "AUV has finished to transmit a TRIGGER packet, so enter in the "
1878 " which it wait a RTS packet";
1880 "AUV has finishe to receive a RTS packet, so go to the state in "
1882 " the RTS is analyzed.";
1884 "AUV has finished to store the information of the RTS packet, so "
1886 " the state in which initiale the CTS packet";
1889 "RTS timeout is expired and another RTS can not be "
1891 "but at least one RTS has been received, so go to the state"
1892 " in which initialize the CTS packet";
1894 "RTS timeout is expired and another RTS can not be received, "
1895 "but zero RTS has been received, so go to the state idle";
1897 "AUV has finished to initialize the CTS packet, so go to the state"
1898 " in which AUV recall the physical layer";
1900 "AUV has finished to transmit a CTS packet, so go to the state in "
1902 " the AUV wait a DATA packets from the HN";
1904 "AUV has finished to receive the DATA packet, so go to the DATA "
1905 "receive method and analyzed it";
1907 "AUV has received the LAST DATA packet from HN, so go to the IDLE "
1910 "AUV has received a DATA packet, and another DATA packet can be "
1911 "received by It, so go to the waiting state in which it wait "
1915 "DATA timeout expired, all the packets are not received by the HN, "
1917 "go to the IDLE stae";
1919 "AUV has received a packet that is not addressed to It";
1936 std::string response;
1937 std::cout <<
"Press Enter to continue";
1938 std::getline(std::cin, response);
Class that represents the binding with the TCL configuration script.
uwUFetchAUVModuleClass()
Constructor of the class uwUFetchAUVModuleClass.
TclObject * create(int, const char *const *)
Creates the TCL object needed for the TCL language interpretation.
virtual void expire(Event *e)
Method called when the timer expire.
virtual void expire(Event *e)
Method called when the timer expire.
virtual void expire(Event *e)
Method called when the timer expire.
virtual void expire(Event *e)
Method called when the timer expire.
virtual void schedule(double val)
Schedule a timer.
uwUFetch_AUV *UWUFETCH_TIMER_STATUS timer_status
< Pointer to an object of type uwUFetch_AUV
Class that represent the UFetch mac layer for AUV node.
@ UWUFETCH_AUV_PACKET_TYPE_CTS
@ UWUFETCH_AUV_PACKET_TYPE_TRIGGER
@ UWUFETCH_AUV_PACKET_TYPE_DATA
@ UWUFETCH_AUV_PACKET_TYPE_RTS
virtual int command(int argc, const char *const *argv)
TCL command interpreter.
int num_pck_hn_1
Counter of the correct DATA packets received by HN 1 from SNs.
double tx_CTS_start_time
Indicates when AUV start a transmission of CTS packet.
virtual double getDataTimerValue()
Compute the length of time interval within AUV want to receive all DATA packet from specifical HN.
int getTrigger_Tx_by_AUV()
Number of TRIGGER packets transmitted during the simulation during the single cycle.
int n_DATA_rx_by_AUV
Counter of the number of DATA packets transmitted by AUV during a single cycle of simulation.
int n_RTS_rx_by_AUV
Counter of the number of RTS packets received by AUV during a single cycle of simulation.
int getTotal_Data_Rx_by_AUV()
Total number of DATA packets received by AUV from all HNs of the netwrok during the simulation.
uwUFetch_RTS_timer RTS_timer
Interval time in which the AUV wait a RTS packets from the HNs.
int HEAD_NODE_4
Id number of HN 4.
virtual void Phy2MacEndTx(const Packet *p)
Handle the end-of-PHY-transmission event.
double MAX_PAYLOAD
Maximum size of DATA PAYLOAD packet.
int num_pck_hn_3
Counter of the correct DATA packets received by HN 3 from SNs.
int number_data_pck_AUV_rx_exact
Number of DATA packets that AUV want exactly received from the HN.
double rx_RTS_start_time
Indicates when AUV start the reception of RTS packet.
UWUFETCH_AUV_STATUS prev_state
Previous state in which the node it was located.
virtual void state_TRIGGER_tx_without()
Initialization of TRIGGER packet that will be forwarded in broadcast to the HNs.
double data_timeout
Interval time within AUV want to receive all DATA packets from the HN.
void incrData_Rx_by_AUV()
Increase of 1 the number of DATA packets received by AUV.
double tx_TRIGGER_finish_time
Indicates when AUV end the transmission of TRIGGER packet.
int HEAD_NODE_2
Id number of HN 2.
int NUM_MAX_DATA_AUV_WANT_RX
Maximum number of data packet that AUV want to receive from the HN in a single cycle of TRIGGER-RTS-C...
uwUFetch_AUV()
Constructor of the class UWUFetch.
bool txTRIGGEREnabled
true if AUV is enabled to transmit a TRIGGER packet
UWUFETCH_AUV_STATUS_CHANGE last_reason
Last reason because the NODE change his state.
std::queue< int > Q_rts_n_pcks_HN_want_tx_AUV
Queue that store the number of DATA packets that the single HN want to tx to the AUV.
int debugMio_
Used if we want to create the logging file.
virtual double getRTT()
Compute the Round Trip Time.
UWUFETCH_AUV_STATUS curr_state
Current state in which the node is located.
std::ofstream out_file_logging
Variable that handle the file in which the protocol write the statistics.
int mac_addr_HN_ctsed
Mac address of the HN from which the AUV want to receive the DATA packets.
int n_TRIGGER_tx_by_AUV
Counter of the number of TRIGGER packets transmitted by AUV during a single cycle of simulation.
double Tdata
Time needed to transmit a DATA packet.
void incrTotal_Data_Rx_by_AUV()
Increase of 1 the number of DATA packets received by AUV.
virtual void state_CTS_tx()
Initialization of CTS packet that will be forwarded to the specifical HN.
virtual void DataTOExpired_first()
Timeout within received the FIRST DATA packet from HN that it has sent a CTS packet is expired.
double RTT
Round Trip Time.
double rx_RTS_finish_time
Indicates when AUV end the reception of RTS packet.
virtual void refreshReason(UWUFETCH_AUV_STATUS_CHANGE reason)
Refresh the reason for the changing of the state.
int HEAD_NODE_1
Id number of HN 1.
std::ofstream fout
Variable that handle the file in which the protocol write the state transition for debug purposes.
virtual void updateQueueRTS()
Remove the information relative to the HN from which AUV wanted and it has finished to receive DATA p...
void incrTotalRts_Rx_corrupted_by_AUV()
Increase of 1 the number of corrupted RTS packets received by AUV.
@ UWUFETCH_AUV_STATUS_CHANGE_PACKET_FOR_ANOTHER_NODE
@ UWUFETCH_AUV_STATUS_CHANGE_RTS_TO_EXPIRED_0_RTS_RX
@ UWUFETCH_AUV_STATUS_CHANGE_TRIGGER_TO_EXPIRED
@ UWUFETCH_AUV_STATUS_CHANGE_TRIGGER_INITIALIZE_TX_TRIGGER
@ UWUFETCH_AUV_STATUS_CHANGE_RTS_TO_EXPIRED_AT_LEAST_ONE_RTS_RX
@ UWUFETCH_AUV_STATUS_CHANGE_CTS_INITIALIZED_TX_CTS
@ UWUFETCH_AUV_STATUS_CHANGE_RTS_FINISHED_TO_RX
@ UWUFETCH_AUV_STATUS_CHANGE_TRIGGER_TX_WAIT_RTS
@ UWUFETCH_AUV_STATUS_CHANGE_DATA_PCK_FINISHED_TO_RX
@ UWUFETCH_AUV_STATUS_CHANGE_RTS_FINSHED_TO_STORE
@ UWUFETCH_AUV_STATUS_CHANGE_TO_WAIT_DATA_EXPIRED
@ UWUFETCH_AUV_STATUS_CHANGE_ANOTHER_DATA_PCK_RX
@ UWUFETCH_AUV_STATUS_CHANGE_CTS_TX_WAIT_DATA
@ UWUFETCH_AUV_STATUS_CHANGE_LAST_DATA_PCK_RX
int mode_comm_hn_auv
Indicate how the communication takes place with or without RTS-CTS packets.
int getTotalCts_Tx_by_AUV()
Total number of CTS packets transmitted by AUV during the simulation.
virtual void Phy2MacStartRx_without(const Packet *p)
Handle the detected-start-of-PHY-reception event in the case protocol doesn't use RTS and CTS packets...
virtual void Mac2PhyStartTx(Packet *p)
This method must be called by the MAC to instruct the PHY to start the transmission of a packet.
virtual void DataTOExpired()
Timeout within received DATA packets is expired.
int num_pck_hn_2
Counter of the correct DATA packets received by HN 2 from SNs.
virtual void computeTxTime(UWUFETCH_AUV_PACKET_TYPE tp)
Compute the transmission time for a specifical type of packet.
int HEAD_NODE_3
Id number of HN 3.
int N_RUN
Number of run in execution
void incrTotalRts_Rx_by_AUV()
Increase of 1 the number of RTS packets received by AUV.
std::queue< double > Q_rts_backoff_time
Queue that stored the backoff time choice by the single HN before to transmit RTS packet.
double T_MAX_RTS
Upper bound of the interval in which HN choice the back-off time to tx RTS pck.
void incrTotalCts_Tx_by_AUV()
Increase of 1 the number of CTS packets transmitted by AUV.
double T_MIN_RTS
Lower bound of the interval in which HN choice the back-off time to tx RTS pck.
double tx_TRIGGER_start_time
Indicates when AUV start a transmission of TRIGGER packet.
virtual void state_TRIGGER_tx()
Initialization of TRIGGER packet that will be forwarded in broadcast to the HNs.
virtual void state_wait_DATA()
AUV is waiting the SECOND and successive DATA packets from HN.
static std::map< UWUFETCH_AUV_PACKET_TYPE, std::string > packetType
Map the UWUFETCH_AUV_PACKET_TYPE to the description of packet type.
bool rxRTSEnabled
true if AUV is enabled to receive a RTS packet
Packet * curr_CTS_pck_tx
Pointer to the CTS packet that is being transmitted by AUV.
uwUFetch_TRIGGER_timer Trigger_timer
Interval time.
virtual void another_DATA_received()
Verify whether AUV must to receive another DATA packet from the HN to whome It has transmitted the TR...
void incrCts_Tx_by_AUV()
Increase of 1 the number of CTS packets transmitted by AUV.
void incrTotalTrigger_Tx_by_AUV()
Increase of 1 the number of TRIGGER packets transmitted by AUV.
double T_START_PROC_TRIGGER
Time before that the AUV start the procedure to transmit a TRIGGER packet.
int getTotal_Data_Rx_corrupted_by_AUV()
Total number of corrupted DATA packets received by the AUV from all HNs of the network.
std::queue< int > Q_rts_mac_HN
Queue of HN MAC address from which AUV has received correctly the RTS packet.
int mac_addr_hn_triggered
MAC address of the HN triggered by the AUV.
virtual void Mac2PhyStartTx_without(Packet *p)
This method must be called by the MAC to instruct the PHY to start the transmission of a packet in th...
int getTotalRts_Rx_by_AUV()
Total number of RTS received by AUV during the simulation from all HNs of the network.
virtual void state_wait_first_DATA_without()
AUV is waiting the FIRST DATA packet from the HN to whom It has sent only RTS packet.
int n_CTS_tx_by_AUV
Counter of the number of CTS packets transmitted by AUV during a single cycle of simulation.
static std::map< UWUFETCH_TIMER_STATUS, std::string > statusTimer
Map the UWUFETCH_TIMER_STATUS to the description of the timers.
void incrTrigger_Tx_by_AUV()
Increment by 1 the number of TRIGGER packets transmitted by AUV during a single cycle TRIGGER-RTS-CTS...
static bool initialized
Indicate if the protocol has been initialized or not.
double T_GUARD
Guard time interval used between two consecutive transmissions of data packets.
Packet * curr_DATA_pck_rx
Pointer to the DATA packet that is being received by AUV.
@ UWUFETCH_AUV_STATUS_RECEIVE_RTS_PACKET
@ UWUFETCH_AUV_STATUS_TRANSMIT_CTS_PACKET
@ UWUFETCH_AUV_STATUS_WAIT_RTS_PACKET
@ UWUFETCH_AUV_STATUS_RECEIVE_DATA_PACKET
@ UWUFETCH_AUV_STATUS_WAIT_DATA_HN
@ UWUFETCH_AUV_STATUS_IDLE
@ UWUFETCH_AUV_STATUS_TRANSMIT_TRIGGER
virtual void waitForUser()
Method used for debug.
int getData_Rx_by_AUV()
Number of DATA packets received by AUV after the transmission of TRIGGER-RTS-CTS packets from a speci...
virtual ~uwUFetch_AUV()
Destructor of the class UWUFetch.
uwUFetch_DATA_timer DATA_timer
Interval time in which the AUV want to receive all DATA packets from the HN.
virtual void Phy2MacEndRx_without(Packet *p)
Handle the end-of-PHY-reception event in the case protocol doesn't use RTS and CTS packets.
double T_RTS
Interval time in which the AUV want to receive an RTS packet in answer to the trigger.
virtual void Phy2MacEndTx_without(const Packet *p)
Handle the end-of-PHY-transmission event in the case protocol doesn't use RTS and CTS packets.
virtual void RTS_rx()
AUV has received RTS packet.
bool rxDATAEnabled
true if AUV is enabled to receive a DATA packet
std::queue< Packet * > Q_data_AUV
Queue of DATA packets stored by the AUV and received from HNs.
double rx_DATA_finish_time
Indicates when AUV end the reception of DATA packet.
int num_pck_hn_4
Counter of the correct DATA packets received by HN 4 from SNs.
virtual void DATA_rx()
AUV has received a DATA packet from HN.
virtual void refreshState(UWUFETCH_AUV_STATUS state)
Refresh the state of the protocol.
virtual void initInfo()
Initialize the protocol at the beginning of the simulation.
double rx_DATA_start_time
Indicates when AUV start the reception of DATA packet.
static std::map< UWUFETCH_AUV_STATUS_CHANGE, std::string > statusChange
Map the UWUFETCH_AUV_STATUS_CHANGE to the description the reason of changing state.
Packet * curr_RTS_pck_rx
Pointer to the RTS packet that is being received by AUV.
int getTotalRts_Rx_corrupted_by_AUV()
Total number of corrupted RTS packets received by AUV from all HNs of the network.
int mac_addr_HN_in_data
MAC address of the HN from which the AUV has received the DATA packet
virtual void state_wait_first_DATA()
AUV is waiting the FIRST DATA packet from the HN to whom It has sent a RTS and CTS packet.
double T_tx_TRIGGER
Time required to transimt a single TRIGGER packet.
virtual void printStateInfo(double delay=0)
Prints a file with every state change for debug purposes.
virtual void stateIdle_AUV()
Idle state.
void incrTotal_Data_Rx_corrupted_by_AUV()
Increase of 1 the number of corrupted DATA packets received by AUV.
virtual void TriggerTOExpired()
Timeout trigger is expired.
virtual void Phy2MacEndRx(Packet *p)
Handle the end-of-PHY-reception event.
Packet * curr_TRIGGER_pck_tx
Pointer to the TRIGGER packet that is being transmitted by AUV.
virtual void Phy2MacStartRx(const Packet *p)
Handle the detected-start-of-PHY-reception event.
bool txCTSEnabled
true if AUV is enabled to transmit a CTS packet
virtual void state_wait_RTS()
AUV is wait a RTS packet from HNs.
virtual void RtsTOExpired()
Timeout within AUV is enabled to receive RTS packet is expired.
virtual void CTS_tx()
Transmission of CTS packet.
void incrRts_Rx_by_AUV()
Increase of 1 the number of RTS packets received by AUV.
virtual void TRIGGER_tx()
Trasmission of TRIGGER packet.
@ UWUFETCH_TIMER_STATUS_IDLE
@ UWUFETCH_TIMER_STATUS_EXPIRED
@ UWUFETCH_TIMER_STATUS_FROZEN
@ UWUFETCH_TIMER_STATUS_RUNNING
virtual bool typeCommunication()
Establish whether the communication between SN and AUV take place with RTS and CTS or only using TRIG...
virtual int crLayCommand(ClMessage *m)
Cross-Layer messages interpreter.
bool print_transitions
true if the writing of state transitions in the file is enabled.
int getTotalTrigger_Tx_by_AUV()
Total number of TRIGGER packets transmitted by the AUV during the simulation.
static std::map< UWUFETCH_AUV_STATUS, std::string > statusInfo
Map the UWUFETCH_AUV_STATUS to the description of each state.
double tx_CTS_finish_time
Indicates when AUV end the transmission of CTS packet.
Content header of CTS packet.
int & mac_addr_HN_ctsed()
Reference to the mac_addr_HN_ctsed_ variable.
int & num_DATA_pcks_MAX_rx()
Reference to the num_DATA_pcks_MAX_rx_ variable.
Content header of RTS packet.
int & backoff_time_RTS()
Reference to the backoff_Time_RTS_ variable.
int & num_DATA_pcks()
Reference to the num_Data_pcks_ variable.
Content header of TRIGGER packet.
int & t_min()
Reference to the t_min variable.
int & t_max()
Reference to the t_max variable.
int & max_pck_want_rx()
Reference to the max_pck_want_rx variable.
hdr_uwcbr describes UWCBR packets.
uint16_t & sn()
Reference to the sn_ variable.
Declaration of class that implement AUV for UFetch protocol.
packet_t PT_POLL_UFETCH
POLL packet type for UFetch protocol.
packet_t PT_CBEACON_UFETCH
CBEACON packet type for UFetch protocol.
#define UWFETCH_AUV_DROP_REASON_ERROR
Packet dropped: Packet corrupted.
#define UWFETCH_AUV_DROP_REASON_WRONG_RECEIVER
Packet dropped: Packet is addressed to another node of the.
packet_t PT_CTS_UFETCH
CTS packet type for UFetch protocol.
packet_t PT_TRIGGER_UFETCH
Trigger packet type for UFetch protocol.
packet_t PT_BEACON_UFETCH
BEACON packet type for UFetch protocol.
packet_t PT_PROBE_UFETCH
PROBE packet type for UFetch protocol.
#define UUFETCH_AUV_DROP_REASON_NOT_ENABLE
Packet dropped: AUV is not enabled to transmit or receive this \ type of packet.
packet_t PT_RTS_UFETCH
RTS packet type for UFetch protocol.
uwUFetchAUVModuleClass class_module_uwufetchauv
Common structures and variables in the protocol.
#define HDR_CTS_UFETCH(p)
alias defined to access the CTS HEADER
static const int BIT_RATE_INSTANT
#define HDR_TRIGGER_UFETCH(p)
alias defined to access the TRIGGER HEADER
static const int v_speed_sound
Underwater sound propagation speed.
static const int BIT_RATE_SERVICE
#define HDR_RTS_UFETCH(p)
alias defined to access the RTS HEADER
Provides the UWCBR packets header description and the definition of the class UWCBR.