📄 umts.patch
字号:
double actual_txtime = end_time-start_time; if (start_time > update_energy_time_) {- em()->DecrIdleEnergy(start_time - + em()->DecrIdleEnergy(start_time - update_energy_time_, P_idle_); update_energy_time_ = start_time; } /* It turns out that MAC sends packet even though, it's receiving some packets.- + if (txtime-actual_txtime > 0.000001) { fprintf(stderr,"Something may be wrong at MAC\n"); fprintf(stderr,"act_tx = %lf, tx = %lf\n", actual_txtime, txtime);@@ -227,7 +261,7 @@ fprintf(stderr,"Argggg !! Overlapping transmission. NOW %lf last %lf temp %lf\n", NOW, last_send_time_, temp); } */- + double begin_adjust_time = min(channel_idle_time_, temp); double finish_adjust_time = min(channel_idle_time_, NOW+txtime); double gap_adjust_time = finish_adjust_time - begin_adjust_time;@@ -244,7 +278,7 @@ if (end_time > channel_idle_time_) { status_ = SEND; }- + last_send_time_ = NOW+txtime; channel_idle_time_ = end_time; update_energy_time_ = end_time;@@ -269,7 +303,7 @@ channel_->recv(p, this); } -int +int WirelessPhy::sendUp(Packet *p) { /*@@ -280,14 +314,14 @@ PacketStamp s; double Pr; int pkt_recvd = 0;- + // if the node is in sleeping mode, drop the packet simply- if (em()) + if (em()) if (em()->sleep() || (em()->node_on() != true)) { pkt_recvd = 0; goto DONE; }- + // if the energy goes to ZERO, drop the packet simply if (em()) { if (em()->energy() <= 0) {@@ -299,6 +333,11 @@ if(propagation_) { s.stamp((MobileNode*)node(), ant_, 0, lambda_); Pr = propagation_->Pr(&p->txinfo_, &s, this);++ // P.M. & P.B. modifications+ hdr_phy *ph = HDR_PHY_UMTS(p);+ ph->rx_power() = Pr;+ if (Pr < CSThresh_) { pkt_recvd = 0; goto DONE;@@ -322,7 +361,7 @@ hdr_cmn *hdr = HDR_CMN(p); hdr->error() = modulation_->BitError(Pr); }- + /* * The MAC layer must be notified of the packet reception * now - ie; when the first bit has been detected - so that@@ -336,7 +375,7 @@ /* WILD HACK: The following two variables are a wild hack. They will go away in the next release... They're used by the mac-802_11 object to determine- capture. This will be moved into the net-if family of + capture. This will be moved into the net-if family of objects in the future. */ p->txinfo_.RxPr = Pr; p->txinfo_.CPThresh = CPThresh_;@@ -348,9 +387,9 @@ //double rcvtime = (8. * hdr_cmn::access(p)->size())/bandwidth_; double rcvtime = hdr_cmn::access(p)->txtime(); // no way to reach here if the energy level < 0- + /*- node()->add_rcvtime(rcvtime); + node()->add_rcvtime(rcvtime); em()->DecrRcvEnergy(rcvtime,Pr_consume_); */ @@ -363,7 +402,7 @@ P_idle_); update_energy_time_ = start_time; }- + em()->DecrRcvEnergy(actual_rcvtime,Pr_consume_); if (end_time > channel_idle_time_) { status_ = RECV;@@ -375,17 +414,17 @@ /* hdr_diff *dfh = HDR_DIFF(p); printf("Node %d receives (%d, %d, %d) energy %lf.\n",- node()->address(), dfh->sender_id.addr_, + node()->address(), dfh->sender_id.addr_, dfh->sender_id.port_, dfh->pk_num, node()->energy()); */- - if (em()->energy() <= 0) { ++ if (em()->energy() <= 0) { // saying node died em()->setenergy(0); ((MobileNode*)node())->log_energy(0); } }- + return pkt_recvd; } @@ -393,13 +432,13 @@ WirelessPhy::node_on() { if (em() == NULL)- return; + return; if (NOW > update_energy_time_) { update_energy_time_ = NOW; } } -void +void WirelessPhy::node_off() { if (em() == NULL)diff -ur Makefile.in ns-umts-extensions/code/Makefile.in--- Makefile.in 2002-10-09 23:57:15.000000000 +0000+++ ns-umts-extensions/code/Makefile.in 2003-06-01 20:10:45.000000000 +0000@@ -67,7 +67,8 @@ -I./routing -I./tools -I./classifier -I./mcast \ -I./diffusion3/lib/main -I./diffusion3/lib \ -I./diffusion3/lib/nr -I./diffusion3/ns \- -I./diffusion3/diffusion -I./asim/+ -I./diffusion3/diffusion -I./asim/ \+ -I./umts LIB = \@@ -101,7 +102,7 @@ # To allow conf/makefile.win overwrite this macro # We will set these two macros to empty in conf/makefile.win since VC6.0-# does not seem to support the STL in gcc 2.8 and up. +# does not seem to support the STL in gcc 2.8 and up. OBJ_STL = diffusion3/lib/nr/nr.o diffusion3/lib/dr.o \ diffusion3/ns/diffagent.o diffusion3/ns/diffrtg.o \ diffusion3/ns/difftimer.o \@@ -213,6 +214,14 @@ queue/priqueue.o queue/dsr-priqueue.o \ mac/phy.o mac/wired-phy.o mac/wireless-phy.o \ mac/mac-timers.o trace/cmu-trace.o mac/varp.o \+ umts/phy-timers.o umts/phy-umts.o umts/phy-umts-nodeb.o \+ umts/mac-umts.o umts/mac-umts-nodeb.o \+ umts/rlc-umts-nodeb.o umts/rlc-umts.o \+ umts/wired-flows.o umts/ll-flows.o \+ umts/ll-ue.o umts/ll-nodeb.o \+ umts/fc-queue.o umts/bsfc-queue.o noah/noah.o \+ umts/linked-list.o umts/tree.o \+ classifier/classifier-umts.o \ dsdv/dsdv.o dsdv/rtable.o queue/rtqueue.o \ routing/rttable.o \ imep/imep.o imep/dest_queue.o imep/imep_api.o \@@ -361,6 +370,8 @@ tcl/lib/ns-lib.tcl \ tcl/lib/ns-link.tcl \ tcl/lib/ns-mobilenode.tcl \+ tcl/lib/ns-uenode.tcl \+ tcl/lib/ns-nodeb.tcl \ tcl/lib/ns-sat.tcl \ tcl/lib/ns-cmutrace.tcl \ tcl/lib/ns-node.tcl \@@ -398,9 +409,10 @@ tcl/mcast/mftp_rcv_stat.tcl \ tcl/mobility/dsdv.tcl \ tcl/mobility/dsr.tcl \- tcl/ctr-mcast/CtrMcast.tcl \- tcl/ctr-mcast/CtrMcastComp.tcl \- tcl/ctr-mcast/CtrRPComp.tcl \+ tcl/mobility/noah.tcl \+ tcl/ctr-mcast/CtrMcast.tcl \+ tcl/ctr-mcast/CtrMcastComp.tcl \+ tcl/ctr-mcast/CtrRPComp.tcl \ tcl/rlm/rlm.tcl \ tcl/rlm/rlm-ns.tcl \ tcl/session/session.tcl \@@ -470,12 +482,12 @@ tags: force ctags -wtd *.cc *.h webcache/*.cc webcache/*.h dsdv/*.cc dsdv/*.h \- dsr/*.cc dsr/*.h webcache/*.cc webcache/*.h lib/*.cc lib/*.h \- ../Tcl/*.cc ../Tcl/*.h + dsr/*.cc dsr/*.h noah/*.cc noah/*.h webcache/*.cc webcache/*.h lib/*.cc lib/*.h \+ ../Tcl/*.cc ../Tcl/*.h TAGS: force etags *.cc *.h webcache/*.cc webcache/*.h dsdv/*.cc dsdv/*.h \- dsr/*.cc dsr/*.h webcache/*.cc webcache/*.h lib/*.cc lib/*.h \+ dsr/*.cc dsr/*.h noah/*.cc noah/*.h webcache/*.cc webcache/*.h lib/*.cc lib/*.h \ ../Tcl/*.cc ../Tcl/*.h tcl/lib/TAGS: forcediff -ur mobile/tworayground.cc ns-umts-extensions/code/tworayground.cc--- mobile/tworayground.cc 2000-10-02 20:23:16.000000000 +0000+++ ns-umts-extensions/code/tworayground.cc 2003-06-01 20:10:45.000000000 +0000@@ -99,25 +99,27 @@ tX += t->getAntenna()->getX(); tY += t->getAntenna()->getY(); - d = sqrt((rX - tX) * (rX - tX) - + (rY - tY) * (rY - tY) + d = sqrt((rX - tX) * (rX - tX)+ + (rY - tY) * (rY - tY) + (rZ - tZ) * (rZ - tZ));- ++ /* We're going to assume the ground is essentially flat.- This empirical two ground ray reflection model doesn't make + This empirical two ground ray reflection model doesn't make any sense if the ground is not a plane. */ - if (rZ != tZ) {- printf("%s: TwoRayGround propagation model assume flat ground\n",- __FILE__);- }+ // P.M. & P.B. modifications, ???????????????????????????????+// if (rZ != tZ) {+// printf("%s: TwoRayGround propagation model assume flat ground\n",+// __FILE__);+// } hr = rZ + r->getAntenna()->getZ(); ht = tZ + t->getAntenna()->getZ(); if (hr != last_hr || ht != last_ht) { // recalc the cross-over distance- /* + /* 4 * PI * hr * ht d = ---------------------------- lambda@@ -139,14 +141,14 @@ * ground reflection model. */ - double Gt = t->getAntenna()->getTxGain(rX - tX, rY - tY, rZ - tZ, + double Gt = t->getAntenna()->getTxGain(rX - tX, rY - tY, rZ - tZ, t->getLambda()); double Gr = r->getAntenna()->getRxGain(tX - rX, tY - rY, tZ - rZ, r->getLambda()); #if DEBUG > 3 printf("TRG %.9f %d(%d,%d)@%d(%d,%d) d=%f xo=%f :",- Scheduler::instance().clock(), + Scheduler::instance().clock(), t->getNode()->index(), (int)tX, (int)tY, r->getNode()->index(), (int)rX, (int)rY, d, crossover_dist);@@ -165,7 +167,7 @@ Pr = TwoRay(t->getTxPr(), Gt, Gr, ht, hr, L, d); #if DEBUG > 3 printf("TwoRay %e\n",Pr);-#endif +#endif return Pr; } }diff -ur queue/queue.h ns-umts-extensions/code/queue.h--- queue/queue.h 2002-05-07 18:28:28.000000000 +0000+++ ns-umts-extensions/code/queue.h 2003-06-01 20:10:45.000000000 +0000@@ -1,8 +1,39 @@ /* -*- Mode:C++; c-basic-offset:8; tab-width:8; indent-tabs-mode:t -*- */++/* Modified and extended by Pablo Martin and Paula Ballester,+ * Strathclyde University, Glasgow.+ * June, 2003.+*/++/* Copyright (c) 2003 Strathclyde University of Glasgow, Scotland.+ * All rights reserved.+ *+ * Redistribution and use in source and binary forms, with or without+ * modification, are permitted provided that the following conditions+ * are met:+ *+ * 1. Redistributions of source code and binary code must contain+ * the above copyright notice, this list of conditions and the following+ * disclaimer.+ *+ * 2. All advertising materials mentioning features or use of this software+ * must display the following acknowledgement:+ * This product includes software developed at Strathclyde University of+ * Glasgow, Scotland.+ *+ * 3. The name of the University may not be used to endorse or promote+ * products derived from this software without specific prior written+ * permission.+ * STRATHCLYDE UNIVERSITY OF GLASGOW, MAKES NO REPRESENTATIONS+ * CONCERNING EITHER THE MERCHANTABILITY OF THIS SOFTWARE OR THE+ * SUITABILITY OF THIS SOFTWARE FOR ANY PARTICULAR PURPOSE. The software+ * is provided "as is" without express or implied warranty of any kind.+*/+ /* * Copyright (c) 1996-1997 The Regents of the University of California. * All rights reserved.- * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met:@@ -18,7 +49,7 @@ * 4. Neither the name of the University nor of the Laboratory may be used * to endorse or promote products derived from this software without * specific prior written permission.- * + * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE@@ -46,7 +77,7 @@ public: PacketQueue() : head_(0), tail_(0), len_(0), bytes_(0) {} virtual int length() const { return (len_); }- virtual int byteLength() const { return (bytes_); }+ virtual double byteLength() const { return (bytes_); } // P.M. & P.B. modifications virtual Packet* enque(Packet* p) { // Returns previous tail Packet* pt = tail_; if (!tail_) head_= tail_= p;@@ -90,18 +121,19 @@ bytes_ += hdr_cmn::access(p)->size(); } void resetIterator() {iter = head_;}- Packet* getNext() { + Packet* getNext() { if (!iter) return 0; Packet *tmp = iter; iter = iter->next_; return tmp; } + protected: Packet* head_; Packet* tail_; int len_; // packet count- int bytes_; // queue size in bytes-+ double bytes_; // queue size in bytes+ // P.M. & P.B. modifications // MONARCH EXTNS private:@@ -125,16 +157,18 @@ virtual void enque(Packet*) = 0; virtual Packet* deque() = 0; virtual void recv(Packet*, Handler*);- virtual void updateStats(int queuesize); + virtual void updateStats(int queuesize); void resume(); int blocked() const { return (blocked_ == 1); } void unblock() { blocked_ = 0; } void block() { blocked_ = 1; } int limit() { return qlim_; }- int length() { return pq_->length(); } /* number of pkts currently in+ double length() { return pq_->length(); } /* number of pkts currently in * underlying packet queue */- int byteLength() { return pq_->byteLength(); } /* number of bytes *+ // P.M. & P.B. modifications+ double byteLength() { return pq_->byteLength(); } /* number of bytes * * currently in packet queue */+ // P.M. & P.B. modifications protected: Queue(); void reset();@@ -142,11 +176,12 @@ int blocked_; /* blocked now? */ int unblock_on_resume_; /* unblock q on idle? */ QueueHandler qh_;- PacketQueue *pq_; /* pointer to actual packet queue + PacketQueue *pq_; /* pointer to actual packet queue * (maintained by the individual disciplines * like DropTail and RED). */ double true_ave_; /* true long-term average queue size */ double total_time_; /* total time average queue size compute for */+ }; #endifdiff -ur routing/rtmodule.cc ns-umts-extensions/code/rtmodule.cc--- routing/rtmodule.cc 2002-09-18 05:41:52.000000000 +0000+++ ns-umts-extensions/code/rtmodule.cc 2003-06-01 20:10:45.000000000 +0000@@ -1,5 +1,36 @@-/* -*- Mode:C++; c-basic-offset:8; tab-width:8; indent-tabs-mode:t -*- +/* -*- Mode:C++; c-basic-offset:8; tab-width:8; indent-tabs-mode:t -*-*/++/* Modified and extended by Pablo Martin and Paula Ballester,+ * Strathclyde University, Glasgow.+ * June, 2003.+*/++/* Copyright (c) 2003 Strathclyde University of Glasgow, Scotland.+ * All rights reserved.+ *+ * Redistribution and use in source and binary forms, with or without+ * modification, are permitted provided that the following conditions+ * are met: *+ * 1. Redistributions of source code and binary code must contain+ * the above copyright notice, this list of conditions and the following+ * disclaimer.+ *+ * 2. All advertising materials mentioning features or use of this software
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -