• 沒有找到結果。

在VANET 中,節點具有高移動性,也因此網路拓樸的變化極為頻繁,使得 節點之間的連線不穩定,傳統網路使用Source Routing 的方式,在來源端決定封 包的傳送路徑,但是在動態網物拓樸中,在封包傳輸過程中路徑斷裂造成封包遺 失的問題, VDTN 的路由利用 store-carry-forward 的技術,使用 Contact Routing 的方式,克服傳輸路徑斷裂的問題。

本論文提出HPVR 解決下列幾點問題:

(1) 為了解決在 IVC 環境下無法使用 RSU 得知節點的地理位置,因此我們 使用History table 記錄所有遇過節點的地理資訊,History table 只有在節點連線 時才能更新History table 的內容,借此方式可以不用透過 RSU 也能得知目的端 的地理資訊。

(2) 使用 History table 會有地理資訊不一致的問題,使用錯誤的地理資訊可 能會使封包轉送的過程中遠離目的端,所以我們使用象限篩選機制減少此問題發 生。當來源端產生封包時,HPVR 從 History table 取出目的端的歷史位置資訊,

我們提出的預測目的端位置公式,使用記錄在History table 的目的端移動向量和 時間,計算目前目的端的位置(PD)。我們觀察來源端的移動方向與 PD 的之間的

With Vector 和 Without Vector 兩種類型,HPVR、SD_MPAR、HVR 為 With Vector,

Epidemic、VR 為 Without Vector,由實驗可觀察出在不同節點數量的情況下,

With Vector 路由在 Delivery ratio 比 Without Vector 路由高,Overhead 與 Latency 也比Without Vector 低,由此可知考量目的端移動方向是可靠的。

HPVR 與 Epidemic 的 Delivery ratio 比較可以看出我們能夠解決封包封包氾 濫的問題,與相同使用History table 的 HVR 的 Latency 比較,我們解決了 History table 地理資訊不一致的問題,確保封包轉送方向是往目的端方向靠近,我們與 相同考量節點移動方向的SD_MPAR 比較,因為 SD_MPAR 使用 RSU 可以隨時 更新目的端的地理資訊,封包可以往目的端位置的方向轉送,所以封包可以在較 少的Latency 內到達目的端,然而 HPVR 的 Latency 比 SD_MPAR 高,因為我們 使用象限篩選機制確保往目的端靠近的中繼節點,確保封包的轉送路徑的方向。

以實驗結果證實使用象限篩選和預測目的端位置是可靠的。

目前 HPVR 主要提升到達率和減少傳輸開銷,若在節點數量高的環境下,

Latency 可能表現不理想,這是因為我們提出的象限篩選機制篩選的條件比較嚴 謹,造成排除可能增加封包複製數量但能夠快速到達目的端的候選點,HPVR 雖 然能夠減少 Overhead 與提高 Delivery ratio, Latency 可能會輸給使用 RSU 的 SD_MPAR,未來可能朝向動態調整篩選條件的方向研究。

參考文獻

[1] K. Fall, “A Delay-Tolerant Network Architecture for Challenged Internets,” in

Proc. ACM SIGCOMM, pp. 27-34, Aug. 2003.

[2] B. Petit, M. Ammar, R. Fujimoto, “Protocols for roadside-to-roadside data relaying over vehicular networks,” in Proc. IEEE Wireless Communications and

Networking Conference, pp. 294-299, April 2006.

[3] L. Christian, M. Martin, Füßler. Holger, H. Hannes, “Geographic Routing in City Scenarios,” in Proc. ACM SIGMOBILE Mobile Computing and Communications

Review, vol. 9, Issue 1, pp. 69-72, January 2005.

[4] P. Yanlin, A. Zakhia, J. Chang. Morris; “Roadside-Aided Routing (RAR) in Vehicular Networks,” in Proc. IEEE International Conference on

Communications, vol. 8, pp. 3602-3607, June 2006.

[5] H. Hartenstein and K. P. Laberteaux, “A tutorial survey on vehicular ad hoc networks,” IEEE Communications Magazine, vol. 46, no. 6, pp. 164-171, Jun.

2008.

[6] Y. Wang and F. Li, “Vehicular Ad Hoc Networks, in Guide to Wireless Ad Hoc Networks,” Computer Communications and Networks, pp. 503-525, 2009.

[7] S. Yousefi, M. S. Mousavi, M. Fathy, “Vehicular Ad Hoc Networks (VANETs):

Challenges and Perspectives,” in Proc. the 6th

international conference on ITS Telecommunications (ITST2006), pp. 761-766, China, June 2006.

[8] S. Jain, K. fall, R. Patra, “Routing in a delay tolerant network,” in Proc. ACM

SIGCOMM, pp.145-158, Aug. 2004.

[9] A. Vahdat, D. Becker, “Epidemic Routing for Partially-Connected Ad Hoc Networks,” Technical Report CS-2000-06, Duke University, July 2000 [10] A. Lindgren, A. Doria, O. Schelen, “Probabilistic Routing in Intermittently

Connected Networks,” ACM SIGMOBILE Mobile Computing and

Communications Review, 2003.

[11] T. Spyropoulos, K. Psounis, C. Raghavendra, “Spray and Wait: An Efficient Routing Scheme for Intermittently Connected Mobile Networks,” in Proc. ACM

SIGCOMM workshop on Delay-tolerant networking, 2005.

[12] R. Sulma, A. Qaisar, M. Soperi Mohd Zahid, A. A.Hanan, “E-DROP: An Effective Drop Buffer Management Policy for DTN Routing Protocols,”

International Journal of Computer Applications, January 2011.

[13] H. Kang, D. Kim, “HVR: History-based Vector Routing for Delay Tolerant Networks,” IEEE Computer Communications and Networks, pp.1-6, 2009.

[14] T. Spyropoulos, K. Psounis, C. Raghavendra, “Spray and Focus: Efficient

Mobility-Assisted Routing for Heterogeneous and Correlated Mobility,” in Proc.

IEEE Pervasive Computing and Communications Workshops, March 2007.

[15] H. Kang, D. Kim, “Vector Routing for Delay Tolerant Networks,” IEEE VTC, pp.

1-5, 2008

[16] H. Hong-Yu, L. Pei-En, L. Minglu, L. Da, L. Xu, S. Wei, W. Min-You,

“Performance Evaluation of SUVnet With Real-Time Traffic Data,” IEEE

Transactions on Vehicular Technology, vol.56, no.6, NOV. 2007.

[17] Y. Lei, C. Yuan-Da, H. Wei, “Similarity Degree-Based Mobility Pattern Aware Routing in DTNs,” International Symposium on Intelligent Ubiquitous

Computing and Education, pp.345-348, 2009.

[18] The Opportunistic Network Environment simularot, http://www.netlab.tkk.fi/tutkimus/dtn/theone/

[19] OpenStreetMap, http://www.openstreetmap.org [20] osm2wkt, http://www.tm.kit.edu/~mayer/osm2wkt/

[21] OpenJUMP, http://www.openjump.org

附錄

1. package routing;

2.

3. import java.util.ArrayList;

4. import java.util.Collections;

5. import java.util.Comparator;

6. import java.util.HashMap;

7. import java.util.List;

8. import java.util.Map;

9.

10. import core.Connection;

11. import core.DTNHost;

12. import core.Message;

13. import core.Settings;

14. import core.SimClock;

15. import core.Tuple;

16.

17. public class HPVR extends ActiveRouter{

18. private Map<DTNHost, List> ConnectTable;

19. private Map<Connection, Integer> DistanceQueue;

20. private Map<Message, Map> TempMap;

21. List<Map.Entry<Connection, Integer>> tempList;

22.

36. String MSG_COUNT_PROPERTY = "property";

42. // TODO Auto-generated constructor stub 43. }

51. this.ConnectTable = new HashMap<DTNHost, List>();

52. } 53.

54. public void changedConnection(Connection con) { 55. if(con.isUp()){

56. DTNHost ContactNode = con.getOtherNode(getHost());

57. othertowardAngle = this.getAngle(ContactNode);

58. othertowardQuadrant = this.countQuadrant(ContactNode);

59. List<Double> CoordList = new ArrayList<Double>();

60. CoordList.add(ContactNode.getLocation().getX());//0 61. CoordList.add(ContactNode.getLocation().getY());//1 62. CoordList.add(SimClock.getTime());//2

63. CoordList.add(othertowardAngle);//3 64. CoordList.add(othertowardQuadrant);//4

65. CoordList.add(this.getnodeSpeed(ContactNode));//getSpeed 5 66. ConnectTable.put(ContactNode, CoordList);

67. checkTable(ContactNode, this.getHost());

68. }

69. }

70. private Tuple<Message, Connection> tryOtherMessages() {

71. List<Tuple<Message, Connection>> messages = new ArrayList<Tuple<Message, Connection>>();

72. DistanceQueue = new HashMap<Connection, Integer>();

73. TempMap = new HashMap<Message, Map>();

74. for(Connection con : this.getConnections())

75. {

76. DTNHost ContactNode = con.getOtherNode(getHost());

77. towardAngle = this.getAngle(this.getHost());

78. towardQuadrant = this.countQuadrant(this.getHost());

79. othertowardAngle = this.getAngle(ContactNode);

80. othertowardQuadrant = this.countQuadrant(ContactNode);

81. for(Message m : getMessageCollection())

82. {

83. if(this.ConnectTable.containsKey(m.getTo())){

84. boolean Q =

this.compareQuadrant(this.ConnectTable.get(m.getTo()), this.getHost(), ContactNode, m.getTo());

85. int CopyNumber =

getCopyNumber(this.ConnectTable.get(m.getTo())); int propertyValue = (Integer) m.getProperty(MSG_COUNT_PROPERTY) ;

86. if(propertyValue == -1){

87. m.updateProperty(MSG_COUNT_PROPERTY, CopyNumber);

88. }

89.

90. if(Q){

91. int distance =

(int)getDistance(con.getOtherNode(getHost()), ConnectTable.get(m.getTo()));

92. int ArrvialTime = this.getArrivalTime(distance,

getHost());

93. DistanceQueue.put(con, ArrvialTime);

94. TempMap.put(m, DistanceQueue);

95. }

96. }

97. }

98. }

99.

100. if(!TempMap.isEmpty()){

101. for(Object key:TempMap.keySet()){

102. tempList = new ArrayList<Map.Entry<Connection,

103. Collections.sort(tempList, new Comparator<Map.Entry<Connection, Integer>>(){

104. public int compare(Map.Entry<Connection, Integer> entry1, Map.Entry<Connection, Integer> entry2){

105. return (entry1.getValue() - entry2.getValue());

106. }

107. });

108. boolean State = true;

109. for(Object

conkey:tempList.get(0).getKey().getOtherNode(getHost()).getMessageCollection()){

110. if(key.toString().equals(conkey.toString())){

111. State = false;

112. }

113. }

114. if(State == true){

115. messages.add(new Tuple<Message, Connection>((Message)key, tempList.get(0).getKey()));

123. return tryMessagesForConnected(messages);

124. } 125.

126. @Override

127. protected int checkReceiving(Message m) { 128. int recvCheck = super.checkReceiving(m);

129. if (recvCheck == RCV_OK) {

130. /* don't accept a message that has already traversed this node */

131. if (m.getHops().contains(getHost())) {

132. recvCheck = DENIED_OLD;

133. }

134. }

135.

136. if (isTransferring()) {

137. return TRY_LATER_BUSY; // only one connection at a time

138. }

145. if ( hasMessage(m.getId()) || isDeliveredMessage(m) ){

146. return DENIED_OLD; // already seen this message -> reject it

147. }

157. if (isTransferring() || !canStartTransfer()) {

158. return;

159. }

160.

161. if (exchangeDeliverableMessages() != null) {

162. return;

163. }

164. tryOtherMessages();

165. } 166.

167. @Override

168. public HPVR replicate() {

169. // TODO Auto-generated method stub 170. return new HPVR(this);

171. }

174. public boolean createNewMessage(Message msg) { 175. makeRoomForNewMessage(msg.getSize());

176. msg.addProperty(MSG_COUNT_PROPERTY, -1);

177. msg.addProperty(MSG_CREATTIME, SimClock.getTime());

178. addToMessages(msg, true);

179. return true;

180. } 181.

182. @Override

183. protected void transferDone(Connection con) { 184. Integer nrofCopies;

185. String msgId = con.getMessage().getId();

186. //get this router's copy of the message 187. Message msg = getMessage(msgId);

188.

189. if (msg == null) { // message has been dropped from the buffer after..

190. return; // ..start of transfer -> no need to reduce amount of copies

191. }

192.

193. // reduce the amount of copies left

194. nrofCopies = (Integer)msg.getProperty(MSG_COUNT_PROPERTY);

195. if(nrofCopies == 0){

196. this.deleteMessage(con.getMessage().getId(), false);

197. }

198. else

199. nrofCopies--;

200. msg.updateProperty(MSG_COUNT_PROPERTY, nrofCopies);

201. } 202.

203. private int getArrivalTime(double dis, DTNHost host){

204. int arrivaltime = 0;

205. double AnlgeCos = this.getnodeSpeed(host) * Math.cos(this.getAngle(host));

206. arrivaltime = (int)(dis/AnlgeCos);

207. return arrivaltime;

208. } 209.

210. //check and update ConnectTable

211. private void checkTable(DTNHost otherhost, DTNHost host){

212. HPVR otherNode = (HPVR)otherhost.getRouter();

213. Map<DTNHost, List> otherTable = otherNode.ConnectTable;

214. HPVR hostNode = (HPVR)host.getRouter();

215. Map<DTNHost, List> thisTable = hostNode.ConnectTable;

216.

217. for(Map.Entry<DTNHost, List> i : otherTable.entrySet()){

218. if(!thisTable.containsKey(i.getKey())){

219. thisTable.put(i.getKey(), i.getValue());

220. }

221. }

222. for(Map.Entry<DTNHost, List> j : thisTable.entrySet()){

223. if(!otherTable.containsKey(j.getKey())){

224. otherTable.put(j.getKey(), j.getValue());

225. }

226. }

227.

228. //contain with thisTable from otherTable

229. for(Map.Entry<DTNHost, List> i : otherTable.entrySet()){//other i

230. for(Map.Entry<DTNHost, List> j : thisTable.entrySet()){ //this j

231. if(i.getKey() == j.getKey()){

232. double otherTime = (double)i.getValue().get(2);//get time 233. double hostTime = (double)j.getValue().get(2);

234.

235. if(hostTime < otherTime){

236. j = i;//update the new value

237. thisTable.put(i.getKey(), i.getValue());

238. }

239. else if(otherTime < hostTime){

240. i = j;

241. otherTable.put(j.getKey(), j.getValue());

242. }

243. }

244. }

245. }

248.

249. public double getnodeSpeed(DTNHost host){

250. double speed = 0;

251. if(host.getPath() != null && host.getPath().hasNext()){

252. speed = host.getPath().getSpeed();

253. }

254. return speed;

255. } 256.

257. public double getDistance(DTNHost host, List ConnectList){

258. double x = (double)ConnectList.get(0) - host.getLocation().getX();

259. double y = (double)ConnectList.get(1) - host.getLocation().getY();

260. double dis = Math.sqrt(x*x + y*y);

261. return dis;

262. } 263.

264.

265. public double getAngle(DTNHost host){

266. double Angle = 0;

267. if(host.getPath() != null && host.getPath().hasNext()){

268. double nextX = host.getPath().getNextWaypoint().getX();

269. host.getPath().BeforenextWpIndex();

270. double nextY = host.getPath().getNextWaypoint().getY();

271. host.getPath().BeforenextWpIndex();

272. double X = host.getLocation().getX();

273. double Y = host.getLocation().getY();

274. Angle = Math.atan2(nextY - Y, nextX - X);

281. public double countQuadrant(DTNHost host){

282. double Q = 0;

283. if(host.getPath() != null && host.getPath().hasNext()){

284. double nextX = host.getPath().getNextWaypoint().getX();

285. host.getPath().BeforenextWpIndex();

286. double nextY = host.getPath().getNextWaypoint().getY();

287. host.getPath().BeforenextWpIndex();

288. Q = Quadrant(nextX - host.getLocation().getX(), nextY - host.getLocation().getY());

289. }

290. return Q;

291. } 292.

293. //host and other Quadrant

294. public double relativeLocation(DTNHost host, DTNHost otherhost){

295. double relativeX = otherhost.getLocation().getX() - host.getLocation().getX();

296. double relativeY = otherhost.getLocation().getY() - host.getLocation().getY();

297. //judgment Quadrant

298. return (Quadrant(relativeX,relativeY));

299. } 300.

301.

302. //Destination and Connect Angle

303. public double ConnectToDesvector(DTNHost host, List des){

304. double Angle = 0;

305. //double CNnew = 0;

306. double otherX = host.getLocation().getX();

307. double otherY = host.getLocation().getY();

308. //vector of host

309. double vectorX = (double)des.get(0) - otherX;

310. double vectorY = (double)des.get(1) - otherY;

311. Angle = Math.atan2(vectorY, vectorX);

317. private double ConnectToPreDesvector(DTNHost host,double x, double y){

318. double Angle = 0;

321. double vectorX = x - hostX;

322. double vectorY = y - hostY;

323. Angle = Math.atan2(vectorY, vectorX);

324. Angle = Angle*180/Math.PI;

325. return Angle;

326. } 327.

328. //Quadrant

329. public static double Quadrant(double X,double Y){

330. double Q = 0;

357. //System.out.println("X = "+X+"; Y = "+Y+"---->"+Q+" Quadrant");

358. return Q;

359. } 360.

361. public boolean compareQuadrant(List desInfo, DTNHost host, DTNHost ContactNode, DTNHost des){

362.

363.

364. DesTowardQuadrant = (double)desInfo.get(4);//Destination toward Quadrant 365. DesTime = SimClock.getTime() - (double)desInfo.get(2);//the time

Destination has traveled

366. DesSpeed = (double)desInfo.get(5);

367. DesTowardAngle = (double)desInfo.get(3);

368. DesX = (double)desInfo.get(0);

369. DesY = (double)desInfo.get(1);

370.

377. if(towardAngle != 0 && othertowardAngle != 0){

378. PreDesX = DesSpeed * DesTime * Math.cos(DesTowardAngle) + DesX;

379. PreDesY = DesSpeed * DesTime * Math.sin(DesTowardAngle) + DesY;

380. PreDesQuadrant = Quadrant(PreDesX - host.getLocation().getX(), PreDesY - host.getLocation().getY());//Predict Destination

381. ConToDesAngle = ConnectToPreDesvector(ContactNode, PreDesX, PreDesY);

382.

383. Angle = Math.abs(othertowardAngle - ConToDesAngle);

384. if(Angle > 180){

385. Angle = 360 - Angle;

386. }

387.

388. if(Angle < 50){

389. double HostToConQuadrant = relativeLocation(host,ContactNode);

390. double Q3 = Math.abs(PreDesQuadrant - towardQuadrant);//Host and

391. double Q4 = Math.abs(PreDesQuadrant - HostToConQuadrant);//Host and Predict Destination

392. if(Q3 == 0){//Host and Predict Destination same Quadrant 393. if(Q4 == 0){//Connect and Predict Destination same Quadrant

394. //MesCopy = 20; 402. if(Q4 == 0){//Connect and Predict Destination same Quadrant

403. return true;

404. }

405. else if(HostToConQuadrant == towardQuadrant){//Connect and HostToward same Quadrant

406. return true;

412. else if(Q3 == 2){//Host and Destination relative Quadrant 413. if(towardQuadrant == HostToConQuadrant){//Connect and

HostToward same Quadrant

414. return false;

426. return true;

427. else

428. return false;

429. }

430. public int getCopyNumber(List desInfo){

431. int copy = 0;

432. DesTowardQuadrant = (double)desInfo.get(4);//Destination toward Quadrant 433. double DesSpeed = (double)desInfo.get(5);

434. double DesTowardAngle = (double)desInfo.get(3);

435. double DesX = (double)desInfo.get(0);

436. double DesY = (double)desInfo.get(1);

437. double PreDesX = DesSpeed * DesTime * Math.cos(DesTowardAngle) + DesX;

438. double PreDesY = DesSpeed * DesTime * Math.sin(DesTowardAngle) + DesY;

439. double PreDesQuadrant = Quadrant(PreDesX - this.getHost().getLocation().getX(),

440. PreDesY -

this.getHost().getLocation().getY());

441.

442. double Q = Math.abs(PreDesQuadrant - towardQuadrant);

443. if(Q == 0){

相關文件