44#define SPEED_OF_LIGHT_VACUUM (3e8)
45#define REFRACTIVE_INDEX_MIN (1)
46#define REFRACTIVE_INDEX_WATER (1.33)
55 : TclClass(
"Module/UW/ElectroMagnetic/Channel")
83 return ChannelModule::command(argc, argv);
89 Scheduler &s = Scheduler::instance();
90 struct hdr_cmn *hdr = HDR_CMN(p);
92 hdr->direction() = hdr_cmn::UP;
94 Position *sourcePos = chsap->getPosition();
98 cout <<
"UwElectroMagneticChannel::sendUpPhy() sending packet" << endl;
100 for (
int i = 0; i < getChSAPnum(); i++) {
101 dest = (ChSAP *) getChSAP(i);
107 dest, p->copy(),
getPropDelay(sourcePos, dest->getPosition()));
122 double distance = src->getDist(dst);
124 assert(distance >= 0.0);
129 cout <<
"UwElectroMagneticChannel::getPropDelay() distance = " << distance
130 <<
"; speed = " <<
speed_of_light <<
"; delay = " << delay << endl;
Adds the module for UwElectroMagneticChannel in ns2.
TclObject * create(int, const char *const *)
UwElectroMagneticChannelClass()
UwElectroMagneticChannel extends Miracle channel class and implements the underwater optical channel.
virtual void recv(Packet *p, ChSAP *chsap)
Performs the reception of packets from upper and lower layers.
void sendUpPhy(Packet *p, ChSAP *chsap)
Sends the given Packet* to the upper PHY layer.
double refractive_index
refractive index of the underwater medium.
UwElectroMagneticChannel()
Constructor of UwElectroMagneticChannel class.
virtual int command(int argc, const char *const *argv)
TCL command interpreter.
virtual double getPropDelay(Position *s, Position *d)
Returns the underwater optical propagation delay between the two given Position pointers.
double speed_of_light
Speed of light in the underwater medium.
#define REFRACTIVE_INDEX_MIN
UwElectroMagneticChannelClass class_UwElectroMagneticChannel
#define SPEED_OF_LIGHT_VACUUM
#define REFRACTIVE_INDEX_WATER
Provides class and APIs of the underwater elctromagnetic channel.