the One Simulator+MargalhoTutorial

本文是藉助MargalhoTutorial的參數配置在the One Simulator基礎上的嘗試,MargalhoTutorial使用的參數配置在網站下有詳細給出。

  • the One Simulator:http://www.netlab.tkk.fi/tutkimus/dtn/theone/
  • MargalhoTutorial:http://www.margalho.pro.br/subsites/theone.html
🍎default_settings.txt文件主要部分

#
# Default settings for the simulation
#

## Scenario settings
Scenario.name = MargalhoTutorial
Scenario.simulateConnections = true
Scenario.updateInterval = 0.1
# 43200s == 12h
Scenario.endTime = 20000


## Interface-specific settings:
# type : which interface class the interface belongs to
# For different types, the sub-parameters are interface-specific
# For SimpleBroadcastInterface, the parameters are:
# transmitSpeed : transmit speed of the interface (bytes per second) 
# transmitRange : range of the interface (meters)

# "WiFi80211" interface for all nodes
WiFi80211.type = SimpleBroadcastInterface
# Transmit speed of 2 Mbps = 250kBps
WiFi80211.transmitSpeed = 1375k
WiFi80211.transmitRange = 100

# Define 1 different node groups
## 原MargalhoTutorial有4組節點類型,這裏只留下了一種
Scenario.nrofHostGroups = 1

## Group-specific settings:
# groupID : Group's identifier. Used as the prefix of host names
# nrofHosts: number of hosts in the group
# movementModel: movement model of the hosts (valid class name from movement package)
# waitTime: minimum and maximum wait times (seconds) after reaching destination
# speed: minimum and maximum speeds (m/s) when moving on a path
# bufferSize: size of the message buffer (bytes)
# router: router used to route messages (valid class name from routing package)
# activeTimes: Time intervals when the nodes in the group are active (start1, end1, start2, end2, ...)
# msgTtl : TTL (minutes) of the messages created by this host group, default=infinite

## Group and movement model specific settings
# pois: Points Of Interest indexes and probabilities (poiIndex1, poiProb1, poiIndex2, poiProb2, ... )
#       for ShortestPathMapBasedMovement
# okMaps : which map nodes are OK for the group (map file indexes), default=all 
#          for all MapBasedMovent models
# routeFile: route's file path - for MapRouteMovement
# routeType: route's type - for MapRouteMovement


# Common settings for all groups
# Group.movementModel = ShortestPathMapBasedMovement
Group.routeType = 1
Group.router = EpidemicRouter
Group.bufferSize = 50M
Group.waitTime = 0, 0
# All nodes have the WiFi80211 interface
Group.nrofInterfaces = 1
Group.interface1 = WiFi80211
# Walking speeds
# Group.speed = 2, 4
Group.speed = 1, 3
# Message TTL of 300 minutes (5 hours)
# Group.msgTtl = 300

# Group.nrofHosts = 40

# group1 (pedestrians) specific settings
# Group1.groupID = Src_
# Group1.nrofHosts = 1
# Group1.movementModel = StationaryMovement
# Group1.nodeLocation = 2000, 1000

# group2 specific settings
Group1.groupID = River_
Group1.nrofHosts = 2
Group1.movementModel = ShortestPathMapBasedMovement
# cars can drive only on roads
Group1.okMaps = 1
# 10-50 km/h
# Group2.speed = 2.7, 13.9


# The Tram groups
# Group3.groupID = Dst_
# Group3.nrofHosts = 1
# Group3.movementModel = StationaryMovement
# Group3.nodeLocation = 3300, 3000


## Message creation parameters 
# How many event generators
Events.nrof = 1
# Class of the first event generator
Events1.class = MessageEventGenerator
# (following settings are specific for the MessageEventGenerator class)
# Creation interval in seconds (one new message every 25 to 35 seconds)
Events1.interval = 1, 5
# Message sizes (500kB - 1MB)
Events1.size = 75k, 75k
# range of message source/destination addresses
Events1.hosts = 0, 2
# Message ID prefix
Events1.prefix = A


## Movement model settings
# seed for movement models' pseudo random number generator (default = 0)
MovementModel.rngSeed = 1
# World's size for Movement Models without implicit size (width, height; meters)
MovementModel.worldSize = 4500, 3400

# How long time to move hosts in the world before real simulation
MovementModel.warmup = 10

## Map based movement -movement model specific settings
MapBasedMovement.nrofMapFiles = 2

# MargalhoTutorial官網上給出的river.wkt沒有找到:(,這裏用到的是the One Simulator下data裏的roads.txt
MapBasedMovement.mapFile1 = data/roads.wkt
MapBasedMovement.mapFile2 = data/main_roads.wkt

## Reports - all report names have to be valid report classes

# how many reports to load
Report.nrofReports = 1
# length of the warm up period (simulated seconds)
Report.warmup = 0
Report.granularity = 1
# default directory of reports (can be overridden per Report with output setting)
Report.reportDir = reports/
# Report classes to load
# Report.report1 = MessageStatsReport
Report.report1 = MovementNs2Report

## Default settings for some routers settings
# ProphetRouter.secondsInTimeUnit = 30
# SprayAndWaitRouter.nrofCopies = 6
# SprayAndWaitRouter.binaryMode = true

## Optimization settings -- these affect the speed of the simulation
## see World class for details.
Optimization.cellSizeMult = 5
Optimization.randomizeUpdateOrder = true


## GUI settings

# GUI underlay image settings
GUI.UnderlayImage.fileName = data/helsinki_underlay.png
# Image offset in pixels (x, y)
GUI.UnderlayImage.offset = 64, 20
# Scaling factor for the image
GUI.UnderlayImage.scale = 4.75
# Image rotation (radians)
GUI.UnderlayImage.rotate = -0.015

# how many events to show in the log panel (default = 30)
GUI.EventLogPanel.nrofEvents = 100
# Regular Expression log filter (see Pattern-class from the Java API for RE-matching details)
# GUI.EventLogPanel.REfilter = .*p[1-9]<->p[1-9]$

🍎MapBasedMovement.java文檔主要部分

/**
	 * Checks that all coordinates of map nodes are within the min&max limits
	 * of the movement model
	 * @param nodes The list of nodes to check
	 * @throws SettingsError if some map node is out of bounds
	 */
	private void checkCoordValidity(List<MapNode> nodes) {
		 // Check that all map nodes are within world limits
		
		List<Integer> list = new ArrayList<Integer>();  
		int countt = 0;
		for (MapNode n : nodes) {
			
			double x = n.getLocation().getX();
			double y = n.getLocation().getY();
			if (x < 0 || x > getMaxX() || y < 0 || y > getMaxY()) {
				throw new SettingsError("Map node " + n.getLocation() + 
						" is out of world  bounds "+
						"(x: 0..." + getMaxX() + " y: 0..." + getMaxY() + ")");
			}
			
			//這裏只保留了在限制座標區域裏的位置節點:x(2000, 4000), y(1000, 3000)
			if (x < 2000 || x > 3300 || y < 1000 || y > 3000) {
				list.add(countt);
			}
			countt += 1;
		}
		
		for(int i=list.size()-1;i>=0;i--){ //倒序
			if(i <= nodes.size()){
				//System.out.println("刪除了第  "+(indexArr[i]+1)+" 個元素");
				int temp = list.get(i);
				nodes.remove(temp);
			}
		}
	}
	
🍎MovementNs2Report.java文檔主要部分

public void newDestination(DTNHost host, Coord dst, double speed) {
		int index = host.getAddress();
		double time = getSimTime();
		
		write(nsCmd + " at " + time + " \"\\" + nodeArray +	"(" + index + ")" + 
				" setdest " + fix(dst.getX()) + " " + fix(dst.getY()) +
				" " + speed + "\"");
				
🍎reports目錄下生成的MargalhoTutorial_MovementNs2Report.txt文檔

$ns_ at 0.0 "\$node_(0) setdest 3054.00362 1947.81383 2.9274095940464155"
$ns_ at 0.0 "\$node_(1) setdest 3178.44788 1908.62483 2.821900961908166"
$ns_ at 2.700000000000001 "\$node_(1) setdest 3161.01661 1892.52113 2.821900961908166"
$ns_ at 11.199999999999976 "\$node_(1) setdest 3128.08446 1849.58128 2.821900961908166"
$ns_ at 13.999999999999966 "\$node_(0) setdest 3071.25340 1884.87938 2.9274095940464155"
$ns_ at 30.30000000000016 "\$node_(1) setdest 3127.75448 1849.44125 2.821900961908166"
$ns_ at 30.500000000000163 "\$node_(1) setdest 3115.84215 1844.34008 2.821900961908166"
$ns_ at 35.10000000000023 "\$node_(1) setdest 3093.24666 1863.23441 2.821900961908166"
$ns_ at 36.300000000000246 "\$node_(0) setdest 3079.56068 1866.67520 2.9274095940464155"
$ns_ at 43.10000000000034 "\$node_(0) setdest 3093.15592 1836.46827 2.9274095940464155"
$ns_ at 45.50000000000038 "\$node_(1) setdest 3079.56068 1866.67520 2.821900961908166"
$ns_ at 50.50000000000045 "\$node_(1) setdest 2970.08933 1906.60437 2.821900961908166"
$ns_ at 54.4000000000005 "\$node_(0) setdest 3097.34668 1802.65051 2.9274095940464155"
$ns_ at 66.10000000000052 "\$node_(0) setdest 3095.65553 1781.53566 2.9274095940464155"
$ns_ at 73.30000000000011 "\$node_(0) setdest 3090.78005 1760.98094 2.9274095940464155"
$ns_ at 80.4999999999997 "\$node_(0) setdest 3076.95383 1736.26527 2.9274095940464155"
$ns_ at 90.19999999999915 "\$node_(0) setdest 2931.62174 1547.11185 2.9274095940464155"
$ns_ at 91.79999999999906 "\$node_(1) setdest 2951.41238 1920.24750 2.821900961908166"
$ns_ at 100.0 "\$node_(1) setdest 2936.22498 1918.76716 2.821900961908166"
$ns_ at 105.39999999999829 "\$node_(1) setdest 2664.32026 2014.79920 2.821900961908166"
$ns_ at 171.69999999999453 "\$node_(0) setdest 2916.97881 1523.96654 2.9274095940464155"
$ns_ at 181.0 "\$node_(0) setdest 2894.49883 1471.99461 2.9274095940464155"
$ns_ at 200.3999999999929 "\$node_(0) setdest 2884.62413 1485.65775 2.9274095940464155"
$ns_ at 206.09999999999258 "\$node_(0) setdest 2889.92033 1560.97504 2.9274095940464155"
$ns_ at 207.5999999999925 "\$node_(1) setdest 2560.98656 2045.01614 2.821900961908166"
$ns_ at 231.8999999999911 "\$node_(0) setdest 2824.34477 1565.34604 2.9274095940464155"
$ns_ at 245.69999999999033 "\$node_(1) setdest 2541.13817 2107.06038 2.821900961908166"
$ns_ at 254.49999999998983 "\$node_(0) setdest 2824.34477 1565.34604 1.5881140640080735"
$ns_ at 254.49999999998983 "\$node_(0) setdest 2814.96504 1431.23526 1.5881140640080735"
$ns_ at 268.7999999999926 "\$node_(1) setdest 2521.67752 2167.90434 2.821900961908166"
$ns_ at 291.4999999999978 "\$node_(1) setdest 2443.76889 2175.84617 2.821900961908166"
$ns_ at 319.3000000000041 "\$node_(1) setdest 2443.76889 2175.84617 2.1667077141968223"
$ns_ at 319.3000000000041 "\$node_(1) setdest 2521.67752 2167.90434 2.1667077141968223"
$ns_ at 339.0000000000086 "\$node_(0) setdest 2883.32071 1427.14432 1.5881140640080735"
$ns_ at 355.4000000000123 "\$node_(1) setdest 2541.13817 2107.06038 2.1667077141968223"
$ns_ at 382.1000000000184 "\$node_(0) setdest 2913.17578 1425.53395 1.5881140640080735"
$ns_ at 384.800000000019 "\$node_(1) setdest 2560.98656 2045.01614 2.1667077141968223"
$ns_ at 401.0000000000227 "\$node_(0) setdest 2921.25207 1456.71110 1.5881140640080735"
......

在這裏插入圖片描述

🍏參考博客
[1]http://www.margalho.pro.br/subsites/theone.html
[2]https://blog.csdn.net/wb7931021/article/details/41077047

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章