#include <wireless-phy.h>
Inheritance diagram for WirelessPhy:


Definition at line 65 of file wireless-phy.h.
Public Member Functions | |
| virtual double | bittime () const |
| virtual Channel * | channel (void) const |
| virtual int | command (int argc, const char *const *argv) |
| virtual void | debug (const char *fmt,...) |
| virtual int | delay_bind_dispatch (const char *varName, const char *localName, TclObject *tracer) |
| virtual void | delay_bind_init_all () |
| NsObject * | downtarget () |
| virtual void | drop (Packet *p) |
| virtual void | dump (void) const |
| double | getAntennaZ () |
| double | getCSThresh () |
| double | getDist (double Pr, double Pt, double Gt, double Gr, double hr, double ht, double L, double lambda) |
| double | getFreq () |
| double | getL () const |
| double | getLambda () const |
| double | getPt () |
| double | getPtconsume () |
| double | getRXThresh () |
| LinkHead * | head () |
| void | insertchnl (struct if_head *head) |
| void | insertnode (struct if_head *head) |
| bool & | Is_node_on () |
| bool | Is_sleeping () |
| int | isdebug () const |
| Phy * | nextchnl (void) const |
| Phy * | nextnode (void) const |
| Node * | node (void) const |
| void | node_off () |
| void | node_on () |
| void | node_sleep () |
| void | node_wakeup () |
| virtual void | recv (Packet *p, const char *s) |
| void | recv (Packet *p, Handler *h) |
| virtual void | recvOnly (Packet *) |
| void | removechnl () |
| void | sendDown (Packet *p) |
| int | sendUp (Packet *p) |
| void | setchnl (Channel *chnl) |
| virtual void | setnode (Node *node) |
| double | txtime (int bytes) |
| double | txtime (Packet *p) |
| NsObject * | uptarget () |
| WirelessPhy () | |
Protected Types | |
| enum | ChannelStatus { SLEEP, IDLE, RECV, SEND } |
Protected Member Functions | |
| virtual void | drop (Packet *p, const char *s) |
| void | handle (Event *) |
| LIST_ENTRY (Phy) node_link_ | |
| LIST_ENTRY (Phy) chnl_link_ | |
| virtual void | reset () |
| virtual void | sendDown (Packet *p, Handler *h) |
| virtual void | sendUp (Packet *p, Handler *h) |
Protected Attributes | |
| Antenna * | ant_ |
| double | bandwidth_ |
| Channel * | channel_ |
| double | channel_idle_time_ |
| double | CPThresh_ |
| double | CSThresh_ |
| int | debug_ |
| NsObject * | downtarget_ |
| NsObject * | drop_ |
| double | freq_ |
| LinkHead * | head_ |
| int | index_ |
| double | L_ |
| double | lambda_ |
| double | last_send_time_ |
| Modulation * | modulation_ |
| Node * | node_ |
| bool | node_on_ |
| double | P_idle_ |
| double | P_sleep_ |
| double | P_transition_ |
| double | Pr_consume_ |
| Propagation * | propagation_ |
| double | Pt_ |
| double | Pt_consume_ |
| double | RXThresh_ |
| Sleep_Timer | sleep_timer_ |
| int | status_ |
| double | T_transition_ |
| double | update_energy_time_ |
| NsObject * | uptarget_ |
Private Member Functions | |
| EnergyModel * | em () |
| int | initialized () |
| void | UpdateIdleEnergy () |
| void | UpdateSleepEnergy () |
Friends | |
| class | Sleep_Timer |
|
|
Definition at line 129 of file wireless-phy.h.
|
|
|
Definition at line 77 of file wireless-phy.cc. References ant_, channel_idle_time_, CPThresh_, CSThresh_, freq_, L_, lambda_, last_send_time_, modulation_, Phy::node_, node_on_, NOW, P_idle_, P_sleep_, P_transition_, Pr_consume_, propagation_, Pt_, Pt_consume_, TimerHandler::resched(), RXThresh_, sleep_timer_, SPEED_OF_LIGHT, and update_energy_time_. 00077 : Phy(), sleep_timer_(this), status_(IDLE) 00078 { 00079 /* 00080 * It sounds like 10db should be the capture threshold. 00081 * 00082 * If a node is presently receiving a packet a a power level 00083 * Pa, and a packet at power level Pb arrives, the following 00084 * comparion must be made to determine whether or not capture 00085 * occurs: 00086 * 00087 * 10 * log(Pa) - 10 * log(Pb) > 10db 00088 * 00089 * OR equivalently 00090 * 00091 * Pa/Pb > 10. 00092 * 00093 */ 00094 bind("CPThresh_", &CPThresh_); 00095 bind("CSThresh_", &CSThresh_); 00096 bind("RXThresh_", &RXThresh_); 00097 //bind("bandwidth_", &bandwidth_); 00098 bind("Pt_", &Pt_); 00099 bind("freq_", &freq_); 00100 bind("L_", &L_); 00101 00102 lambda_ = SPEED_OF_LIGHT / freq_; 00103 00104 node_ = 0; 00105 ant_ = 0; 00106 propagation_ = 0; 00107 modulation_ = 0; 00108 00109 // Assume AT&T's Wavelan PCMCIA card -- Chalermek 00110 // Pt_ = 8.5872e-4; // For 40m transmission range. 00111 // Pt_ = 7.214e-3; // For 100m transmission range. 00112 // Pt_ = 0.2818; // For 250m transmission range. 00113 // Pt_ = pow(10, 2.45) * 1e-3; // 24.5 dbm, ~ 281.8mw 00114 00115 Pt_consume_ = 0.660; // 1.6 W drained power for transmission 00116 Pr_consume_ = 0.395; // 1.2 W drained power for reception 00117 00118 // P_idle_ = 0.035; // 1.15 W drained power for idle 00119 00120 P_idle_ = 0.0; 00121 P_sleep_ = 0.00; 00122 P_transition_ = 0.00; 00123 node_on_=1; 00124 00125 channel_idle_time_ = NOW; 00126 update_energy_time_ = NOW; 00127 last_send_time_ = NOW; 00128 00129 sleep_timer_.resched(1.0); 00130 00131 }
Here is the call graph for this function: ![]() |
|
|
Definition at line 85 of file phy.h. References Phy::bandwidth_. 00085 { return 1/bandwidth_; }
|
|
|
Definition at line 105 of file phy.h. References Phy::channel_. Referenced by SatLL::channel(), SatRouteObject::compute_topology(), LinkHandoffMgr::get_peer(), LinkHandoffMgr::get_peer_linkhead(), LinkHandoffMgr::get_peer_next_linkhead(), Mac802_3::sendDown(), and WirelessChannel::sendUp(). 00105 {return channel_;}
|
|
||||||||||||
|
Reimplemented from Phy. Definition at line 134 of file wireless-phy.cc. References ant_, Phy::command(), EnergyModel::DecrIdleEnergy(), em(), Phy::node_, node_off(), node_on(), NOW, P_idle_, P_sleep_, P_transition_, Pr_consume_, propagation_, Pt_consume_, T_transition_, and update_energy_time_. 00135 { 00136 TclObject *obj; 00137 00138 if (argc==2) { 00139 if (strcasecmp(argv[1], "NodeOn") == 0) { 00140 node_on(); 00141 00142 if (em() == NULL) 00143 return TCL_OK; 00144 if (NOW > update_energy_time_) { 00145 update_energy_time_ = NOW; 00146 } 00147 return TCL_OK; 00148 } else if (strcasecmp(argv[1], "NodeOff") == 0) { 00149 node_off(); 00150 00151 if (em() == NULL) 00152 return TCL_OK; 00153 if (NOW > update_energy_time_) { 00154 em()->DecrIdleEnergy(NOW-update_energy_time_, 00155 P_idle_); 00156 update_energy_time_ = NOW; 00157 } 00158 return TCL_OK; 00159 } 00160 } else if(argc == 3) { 00161 if (strcasecmp(argv[1], "setTxPower") == 0) { 00162 Pt_consume_ = atof(argv[2]); 00163 return TCL_OK; 00164 } else if (strcasecmp(argv[1], "setRxPower") == 0) { 00165 Pr_consume_ = atof(argv[2]); 00166 return TCL_OK; 00167 } else if (strcasecmp(argv[1], "setIdlePower") == 0) { 00168 P_idle_ = atof(argv[2]); 00169 return TCL_OK; 00170 }else if (strcasecmp(argv[1], "setSleepPower") == 0) { 00171 P_sleep_ = atof(argv[2]); 00172 return TCL_OK; 00173 } else if (strcasecmp(argv[1], "setTransitionPower") == 0) { 00174 P_transition_ = atof(argv[2]); 00175 return TCL_OK; 00176 } else if (strcasecmp(argv[1], "setTransitionTime") == 0) { 00177 T_transition_ = atof(argv[2]); 00178 return TCL_OK; 00179 }else if( (obj = TclObject::lookup(argv[2])) == 0) { 00180 fprintf(stderr,"WirelessPhy: %s lookup of %s failed\n", 00181 argv[1], argv[2]); 00182 return TCL_ERROR; 00183 }else if (strcmp(argv[1], "propagation") == 0) { 00184 assert(propagation_ == 0); 00185 propagation_ = (Propagation*) obj; 00186 return TCL_OK; 00187 } else if (strcasecmp(argv[1], "antenna") == 0) { 00188 ant_ = (Antenna*) obj; 00189 return TCL_OK; 00190 } else if (strcasecmp(argv[1], "node") == 0) { 00191 assert(node_ == 0); 00192 node_ = (Node *)obj; 00193 return TCL_OK; 00194 } 00195 } 00196 return Phy::command(argc,argv); 00197 }
Here is the call graph for this function: ![]() |
|
||||||||||||
|
Definition at line 102 of file object.cc. References NsObject::debug_. 00103 { 00104 if (!debug_) 00105 return; 00106 va_list ap; 00107 va_start(ap, fmt); 00108 vprintf(fmt, ap); 00109 }
|
|
||||||||||||||||
|
Reimplemented in BayFullTcpAgent, Agent, MPLSAddressClassifier, LDPAgent, HbAfterRtoSctpAgent, MfrHbAfterRtoSctpAgent, MfrTimestampSctpAgent, MultipleFastRtxSctpAgent, NewRenoSctpAgent, TimestampSctpAgent, SctpAgent, FullTcpAgent, SackFullTcpAgent, RFC793eduTcpAgent, TcpSink, TcpAgent, VegasTcpAgent, XcpAgent, and XcpSink. Definition at line 63 of file object.cc. References NsObject::debug_. Referenced by MPLSAddressClassifier::delay_bind_dispatch(), and Agent::delay_bind_dispatch(). 00064 { 00065 if (delay_bind_bool(varName, localName, "debug_", &debug_, tracer)) 00066 return TCL_OK; 00067 return TclObject::delay_bind_dispatch(varName, localName, tracer); 00068 }
|
|
|
Reimplemented in BayFullTcpAgent, Agent, MPLSAddressClassifier, LDPAgent, HbAfterRtoSctpAgent, MfrHbAfterRtoSctpAgent, MfrTimestampSctpAgent, MultipleFastRtxSctpAgent, NewRenoSctpAgent, TimestampSctpAgent, SctpAgent, FullTcpAgent, SackFullTcpAgent, RFC793eduTcpAgent, TcpSink, TcpAgent, VegasTcpAgent, XcpAgent, and XcpSink. Definition at line 57 of file object.cc. Referenced by MPLSAddressClassifier::delay_bind_init_all(), and Agent::delay_bind_init_all().
|
|
|
Definition at line 49 of file bi-connector.h. References BiConnector::downtarget_. Referenced by SatLL::channel(). 00049 { return downtarget_; }
|
|
||||||||||||
|
Definition at line 144 of file bi-connector.cc. References BiConnector::drop_, Packet::free(), and NsObject::recv(). 00145 { 00146 if (drop_ != 0) 00147 drop_->recv(p, s); 00148 else 00149 Packet::free(p); 00150 }
Here is the call graph for this function: ![]() |
|
|
Definition at line 135 of file bi-connector.cc. References BiConnector::drop_, Packet::free(), and NsObject::recv(). Referenced by Mac802_3::collision(), SMAC::drop_CTS(), SMAC::drop_DATA(), SMAC::drop_RTS(), SMAC::drop_SYNC(), UnslottedAlohaMac::end_of_contention(), Mac802_15_4::recv(), MacTdma::recvHandler(), MacSimple::recvHandler(), Phy802_15_4::recvOverHandler(), Mac::resume(), MacCsma::resume(), UnslottedAlohaMac::sendUp(), SatMac::sendUp(), Mac::sendUp(), MacTdma::TX_Time(), and Mac802_11::txtime(). 00136 { 00137 if (drop_ != 0) 00138 drop_->recv(p); 00139 else 00140 Packet::free(p); 00141 }
Here is the call graph for this function: ![]() |
|
|
Reimplemented from Phy. Definition at line 525 of file wireless-phy.cc. References ant_, Phy::dump(), Antenna::getRxGain(), Antenna::getTxGain(), L_, lambda_, and Pt_. 00526 { 00527 Phy::dump(); 00528 fprintf(stdout, 00529 "\tPt: %f, Gt: %f, Gr: %f, lambda: %f, L: %f\n", 00530 Pt_, ant_->getTxGain(0,0,0,lambda_), ant_->getRxGain(0,0,0,lambda_), lambda_, L_); 00531 //fprintf(stdout, "\tbandwidth: %f\n", bandwidth_); 00532 fprintf(stdout, "--------------------------------------------------\n"); 00533 }
Here is the call graph for this function: ![]() |
|
|
Definition at line 142 of file wireless-phy.h. References Node::energy_model(), and node(). Referenced by command(), node_off(), node_on(), node_sleep(), node_wakeup(), sendDown(), sendUp(), UpdateIdleEnergy(), and UpdateSleepEnergy(). 00142 { return node()->energy_model(); }
Here is the call graph for this function: ![]() |
|
|
Definition at line 88 of file wireless-phy.h. References ant_, and Antenna::getZ().
Here is the call graph for this function: ![]() |
|
|
Definition at line 91 of file wireless-phy.h. References CSThresh_. 00091 { return CSThresh_; }
|
|
||||||||||||||||||||||||||||||||||||
|
Definition at line 557 of file wireless-phy.cc. References Propagation::getDist(), and propagation_. 00559 { 00560 if (propagation_) { 00561 return propagation_->getDist(Pr, Pt, Gt, Gr, hr, ht, L, 00562 lambda); 00563 } 00564 return 0; 00565 }
Here is the call graph for this function: ![]() |
|
|
Definition at line 92 of file wireless-phy.h. References freq_. 00092 { return freq_; }
|
|
|
Definition at line 72 of file wireless-phy.h. References L_. Referenced by TwoRayGround::Pr(), Shadowing::Pr(), and FreeSpace::Pr(). 00072 {return L_;}
|
|
|
Definition at line 73 of file wireless-phy.h. References lambda_. Referenced by TwoRayGround::Pr(), Shadowing::Pr(), and FreeSpace::Pr(). 00073 {return lambda_;}
|
|
|
Definition at line 89 of file wireless-phy.h. References Pt_. 00089 { return Pt_; }
|
|
|
Definition at line 75 of file wireless-phy.h. References Pt_consume_. 00075 { return Pt_consume_; }
|
|
|
Definition at line 90 of file wireless-phy.h. References RXThresh_. 00090 { return RXThresh_; }
|
|
|
Implements Handler. Reimplemented in LinkDelay, LL, AckRecons, and Snoop. Definition at line 91 of file object.cc. References NsObject::recv().
Here is the call graph for this function: ![]() |
|
|
Definition at line 108 of file phy.h. References Phy::head_. Referenced by SatRouteObject::compute_topology(), SatChannel::find_peer_mac_addr(), LinkHandoffMgr::get_peer_linkhead(), and SatPhy::sendDown(). 00108 { return head_; }
|
|
|
Definition at line 135 of file wireless-phy.h. References BiConnector::downtarget_, Phy::node_, propagation_, and BiConnector::uptarget_. Referenced by sendDown(), and sendUp(). 00135 { 00136 return (node_ && uptarget_ && downtarget_ && propagation_); 00137 }
|
|
|
Definition at line 89 of file phy.h. References LIST_INSERT_HEAD. Referenced by SatChannel::add_interface(). 00089 { 00090 LIST_INSERT_HEAD(head, this, chnl_link_); 00091 //channel_ = chnl; 00092 }
|
|
|
Definition at line 95 of file phy.h. References LIST_INSERT_HEAD. Referenced by SatNode::command(), and MobileNode::command(). 00095 { 00096 LIST_INSERT_HEAD(head, this, node_link_); 00097 //node_ = node; 00098 }
|
|
|
Definition at line 97 of file wireless-phy.h. References node_on_. Referenced by sendDown(), sendUp(), UpdateIdleEnergy(), and UpdateSleepEnergy(). 00097 { return node_on_; }
|
|
|
Definition at line 98 of file wireless-phy.h. References SLEEP, and status_. Referenced by sendDown(), sendUp(), and UpdateSleepEnergy().
|
|
|
Definition at line 61 of file object.h. References NsObject::debug_. 00061 { return debug_; }
|
|
|
|
|
|
|
|
|
Definition at line 88 of file phy.h. Referenced by WirelessChannel::calcHighestAntennaZ(), SatRouteObject::compute_topology(), Channel::dump(), LinkHandoffMgr::get_peer(), LinkHandoffMgr::get_peer_linkhead(), and Channel::sendUp().
|
|
|
Definition at line 94 of file phy.h. Referenced by MobileNode::dump(), and WirelessChannel::sendUp().
|
|
|
Reimplemented from Phy. Definition at line 74 of file wireless-phy.h. References Phy::node_. Referenced by em(), Phy802_15_4::recv(), sendDown(), and sendUp(). 00074 { return node_; }
|
|
|
Definition at line 451 of file wireless-phy.cc. References EnergyModel::DecrIdleEnergy(), em(), FALSE, node_on_, NOW, P_idle_, SLEEP, status_, and update_energy_time_. Referenced by command(). 00452 { 00453 00454 node_on_= FALSE; 00455 status_ = SLEEP; 00456 00457 if (em() == NULL) 00458 return; 00459 if (NOW > update_energy_time_) { 00460 em()->DecrIdleEnergy(NOW-update_energy_time_, 00461 P_idle_); 00462 update_energy_time_ = NOW; 00463 } 00464 }
Here is the call graph for this function: ![]() |
|
|
Definition at line 437 of file wireless-phy.cc. References em(), IDLE, node_on_, NOW, status_, TRUE, and update_energy_time_. Referenced by command(). 00438 { 00439 00440 node_on_= TRUE; 00441 status_ = IDLE; 00442 00443 if (em() == NULL) 00444 return; 00445 if (NOW > update_energy_time_) { 00446 update_energy_time_ = NOW; 00447 } 00448 }
Here is the call graph for this function: ![]() |
|
|
Definition at line 495 of file wireless-phy.cc. References EnergyModel::DecrIdleEnergy(), EnergyModel::DecrTransitionEnergy(), em(), IDLE, Phy::node_, NOW, P_idle_, P_transition_, SLEEP, status_, T_transition_, and update_energy_time_. Referenced by UpdateSleepEnergy(). 00496 { 00497 // 00498 // node_on_= FALSE; 00499 // 00500 if (status_== SLEEP) 00501 return; 00502 00503 if (em() == NULL) 00504 return; 00505 00506 if ( NOW > update_energy_time_ && (status_== IDLE) ) { 00507 //the power consumption when radio goes from IDLE mode to SLEEP mode 00508 em()->DecrTransitionEnergy(T_transition_,P_transition_); 00509 00510 em()->DecrIdleEnergy(NOW-update_energy_time_, 00511 P_idle_); 00512 status_ = SLEEP; 00513 update_energy_time_ = NOW; 00514 00515 // log node energy 00516 if (em()->energy() > 0) { 00517 ((MobileNode *)node_)->log_energy(1); 00518 } else { 00519 ((MobileNode *)node_)->log_energy(0); 00520 } 00521 } 00522 }
Here is the call graph for this function: ![]() |
|
|
Definition at line 467 of file wireless-phy.cc. References EnergyModel::DecrSleepEnergy(), EnergyModel::DecrTransitionEnergy(), em(), IDLE, Phy::node_, NOW, P_sleep_, P_transition_, SLEEP, status_, T_transition_, and update_energy_time_. Referenced by UpdateSleepEnergy(). 00468 { 00469 00470 if (status_== IDLE) 00471 return; 00472 00473 if (em() == NULL) 00474 return; 00475 00476 if ( NOW > update_energy_time_ && (status_== SLEEP) ) { 00477 //the power consumption when radio goes from SLEEP mode to IDLE mode 00478 em()->DecrTransitionEnergy(T_transition_,P_transition_); 00479 00480 em()->DecrSleepEnergy(NOW-update_energy_time_, 00481 P_sleep_); 00482 status_ = IDLE; 00483 update_energy_time_ = NOW; 00484 00485 // log node energy 00486 if (em()->energy() > 0) { 00487 ((MobileNode *)node_)->log_energy(1); 00488 } else { 00489 ((MobileNode *)node_)->log_energy(0); 00490 } 00491 } 00492 }
Here is the call graph for this function: ![]() |
|
||||||||||||
|
Reimplemented in CMUTrace. Definition at line 96 of file object.cc. References Packet::free(). 00097 { 00098 Packet::free(p); 00099 }
Here is the call graph for this function: ![]() |
|
||||||||||||
|
Reimplemented from BiConnector. Reimplemented in RepeaterPhy, and Phy802_15_4. Definition at line 106 of file phy.cc. References hdr_cmn::direction(), hdr_cmn::DOWN, Packet::free(), HDR_CMN, NsObject::recv(), Phy::sendDown(), Phy::sendUp(), hdr_cmn::UP, and BiConnector::uptarget_. 00107 { 00108 struct hdr_cmn *hdr = HDR_CMN(p); 00109 //struct hdr_sr *hsr = HDR_SR(p); 00110 00111 /* 00112 * Handle outgoing packets 00113 */ 00114 switch(hdr->direction()) { 00115 case hdr_cmn::DOWN : 00116 /* 00117 * The MAC schedules its own EOT event so we just 00118 * ignore the handler here. It's only purpose 00119 * it distinguishing between incoming and outgoing 00120 * packets. 00121 */ 00122 sendDown(p); 00123 return; 00124 case hdr_cmn::UP : 00125 if (sendUp(p) == 0) { 00126 /* 00127 * XXX - This packet, even though not detected, 00128 * contributes to the Noise floor and hence 00129 * may affect the reception of other packets. 00130 */ 00131 Packet::free(p); 00132 return; 00133 } else { 00134 uptarget_->recv(p, (Handler*) 0); 00135 } 00136 break; 00137 default: 00138 printf("Direction for pkt-flow not specified; Sending pkt up the stack on default.\n\n"); 00139 if (sendUp(p) == 0) { 00140 /* 00141 * XXX - This packet, even though not detected, 00142 * contributes to the Noise floor and hence 00143 * may affect the reception of other packets. 00144 */ 00145 Packet::free(p); 00146 return; 00147 } else { 00148 uptarget_->recv(p, (Handler*) 0); 00149 } 00150 } 00151 00152 }
Here is the call graph for this function: ![]() |
|
|
Reimplemented in Agent, and Trace. Definition at line 56 of file object.h. Referenced by Trace::recvOnly().
|
|
|
Definition at line 99 of file phy.h. References LIST_REMOVE. Referenced by SatChannel::remove_interface(). 00099 { 00100 LIST_REMOVE(this, chnl_link_); 00101 }
|
|
|
Reimplemented in BayFullTcpAgent, HashClassifier, IvsSource, dsREDQueue, DiffusionRate, SinkAgent, DiffusionAgent, FloodingAgent, OmniMcastAgent, LinkDelay, CBQueue, DropTail, ErrorModel, PIQueue, Queue< T >, RedPDQueue, REDQueue, REMQueue, RIOQueue, Snoop, FackTcpAgent, FullTcpAgent, SackFullTcpAgent, RFC793eduTcpAgent, Sack1TcpAgent, TcpSink, DelAckSink, TcpAgent, VegasTcpAgent, toraAgent, Queue< T >, and XcpSink. Definition at line 70 of file object.cc. Referenced by NsObject::command().
|
|
||||||||||||
|
Reimplemented in Mac802_3, and Mac802_15_4. Definition at line 55 of file bi-connector.h. References BiConnector::downtarget_, and NsObject::recv(). Referenced by BiConnector::recv(). 00056 { downtarget_->recv(p, h); }
Here is the call graph for this function: ![]() |
|
|
Implements Phy. Definition at line 200 of file wireless-phy.cc. References hdr_cmn::access(), ant_, Phy::channel_, channel_idle_time_, Antenna::copy(), EnergyModel::DecrIdleEnergy(), EnergyModel::DecrTxEnergy(), em(), Packet::free(), IDLE, initialized(), Is_node_on(), Is_sleeping(), lambda_, last_send_time_, MAX, MIN, node(), Phy::node_, NOW, P_idle_, P_sleep_, Pr_consume_, Pt_, Pt_consume_, Channel::recv(), RECV, EnergyModel::setenergy(), PacketStamp::stamp(), status_, Packet::txinfo_, hdr_cmn::txtime(), Phy::txtime(), and update_energy_time_. Referenced by Phy802_15_4::PD_DATA_request(). 00201 { 00202 /* 00203 * Sanity Check 00204 */ 00205 assert(initialized()); 00206 00207 if (em()) { 00208 //node is off here... 00209 if (Is_node_on() != true ) { 00210 Packet::free(p); 00211 return; 00212 } 00213 if(Is_node_on() == true && Is_sleeping() == true){ 00214 em()-> DecrSleepEnergy(NOW-update_energy_time_, 00215 P_sleep_); 00216 update_energy_time_ = NOW; 00217 00218 } 00219 00220 } 00221 /* 00222 * Decrease node's energy 00223 */ 00224 if(em()) { 00225 if (em()->energy() > 0) { 00226 00227 double txtime = hdr_cmn::access(p)->txtime(); 00228 double start_time = MAX(channel_idle_time_, NOW); 00229 double end_time = MAX(channel_idle_time_, NOW+txtime); 00230 double actual_txtime = end_time-start_time; 00231 00232 if (start_time > update_energy_time_) { 00233 em()->DecrIdleEnergy(start_time - 00234 update_energy_time_, P_idle_); 00235 update_energy_time_ = start_time; 00236 } 00237 00238 /* It turns out that MAC sends packet even though, it's 00239 receiving some packets. 00240 00241 if (txtime-actual_txtime > 0.000001) { 00242 fprintf(stderr,"Something may be wrong at MAC\n"); 00243 fprintf(stderr,"act_tx = %lf, tx = %lf\n", actual_txtime, txtime); 00244 } 00245 */ 00246 00247 // Sanity check 00248 double temp = MAX(NOW,last_send_time_); 00249 00250 /* 00251 if (NOW < last_send_time_) { 00252 fprintf(stderr,"Argggg !! Overlapping transmission. NOW %lf last %lf temp %lf\n", NOW, last_send_time_, temp); 00253 } 00254 */ 00255 00256 double begin_adjust_time = MIN(channel_idle_time_, temp); 00257 double finish_adjust_time = MIN(channel_idle_time_, NOW+txtime); 00258 double gap_adjust_time = finish_adjust_time - begin_adjust_time; 00259 if (gap_adjust_time < 0.0) { 00260 fprintf(stderr,"What the heck ! negative gap time.\n"); 00261 } 00262 00263 if ((gap_adjust_time > 0.0) && (status_ == RECV)) { 00264 em()->DecrTxEnergy(gap_adjust_time, 00265 Pt_consume_-Pr_consume_); 00266 } 00267 00268 em()->DecrTxEnergy(actual_txtime,Pt_consume_); 00269 // if (end_time > channel_idle_time_) { 00270 // status_ = SEND; 00271 // } 00272 // 00273 status_ = IDLE; 00274 00275 last_send_time_ = NOW+txtime; 00276 channel_idle_time_ = end_time; 00277 update_energy_time_ = end_time; 00278 00279 if (em()->energy() <= 0) { 00280 em()->setenergy(0); 00281 ((MobileNode*)node())->log_energy(0); 00282 } 00283 00284 } else { 00285 00286 // log node energy 00287 if (em()->energy() > 0) { 00288 ((MobileNode *)node_)->log_energy(1); 00289 } 00290 // 00291 Packet::free(p); 00292 return; 00293 } 00294 } 00295 00296 /* 00297 * Stamp the packet with the interface arguments 00298 */ 00299 p->txinfo_.stamp((MobileNode*)node(), ant_->copy(), Pt_, lambda_); 00300 00301 // Send the packet 00302 channel_->recv(p, this); 00303 }
Here is the call graph for this function: ![]() |
|
||||||||||||
|
Reimplemented in Mac802_3. Definition at line 57 of file bi-connector.h. References NsObject::recv(), and BiConnector::uptarget_. Referenced by BiConnector::recv().
Here is the call graph for this function: ![]() |
|
|
Implements Phy. Definition at line 306 of file wireless-phy.cc. References hdr_cmn::access(), ant_, Modulation::BitError(), channel_idle_time_, PacketStamp::CPThresh, CPThresh_, CSThresh_, EnergyModel::DecrIdleEnergy(), EnergyModel::DecrRcvEnergy(), em(), hdr_cmn::error(), PacketStamp::getAntenna(), PacketStamp::getNode(), PacketStamp::getTxPr(), HDR_CMN, IDLE, initialized(), Scheduler::instance(), Is_node_on(), Is_sleeping(), lambda_, MAX, modulation_, node(), Phy::node_, NOW, P_idle_, Propagation::Pr(), Pr_consume_, propagation_, Antenna::release(), PacketStamp::RxPr, RXThresh_, EnergyModel::setenergy(), PacketStamp::stamp(), status_, Packet::txinfo_, hdr_cmn::txtime(), and update_energy_time_. Referenced by Phy802_15_4::PD_DATA_indication(), and Phy802_15_4::recv(). 00307 { 00308 /* 00309 * Sanity Check 00310 */ 00311 assert(initialized()); 00312 00313 PacketStamp s; 00314 double Pr; 00315 int pkt_recvd = 0; 00316 00317 Pr = p->txinfo_.getTxPr(); 00318 00319 // if the node is in sleeping mode, drop the packet simply 00320 if (em()) { 00321 if (Is_node_on()!= true){ 00322 pkt_recvd = 0; 00323 goto DONE; 00324 } 00325 00326 if (Is_sleeping()==true && (Is_node_on() == true)) { 00327 pkt_recvd = 0; 00328 goto DONE; 00329 } 00330 00331 } 00332 // if the energy goes to ZERO, drop the packet simply 00333 if (em()) { 00334 if (em()->energy() <= 0) { 00335 pkt_recvd = 0; 00336 goto DONE; 00337 } 00338 } 00339 00340 if(propagation_) { 00341 s.stamp((MobileNode*)node(), ant_, 0, lambda_); 00342 Pr = propagation_->Pr(&p->txinfo_, &s, this); 00343 if (Pr < CSThresh_) { 00344 pkt_recvd = 0; 00345 goto DONE; 00346 } 00347 if (Pr < RXThresh_) { 00348 /* 00349 * We can detect, but not successfully receive 00350 * this packet. 00351 */ 00352 hdr_cmn *hdr = HDR_CMN(p); 00353 hdr->error() = 1; 00354 #if DEBUG > 3 00355 printf("SM %f.9 _%d_ drop pkt from %d low POWER %e/%e\n", 00356 Scheduler::instance().clock(), node()->index(), 00357 p->txinfo_.getNode()->index(), 00358 Pr,RXThresh); 00359 #endif 00360 } 00361 } 00362 if(modulation_) { 00363 hdr_cmn *hdr = HDR_CMN(p); 00364 hdr->error() = modulation_->BitError(Pr); 00365 } 00366 00367 /* 00368 * The MAC layer must be notified of the packet reception 00369 * now - ie; when the first bit has been detected - so that 00370 * it can properly do Collision Avoidance / Detection. 00371 */ 00372 pkt_recvd = 1; 00373 00374 DONE: 00375 p->txinfo_.getAntenna()->release(); 00376 00377 /* WILD HACK: The following two variables are a wild hack. 00378 They will go away in the next release... 00379 They're used by the mac-802_11 object to determine 00380 capture. This will be moved into the net-if family of 00381 objects in the future. */ 00382 p->txinfo_.RxPr = Pr; 00383 p->txinfo_.CPThresh = CPThresh_; 00384 00385 /* 00386 * Decrease energy if packet successfully received 00387 */ 00388 if(pkt_recvd && em()) { 00389 00390 double rcvtime = hdr_cmn::access(p)->txtime(); 00391 // no way to reach here if the energy level < 0 00392 00393 double start_time = MAX(channel_idle_time_, NOW); 00394 double end_time = MAX(channel_idle_time_, NOW+rcvtime); 00395 double actual_rcvtime = end_time-start_time; 00396 00397 if (start_time > update_energy_time_) { 00398 em()->DecrIdleEnergy(start_time-update_energy_time_, 00399 P_idle_); 00400 update_energy_time_ = start_time; 00401 } 00402 00403 em()->DecrRcvEnergy(actual_rcvtime,Pr_consume_); 00404 /* 00405 if (end_time > channel_idle_time_) { 00406 status_ = RECV; 00407 } 00408 */ 00409 channel_idle_time_ = end_time; 00410 update_energy_time_ = end_time; 00411 00412 status_ = IDLE; 00413 00414 /* 00415 hdr_diff *dfh = HDR_DIFF(p); 00416 printf("Node %d receives (%d, %d, %d) energy %lf.\n", 00417 node()->address(), dfh->sender_id.addr_, 00418 dfh->sender_id.port_, dfh->pk_num, node()->energy()); 00419 */ 00420 00421 // log node energy 00422 if (em()->energy() > 0) { 00423 ((MobileNode *)node_)->log_energy(1); 00424 } 00425 00426 if (em()->energy() <= 0) { 00427 // saying node died 00428 em()->setenergy(0); 00429 ((MobileNode*)node())->log_energy(0); 00430 } 00431 } 00432 00433 return pkt_recvd; 00434 }
Here is the call graph for this function: ![]() |
|
|
Definition at line 102 of file phy.h. References Phy::channel_. Referenced by SatChannel::add_interface(), and SatChannel::remove_interface(). 00102 { channel_ = chnl; }
|
|
|
Definition at line 103 of file phy.h. References Phy::node(), and Phy::node_. Referenced by SatNode::command(), and MobileNode::command().
Here is the call graph for this function: ![]() |
|
|
Definition at line 83 of file phy.h. References Phy::bandwidth_. 00083 { 00084 return (8.0 * bytes / bandwidth_); }
|
|
|
Definition at line 81 of file phy.h. References hdr_cmn::access(), and Phy::bandwidth_. Referenced by Mac802_3::collision(), Mac8023HandlerSend::handle(), MacHandlerRetx::schedule(), sendDown(), and Mac802_3::sendDown(). 00081 { 00082 return (hdr_cmn::access(p)->size() * 8.0) / bandwidth_; }
Here is the call graph for this function: ![]() |
|
|
Definition at line 536 of file wireless-phy.cc. References em(), IDLE, Is_node_on(), Phy::node_, NOW, P_idle_, status_, TRUE, and update_energy_time_. 00537 { 00538 if (em() == NULL) { 00539 return; 00540 } 00541 if (NOW > update_energy_time_ && (Is_node_on()==TRUE && status_ == IDLE ) ) { 00542 em()-> DecrIdleEnergy(NOW-update_energy_time_, 00543 P_idle_); 00544 update_energy_time_ = NOW; 00545 } 00546 00547 // log node energy 00548 if (em()->energy() > 0) { 00549 ((MobileNode *)node_)->log_energy(1); 00550 } else { 00551 ((MobileNode *)node_)->log_energy(0); 00552 } 00553 00554 // idle_timer_.resched(10.0); 00555 }
Here is the call graph for this function: ![]() |
|
|
Definition at line 568 of file wireless-phy.cc. References em(), Is_node_on(), Is_sleeping(), Phy::node_, node_sleep(), node_wakeup(), NOW, P_sleep_, TimerHandler::resched(), EnergyModel::sleep(), sleep_timer_, TRUE, and update_energy_time_. Referenced by Sleep_Timer::expire(). 00569 { 00570 if (em() == NULL) { 00571 return; 00572 } 00573 if (NOW > update_energy_time_ && ( Is_node_on()==TRUE && Is_sleeping() == true) ) { 00574 em()-> DecrSleepEnergy(NOW-update_energy_time_, 00575 P_sleep_); 00576 update_energy_time_ = NOW; 00577 // log node energy 00578 if (em()->energy() > 0) { 00579 ((MobileNode *)node_)->log_energy(1); 00580 } else { 00581 ((MobileNode *)node_)->log_energy(0); 00582 } 00583 } 00584 00585 //A hack to make states consistent with those of in Energy Model for AF 00586 int static s=em()->sleep(); 00587 if(em()->sleep()!=s){ 00588 00589 s=em()->sleep(); 00590 if(s==1) 00591 node_sleep(); 00592 else 00593 node_wakeup(); 00594 printf("\n AF hack %d\n",em()->sleep()); 00595 } 00596 00597 sleep_timer_.resched(10.0); 00598 }
Here is the call graph for this function: ![]() |
|
|
Definition at line 48 of file bi-connector.h. References BiConnector::uptarget_. 00048 { return uptarget_; }
|
|
|
Definition at line 144 of file wireless-phy.h. |
|
|
Definition at line 122 of file wireless-phy.h. Referenced by command(), dump(), getAntennaZ(), sendDown(), sendUp(), and WirelessPhy(). |
|
|
Definition at line 137 of file phy.h. Referenced by Phy::bittime(), Phy::Phy(), Phy::txtime(), and WiredPhy::WiredPhy(). |
|
|
Definition at line 138 of file phy.h. Referenced by Phy::channel(), Phy::command(), Phy::dump(), Phy::Phy(), sendDown(), WiredPhy::sendDown(), RepeaterPhy::sendDown(), SatPhy::sendDown(), and Phy::setchnl(). |
|
|
Definition at line 111 of file wireless-phy.h. Referenced by sendDown(), sendUp(), and WirelessPhy(). |
|
|
Definition at line 120 of file wireless-phy.h. Referenced by sendUp(), and WirelessPhy(). |
|
|
Definition at line 119 of file wireless-phy.h. Referenced by Phy802_15_4::CCAHandler(), getCSThresh(), sendUp(), and WirelessPhy(). |
|
|
Reimplemented in FECModel, FloodAgent, and LandmarkAgent. Definition at line 66 of file object.h. Referenced by REDQueue::command(), RedPDQueue::command(), PushbackQueue::command(), NsObject::debug(), NsObject::delay_bind_dispatch(), PushbackQueue::enque(), NsObject::isdebug(), NsObject::NsObject(), TfrcAgent::recv(), PushbackQueue::reportDrop(), SctpAgent::Reset(), REDQueue::reset(), DropTail::shrink_queue(), and Delayer::try_send(). |
|
|
Definition at line 63 of file bi-connector.h. Referenced by Phy::command(), BiConnector::command(), BiConnector::downtarget(), initialized(), WiredPhy::initialized(), Mac::initialized(), FECModel::recv(), MacTdma::send(), UnslottedAlohaMac::sendDown(), SatMac::sendDown(), Mac::sendDown(), BiConnector::sendDown(), SMAC::transmit(), Mac802_11::transmit(), and MacSimple::waitHandler(). |
|
|
Definition at line 64 of file bi-connector.h. Referenced by BiConnector::command(), and BiConnector::drop(). |
|
|
Definition at line 114 of file wireless-phy.h. Referenced by getFreq(), and WirelessPhy(). |
|
|
Definition at line 116 of file phy.h. Referenced by Phy::command(), Phy::head(), and Phy::Phy(). |
|
|
Definition at line 113 of file phy.h. Referenced by Phy::command(), Phy::dump(), Phy802_15_4::PD_DATA_request(), Phy::Phy(), Phy802_15_4::PLME_SET_request(), Phy802_15_4::PLME_SET_TRX_STATE_request(), Phy802_15_4::recv(), Phy802_15_4::recvOverHandler(), and Phy802_15_4::sendOverHandler(). |
|
|
Definition at line 116 of file wireless-phy.h. Referenced by dump(), getL(), and WirelessPhy(). |
|
|
Definition at line 115 of file wireless-phy.h. Referenced by dump(), getLambda(), sendDown(), sendUp(), and WirelessPhy(). |
|
|
Definition at line 110 of file wireless-phy.h. Referenced by sendDown(), and WirelessPhy(). |
|
|
Definition at line 124 of file wireless-phy.h. Referenced by sendUp(), and WirelessPhy(). |
|
|
Definition at line 115 of file phy.h. Referenced by command(), Phy::command(), initialized(), WiredPhy::initialized(), node(), Phy::node(), node_sleep(), node_wakeup(), Phy::Phy(), sendDown(), sendUp(), Phy::setnode(), UpdateIdleEnergy(), UpdateSleepEnergy(), and WirelessPhy(). |
|
|
Definition at line 130 of file wireless-phy.h. Referenced by Is_node_on(), node_off(), node_on(), and WirelessPhy(). |
|
|
Definition at line 104 of file wireless-phy.h. Referenced by command(), node_off(), node_sleep(), sendDown(), sendUp(), UpdateIdleEnergy(), and WirelessPhy(). |
|
|
Definition at line 105 of file wireless-phy.h. Referenced by command(), node_wakeup(), sendDown(), UpdateSleepEnergy(), and WirelessPhy(). |
|
|
Definition at line 106 of file wireless-phy.h. Referenced by command(), node_sleep(), node_wakeup(), and WirelessPhy(). |
|
|
Definition at line 103 of file wireless-phy.h. Referenced by command(), sendDown(), sendUp(), and WirelessPhy(). |
|
|
Definition at line 123 of file wireless-phy.h. Referenced by command(), getDist(), initialized(), sendUp(), and WirelessPhy(). |
|
|
Definition at line 101 of file wireless-phy.h. Referenced by dump(), getPt(), sendDown(), and WirelessPhy(). |
|
|
Definition at line 102 of file wireless-phy.h. Referenced by command(), getPtconsume(), sendDown(), and WirelessPhy(). |
|
|
Definition at line 118 of file wireless-phy.h. Referenced by Phy802_15_4::EDHandler(), getRXThresh(), Phy802_15_4::measureLinkQ(), sendUp(), and WirelessPhy(). |
|
|
Definition at line 131 of file wireless-phy.h. Referenced by UpdateSleepEnergy(), and WirelessPhy(). |
|
|
Definition at line 132 of file wireless-phy.h. Referenced by Is_sleeping(), node_off(), node_on(), node_sleep(), node_wakeup(), sendDown(), sendUp(), and UpdateIdleEnergy(). |
|
|
Definition at line 107 of file wireless-phy.h. Referenced by command(), node_sleep(), and node_wakeup(). |
|
|
Definition at line 112 of file wireless-phy.h. Referenced by command(), node_off(), node_on(), node_sleep(), node_wakeup(), sendDown(), sendUp(), UpdateIdleEnergy(), UpdateSleepEnergy(), and WirelessPhy(). |
|
1.4.6