67 TclObject*
create(
int,
const char*
const*) {
76 , adaptiveRTO_parameter(0.5)
87 cerr << NOW <<
"Invalid adaptive RTO parameter < 0, set to 0.5 "
88 <<
"by default " << std::endl;
97 , adaptiveRTO_parameter(0.5)
109 cerr << NOW <<
"Invalide adaptive RTO parameter < 0, set to 0.5 "
110 <<
"by default " << std::endl;
120 Tcl& tcl = Tcl::instance();
122 if (strcasecmp(argv[1],
"getROVMonheadersize") == 0) {
126 else if(strcasecmp(argv[1],
"getROVctrheadersize") == 0) {
130 else if(strcasecmp(argv[1],
"getX") == 0) {
131 tcl.resultf(
"%f",
posit.getX());
134 else if(strcasecmp(argv[1],
"getY") == 0) {
135 tcl.resultf(
"%f",
posit.getY());
138 else if(strcasecmp(argv[1],
"getZ") == 0) {
139 tcl.resultf(
"%f",
posit.getZ());
144 if (strcasecmp(argv[1],
"setPosition") == 0) {
145 Position*
p =
dynamic_cast<Position*
> (tcl.lookup(argv[2]));
148 }
else if (strcasecmp(argv[1],
"setSpeed") == 0) {
149 speed = atof(argv[2]);
151 }
else if (strcasecmp(argv[1],
"setAdaptiveRTOparameter") == 0) {
157 if (strcasecmp(argv[1],
"sendPosition") == 0) {
158 newX = atof(argv[2]);
159 newY = atof(argv[3]);
160 newZ = atof(argv[4]);
163 tcl.resultf(
"%s",
"position Setted");
167 if (strcasecmp(argv[1],
"sendPosition") == 0) {
168 newX = atof(argv[2]);
169 newY = atof(argv[3]);
170 newZ = atof(argv[4]);
171 speed = atof(argv[5]);
174 tcl.resultf(
"%s",
"position Setted");
187 std::cout << NOW <<
" UwROVCtrModule::RTO set to " <<
period_
204 uwROVh -> x() =
newX;
219 std::cout << NOW <<
" UwROVCtrModule::initPkt(Packet *p) "
220 <<
"Retransmitting"<< std::endl;
227 <<
" s" << std::endl;
234 std::cout << NOW <<
" UwROVCtrModule::initPkt(Packet *p) setting new"
235 <<
" ROV way-point: X = "<< uwROVh->
x() <<
", Y = "
236 << uwROVh->
y() <<
", Z = " << uwROVh->
z()<< std::endl;
252 hdr_cmn *ch = hdr_cmn::access(
p);
253 if(monitoring->
ack() ==
sn + 1) {
259 std::cout << NOW <<
" UwROVCtrModule::recv(Packet *p) control ACK "
260 <<
"received " << monitoring->
ack()<< std::endl;
262 std::cout << NOW <<
" UwROVCtrModule::recv(Packet *p) control error "
263 <<
"received"<< std::endl;
265 std::cout << NOW <<
" UwROVCtrModule::recv(Packet *p) ROV monitoring "
266 <<
"position: X = " <<
x_rov <<
", Y = " <<
y_rov
267 <<
", Z = " <<
z_rov << std::endl;
UwCbrModule class is used to manage UWCBR packets and to collect statistics about them.
virtual void initPkt(Packet *p)
Initializes a data packet passed as argument with the default values.
int debug_
Flag to enable several levels of debug.
UwSendTimer sendTmr_
Timer which schedules packet transmissions.
double sumrtt
Sum of RTT samples.
virtual void recv(Packet *)
Performs the reception of packets from upper and lower layers.
virtual int command(int argc, const char *const *argv)
TCL command interpreter.
double period_
Period between two consecutive packet transmissions.
virtual void sendPkt()
Allocates, initialize and sends a packet with the default priority flag set from tcl.
int rttsamples
Number of RTT samples.
Adds the module for UwROVModuleClass in ns2.
UwROVCtrModuleClass()
Constructor of the class.
TclObject * create(int, const char *const *)
Creates the TCL object needed for the tcl language interpretation.
UwROVCtrModule class is used to manage UWROVCtr packets and to collect statistics about them.
float y_rov
Y of the last ROV position monitored.
Packet * p
Sequence number of the last control packet sent.
int adaptiveRTO
1 if an adaptive RTO is used, 0 if a constant RTO is used.
virtual int command(int argc, const char *const *argv)
TCL command interpreter.
virtual ~UwROVCtrModule()
Destructor of UwROVCtrModule class.
float x_rov
X of the last ROV position monitored.
float newY
Y of the new position sent to the ROV.
virtual void start()
Start the controller.
double adaptiveRTO_parameter
Parameter for the adaptive RTO.
float newZ
Z of the new position sent to the ROV.
static int getROVCTRHeaderSize()
Returns the size in byte of a hdr_uwROV_ctr packet header.
float z_rov
Z of the last ROV position monitored.
float newX
X of the new position sent to the ROV.
void reset_retx()
Reset retransmissions.
virtual void initPkt(Packet *p)
Initializes a control data packet passed as argument with the default values.
virtual void recv(Packet *)
Performs the reception of packets from upper and lower layers.
Position posit
Controller position.
static int getROVMonHeaderSize()
Returns the size in byte of a hdr_uwROV_monitoring packet header.
virtual void setPosition(Position p)
Set the position of the ROVCtr.
virtual void transmit()
Creates and transmits a packet.
UwROVCtrModule()
Constructor of UwROVCtrModule class.
float speed
Moving speed sent to the ROV.
hdr_uwROV_ctr describes UWROV_ctr packets for controlling the ROV.
hdr_uwROV_monitoring describes UWROV_monitoring packets sent by the ROV to the base station for monit...
hdr_uwcbr describes UWCBR packets.
UwROVCtrModuleClass class_module_uwROV_ctr
Provides the definition of the class UWROV.
#define HDR_UWROV_MONITORING(p)