You can subscribe to this list here.
| 2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(45) |
Jun
(115) |
Jul
(77) |
Aug
(57) |
Sep
(51) |
Oct
(139) |
Nov
(219) |
Dec
(181) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2008 |
Jan
(407) |
Feb
(91) |
Mar
(26) |
Apr
(26) |
May
(103) |
Jun
(245) |
Jul
(144) |
Aug
(134) |
Sep
(245) |
Oct
(22) |
Nov
(5) |
Dec
(14) |
| 2009 |
Jan
(2) |
Feb
(4) |
Mar
|
Apr
|
May
|
Jun
(25) |
Jul
(20) |
Aug
|
Sep
(3) |
Oct
(5) |
Nov
|
Dec
|
| 2010 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <dir...@us...> - 2010-05-10 09:29:55
|
Revision: 2112
http://shox.svn.sourceforge.net/shox/?rev=2112&view=rev
Author: dirk_held
Date: 2010-05-10 09:29:49 +0000 (Mon, 10 May 2010)
Log Message:
-----------
Add two new default constructors, which add also a supplied link to the packet.
Modified Paths:
--------------
trunk/src/net/sf/shox/simulator/event/LogLinkPacket.java
Modified: trunk/src/net/sf/shox/simulator/event/LogLinkPacket.java
===================================================================
--- trunk/src/net/sf/shox/simulator/event/LogLinkPacket.java 2010-05-10 09:22:05 UTC (rev 2111)
+++ trunk/src/net/sf/shox/simulator/event/LogLinkPacket.java 2010-05-10 09:29:49 UTC (rev 2112)
@@ -52,7 +52,35 @@
}
/**
+ * Overloaded constructor to create non-terminal packets by
+ * specifying a packet to enclose and a link to use.
+ * ReceiverID of the new packet taken from enclosedPacket.
+ *
+ * @param sender Sender address of the packet
+ * @param packet The packet to enclose inside the new packet.
+ * @param link The link, containing also the ReceiverId of the packet.
+ */
+ public LogLinkPacket(Address sender, Packet packet, Link link) {
+ super(sender, packet);
+
+ addLink(link);
+ }
+
+ /**
* Default constructor of class Packet to create a terminal packet
+ * with no enclosed packet, but with a specified link.
+ *
+ * @param sender The sender address of the packet
+ * @param link The link, containing also the ReceiverId of the packet.
+ */
+ public LogLinkPacket(Address sender, Link link) {
+ super(sender, link.getV());
+
+ addLink(link);
+ }
+
+ /**
+ * Default constructor of class Packet to create a terminal packet
* with no enclosed packet.
* @param sender Sender address of the packet
* @param receiver ReceiverId of the packet
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dir...@us...> - 2010-05-10 09:22:11
|
Revision: 2111
http://shox.svn.sourceforge.net/shox/?rev=2111&view=rev
Author: dirk_held
Date: 2010-05-10 09:22:05 +0000 (Mon, 10 May 2010)
Log Message:
-----------
Add addLink (copied and adapted from the LogLinkLayer-class) to this class.
Modified Paths:
--------------
trunk/src/net/sf/shox/simulator/event/LogLinkPacket.java
Modified: trunk/src/net/sf/shox/simulator/event/LogLinkPacket.java
===================================================================
--- trunk/src/net/sf/shox/simulator/event/LogLinkPacket.java 2009-10-23 13:45:53 UTC (rev 2110)
+++ trunk/src/net/sf/shox/simulator/event/LogLinkPacket.java 2010-05-10 09:22:05 UTC (rev 2111)
@@ -20,6 +20,9 @@
import net.sf.shox.simulator.Address;
import net.sf.shox.simulator.NodeId;
+import net.sf.shox.simulator.node.Link;
+import net.sf.shox.simulator.node.metainf.CastType;
+import net.sf.shox.simulator.node.metainf.DownwardsLLCMetaInfo;
/**
* Super-class of all packets generated by the LogLinkLayer. This is to ensure some
@@ -30,6 +33,23 @@
*/
public class LogLinkPacket extends Packet {
+ /**
+ * Method to add a link to the packet.
+ *
+ * @param link The link to add to this packet.
+ */
+ public void addLink(Link link) {
+ CastType castType = CastType.getCastType(getReceiver());
+ DownwardsLLCMetaInfo mi = null;
+
+ if (castType == CastType.BROADCAST) {
+ mi = new DownwardsLLCMetaInfo(link, castType);
+ } else {
+ mi = new DownwardsLLCMetaInfo(link, castType, getReceiver());
+ }
+
+ getMetaInfos().addMetaInfo(mi);
+ }
/**
* Default constructor of class Packet to create a terminal packet
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dir...@us...> - 2009-10-23 13:46:03
|
Revision: 2110
http://shox.svn.sourceforge.net/shox/?rev=2110&view=rev
Author: dirk_held
Date: 2009-10-23 13:45:53 +0000 (Fri, 23 Oct 2009)
Log Message:
-----------
removed a warning.
Modified Paths:
--------------
trunk/src/net/sf/shox/simulator/node/user/MACDebug.java
Modified: trunk/src/net/sf/shox/simulator/node/user/MACDebug.java
===================================================================
--- trunk/src/net/sf/shox/simulator/node/user/MACDebug.java 2009-10-23 13:43:13 UTC (rev 2109)
+++ trunk/src/net/sf/shox/simulator/node/user/MACDebug.java 2009-10-23 13:45:53 UTC (rev 2110)
@@ -154,6 +154,7 @@
* Is invoked because a new packet is to be sent to the physical layer.
* @param wuc The MACAdvanceQueue event that contains the next packet in the MAC queue
*/
+ @Override
public final void processWakeUpCall(WakeUpCall wuc) {
if (wuc instanceof MACAdvanceQueue) {
MACAdvanceQueue maq = (MACAdvanceQueue) wuc;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dir...@us...> - 2009-10-23 13:43:19
|
Revision: 2109
http://shox.svn.sourceforge.net/shox/?rev=2109&view=rev
Author: dirk_held
Date: 2009-10-23 13:43:13 +0000 (Fri, 23 Oct 2009)
Log Message:
-----------
replaced splash picture with a free version (creative commons), as used on the web page.
Modified Paths:
--------------
trunk/conf/splash.jpg
Added Paths:
-----------
trunk/conf/splash blank.jpg
trunk/conf/splash_old.jpg
Added: trunk/conf/splash blank.jpg
===================================================================
(Binary files differ)
Property changes on: trunk/conf/splash blank.jpg
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Modified: trunk/conf/splash.jpg
===================================================================
(Binary files differ)
Copied: trunk/conf/splash_old.jpg (from rev 2102, trunk/conf/splash.jpg)
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dir...@us...> - 2009-10-16 13:58:58
|
Revision: 2108
http://shox.svn.sourceforge.net/shox/?rev=2108&view=rev
Author: dirk_held
Date: 2009-10-16 13:58:49 +0000 (Fri, 16 Oct 2009)
Log Message:
-----------
cleared minor warning.
Modified Paths:
--------------
trunk/src/net/sf/shox/simulator/node/user/MAC_IEEE802_11bg_DCF.java
Modified: trunk/src/net/sf/shox/simulator/node/user/MAC_IEEE802_11bg_DCF.java
===================================================================
--- trunk/src/net/sf/shox/simulator/node/user/MAC_IEEE802_11bg_DCF.java 2009-10-09 16:11:42 UTC (rev 2107)
+++ trunk/src/net/sf/shox/simulator/node/user/MAC_IEEE802_11bg_DCF.java 2009-10-16 13:58:49 UTC (rev 2108)
@@ -300,25 +300,27 @@
} else {
startCarrierSense(difs, backoffTime);
}
+
return true;
- } else {
- if (as != null) {
- Interval lastIncoming = as.getLastIncoming();
+ }
+
+ if (as != null) {
+ Interval lastIncoming = as.getLastIncoming();
+
+ if (lastIncoming != null) {
+ double end = lastIncoming.getEnd();
+ double now = node.getCurrentTime();
- if (lastIncoming != null) {
- double end = lastIncoming.getEnd();
- double now = node.getCurrentTime();
-
- if (end > now) {
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug("initiate a delayed trySend()");
- }
- sendEventSelf(new MACEvent(sender, end - now));
+ if (end > now) {
+ if (LOGGER.isDebugEnabled()) {
+ LOGGER.debug("initiate a delayed trySend()");
}
+ sendEventSelf(new MACEvent(sender, end - now));
}
}
}
}
+
return false;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dir...@us...> - 2009-10-09 16:11:48
|
Revision: 2107
http://shox.svn.sourceforge.net/shox/?rev=2107&view=rev
Author: dirk_held
Date: 2009-10-09 16:11:42 +0000 (Fri, 09 Oct 2009)
Log Message:
-----------
typo.
Modified Paths:
--------------
trunk/src/net/sf/shox/simulator/node/user/OptimalSourceRouting.java
Modified: trunk/src/net/sf/shox/simulator/node/user/OptimalSourceRouting.java
===================================================================
--- trunk/src/net/sf/shox/simulator/node/user/OptimalSourceRouting.java 2009-10-07 11:15:35 UTC (rev 2106)
+++ trunk/src/net/sf/shox/simulator/node/user/OptimalSourceRouting.java 2009-10-09 16:11:42 UTC (rev 2107)
@@ -64,10 +64,6 @@
private static final String clear = new String(Integer.toString(Integer.MAX_VALUE));
- /**
- * method to display the
- * @param other
- */
private void updateLinkInfo(NodeId other, String tag, String msg) {
NodeId a = id,b = other;
@@ -239,7 +235,7 @@
if (wuc instanceof CrossLayerEvent) {
((CrossLayerEvent) wuc).forwardUp(this);
} else {
- throw new LayerException("MacModule of Node " + id + " received wakeup call " + wuc.getClass().getName());
+ throw new LayerException("routing module of Node " + id + " received wakeup call " + wuc.getClass().getName());
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dir...@us...> - 2009-10-07 11:15:49
|
Revision: 2106
http://shox.svn.sourceforge.net/shox/?rev=2106&view=rev
Author: dirk_held
Date: 2009-10-07 11:15:35 +0000 (Wed, 07 Oct 2009)
Log Message:
-----------
removed usage of graph-visualization package, since it is not available.
Modified Paths:
--------------
trunk/src/net/sf/shox/simulator/node/user/network/aodvm/AodvmNetworkLayer.java
trunk/src/net/sf/shox/simulator/node/user/network/aodvm/PathDiscovery.java
trunk/src/net/sf/shox/simulator/node/user/network/aodvm/PathMaintenance.java
Modified: trunk/src/net/sf/shox/simulator/node/user/network/aodvm/AodvmNetworkLayer.java
===================================================================
--- trunk/src/net/sf/shox/simulator/node/user/network/aodvm/AodvmNetworkLayer.java 2009-09-16 11:05:50 UTC (rev 2105)
+++ trunk/src/net/sf/shox/simulator/node/user/network/aodvm/AodvmNetworkLayer.java 2009-10-07 11:15:35 UTC (rev 2106)
@@ -58,10 +58,11 @@
import com.google.common.collect.Multimap;
import com.google.common.collect.Multimaps;
+/* disabled
import de.upb.shox.util.networkGraphs.Graph;
import de.upb.shox.util.networkGraphs.GraphNode;
+*/
-
/**
* Central class of the AODVM routing algorithm.
*
@@ -162,10 +163,10 @@
private double timeOfLastSentPacket;
/** Visualization graph representing the network of nodes. */
- private static Graph vizGraph;
+ /* disabled private static Graph vizGraph;*/
/** Represents the visualization node for this node. */
- private GraphNode vizNode;
+ /* disabled private GraphNode vizNode;*/
/** a unique ID for each multipath constructed by AODVM. */
private static long multipathID = 0;
@@ -174,9 +175,9 @@
* Empty constructor.
*/
public AodvmNetworkLayer() {
- if (vizGraph == null) {
+ /* disabled if (vizGraph == null) {
vizGraph = new Graph("Multipaths", 20.0);
- }
+ }*/
}
/**
@@ -224,7 +225,7 @@
LOGGER.debug(getLogPrefix() + "Route table:\n" + routeTable);
LOGGER.debug(getLogPrefix() + "Neighbors:" + this.neighborhoodTable);
if (id.asInt() == 1) {
- vizGraph.printGraph("", "", "");
+ /* disabled vizGraph.printGraph("", "", ""); */
}
}
@@ -235,9 +236,11 @@
protected void processEvent(Initialize init) {
SimulationManager.logNodeState(this.getId(), "nodeID", "int", this.getId().toString());
Position p = this.getNode().getPosition();
+
+ /* disabled
this.vizNode = new GraphNode(this.getId().asInt(), p.getXCoord(), p.getYCoord(), vizGraph);
vizGraph.addNode(this.vizNode);
- /*
+
for (Node n : this.getNode().getNeighbors()) {
GraphNode gn = vizGraph.getNode(n.getId().asInt());
if (gn != null) {
@@ -862,6 +865,7 @@
this.routeTable = routeTable;
}
+ /* disabled
public static Graph getVizGraph() {
return vizGraph;
}
@@ -869,6 +873,7 @@
public GraphNode getVizNode() {
return vizNode;
}
+ */
public static long getNewMultipathID() {
return multipathID++;
Modified: trunk/src/net/sf/shox/simulator/node/user/network/aodvm/PathDiscovery.java
===================================================================
--- trunk/src/net/sf/shox/simulator/node/user/network/aodvm/PathDiscovery.java 2009-09-16 11:05:50 UTC (rev 2105)
+++ trunk/src/net/sf/shox/simulator/node/user/network/aodvm/PathDiscovery.java 2009-10-07 11:15:35 UTC (rev 2106)
@@ -37,8 +37,10 @@
import org.apache.log4j.Logger;
+/* disabled
import de.upb.shox.util.networkGraphs.GraphEdge;
import de.upb.shox.util.networkGraphs.customElements.ColoredGraphEdge;
+*/
/**
* This class handles all path discovery related stuff.
@@ -504,15 +506,22 @@
try {
int node1 = this.aodvmNetworkLayer.getId().asInt();
int node2 = routeReplyPacket.getSender().getId().asInt();
- GraphEdge graphEdge = AodvmNetworkLayer.getVizGraph().getEdge(node1, node2, GraphEdge.EDGE_TYPE_UNDIRECTED);
+
+ /* disabled
+ GraphEdge graphEdge = AodvmNetworkLayer.getVizGraph().getEdge(node1, node2, GraphEdge.EDGE_TYPE_UNDIRECTED);
+
if (graphEdge != null) {
// normally, there is already an undirected edge between two neighbors
AodvmNetworkLayer.getVizGraph().removeEdge(graphEdge);
}
- ColoredGraphEdge link = new ColoredGraphEdge(this.aodvmNetworkLayer.getVizNode(), AodvmNetworkLayer.getVizGraph().getNode(node2),
- AodvmNetworkLayer.getVizGraph(), GraphEdge.EDGE_TYPE_DIRECTED);
+
+ ColoredGraphEdge link = new ColoredGraphEdge(this.aodvmNetworkLayer.getVizNode(),
+ AodvmNetworkLayer.getVizGraph().getNode(node2),
+ AodvmNetworkLayer.getVizGraph(), GraphEdge.EDGE_TYPE_DIRECTED);
+
link.setColor(Color.BLACK); //pathColors.get(routeReplyPacket.getLastHopId()));
AodvmNetworkLayer.getVizGraph().addEdge(link);
+ */
} catch (Exception ex) {
LOGGER.warn(aodvmNetworkLayer.getLogPrefix() + "Exception occured during edge adding: " + ex.getMessage());
}
@@ -522,11 +531,13 @@
try {
int node2 = this.aodvmNetworkLayer.getId().asInt();
int node1 = rdErrorPacket.getSender().getId().asInt();
+ /* disabled
GraphEdge graphEdge = AodvmNetworkLayer.getVizGraph().getEdge(node1, node2, GraphEdge.EDGE_TYPE_DIRECTED);
GraphEdge graphEdge2 = AodvmNetworkLayer.getVizGraph().getEdge(node1, node2, GraphEdge.EDGE_TYPE_UNDIRECTED);
+
if (graphEdge != null) {
AodvmNetworkLayer.getVizGraph().removeEdge(graphEdge);
- }/*
+ }
if (graphEdge2 == null) {
GraphEdge link = new GraphEdge(this.aodvmNetworkLayer.getVizNode(), AodvmNetworkLayer.getVizGraph().getNode(node1),
AodvmNetworkLayer.getVizGraph(), GraphEdge.EDGE_TYPE_UNDIRECTED);
Modified: trunk/src/net/sf/shox/simulator/node/user/network/aodvm/PathMaintenance.java
===================================================================
--- trunk/src/net/sf/shox/simulator/node/user/network/aodvm/PathMaintenance.java 2009-09-16 11:05:50 UTC (rev 2105)
+++ trunk/src/net/sf/shox/simulator/node/user/network/aodvm/PathMaintenance.java 2009-10-07 11:15:35 UTC (rev 2106)
@@ -30,9 +30,10 @@
import org.apache.log4j.Logger;
+/* disabled
import de.upb.shox.util.networkGraphs.GraphEdge;
import de.upb.shox.util.networkGraphs.customElements.ColoredGraphEdge;
-
+*/
/**
* This class encapsulates all methods and data structures for AODVMs path
* maintenance process.
@@ -80,14 +81,18 @@
// remove corresponding edge in visualization graph
int node1 = this.aodvmNetworkLayer.getId().asInt();
int node2 = brokenNode.asInt();
+
+ /* disabled
GraphEdge graphEdge = AodvmNetworkLayer.getVizGraph().getEdge(node1, node2, GraphEdge.EDGE_TYPE_DIRECTED);
+
if (graphEdge != null) {
ColoredGraphEdge ge = (ColoredGraphEdge) graphEdge;
ge.setColor(Color.LIGHT_GRAY);
- //graphEdge.setLabel("broken");
- //AodvmNetworkLayer.getVizGraph().removeEdge(graphEdge);
+ graphEdge.setLabel("broken");
+ AodvmNetworkLayer.getVizGraph().removeEdge(graphEdge);
}
+ */
SimulationManager.logLinkState(this.aodvmNetworkLayer.getId(), brokenNode, "lastHopID", "int", "0");
SimulationManager.logLinkState(this.aodvmNetworkLayer.getId(), brokenNode, "broken", "float", this.aodvmNetworkLayer.getId() + "." + brokenNode);
@@ -177,14 +182,18 @@
int node1 = this.aodvmNetworkLayer.getId().asInt();
int node2 = packet.getSender().getId().asInt();
+
+ /* disabled
GraphEdge graphEdge = AodvmNetworkLayer.getVizGraph().getEdge(node1, node2, GraphEdge.EDGE_TYPE_DIRECTED);
+
if (graphEdge != null) {
ColoredGraphEdge ge = (ColoredGraphEdge) graphEdge;
ge.setColor(Color.LIGHT_GRAY);
- //graphEdge.setLabel("broken");
- // AodvmNetworkLayer.getVizGraph().removeEdge(graphEdge);
+ graphEdge.setLabel("broken");
+ AodvmNetworkLayer.getVizGraph().removeEdge(graphEdge);
}
+ */
}
}
@@ -202,12 +211,17 @@
sendRouteErrorPacket(routeErrorPacket);
int s = packet.getSender().getId().asInt();
+
+ /* disabled
GraphEdge e = AodvmNetworkLayer.getVizGraph().getEdge(this.aodvmNetworkLayer.getId().asInt(), s, GraphEdge.EDGE_TYPE_DIRECTED);
+
if (e != null) {
ColoredGraphEdge ge = (ColoredGraphEdge) e;
ge.setColor(Color.LIGHT_GRAY);
//e.setLabel("broken");
}
+ */
+
SimulationManager.logLinkState(packet.getSender().getId(), this.aodvmNetworkLayer.getId(), "lastHopID", "int", "0");
SimulationManager.logLinkState(packet.getSender().getId(), this.aodvmNetworkLayer.getId(), "broken", "float", packet.getSender().getId() + "." + this.aodvmNetworkLayer.getId());
SimulationManager.logNodeState(this.aodvmNetworkLayer.getId(), "affectedNode", "int", "10000");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dir...@us...> - 2009-09-16 11:05:59
|
Revision: 2105
http://shox.svn.sourceforge.net/shox/?rev=2105&view=rev
Author: dirk_held
Date: 2009-09-16 11:05:50 +0000 (Wed, 16 Sep 2009)
Log Message:
-----------
minor cleanups, changed comments and rearrangements.
Modified Paths:
--------------
trunk/src/net/sf/shox/simulator/util/Util.java
Modified: trunk/src/net/sf/shox/simulator/util/Util.java
===================================================================
--- trunk/src/net/sf/shox/simulator/util/Util.java 2009-09-14 12:52:47 UTC (rev 2104)
+++ trunk/src/net/sf/shox/simulator/util/Util.java 2009-09-16 11:05:50 UTC (rev 2105)
@@ -13,10 +13,25 @@
/** @return the current time in seconds. */
@SuppressWarnings("boxing")
- public static String time() {
+ public static String timeStr() {
return String.format(" time: %.3f", nowS());
}
+
+ /** @return the current time converted to a string. */
+ public static String nowStr() {
+ return Double.toString(nowS());
+ }
+ /** @return the current time converted to a 4 digit string. */
+ public static String nowStr4() {
+ return Double.toString(round4(nowS()));
+ }
+
+ /** @return the current simulation time converted to seconds. */
+ public static double nowS() {
+ return Configuration.getInstance().getSeconds(now());
+ }
+
/** @return the current simulation time. */
public static double now() {
return SimulationManager.getInstance().getCurrentTime();
@@ -31,21 +46,6 @@
return now() - x;
}
- /** @return the current simulation time. */
- public static double nowS() {
- return Configuration.getInstance().getSeconds(now());
- }
-
- /** @return the current time converted to a 4 digit string. */
- public static String nowStr() {
- return Double.toString(nowS());
- }
-
- /** @return the current time converted to a 4 digit string. */
- public static String nowStr4() {
- return Double.toString(round4(nowS()));
- }
-
/**
* method to round a given value to 2 digits.
* @param x the to be rounded value.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dir...@us...> - 2009-09-14 12:53:01
|
Revision: 2104
http://shox.svn.sourceforge.net/shox/?rev=2104&view=rev
Author: dirk_held
Date: 2009-09-14 12:52:47 +0000 (Mon, 14 Sep 2009)
Log Message:
-----------
make StatUtil more generic.
Modified Paths:
--------------
trunk/src/net/sf/shox/simulator/util/StatUtil.java
Modified: trunk/src/net/sf/shox/simulator/util/StatUtil.java
===================================================================
--- trunk/src/net/sf/shox/simulator/util/StatUtil.java 2009-09-13 14:52:07 UTC (rev 2103)
+++ trunk/src/net/sf/shox/simulator/util/StatUtil.java 2009-09-14 12:52:47 UTC (rev 2104)
@@ -29,31 +29,50 @@
*/
public class StatUtil {
- private Configuration cfg; // The configuration object, to access the time translation method
- private NodeId statNode; // set to a fixed node, to generate valid statistics.
- private int vals; // The number of entries plus one.
- private Object val[]; // This array will hold all your generated values
- private String title[]; // for each column, add a title, but not forget
- // to replace all spaces with an underline "_".
- private int index; // the next position, where a statistical element is written to.
+ private Configuration cfg; // The configuration object, to access the time translation method
+ private NodeId statNode; // set to a fixed node, to generate valid statistics.
+ private LayerType statLayer; // set to a fixed layer, to generate valid statistics.
+ private int vals; // The number of entries plus one.
+ private Object val[]; // This array will hold all your generated values
+ private String title[]; // for each column, add a title, but not forget
+ // to replace all spaces with an underline "_".
+ private int index; // the next position, where a statistical element is written to.
private FileEvaluationLogger log; // If set, dump values to a CSV-file too.
private String file = ""; // If set, a CSV-file of that name will be created.
private char separator = ' '; // The separating char between two columns.
-
+
+ /**
+ * Default constructor of this class.
+ *
+ * @param node the node, to assign the statistics to.
+ * @param layer the layer to assign the statistics to.
+ * @param vals enter here the number of statistic values.
+ * @param file use "", to not create an additional CSV-file, or a valid filename otherwise.
+ * @param separator the separating char between two columns of the CSV-file.
+ */
+ public StatUtil(NodeId node, LayerType layer, int vals,
+ String file, char separator) {
+ init(node, layer, vals, file, separator);
+ }
+
/**
+ * Simplified constructor of this class.
+ *
* @param vals enter here the number of statistic values.
* @param file use "", to not create an additional CSV-file, or a valid filename otherwise.
* @param separator the separating char between two columns of the CSV-file.
*/
public StatUtil(int vals, String file, char separator) {
- init(vals, file, separator);
+ init(NodeId.get(1), LayerType.APPLICATION, vals, file, separator);
}
- /**
- * @param vals enter here the number of statistic values.
+ /**
+ * Simplified constructor of this class.
+ *
+ * @param vals enter here the number of statistic values.
*/
public StatUtil(int vals) {
- init(vals, "", ' ');
+ init(NodeId.get(1), LayerType.APPLICATION, vals, "", ' ');
}
/**
@@ -63,7 +82,8 @@
* @param file the CSV-file, if any (== "" for no CSV-file).
* @param separator the column-separator for the former file.
*/
- private void init(@SuppressWarnings("hiding") int vals,
+ private void init(NodeId node, LayerType layer,
+ @SuppressWarnings("hiding") int vals,
@SuppressWarnings("hiding") String file,
@SuppressWarnings("hiding") char separator) {
@@ -80,7 +100,8 @@
// to replace the separator char by a "_", if used.
cfg = Configuration.getInstance();
- statNode = NodeId.get(1);
+ statNode = node;
+ statLayer = layer;
resetIndex();
log = null;
@@ -103,8 +124,8 @@
val[index] = new Integer(x);
title[index] = checkTitle(label);
- SimulationManager.logStatistic(statNode, LayerType.NETWORK, "time",
- label, Util.nowStr(), Integer.toString(x));
+ SimulationManager.logStatistic(statNode, statLayer, "time", label,
+ Util.nowStr(), Integer.toString(x));
checkEOL();
}
@@ -122,8 +143,8 @@
val[index] = new Double(Util.round4(x));
title[index] = checkTitle(label);
- SimulationManager.logStatistic(statNode, LayerType.NETWORK, "time",
- label, Util.nowStr(), Double.toString(x));
+ SimulationManager.logStatistic(statNode, statLayer, "time", label,
+ Util.nowStr(), Double.toString(x));
checkEOL();
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dir...@us...> - 2009-09-13 14:52:18
|
Revision: 2103
http://shox.svn.sourceforge.net/shox/?rev=2103&view=rev
Author: dirk_held
Date: 2009-09-13 14:52:07 +0000 (Sun, 13 Sep 2009)
Log Message:
-----------
remove some text-files, after they have been moved to the wiki.
Removed Paths:
-------------
trunk/conf/examples/configuration-Intro.txt
trunk/conf/examples/layer-prog-Intro.txt
trunk/conf/examples/statistics-Intro.txt
Deleted: trunk/conf/examples/configuration-Intro.txt
===================================================================
--- trunk/conf/examples/configuration-Intro.txt 2009-07-23 12:28:30 UTC (rev 2102)
+++ trunk/conf/examples/configuration-Intro.txt 2009-09-13 14:52:07 UTC (rev 2103)
@@ -1,215 +0,0 @@
-This documentation gives a first introduction, how a configuration for a
-simulation using ShoX is done.
-
-1 locating and using sample configurations
-
-You can find several sample configurations in the "shox/conf" directory. Please open now
-the file "shox/conf/examples/OSRdynamic.xml". This configuration is used as main example
-in this documentation. To start a simulation, you have to add a new run-configuration to
-Eclipse (open menu "Run/Run Configurations..." and add a new Java Application). On the
-main-tab, you add the project shox (depending on your choice, when creating the shox
-project). The main class is "net.sf.shox.simulator.kernel.Simulator". In the Arguments-tab,
-you add the configuration, you want to run (use the configuration, you just have opened).
-To start the gui, use the main-class "net.sf.shox.visual.ShoX" with no arguments.
-
-2 sections of a configuration file
-
-There are sections, which define the size of the field, the initial placement
-of the nodes and how they move, if at all. Some sections describe the radio
-model and how collisions are detected or resolved. One sections describes
-the number of nodes and which layers each node uses. A logging section
-describes, how the log and the statistics are stored. There are some more
-sections, dealing with random numbers and the simulation time for instance.
-
-2.1 pseudo random number generator
-
-Although each class can create its own pseudo random number generator (PRNG), shox
-offers a central instance, which can be defined in the randomgenerator-section
-(lines 4-9). The example generator, which is the Mersenne-Twister, is currently the
-best choice. It will generate a random seed for each simulation run, which is written
-to the console on several occasions (at the beginning of a simulation, at the end and
-if the simulation is stopped due to a user exception). If you only use the standard
-random number generator, you can reproduce a run to a large extend by specifying this
-seed. Just uncomment the seed parameter in line 7 and enter the value. The PRNG offers
-several distributions you can choose from. The class AppRandomVoiceData in the directory
-shox/conf/examples offers some examples, how to create a special distribution. It was
-taken from another project, but can be easily adapted to your needs.
-
-2.2 size of the field, node positioning and movement
-
-The field-section (l. 10-12) defines the size of the rectangular network area, where the
-nodes are placed in. The used unit is the same as the unit used for the radio-model. The
-positions-section (l. 13-21) defines the class, which is used to generate the initial
-placement of all nodes. Alternatives to the used RandomStartPositions class are the
-GridPositionGenerator and the UniformStartPositions class. The first one positions the
-nodes on a grid and uses a tunable minimal distance, to set all nodes apart. Each line is
-filled before the next line is started. The second tries to position the nodes uniformly
-positioned in both directions, where the grid dimensions are as close as possible to
-sqrt(#Nodes) (for example are 100 nodes placed in a 10 times 10 grid). If this does not suit
-your needs, you can implement your own position generator by implementing a subclass of
-the StartPositionGenerator class. You can do this of course for all referenced classes too.
-Open the example implementation for the task and find its super-class and which methods to
-implement. Most aspects of the ShoX framework can be replaced this way.
-
-If you activate the nodefile section, you can specify a file, where the generated positions
-will be written to. If you omit the generated-section but supply the nodefile section, the
-positions from the nodefile will be used.
-
-The movementmanager-section (l. 22-30) defines if and how nodes move. The activated
-RandomWaypoint class is a good choice for moving nodes. The used parameters are described
-directly within the class. In general, this is done at the very beginning of each class,
-which has parameters. If you do not need/want moving nodes, just use the NoMovement-class.
-
-2.3 physical model and bit mangling
-
-The physicalmodel-section (l. 31-37) define the used physical model. This describes, how
-the propagation of the radio waves in the field is simulated. The bitmanglingmodel-section
-(l. 38-40) describes, what happens, if two or more radio-transmissions arrive at a receiver
-at the same time, or in other words determines, if a packet was received correct or not.
-
-ShoX offers currently the following bitmanglers:
-
-1.) NoBitMangling: As the name suggests, no packets are dropped. The use is not recommended
-in conjunction with a nontrivial MAC or PHY (like 802.11bg).
-
-2.) CollisionPacketMangler: Drops a packet, if at least one interference collides with it,
-no matter how weak this interference is. This means that the second parameter of a physical
-model, which describes the interference distance or threshold, should be better set to the
-value of the first parameter, if a physical model is used, where no attenuation of the signal
-is determined.
-
-3.) PeakNoiseMangler: Drops a packet, if a colliding interference is found, where the signal
-to noise ratio (SNR) is below a tunable level, for example 2. Thus if at a time multiple
-interferences collide with the transmission, where each interference is too insignificant,
-but the sum would be significant, the result is not accurate. This simplification drastically
-reduces the needed effort, to handle the reception of a transmission. (Depends on a physical
-model, where the attenuation is somehow determined)
-
-4.) AddedNoiseMangler: Adds all current interferences up and drops the packet, if the SNR
-drops at any time below a tunable level. (Depends on a physical model, where the attenuation
-is somehow determined)
-
-Useful combinations of a physical model with a bit mangler:
-
-a.) SimplePhysics + NoBitMangling
-
-All nodes can reach each other and are in the same collision set.
-This combination is not recommended, when used with a nontrivial MAC.
-
-b.) UnitDisk + CollisionPacketMangler
-This is probably the most basic model. The UnitDisc model describes a disc with the
-radius "reachableDistance", where all transmissions reach all nodes within this range.
-
-c.) RandomizedUnitDisc + PeakNoiseMangler|AddedNoiseMangler
-
-It offers a randomized decision, if a interference occurs and decreases the RSS
-linearly beyond the reachableDistance down to zero at the interferenceDistance.
-
-d.) FuzzyDisc + CollisionPacketMangler?
-
-No much information available here.
-
-e.) IndoorAttenuationFactor + PeakNoiseMangler|AddedNoiseMangler
-
-The IndoorAttenuationFactor class uses a map to calculate the attenuation of the
-transmission for each passed obstacle.
-
-f.) VariableDisc + PeakNoiseMangler|AddedNoiseMangler
-
-Simulates a quadratic decaying radio signal with two thresholds. One for the minimum
-needed signal strength at which a packet is still received successfully, the other
-for the signal strength at which a transmission still interferes with other signals.
-
-The easiest way to get some more realism, compared to the
-example, is choice c or f.
-
-2.4 nodes and layers
-
-It is possible, to exchange several layers for all nodes. There are the physical layer,
-the MAC layer, the logical link layer, the network layer, the operating system layer
-and the application layer. The example specifies only the physical, the MAC, the
-network and the application layer. The remaining layers are set to dummy implementations,
-which only forwards all received packets up or down the layer-stack, along the direction
-of the packet.
-
-The count section in line 36 specifies the number of nodes for the simulation.
-
-2.4.1 physical layers
-
-Currently only the dummy and the 802.11bg implementation are available. Which are the
-PhysicalDebug and the PHY_802_11bg class. If you do not care about a MAC or a physical
-layer and thus do not specify them, the PhysicalDebug class is used. If you wand to
-implement a new (for example TDMA) MAC on top of the 802.11bg hardware, specify the
-PHY_802_11bg class. This class is of course needed, if the 802.11bg MAC is used.
-
-2.4.2 MAC layers
-
-Likewise to the physical layer, only the dummy and the 802.11bg implementation are
-currently available. The 802.11bg MAC of course needs the 802.11bg physical layer and
-the MACdebug class works with the PhysicalDebug class.
-
-2.4.3 logical link layers
-
-There are several descendants of the LogLinkLayer class, like OBMStatisticLayer,
-StaticGridBackboneLogLinkLayer class, LogLinkDebug class and the LogLinkPosition class.
-The LogLinkDebug class is again the dummy implementation, which is used, if nothing else
-was specified. For the remaining classes, not much information is available. The the source
-of each class, where a short comment at the beginning and the comment of the parameters may
-give you a hint about the function.
-
-See the shox/conf/examples/ll directory for an example implementation of a layer, which
-aggregates multiple packets to the same receiver to a larger one, to reduce the overhead,
-when many packets are sent. To do so, small packets are delayed for some time and combined
-with other small packets for the same receiver, until they are sent. Although this is not a
-logical link task, this class can be used as an example, how to implement a layer and how to
-do logging and statistics.
-
-2.4.4 network layers
-
-There are several implementations of a network layer:
-
-a.) NetworkDebug: the dummy implementation, if nothing is specified. No routing
-is performed here, so this implementation actually makes not much sense.
-
-b.) OptimalSourceRouting: Used in the example and determines the next hop by
-questioning an oracle. This class is applicable for static and for moving nodes
-and is the real dummy-implementation, since it performs real routing.
-
-c.) AodvNetworkLayer: implements the aodv protocol.
-(timing parameters seem to be simulation steps, instead of seconds, thus be
-careful, when you change the resolution of the simulation to another value)
-
-d.) AodvmNetworkLayer: currently incomplete multipath variant of the aodv implementation.
-
-e.) Threephase: implements a geographic routing scheme.
-
-If you do not care about routing, or want to eliminate the influence of routing
-on your personal layers, you want to analyze, use b. Implementation a makes
-not much sense for nontrivial setups, but d and e should be usable.
-
-2.4.5 operating system layers
-
-If you do not care about multiple ports and services, use the dummy implementation,
-which is NullOperatingSystemLayer (or just do not specify an operating system layer).
-The BasicOperatingSystemLayer class offers port mapping.
-
-2.5 logging and time
-
-Each class can have its own logger object, to print messages with a selectable
-priority. Have a look at the Aggregator class in line 51, where a LOGGER object
-is created and how it is used. Have a look at /shox/conf/log4j.properties, where
-you can specify the verbosity-level for each class, which uses a Logger object.
-
-The whole simulation can be recorded and replayed within the gui. During each run
-arbitrary statistics can be created and later on visualized within the gui. To do so,
-set logging to true (line 59) and add a file-name for the parts, you need in line 60
-and 61, where history refers to the simulation-replay file and statistics to the file,
-where all statistics are written to. The first implementation, which stores the data,
-used XML, which has lead to LARGE files. The current compact file logger is much more
-economical. To reduce the number of entries to the history even more, you can add
-filters (see lines 67 to 77).
-
-The last section simulationtime (line 81) is used, to specify the granularity of the
-simulation time and the total duration in seconds. There may be unexpected side effects,
-when changing stepspersecond, thus just keep it as is.
-
Deleted: trunk/conf/examples/layer-prog-Intro.txt
===================================================================
--- trunk/conf/examples/layer-prog-Intro.txt 2009-07-23 12:28:30 UTC (rev 2102)
+++ trunk/conf/examples/layer-prog-Intro.txt 2009-09-13 14:52:07 UTC (rev 2103)
@@ -1,148 +0,0 @@
-0 quick overview
-
-The following text will refer to the OptimalSourceRoutingLayer class (OSRL), which is located in
-net.sf.shox.simulator.node.user is a short example, how to implement a (network) layer. The most
-basic methods a layer has to implement are the lowerSAP (service access point) and the upperSAP
-(the application layer has no such thing). All packets go through these calls. Each layer also
-has to listen to (own) wakeup calls. The central hub for these events is the processWakeUpCall
-method. All timer events for example go through this call. If you need to configure your layer
-depending on the configuration, the initConfiguration method is the place to go. The configuration
-object contains some external values, like simulation duration or node count. All the parameters,
-which you have created, by marking your variables with a @ShoXParameter tag, a filled now. In most
-cases the processEvent calls with a Initialize, StartSimulation or Finalize event are used too, to
-take action in the respective phase of the simulation run. No layer should send packets prior the
-StartSimulation event. Any final statistics for example must be collected, when the Finalize event
-is received. A layer may have some states, which may me exported or even may be modified by other
-layers. To do so, the methods getState and setState are used.
-
-1. some predefined variables and methods, to use
-
-All nodes have a unique ID and each layer has an unique LayerType. Together they form the Address
-of this layer at this node. All descendants of the Layer-Class have access to the protected variables
-layerType, id, sender (as combination of id and layerType) and node. Whenever a packet is to be
-created, or the id of a node is needed (to print a log-message for example), these variables can be
-used. If you want to print log-messages to the console, you can add a Logger to your class, as it is
-done in most classes at the beginning (see OSRL @ line ~57). The node can return the local time
-with the getCurrentTime() method. No inaccurate clock is simulated here, thus this the accurate
-simulation time. The methods node.getPosition() gives access to the current real position. Setting
-the position is preferable done by a movement-manager or a position-generator, which you may
-want to implement yourself (see net.sf.shox.simulator.movement). The method node.getRandom()
-returns the global pseudo random number generator, which yields random numbers with the next*()
-calls. To resolve the neighborhood directly, without having to detect them first, using extra packets,
-use the node.getNeighbors(), getNeighborCount(), or resolveNeighbor() methods. Although there are
-other public methods, which deal with neighbors, they are only used internally.
-Although it may be useful, to directly access the MAC-Layer of of a neighbors node, to check, if a
-packet has reached this node, to have exact statistics, lots of nasty things can be done this way.
-It is up to you, how you use so-called god-knowledge or god-methods, since in reality one node
-cannot directly access other nodes inner state.
-
-2. The packet-class
-
-Each packet has its own header, a current direction (up or down the layer-stack), a timestamp of the
-creation time and a pointer to the inner packet of the next higher layer. The creating layer uses the
-Packet(Address sender, NodeId receiver) constructor to create the innermost layer, where the header is
-actually the payload of the packet. Use NodeId.ALLNODES as broadcast-address, if needed. The other two
-constructors are used down the layer-stack, to wrap the layer-specific header around a packet, which
-was received from a higher layer. Only the network-layer may specify a new receiver, which is the next
-hop along the path to the final receiver.
-
-here is an extract of the methods of the packet class:
-
-- isTerminal() : returns true, if there is no inner packet.
-- flipDirection() : used on network layers, to send a to be forwarded again down the layer stack.
-- getDirection() : the current direction along which this packet is currently traveling (up/down)
-- getEnclosedPacket() : used to unwrap a packet, before it is forwarded up to the next layer.
-- getEnclosedPacket(LayerType) specify the layer. to extract .
-- getHighestLayerType(): the layer-type, which originally has created this packet.
-- getHighestEnclosedPacket(): return the packet of the innermost layer, which originally created it.
-- getLayer(): return the layer of the packet.
-- <T extends Packet> T containsPacketType(Class<T> packetClass): alternative to getEnclosedPacket(LayerType)
- which saves some casts.
-- getHeaderLength(): return the length of the header of this layer in bits, if the annotations are not used.
-- setHeaderLength(int bits) set the number of bits, which are used for the header of this layer.
-- getTotalPacketSizeInBit(): sum up the total size of the headers of all layers including the payload.
-- setTime(double currentTime): is set by the simulator at the creation of this packet.
-- getTime(): return the previously set timestamp.
-- getMetaInfos(): additional informations for a packet, which should not be sent to next node, but are
-needed further down or up the layer-stack.
-
- There are some other methods, which mainly deal with debug- or statistic-informations. It is
- possible, to request the nodes, which successfully have received a packet and which where in
- transmission range, but did not receive it successfully. Use setRequestReceiverInformation(true),
- to request information about the receiving nodes. This is of course god-information and is only
- meant for debug- or statistic-purposes.
-
-3. The upperSAP() (service access point)
-
-For each layer, but the Application-layer, the basic concept is to receive packets from the next
-higher layer via the upperSAP (service access point), wrap the received packet p with a header
-of this layer and send it down to the next lower layer with sendPacket(p2) method. This is done,
-by generating a descendant of one layer-specific super-class and creating a new packet p2 of
-this class and supplying it with the packet p of the next higher layer. The physical layer sends
-then a physical packet to the pseudo-layer AirModule, which handles the physical transmission
-to all affected nodes.
-
-4. The lowerSAP()
-
-Each packet, which reaches a node, is fed from the AirModule to its physical layer at its lowerSAP(),
-if the nodes radio is currently listening. A physical layer mainly drops invalid packets and forwards
-the enclosed packet up to the MAC, using sendPacket(). Since the direction of the packet was
-toggled, when going through the AirModule, the packet is now sent up the layer-stack.
-
-5. The event hub processWakeUpCall()
-
-To send (delayed) events, you need to create a descendant of the WakeUpCall-class, to create
-events of your own type. You can send your events with the sendEventUp(), sendEventDown(),
-sendEventSelf() or sendEventTo(layerType) call. These methods forward an event up to the next
-higher layer, or down, or to this layer, or you specify the destination layer. In order to process
-received events in the processWakeUpCall method, you need to distinguish between all types of
-events, which may arrive here. Check for the most specific types first.
-To return the result of a operation for a packet up to the layer, which has initially created
-this packet, a so-called CrossLayerEvent is used. The most important event is here the
-TransmissionFailedEvent event, which is issued, when a packet was not successfully sent after
-a fixed maximum number of retries failed (see MAC_IEEE802_11bg_DCF.java at line ~704 for example).
-Even if a layer does not care about CrossLayerEvents, they still need to be forwarded up. See the
-method processWakeUpCall in line ~239 ff. of OSRL, how to do that.
-
-6. Accessing the configuration: initConfiguration()
-
-To access the configuration, use the getConfig()-method. It is best practice, to use real seconds
-for all time-parameters, which are stored in a configuration. Then convert these values to internal
-simulation-steps, using the getConfig().getSimulationSteps(seconds) method. The inverse method
-getConfig().getSeconds(simulationSteps) converts these values back to seconds.
-
-7. The Initialize, StartSimulation or Finalize events
-
-Doing the initialization, when processing the Initialize event is rather obsolete, apart from the
-neighborhood information, which is now ready too. Thus this is the latest time, to setup all needed
-structures. When the StartSimulation event is processed, each layer may start with sending
-packets, for example beacons, to explore the environment. If you have implemented your traffic
-generating engine in the application layer, it is time, to start to send your traffic. When the
-Finalize event arrives, final actions have to be performed, since this is the last call. See OSRL
-@ line ~143, where the Finalize event is processed, how the last call to this method is detected.
-Although testing for the id == #Nodes would do too, this is more safe, since the order of calls
-may change in the future.
-
-8. getting and setting layer states
-
-The node object of each layer offers the two methods getLayerState() and setLayerState().
-The first method returns an state-object, which is specific for the requested layer. This object
-contains the current state of this layer at this node. It may contain some tunable variables,
-which could be send to the layer with the setLayerState() method. See the 802.11 MAC
-implementation in net.sf.shox.simulator.node.user.MAC_IEEE802_11bg_DCF for the use of
-the getLayerState() method. Setting a state is rather rarely done in higher layers than the
-MAC-Layer. The layerState of the application-layer is used to form a return code. The enum
-ApplicationState offers the values CREATED, WAITING, RUNNING, FAILED, DONE. If the value is
-not set to DONE before the end, the value is set to FAILED. At the end, the number of done and
-failed nodes is printed. This just for your quick information at the end.
-
-9. dumping link- and node-states
-
-Each node can dump arbitrary named values as the current link- or node-state. These values are
-stored in the log-file and could be visualized in several ways after the simulation. Each node
-and link has certain attributes, which could be used, to visualize one named value, which was
-stored as link- or node-state. See OSRL at lines ~60-97 for some wrapper routines, which can write
-a link- or node-state. After completing a run, start the GUI and open the file history.compact
-in the shox directory with the "File/Open Log File ..." menu. After parsing the data, a new tab
-"Monitor" should be created. The menu "Mapping/Config Mapping ..." offers the possibility, to
-assign certain values to certain visualizations, like node color, node/link-label.
Deleted: trunk/conf/examples/statistics-Intro.txt
===================================================================
--- trunk/conf/examples/statistics-Intro.txt 2009-07-23 12:28:30 UTC (rev 2102)
+++ trunk/conf/examples/statistics-Intro.txt 2009-09-13 14:52:07 UTC (rev 2103)
@@ -1,93 +0,0 @@
-/*
- This code snipped is intended to show, how statistics could be created. The values are stored
- in two ways: as entry in the file statisticsdefault.compact and in a cvs file "statistics.csv",
- using the FileEvaluationLogger class. You need to enable logging in the configuration file, to
- actually create the file statisticsdefault.compact. Do this by adding the section logging:
-
- <logging>
- <log>true</log>
- <nameHistoryFile></nameHistoryFile>
- <nameStatisticsFile>statistics</nameStatisticsFile>
- <logClass>net.sf.shox.debug.compactlogging.CompactFileLogger</logClass>
- </logging>
-
- The history file is ommitted here, to save space and time.
-*/
-
-Look at the class net.sf.shox.simulator.util.StatUtil. This class can be used, to write statistic values
-to the ShoX statistics-file, which can be displayed after the run is completed. All those statistics are
-assigned to node "1", no matter, which node uses this class. Actually should only one node use this class.
-Additionally could all values also be written to a CSV-file of your choice. To organize the creation of
-statistic-value creation, create a StatUtil-object, establish a timer, which is called once a second or
-so for one node, where a createStatistics(false) method is called. Call createStatistics(true) when the
-Finalize-event is processed in the method "protected final void processEvent(final Finalize end)" of your
-application. Thus add/correct the following lines to the appropriate places of your application-layer:
-
- // were the variables are declared
-
- private StatUtil su = null;
-
- ...
-
- // were they are initialized -> like in "protected final void processEvent(Initialize init)"
-
- if (id.asInt() == 1) {
- choose: su = new StatUtil(<the number of statistic values>);
- or: su = new StatUtil(<the number of statistic values>, "statistics.csv or the like", ' ');
- // you may choose another separating char, like ';', but not '_'
-
- AppTimerEvent timer = new AppTimerEvent(getConfig().getSimulationSteps(1.0)); // interval = one second
- sendEventSelf(timer);
- }
-
- ...
-
- // near the beginning of "public void processWakeUpCall(final WakeUpCall wuc)"
-
- if (wuc instanceof AppTimerEvent) {
- createStatistics(false);
- sendEventSelf(wuc);
- } else ...
-
- ...
-
- // Add to "protected final void processEvent(final Finalize end)"
-
- if (id.asInte() == 1) { // or the node with the highest id, if some global statistics are not yet created.
- createStatistics(true);
- }
-
- ...
-
- private void createStatistics(boolean finalize) {
- // add your calls to create statistic-values here like...
- // this tiny example adds four values, which needs to be added to the constructor of the su-object.
-
- int i = 42;
- su.statInt("int-label", i);
-
- double x = 4711.0815;
- su.statDouble("double-label", x);
-
- x = 0.42;
- su.statPercent("percent-label", x);
-
- x = Util.now(); // it is a simulation-time value, no need to convert it to seconds.
- su.statTime("time-label", x);
-
- // this is of course not needed, if you did not add a CSV-file
-
- if (finalize) {
- su.closeCSVfile();
- }
- }
-
- ...
-
- // well, you need still a AppTimerEvent-class, like
-
- public class AppTimerEvent extends WakeUpCall {
- }
-
- // or use the net.sf.shox.simulator.event.AppEvent-class directly and select by a type of your choice.
-
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dir...@us...> - 2009-07-23 12:28:31
|
Revision: 2102
http://shox.svn.sourceforge.net/shox/?rev=2102&view=rev
Author: dirk_held
Date: 2009-07-23 12:28:30 +0000 (Thu, 23 Jul 2009)
Log Message:
-----------
Add example code, using the StatUtil class, to describe, how statistics could be created.
Modified Paths:
--------------
trunk/conf/examples/statistics-Intro.txt
Modified: trunk/conf/examples/statistics-Intro.txt
===================================================================
--- trunk/conf/examples/statistics-Intro.txt 2009-07-23 12:01:27 UTC (rev 2101)
+++ trunk/conf/examples/statistics-Intro.txt 2009-07-23 12:28:30 UTC (rev 2102)
@@ -14,3 +14,80 @@
The history file is ommitted here, to save space and time.
*/
+Look at the class net.sf.shox.simulator.util.StatUtil. This class can be used, to write statistic values
+to the ShoX statistics-file, which can be displayed after the run is completed. All those statistics are
+assigned to node "1", no matter, which node uses this class. Actually should only one node use this class.
+Additionally could all values also be written to a CSV-file of your choice. To organize the creation of
+statistic-value creation, create a StatUtil-object, establish a timer, which is called once a second or
+so for one node, where a createStatistics(false) method is called. Call createStatistics(true) when the
+Finalize-event is processed in the method "protected final void processEvent(final Finalize end)" of your
+application. Thus add/correct the following lines to the appropriate places of your application-layer:
+
+ // were the variables are declared
+
+ private StatUtil su = null;
+
+ ...
+
+ // were they are initialized -> like in "protected final void processEvent(Initialize init)"
+
+ if (id.asInt() == 1) {
+ choose: su = new StatUtil(<the number of statistic values>);
+ or: su = new StatUtil(<the number of statistic values>, "statistics.csv or the like", ' ');
+ // you may choose another separating char, like ';', but not '_'
+
+ AppTimerEvent timer = new AppTimerEvent(getConfig().getSimulationSteps(1.0)); // interval = one second
+ sendEventSelf(timer);
+ }
+
+ ...
+
+ // near the beginning of "public void processWakeUpCall(final WakeUpCall wuc)"
+
+ if (wuc instanceof AppTimerEvent) {
+ createStatistics(false);
+ sendEventSelf(wuc);
+ } else ...
+
+ ...
+
+ // Add to "protected final void processEvent(final Finalize end)"
+
+ if (id.asInte() == 1) { // or the node with the highest id, if some global statistics are not yet created.
+ createStatistics(true);
+ }
+
+ ...
+
+ private void createStatistics(boolean finalize) {
+ // add your calls to create statistic-values here like...
+ // this tiny example adds four values, which needs to be added to the constructor of the su-object.
+
+ int i = 42;
+ su.statInt("int-label", i);
+
+ double x = 4711.0815;
+ su.statDouble("double-label", x);
+
+ x = 0.42;
+ su.statPercent("percent-label", x);
+
+ x = Util.now(); // it is a simulation-time value, no need to convert it to seconds.
+ su.statTime("time-label", x);
+
+ // this is of course not needed, if you did not add a CSV-file
+
+ if (finalize) {
+ su.closeCSVfile();
+ }
+ }
+
+ ...
+
+ // well, you need still a AppTimerEvent-class, like
+
+ public class AppTimerEvent extends WakeUpCall {
+ }
+
+ // or use the net.sf.shox.simulator.event.AppEvent-class directly and select by a type of your choice.
+
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dir...@us...> - 2009-07-23 12:01:58
|
Revision: 2101
http://shox.svn.sourceforge.net/shox/?rev=2101&view=rev
Author: dirk_held
Date: 2009-07-23 12:01:27 +0000 (Thu, 23 Jul 2009)
Log Message:
-----------
change comment, to not confuse the user of the getCurrentTime() method.
Modified Paths:
--------------
trunk/src/net/sf/shox/simulator/node/Node.java
Modified: trunk/src/net/sf/shox/simulator/node/Node.java
===================================================================
--- trunk/src/net/sf/shox/simulator/node/Node.java 2009-07-23 11:37:44 UTC (rev 2100)
+++ trunk/src/net/sf/shox/simulator/node/Node.java 2009-07-23 12:01:27 UTC (rev 2101)
@@ -431,15 +431,15 @@
*/
}
- /**
- * Warning: The returned value might be totally unreliable!!
- * If you use this function, you are responsible for keeping
- * the currentTime information up-to-date yourself!
- * @return The current time as calculated by the node.
- */
+ /** @return The current time as calculated by the node. */
public double getCurrentTime() {
/* TODO Replace this by a clock simulation with adjustable error and
* drift and use the currentTime field.
+ *
+ * Add then the following comment:
+ * Warning: The returned value might be totally unreliable!!
+ * If you use this function, you are responsible for keeping
+ * the currentTime information up-to-date yourself!
*/
return SimulationManager.getInstance().getCurrentTime();
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dir...@us...> - 2009-07-23 11:38:26
|
Revision: 2100
http://shox.svn.sourceforge.net/shox/?rev=2100&view=rev
Author: dirk_held
Date: 2009-07-23 11:37:44 +0000 (Thu, 23 Jul 2009)
Log Message:
-----------
cleanups.
Modified Paths:
--------------
trunk/src/net/sf/shox/simulator/util/StatUtil.java
Modified: trunk/src/net/sf/shox/simulator/util/StatUtil.java
===================================================================
--- trunk/src/net/sf/shox/simulator/util/StatUtil.java 2009-07-23 11:34:32 UTC (rev 2099)
+++ trunk/src/net/sf/shox/simulator/util/StatUtil.java 2009-07-23 11:37:44 UTC (rev 2100)
@@ -36,9 +36,9 @@
private String title[]; // for each column, add a title, but not forget
// to replace all spaces with an underline "_".
private int index; // the next position, where a statistical element is written to.
- private FileEvaluationLogger log; // If set, dump values to a csv-file too.
- private String file = "";
- private char separator = ' ';
+ private FileEvaluationLogger log; // If set, dump values to a CSV-file too.
+ private String file = ""; // If set, a CSV-file of that name will be created.
+ private char separator = ' '; // The separating char between two columns.
/**
* @param vals enter here the number of statistic values.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dir...@us...> - 2009-07-23 11:34:48
|
Revision: 2099
http://shox.svn.sourceforge.net/shox/?rev=2099&view=rev
Author: dirk_held
Date: 2009-07-23 11:34:32 +0000 (Thu, 23 Jul 2009)
Log Message:
-----------
add checking and replacing the separator-char in each title.
Modified Paths:
--------------
trunk/src/net/sf/shox/simulator/util/StatUtil.java
Modified: trunk/src/net/sf/shox/simulator/util/StatUtil.java
===================================================================
--- trunk/src/net/sf/shox/simulator/util/StatUtil.java 2009-07-23 11:05:31 UTC (rev 2098)
+++ trunk/src/net/sf/shox/simulator/util/StatUtil.java 2009-07-23 11:34:32 UTC (rev 2099)
@@ -67,12 +67,17 @@
@SuppressWarnings("hiding") String file,
@SuppressWarnings("hiding") char separator) {
+ if (separator == '_') { // avoid the clash of the separator with the replacement-char
+ separator = ' ';
+ }
+
this.vals = ++vals;
this.file = file;
this.separator = separator;
val = new Object[vals]; // This array will hold all your generated values
title = new String[vals]; // for each column, add a title, but not forget
+ // to replace the separator char by a "_", if used.
cfg = Configuration.getInstance();
statNode = NodeId.get(1);
@@ -96,7 +101,7 @@
*/
public void statInt(String label, int x) {
val[index] = new Integer(x);
- title[index] = label;
+ title[index] = checkTitle(label);
SimulationManager.logStatistic(statNode, LayerType.NETWORK, "time",
label, Util.nowStr(), Integer.toString(x));
@@ -115,7 +120,7 @@
}
val[index] = new Double(Util.round4(x));
- title[index] = label;
+ title[index] = checkTitle(label);
SimulationManager.logStatistic(statNode, LayerType.NETWORK, "time",
label, Util.nowStr(), Double.toString(x));
@@ -152,6 +157,20 @@
title[0] = "time";
}
+ /**
+ * method to replace any occurrences of the separator char by '_'.
+ *
+ * @param str the title-string, to check.
+ * @return the corrected string, or the original, if the separator was not found.
+ */
+ private String checkTitle(String str) {
+ if (str.indexOf(separator) >= 0) {
+ return str.replace(separator, '_');
+ }
+
+ return str;
+ }
+
/** Method check whether to finalize a line, after the last entry was added. */
private void checkEOL() {
if (index == vals) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dir...@us...> - 2009-07-23 11:05:50
|
Revision: 2098
http://shox.svn.sourceforge.net/shox/?rev=2098&view=rev
Author: dirk_held
Date: 2009-07-23 11:05:31 +0000 (Thu, 23 Jul 2009)
Log Message:
-----------
Move the creation of the FileEvaluationLogger object to the
end-of-line handling, when the title elements are actually present.
Modified Paths:
--------------
trunk/src/net/sf/shox/simulator/util/StatUtil.java
Modified: trunk/src/net/sf/shox/simulator/util/StatUtil.java
===================================================================
--- trunk/src/net/sf/shox/simulator/util/StatUtil.java 2009-07-23 10:22:32 UTC (rev 2097)
+++ trunk/src/net/sf/shox/simulator/util/StatUtil.java 2009-07-23 11:05:31 UTC (rev 2098)
@@ -37,12 +37,40 @@
// to replace all spaces with an underline "_".
private int index; // the next position, where a statistical element is written to.
private FileEvaluationLogger log; // If set, dump values to a csv-file too.
+ private String file = "";
+ private char separator = ' ';
/**
* @param vals enter here the number of statistic values.
+ * @param file use "", to not create an additional CSV-file, or a valid filename otherwise.
+ * @param separator the separating char between two columns of the CSV-file.
*/
+ public StatUtil(int vals, String file, char separator) {
+ init(vals, file, separator);
+ }
+
+ /**
+ * @param vals enter here the number of statistic values.
+ */
public StatUtil(int vals) {
- this.vals = ++vals;
+ init(vals, "", ' ');
+ }
+
+ /**
+ * method to actually initialize the object.
+ *
+ * @param vals the number of statistic values.
+ * @param file the CSV-file, if any (== "" for no CSV-file).
+ * @param separator the column-separator for the former file.
+ */
+ private void init(@SuppressWarnings("hiding") int vals,
+ @SuppressWarnings("hiding") String file,
+ @SuppressWarnings("hiding") char separator) {
+
+ this.vals = ++vals;
+ this.file = file;
+ this.separator = separator;
+
val = new Object[vals]; // This array will hold all your generated values
title = new String[vals]; // for each column, add a title, but not forget
@@ -53,16 +81,6 @@
log = null;
}
- /**
- * Method to add a CSV-file to dump all values to too.
- *
- * @param file the file-name for the to be created CSV-file, like statistics.csv
- * @param separator the char between two columns like ' '
- */
- public void addCSVfile(String file, char separator) {
- log = new FileEvaluationLogger(separator, file, title);
- }
-
/** do not forget to close the CSV-file, after the last line was added. */
public void closeCSVfile() {
if (log != null) {
@@ -139,6 +157,10 @@
if (index == vals) {
resetIndex();
+ if ((log == null) && (file.length() > 0)) {
+ log = new FileEvaluationLogger(separator, file, title);
+ }
+
if (log != null) {
log.write((Object[]) val);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dir...@us...> - 2009-07-23 10:22:35
|
Revision: 2097
http://shox.svn.sourceforge.net/shox/?rev=2097&view=rev
Author: dirk_held
Date: 2009-07-23 10:22:32 +0000 (Thu, 23 Jul 2009)
Log Message:
-----------
cleanup unneeded import.
Modified Paths:
--------------
trunk/src/net/sf/shox/simulator/util/Util.java
Modified: trunk/src/net/sf/shox/simulator/util/Util.java
===================================================================
--- trunk/src/net/sf/shox/simulator/util/Util.java 2009-07-23 10:21:18 UTC (rev 2096)
+++ trunk/src/net/sf/shox/simulator/util/Util.java 2009-07-23 10:22:32 UTC (rev 2097)
@@ -1,7 +1,6 @@
package net.sf.shox.simulator.util;
import static java.lang.Math.floor;
-import de.upb.shox.traffic.DisconnectionInfo;
import net.sf.shox.simulator.kernel.Configuration;
import net.sf.shox.simulator.kernel.SimulationManager;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dir...@us...> - 2009-07-23 10:21:34
|
Revision: 2096
http://shox.svn.sourceforge.net/shox/?rev=2096&view=rev
Author: dirk_held
Date: 2009-07-23 10:21:18 +0000 (Thu, 23 Jul 2009)
Log Message:
-----------
remove code-snipped-file, after its contents was moved to a class.
Modified Paths:
--------------
trunk/conf/examples/statistics-Intro.txt
Removed Paths:
-------------
trunk/conf/examples/Statistics CodeSnippet.txt
Deleted: trunk/conf/examples/Statistics CodeSnippet.txt
===================================================================
--- trunk/conf/examples/Statistics CodeSnippet.txt 2009-07-23 10:19:52 UTC (rev 2095)
+++ trunk/conf/examples/Statistics CodeSnippet.txt 2009-07-23 10:21:18 UTC (rev 2096)
@@ -1,121 +0,0 @@
-/*
- This code snipped is intended to show, how statistics could be created. The values are stored
- in two ways: as entry in the file statisticsdefault.compact and in a cvs file "statistics.csv",
- using the FileEvaluationLogger class. You need to enable logging in the configuration file, to
- actually create the file statisticsdefault.compact. Do this by adding the section logging:
-
- <logging>
- <log>true</log>
- <nameHistoryFile></nameHistoryFile>
- <nameStatisticsFile>statistics</nameStatisticsFile>
- <logClass>net.sf.shox.debug.compactlogging.CompactFileLogger</logClass>
- </logging>
-
- The history file is ommitted here, to save space and time.
-*/
- static NodeId statNode = NodeId.get(1); // set to a fixed node, to generate valid statistics.
- static final int vals = <a value>; // enter here the number of statistics plus one.
- static Object val[] = new Object[vals]; // This array will hold all your generated values
- static String title[] = new String[vals]; // for each column, add a title, but not forget
- // to replace all spaces with an underline "_".
-
- private static FileEvaluationLogger log = null;
- private static final char separator = ' ';
-
- /**
- * wrapper to generate a statistic item for an integer value.
- *
- * @param idx index into the value array.
- * @param label the label of the statistics item.
- * @param x the value of the statistics item.
- */
- private void statInt(int idx, String now, String label, int x) {
- val[idx] = new Integer(x);
- title[idx] = label;
-
- SimulationManager.logStatistic(statNode, LayerType.NETWORK, "time",
- label, now, Integer.toString(x));
- }
-
- /**
- * wrapper to generate a statistic item for an double value.
- *
- * @param idx index into the value array.
- * @param label the label of the statistics item.
- * @param x the value of the statistics item.
- */
- private void statDouble(int idx, String now, String label, double x) {
- if (x == Double.NaN) {
- x = 0.0;
- }
-
- val[idx] = new Double(Util.round4(x));
- title[idx] = label;
-
- SimulationManager.logStatistic(statNode, LayerType.NETWORK, "time",
- label, now, Double.toString(x));
- }
-
- /**
- * wrapper to generate a statistic item for an percent value.
- *
- * @param idx index into the value array.
- * @param label the label of the statistics item.
- * @param x the value of the statistics item.
- */
- private void statPercent(int idx, String now, String label, double x) {
- statDouble(idx, now, label, x * 100.0);
- }
-
- /**
- * wrapper to generate a statistic item for an time value.
- * The given value is interpreted as simulation time and
- * converted to seconds.
- *
- * @param idx index into the value array.
- * @param label the label of the statistics item.
- * @param x the value of the statistics item.
- */
- private void statTime(int idx, String now, String label, double x) {
- statDouble(idx, now, label, getConfig().getSeconds(x));
- }
-
- /** method to evaluate the counters and to store the statistics. */
- @SuppressWarnings("cast")
- private void generateStatistics(boolean finalize) {
- double now = SimulationManager.getInstance().getCurrentTime();
- double nowD = Configuration.getInstance().getSeconds(now);
- String nowS = Double.toString(nowD);
-
- for (i = 1; i < vals; i++) {
- val[i] = new Double(0.0);
- }
-
- int idx = 1;
-
- val[0] = new Double(nowD);
- title[0] = "time";
-
- statInt(idx++, nowS, "int_stat_title", intStatValue);
- // similar for statDouble, statTime or statPercent
- // add as many calls to stat*(), as you need -> see vals constant
-
- Object val2[] = new Object[idx];
- String title2[] = new String[idx];
-
- for (i = 0; i < idx; i++) {
- val2[i] = val[i];
- title2[i] = title[i];
- }
-
- if (log == null) {
- log = new FileEvaluationLogger(separator, "statistics.csv", title2);
- log.setFlush(true);
- }
-
- log.write((Object[]) val2);
-
- if (finalize) {
- log.close();
- }
- }
\ No newline at end of file
Modified: trunk/conf/examples/statistics-Intro.txt
===================================================================
--- trunk/conf/examples/statistics-Intro.txt 2009-07-23 10:19:52 UTC (rev 2095)
+++ trunk/conf/examples/statistics-Intro.txt 2009-07-23 10:21:18 UTC (rev 2096)
@@ -1 +1,16 @@
-bla
+/*
+ This code snipped is intended to show, how statistics could be created. The values are stored
+ in two ways: as entry in the file statisticsdefault.compact and in a cvs file "statistics.csv",
+ using the FileEvaluationLogger class. You need to enable logging in the configuration file, to
+ actually create the file statisticsdefault.compact. Do this by adding the section logging:
+
+ <logging>
+ <log>true</log>
+ <nameHistoryFile></nameHistoryFile>
+ <nameStatisticsFile>statistics</nameStatisticsFile>
+ <logClass>net.sf.shox.debug.compactlogging.CompactFileLogger</logClass>
+ </logging>
+
+ The history file is ommitted here, to save space and time.
+*/
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dir...@us...> - 2009-07-23 10:20:39
|
Revision: 2095
http://shox.svn.sourceforge.net/shox/?rev=2095&view=rev
Author: dirk_held
Date: 2009-07-23 10:19:52 +0000 (Thu, 23 Jul 2009)
Log Message:
-----------
util-class, to collect some usefull routines to create time values and round doubles. StatUtil.class,
to aid adding statistic-values to the statistic file and optionally to an additional CSV-file.
Added Paths:
-----------
trunk/src/net/sf/shox/simulator/util/StatUtil.java
trunk/src/net/sf/shox/simulator/util/Util.java
Added: trunk/src/net/sf/shox/simulator/util/StatUtil.java
===================================================================
--- trunk/src/net/sf/shox/simulator/util/StatUtil.java (rev 0)
+++ trunk/src/net/sf/shox/simulator/util/StatUtil.java 2009-07-23 10:19:52 UTC (rev 2095)
@@ -0,0 +1,147 @@
+/********************************************************************************
+This file is part of ShoX.
+
+ShoX is free software; you can redistribute it and/or modify it under the terms
+of the GNU General Public License as published by the Free Software Foundation;
+either version 2 of the License, or (at your option) any later version.
+
+ShoX is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE. See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+ShoX; if not, write to the Free Software Foundation, Inc., 51 Franklin Street,
+Fifth Floor, Boston, MA 02110-1301, USA
+
+Copyright 2006 The ShoX developers as defined under http://shox.sourceforge.net
+********************************************************************************/
+
+package net.sf.shox.simulator.util;
+
+import net.sf.shox.simulator.LayerType;
+import net.sf.shox.simulator.NodeId;
+import net.sf.shox.simulator.kernel.Configuration;
+import net.sf.shox.simulator.kernel.SimulationManager;
+
+/**
+ *
+ * @author Dirk Held
+ */
+public class StatUtil {
+
+ private Configuration cfg; // The configuration object, to access the time translation method
+ private NodeId statNode; // set to a fixed node, to generate valid statistics.
+ private int vals; // The number of entries plus one.
+ private Object val[]; // This array will hold all your generated values
+ private String title[]; // for each column, add a title, but not forget
+ // to replace all spaces with an underline "_".
+ private int index; // the next position, where a statistical element is written to.
+ private FileEvaluationLogger log; // If set, dump values to a csv-file too.
+
+ /**
+ * @param vals enter here the number of statistic values.
+ */
+ public StatUtil(int vals) {
+ this.vals = ++vals;
+ val = new Object[vals]; // This array will hold all your generated values
+ title = new String[vals]; // for each column, add a title, but not forget
+
+ cfg = Configuration.getInstance();
+ statNode = NodeId.get(1);
+ resetIndex();
+
+ log = null;
+ }
+
+ /**
+ * Method to add a CSV-file to dump all values to too.
+ *
+ * @param file the file-name for the to be created CSV-file, like statistics.csv
+ * @param separator the char between two columns like ' '
+ */
+ public void addCSVfile(String file, char separator) {
+ log = new FileEvaluationLogger(separator, file, title);
+ }
+
+ /** do not forget to close the CSV-file, after the last line was added. */
+ public void closeCSVfile() {
+ if (log != null) {
+ log.close();
+ }
+ }
+
+ /**
+ * wrapper to generate a statistic item for an integer value.
+ *
+ * @param label the label of the statistics item.
+ * @param x the value of the statistics item.
+ */
+ public void statInt(String label, int x) {
+ val[index] = new Integer(x);
+ title[index] = label;
+
+ SimulationManager.logStatistic(statNode, LayerType.NETWORK, "time",
+ label, Util.nowStr(), Integer.toString(x));
+ checkEOL();
+ }
+
+ /**
+ * wrapper to generate a statistic item for an double value.
+ *
+ * @param label the label of the statistics item.
+ * @param x the value of the statistics item.
+ */
+ public void statDouble(String label, double x) {
+ if (x == Double.NaN) {
+ x = 0.0;
+ }
+
+ val[index] = new Double(Util.round4(x));
+ title[index] = label;
+
+ SimulationManager.logStatistic(statNode, LayerType.NETWORK, "time",
+ label, Util.nowStr(), Double.toString(x));
+ checkEOL();
+ }
+
+ /**
+ * wrapper to generate a statistic item for an percent value.
+ *
+ * @param label the label of the statistics item.
+ * @param x the value of the statistics item.
+ */
+ public void statPercent(String label, double x) {
+ statDouble(label, x * 100.0);
+ }
+
+ /**
+ * wrapper to generate a statistic item for an time value.
+ * The given value is interpreted as simulation time and
+ * converted to seconds.
+ *
+ * @param idx index into the value array.
+ * @param label the label of the statistics item.
+ * @param x the value of the statistics item.
+ */
+ public void statTime(String label, double x) {
+ statDouble(label, cfg.getSeconds(x));
+ }
+
+ /** Use this method, to start a new line of entries. */
+ private void resetIndex() {
+ index = 1;
+ val[0] = new Double(Util.nowS());
+ title[0] = "time";
+ }
+
+ /** Method check whether to finalize a line, after the last entry was added. */
+ private void checkEOL() {
+ if (index == vals) {
+ resetIndex();
+
+ if (log != null) {
+ log.write((Object[]) val);
+ }
+ }
+ }
+}
Added: trunk/src/net/sf/shox/simulator/util/Util.java
===================================================================
--- trunk/src/net/sf/shox/simulator/util/Util.java (rev 0)
+++ trunk/src/net/sf/shox/simulator/util/Util.java 2009-07-23 10:19:52 UTC (rev 2095)
@@ -0,0 +1,86 @@
+package net.sf.shox.simulator.util;
+
+import static java.lang.Math.floor;
+import de.upb.shox.traffic.DisconnectionInfo;
+import net.sf.shox.simulator.kernel.Configuration;
+import net.sf.shox.simulator.kernel.SimulationManager;
+
+/**
+ * Collection of some generic helper functions.
+ *
+ * @author Dirk Held
+ */
+public class Util {
+
+ /** @return the current time in seconds. */
+ @SuppressWarnings("boxing")
+ public static String time() {
+ return String.format(" time: %.3f", nowS());
+ }
+
+ /** @return the current simulation time. */
+ public static double now() {
+ return SimulationManager.getInstance().getCurrentTime();
+ }
+
+ /**
+ * Method to calculate the elapsed time since a given earlier time.
+ *
+ * @param x the earlier time.
+ * @return the elapsed time since the given one. */
+ public static double delta(double x) {
+ return now() - x;
+ }
+
+ /** @return the current simulation time. */
+ public static double nowS() {
+ return Configuration.getInstance().getSeconds(now());
+ }
+
+ /** @return the current time converted to a 4 digit string. */
+ public static String nowStr() {
+ return Double.toString(nowS());
+ }
+
+ /** @return the current time converted to a 4 digit string. */
+ public static String nowStr4() {
+ return Double.toString(round4(nowS()));
+ }
+
+ /**
+ * method to round a given value to 2 digits.
+ * @param x the to be rounded value.
+ * @return the to 2 digits rounded input value.
+ */
+ public static double round3(double x) {
+ x *= 1000.0;
+ x = floor(x + 0.5);
+ x /= 1000.0;
+
+ return x;
+ }
+
+ /**
+ * method to round a given value to 4 digits.
+ * @param x the to be rounded value.
+ * @return the to10 digits rounded input value.
+ */
+ public static double round4(double x) {
+ x *= 10000.0;
+ x = floor(x + 0.5);
+ x /= 10000.0;
+ return x;
+ }
+
+ /**
+ * method to round a given value to 10 digits.
+ * @param x the to be rounded value.
+ * @return the to10 digits rounded input value.
+ */
+ public static double round10(double x) {
+ x *= 10000000000.0;
+ x = floor(x + 0.5);
+ x /= 10000000000.0;
+ return x;
+ }
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dir...@us...> - 2009-07-09 11:20:24
|
Revision: 2094
http://shox.svn.sourceforge.net/shox/?rev=2094&view=rev
Author: dirk_held
Date: 2009-07-09 11:20:23 +0000 (Thu, 09 Jul 2009)
Log Message:
-----------
empty startpoint for statistics-generation intro.
Added Paths:
-----------
trunk/conf/examples/statistics-Intro.txt
Added: trunk/conf/examples/statistics-Intro.txt
===================================================================
--- trunk/conf/examples/statistics-Intro.txt (rev 0)
+++ trunk/conf/examples/statistics-Intro.txt 2009-07-09 11:20:23 UTC (rev 2094)
@@ -0,0 +1 @@
+bla
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dir...@us...> - 2009-07-09 11:19:55
|
Revision: 2093
http://shox.svn.sourceforge.net/shox/?rev=2093&view=rev
Author: dirk_held
Date: 2009-07-09 11:19:30 +0000 (Thu, 09 Jul 2009)
Log Message:
-----------
small clarifications.
Modified Paths:
--------------
trunk/conf/examples/configuration-Intro.txt
Modified: trunk/conf/examples/configuration-Intro.txt
===================================================================
--- trunk/conf/examples/configuration-Intro.txt 2009-07-09 11:10:38 UTC (rev 2092)
+++ trunk/conf/examples/configuration-Intro.txt 2009-07-09 11:19:30 UTC (rev 2093)
@@ -3,15 +3,14 @@
1 locating and using sample configurations
-You can find several sample configurations in the "shox/conf" directory. Have a
-look at "shox/conf/examples/OSRdynamic.xml", which is used as example in this
-documentation. To start a simulation, you have to add a new run-configuration to
-Eclipse (open menu "Run/Run Configurations..." and add a new Java Application).
-On the main-tab, you add the project shox (depending on your choice, when creating
-the shox project). The main class is "net.sf.shox.simulator.kernel.Simulator". In
-the Arguments-tab, you add the configuration, you want to run. For this example,
-use "conf/examples/OSRdynamic.xml". To start the gui, use the main-class
-"net.sf.shox.visual.ShoX" with no arguments.
+You can find several sample configurations in the "shox/conf" directory. Please open now
+the file "shox/conf/examples/OSRdynamic.xml". This configuration is used as main example
+in this documentation. To start a simulation, you have to add a new run-configuration to
+Eclipse (open menu "Run/Run Configurations..." and add a new Java Application). On the
+main-tab, you add the project shox (depending on your choice, when creating the shox
+project). The main class is "net.sf.shox.simulator.kernel.Simulator". In the Arguments-tab,
+you add the configuration, you want to run (use the configuration, you just have opened).
+To start the gui, use the main-class "net.sf.shox.visual.ShoX" with no arguments.
2 sections of a configuration file
@@ -38,19 +37,19 @@
2.2 size of the field, node positioning and movement
-The field-section (l. 10-12) defines the size of the used field, where the nodes are
-placed in. The used unit is the same as the unit used for the radio-model. The positions-
-section (l. 13-21) defines the class, which is used to generate the initial placement of
-all nodes. Alternatives to the used RandomStartPositions class are the GridPositionGenerator
-and the UniformStartPositions class. The first one positions the nodes on a grid and uses a
-tunable minimal distance, to set all nodes apart. Each line is filled before the next line
-is started. The second tries to position the nodes uniformly positioned in both directions,
-where the grid dimensions are as close as possible to sqrt(#Nodes) (for ex. are 100 nodes
-placed in a 10 times 10 grid). If this does not suit your needs, you can implement your own
-position generator by implementing a subclass of the StartPositionGenerator class. You can
-do this of course for all referenced classes too. Open the an example implementation and
-find its super-class and which methods to implement. Most aspects of the ShoX framework can
-be replaced this way.
+The field-section (l. 10-12) defines the size of the rectangular network area, where the
+nodes are placed in. The used unit is the same as the unit used for the radio-model. The
+positions-section (l. 13-21) defines the class, which is used to generate the initial
+placement of all nodes. Alternatives to the used RandomStartPositions class are the
+GridPositionGenerator and the UniformStartPositions class. The first one positions the
+nodes on a grid and uses a tunable minimal distance, to set all nodes apart. Each line is
+filled before the next line is started. The second tries to position the nodes uniformly
+positioned in both directions, where the grid dimensions are as close as possible to
+sqrt(#Nodes) (for example are 100 nodes placed in a 10 times 10 grid). If this does not suit
+your needs, you can implement your own position generator by implementing a subclass of
+the StartPositionGenerator class. You can do this of course for all referenced classes too.
+Open the example implementation for the task and find its super-class and which methods to
+implement. Most aspects of the ShoX framework can be replaced this way.
If you activate the nodefile section, you can specify a file, where the generated positions
will be written to. If you omit the generated-section but supply the nodefile section, the
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dir...@us...> - 2009-07-09 11:11:28
|
Revision: 2092
http://shox.svn.sourceforge.net/shox/?rev=2092&view=rev
Author: dirk_held
Date: 2009-07-09 11:10:38 +0000 (Thu, 09 Jul 2009)
Log Message:
-----------
new folder, for new material.
Added Paths:
-----------
trunk/conf/examples/incoming/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dir...@us...> - 2009-07-03 11:09:14
|
Revision: 2091
http://shox.svn.sourceforge.net/shox/?rev=2091&view=rev
Author: dirk_held
Date: 2009-07-03 11:09:05 +0000 (Fri, 03 Jul 2009)
Log Message:
-----------
some clarifications.
Modified Paths:
--------------
trunk/conf/examples/configuration-Intro.txt
Modified: trunk/conf/examples/configuration-Intro.txt
===================================================================
--- trunk/conf/examples/configuration-Intro.txt 2009-07-02 14:51:40 UTC (rev 2090)
+++ trunk/conf/examples/configuration-Intro.txt 2009-07-03 11:09:05 UTC (rev 2091)
@@ -3,15 +3,15 @@
1 locating and using sample configurations
-If you've downloaded ShoX, you can find several sample configurations in the
-"shox/conf" directory. Have a look at "shox/conf/examples/OSRdynamic.xml",
-which is used as example in this documentation. To start a simulation, you
-have to add a new run-configuration to Eclipse (open menu "Run/Run
-Configurations..." and add a new Java Application). On the main-tab, you add
-the project shox (depending on your choice, when creating the shox project).
-The main class is "net.sf.shox.simulator.kernel.Simulator". In the Arguments-
-tab, you add the configuration, you want to run, use "conf/examples/OSRdynamic.xml".
-To start the gui, use the main-class "net.sf.shox.visual.ShoX" with no arguments.
+You can find several sample configurations in the "shox/conf" directory. Have a
+look at "shox/conf/examples/OSRdynamic.xml", which is used as example in this
+documentation. To start a simulation, you have to add a new run-configuration to
+Eclipse (open menu "Run/Run Configurations..." and add a new Java Application).
+On the main-tab, you add the project shox (depending on your choice, when creating
+the shox project). The main class is "net.sf.shox.simulator.kernel.Simulator". In
+the Arguments-tab, you add the configuration, you want to run. For this example,
+use "conf/examples/OSRdynamic.xml". To start the gui, use the main-class
+"net.sf.shox.visual.ShoX" with no arguments.
2 sections of a configuration file
@@ -24,72 +24,78 @@
2.1 pseudo random number generator
-Although each class can create its own pseudo random number generator (PRNG),
-shox offers a central instance, which can be defined in the randomgenerator-
-section (lines 4-9). The example generator is currently the best choice. It
-will generate a random seed for each simulation run, which is dumped on several
-occasions. If you only use the standard random number generator, you can
-reproduce a run to a large extend by specifying the dumped seed. Just uncomment
-the seed parameter in line 7 and enter the value. The PRNG offers several
-distributions you can choose from. The class AppRandomVoiceData in the
-directory shox/conf/examples offers some examples, how to create a special
-distribution. It was taken from another project, but can be easily adapted to
-your needs.
+Although each class can create its own pseudo random number generator (PRNG), shox
+offers a central instance, which can be defined in the randomgenerator-section
+(lines 4-9). The example generator, which is the Mersenne-Twister, is currently the
+best choice. It will generate a random seed for each simulation run, which is written
+to the console on several occasions (at the beginning of a simulation, at the end and
+if the simulation is stopped due to a user exception). If you only use the standard
+random number generator, you can reproduce a run to a large extend by specifying this
+seed. Just uncomment the seed parameter in line 7 and enter the value. The PRNG offers
+several distributions you can choose from. The class AppRandomVoiceData in the directory
+shox/conf/examples offers some examples, how to create a special distribution. It was
+taken from another project, but can be easily adapted to your needs.
2.2 size of the field, node positioning and movement
-The field-section (l. 10-12) defines the size of the used field, where the nodes
-are placed in. The used unit is the same as the unit used for the radio-model.
-The positions-section (l. 13-21) defines the class, which is used to generate
-the initial placement of all nodes. Alternatives are GridPositionGenerator and
-UniformStartPositions. Or add your own descendant of the StartPositionGenerator
-class. If you activate the nodefile section, you can specify a file, where the
-generated positions will be written to. If you omit the generated-section
-but supply the nodefile section, the positions from the nodefile will be used.
+The field-section (l. 10-12) defines the size of the used field, where the nodes are
+placed in. The used unit is the same as the unit used for the radio-model. The positions-
+section (l. 13-21) defines the class, which is used to generate the initial placement of
+all nodes. Alternatives to the used RandomStartPositions class are the GridPositionGenerator
+and the UniformStartPositions class. The first one positions the nodes on a grid and uses a
+tunable minimal distance, to set all nodes apart. Each line is filled before the next line
+is started. The second tries to position the nodes uniformly positioned in both directions,
+where the grid dimensions are as close as possible to sqrt(#Nodes) (for ex. are 100 nodes
+placed in a 10 times 10 grid). If this does not suit your needs, you can implement your own
+position generator by implementing a subclass of the StartPositionGenerator class. You can
+do this of course for all referenced classes too. Open the an example implementation and
+find its super-class and which methods to implement. Most aspects of the ShoX framework can
+be replaced this way.
-The movementmanager-section (l. 22-30) defines if and how nodes move.
-The activated RandomWaypoint class is a good choice for moving nodes.
-The used parameters are described directly within the class. In general, this
-is done at the very beginning of each class, which has parameters.
-If you do not need/want moving nodes, just use the NoMovement-class.
+If you activate the nodefile section, you can specify a file, where the generated positions
+will be written to. If you omit the generated-section but supply the nodefile section, the
+positions from the nodefile will be used.
+The movementmanager-section (l. 22-30) defines if and how nodes move. The activated
+RandomWaypoint class is a good choice for moving nodes. The used parameters are described
+directly within the class. In general, this is done at the very beginning of each class,
+which has parameters. If you do not need/want moving nodes, just use the NoMovement-class.
+
2.3 physical model and bit mangling
-The physicalmodel-section (l. 31-37) define the used physical model. This
-describes, how the propagation of the radio waves in the field is simulated.
-The bitmanglingmodel-section (l. 38-40) describes, what happens, if two or
-more radio-transmissions arrive at a receiver at the same time, or in other
-words determines, if a packet was received correct or not.
+The physicalmodel-section (l. 31-37) define the used physical model. This describes, how
+the propagation of the radio waves in the field is simulated. The bitmanglingmodel-section
+(l. 38-40) describes, what happens, if two or more radio-transmissions arrive at a receiver
+at the same time, or in other words determines, if a packet was received correct or not.
-bitmanglers:
+ShoX offers currently the following bitmanglers:
-1.) NoBitMangling: As the name suggests, no packets are dropped. The use is
-not recommended in conjunction with a nontrivial MAC or PHY (like 802.11bg).
+1.) NoBitMangling: As the name suggests, no packets are dropped. The use is not recommended
+in conjunction with a nontrivial MAC or PHY (like 802.11bg).
-2.) CollisionPacketMangler: Drops a packet, if at least one interference collides
-with it, no matter how weak this interference is. This means that the second
-parameter of a physical model, which describes the interference distance or
-threshold should be better set to the value of the first parameter, if a
-physical model is used, where no attenuation of the signal is determined.
+2.) CollisionPacketMangler: Drops a packet, if at least one interference collides with it,
+no matter how weak this interference is. This means that the second parameter of a physical
+model, which describes the interference distance or threshold, should be better set to the
+value of the first parameter, if a physical model is used, where no attenuation of the signal
+is determined.
-3.) PeakNoiseMangler: Drops a packet, if a colliding interference is found, where
-the signal to noise ratio (SNR) is below a tunable level, for example 2.
-If at a time multiple interferences collide with the transmission, where each
-interference is too insignificant, but the sum would be significant, the result
-is not accurate. This simplification drastically reduces the needed effort,
-to handle the reception of a transmission.
-(Depends on a physical model, where the attenuation is somehow determined)
+3.) PeakNoiseMangler: Drops a packet, if a colliding interference is found, where the signal
+to noise ratio (SNR) is below a tunable level, for example 2. Thus if at a time multiple
+interferences collide with the transmission, where each interference is too insignificant,
+but the sum would be significant, the result is not accurate. This simplification drastically
+reduces the needed effort, to handle the reception of a transmission. (Depends on a physical
+model, where the attenuation is somehow determined)
-4.) AddedNoiseMangler: Adds all current interferences up and drops the packet,
-if the SNR drops at any time below a tunable level.
-(Depends on a physical model, where the attenuation is somehow determined)
+4.) AddedNoiseMangler: Adds all current interferences up and drops the packet, if the SNR
+drops at any time below a tunable level. (Depends on a physical model, where the attenuation
+is somehow determined)
-useful combinations of a physical model with a bit mangler:
+Useful combinations of a physical model with a bit mangler:
a.) SimplePhysics + NoBitMangling
All nodes can reach each other and are in the same collision set.
-Probably useless, when used with a nontrivial MAC.
+This combination is not recommended, when used with a nontrivial MAC.
b.) UnitDisk + CollisionPacketMangler
This is probably the most basic model. The UnitDisc model describes a disc with the
@@ -106,8 +112,8 @@
e.) IndoorAttenuationFactor + PeakNoiseMangler|AddedNoiseMangler
-Uses a map to calculate the attenuation of the transmission for each
-passed obstacle.
+The IndoorAttenuationFactor class uses a map to calculate the attenuation of the
+transmission for each passed obstacle.
f.) VariableDisc + PeakNoiseMangler|AddedNoiseMangler
@@ -120,42 +126,43 @@
2.4 nodes and layers
-It is possible, to exchange several layers for all nodes. There are the
-physical layer, the MAC layer, the logical link layer, the network layer,
-the operating system layer and the application layer. The example
-specifies only the physical, the MAC, the network and the application
-layer. The remaining layers are set to dummy implementations, which
-only forward all received packets along the direction of the packet.
+It is possible, to exchange several layers for all nodes. There are the physical layer,
+the MAC layer, the logical link layer, the network layer, the operating system layer
+and the application layer. The example specifies only the physical, the MAC, the
+network and the application layer. The remaining layers are set to dummy implementations,
+which only forwards all received packets up or down the layer-stack, along the direction
+of the packet.
The count section in line 36 specifies the number of nodes for the simulation.
2.4.1 physical layers
-Currently only the dummy and the 802.11bg implementation are available.
-Which are the PhysicalDebug and the PHY_802_11bg class. If you do not
-care about a MAC or a physical layer and thus do not specify them, the
-PhysicalDebug class is used. If you wand to implement a new (for ex. TDMA)
-MAC on top of the 802.11bg hardware, specify the PHY_802_11bg class.
-This class is of course needed, if the 802.11bg MAC is used.
+Currently only the dummy and the 802.11bg implementation are available. Which are the
+PhysicalDebug and the PHY_802_11bg class. If you do not care about a MAC or a physical
+layer and thus do not specify them, the PhysicalDebug class is used. If you wand to
+implement a new (for example TDMA) MAC on top of the 802.11bg hardware, specify the
+PHY_802_11bg class. This class is of course needed, if the 802.11bg MAC is used.
2.4.2 MAC layers
-Likewise to the physical layer, only the dummy and the 802.11bg implementation
-are currently available. The 802.11bg MAC of course needs the 802.11bg physical
-layer and the MACdebug class works with the PhysicalDebug class.
+Likewise to the physical layer, only the dummy and the 802.11bg implementation are
+currently available. The 802.11bg MAC of course needs the 802.11bg physical layer and
+the MACdebug class works with the PhysicalDebug class.
2.4.3 logical link layers
There are several descendants of the LogLinkLayer class, like OBMStatisticLayer,
-StaticGridBackboneLogLinkLayer class, LogLinkDebug class and the
-LogLinkPosition class. The LogLinkDebug class is again the dummy implementation,
-which is used, if nothing else was specified. For the remaining classes, not much
-information is available. See the shox/conf/examples/ll directory for an example
-implementation of a layer, which aggregates multiple packets to the same receiver
-to a larger one, to reduce the overhead, when many packets are sent. To do so,
-small packets are delayed for some time and combined with other small packets
-for the same receiver, until they are sent. Although this is not a logical link
-task, this class can be used as an example, how to implement a layer and how to
+StaticGridBackboneLogLinkLayer class, LogLinkDebug class and the LogLinkPosition class.
+The LogLinkDebug class is again the dummy implementation, which is used, if nothing else
+was specified. For the remaining classes, not much information is available. The the source
+of each class, where a short comment at the beginning and the comment of the parameters may
+give you a hint about the function.
+
+See the shox/conf/examples/ll directory for an example implementation of a layer, which
+aggregates multiple packets to the same receiver to a larger one, to reduce the overhead,
+when many packets are sent. To do so, small packets are delayed for some time and combined
+with other small packets for the same receiver, until they are sent. Although this is not a
+logical link task, this class can be used as an example, how to implement a layer and how to
do logging and statistics.
2.4.4 network layers
@@ -197,13 +204,13 @@
The whole simulation can be recorded and replayed within the gui. During each run
arbitrary statistics can be created and later on visualized within the gui. To do so,
set logging to true (line 59) and add a file-name for the parts, you need in line 60
-and 61, where history refers to the simulation-replay file and statistics to the
-file, where all statistics are dumped to. The first implementation, which stores
-the data, used XML, which has lead to LARGE files. The current compact file
-logger is much more economical. To reduce the number of entries to the history
-even more, you can add filters (see lines 67 to 77).
+and 61, where history refers to the simulation-replay file and statistics to the file,
+where all statistics are written to. The first implementation, which stores the data,
+used XML, which has lead to LARGE files. The current compact file logger is much more
+economical. To reduce the number of entries to the history even more, you can add
+filters (see lines 67 to 77).
The last section simulationtime (line 81) is used, to specify the granularity of the
-simulation time and the total duration in seconds. There may be unexpected
-side effects, when changing stepspersecond, thus just keep it as is.
+simulation time and the total duration in seconds. There may be unexpected side effects,
+when changing stepspersecond, thus just keep it as is.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dir...@us...> - 2009-07-02 15:13:06
|
Revision: 2090
http://shox.svn.sourceforge.net/shox/?rev=2090&view=rev
Author: dirk_held
Date: 2009-07-02 14:51:40 +0000 (Thu, 02 Jul 2009)
Log Message:
-----------
typos.
Modified Paths:
--------------
trunk/conf/examples/layer-prog-Intro.txt
Modified: trunk/conf/examples/layer-prog-Intro.txt
===================================================================
--- trunk/conf/examples/layer-prog-Intro.txt 2009-07-02 14:39:00 UTC (rev 2089)
+++ trunk/conf/examples/layer-prog-Intro.txt 2009-07-02 14:51:40 UTC (rev 2090)
@@ -30,21 +30,21 @@
returns the global pseudo random number generator, which yields random numbers with the next*()
calls. To resolve the neighborhood directly, without having to detect them first, using extra packets,
use the node.getNeighbors(), getNeighborCount(), or resolveNeighbor() methods. Although there are
-other public methods, which deal with neighbors, they are only used internally. Although it may be
-useful, to directly access the MAC-Layer of of a neighbors node, to check, if a packet has reached
-this node, to have exact statistics, lots of nasty things can be done this way. It is up to you, how
-you use so-called god-knowledge or god-methods, since in reality one node cannot directly access
-other nodes inner state.
+other public methods, which deal with neighbors, they are only used internally.
+Although it may be useful, to directly access the MAC-Layer of of a neighbors node, to check, if a
+packet has reached this node, to have exact statistics, lots of nasty things can be done this way.
+It is up to you, how you use so-called god-knowledge or god-methods, since in reality one node
+cannot directly access other nodes inner state.
2. The packet-class
-Each packet has its own header, a current direction (up or down the layer-stack), a timestamp
-of the creation time and a pointer to the inner packet of the next higher layer. The creating layer
-uses the Packet(Address sender, NodeId receiver) constructor to create the innermost layer,
-where the header is actually the payload of the packet. Use NodeId.ALLNODES as broadcast-
-address, if needed. The other two constructors are used down the layer-stack, to wrap the
-layer-specific header around a packet, which was received from a higher layer. Only the network-
-layer may specify a new receiver, which is the next hop along the path to the final receiver.
+Each packet has its own header, a current direction (up or down the layer-stack), a timestamp of the
+creation time and a pointer to the inner packet of the next higher layer. The creating layer uses the
+Packet(Address sender, NodeId receiver) constructor to create the innermost layer, where the header is
+actually the payload of the packet. Use NodeId.ALLNODES as broadcast-address, if needed. The other two
+constructors are used down the layer-stack, to wrap the layer-specific header around a packet, which
+was received from a higher layer. Only the network-layer may specify a new receiver, which is the next
+hop along the path to the final receiver.
here is an extract of the methods of the packet class:
@@ -134,7 +134,7 @@
MAC-Layer. The layerState of the application-layer is used to form a return code. The enum
ApplicationState offers the values CREATED, WAITING, RUNNING, FAILED, DONE. If the value is
not set to DONE before the end, the value is set to FAILED. At the end, the number of done and
-failed nodes is printed. Thus this just for your quick information at the end.
+failed nodes is printed. This just for your quick information at the end.
9. dumping link- and node-states
@@ -144,5 +144,5 @@
stored as link- or node-state. See OSRL at lines ~60-97 for some wrapper routines, which can write
a link- or node-state. After completing a run, start the GUI and open the file history.compact
in the shox directory with the "File/Open Log File ..." menu. After parsing the data, a new tab
-"Monitor" should become visible. The menu "Mapping/Config Mapping ..." offers the possibility, to
+"Monitor" should be created. The menu "Mapping/Config Mapping ..." offers the possibility, to
assign certain values to certain visualizations, like node color, node/link-label.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dir...@us...> - 2009-07-02 14:39:01
|
Revision: 2089
http://shox.svn.sourceforge.net/shox/?rev=2089&view=rev
Author: dirk_held
Date: 2009-07-02 14:39:00 +0000 (Thu, 02 Jul 2009)
Log Message:
-----------
rewrote intro.
Modified Paths:
--------------
trunk/conf/examples/layer-prog-Intro.txt
Modified: trunk/conf/examples/layer-prog-Intro.txt
===================================================================
--- trunk/conf/examples/layer-prog-Intro.txt 2009-07-02 14:28:06 UTC (rev 2088)
+++ trunk/conf/examples/layer-prog-Intro.txt 2009-07-02 14:39:00 UTC (rev 2089)
@@ -1,19 +1,19 @@
0 quick overview
-The most basic methods a layer has to implement are the lowerSAP (service access point) and the
-upperSAP (the application layer has no such thing). All packets go through these calls. Each layer
-also has to listen to (own) wakeup calls. The central hub for these events is the processWakeUpCall
+The following text will refer to the OptimalSourceRoutingLayer class (OSRL), which is located in
+net.sf.shox.simulator.node.user is a short example, how to implement a (network) layer. The most
+basic methods a layer has to implement are the lowerSAP (service access point) and the upperSAP
+(the application layer has no such thing). All packets go through these calls. Each layer also
+has to listen to (own) wakeup calls. The central hub for these events is the processWakeUpCall
method. All timer events for example go through this call. If you need to configure your layer
depending on the configuration, the initConfiguration method is the place to go. The configuration
object contains some external values, like simulation duration or node count. All the parameters,
-which you have created, by marking your variables with a @ShoXParameter tag, a filled now. In
-most cases the processEvent calls with a Initialize, StartSimulation or Finalize event are used too,
-to take action in the respective phase of the simulation run. No layer should send packets prior the
-StartSimulation event. Any final statistics for example must be collected, when the Finalize event is
-received. A layer may have some states, which may me exported or even may be modified by other
-layers. To do so, the methods getState and setState are used. The OptimalSourceRoutingLayer class
-(OSRL), which is located in net.sf.shox.simulator.node.user is a short example, how to implement a
-layer. The following text will mainly use this implementation of a network-layer as simple example.
+which you have created, by marking your variables with a @ShoXParameter tag, a filled now. In most
+cases the processEvent calls with a Initialize, StartSimulation or Finalize event are used too, to
+take action in the respective phase of the simulation run. No layer should send packets prior the
+StartSimulation event. Any final statistics for example must be collected, when the Finalize event
+is received. A layer may have some states, which may me exported or even may be modified by other
+layers. To do so, the methods getState and setState are used.
1. some predefined variables and methods, to use
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dir...@us...> - 2009-07-02 14:28:14
|
Revision: 2088
http://shox.svn.sourceforge.net/shox/?rev=2088&view=rev
Author: dirk_held
Date: 2009-07-02 14:28:06 +0000 (Thu, 02 Jul 2009)
Log Message:
-----------
typos.
Modified Paths:
--------------
trunk/conf/examples/configuration-Intro.txt
Modified: trunk/conf/examples/configuration-Intro.txt
===================================================================
--- trunk/conf/examples/configuration-Intro.txt 2009-07-02 13:13:23 UTC (rev 2087)
+++ trunk/conf/examples/configuration-Intro.txt 2009-07-02 14:28:06 UTC (rev 2088)
@@ -4,14 +4,14 @@
1 locating and using sample configurations
If you've downloaded ShoX, you can find several sample configurations in the
-"shox/conf" directory. Have a look at "shox/conf/OSRdynamic.xml", which is
-used as example in this documentation. To start a simulation, you have to add
-a new run-configuration to Eclipse (open menu Run/Run Configurations... and
-add a new Java Application). On the main-tab, you add the project shox
-(depending on your choice, when creating the shox project). The main class is
-"net.sf.shox.simulator.kernel.Simulator". In the Arguments-tab, you add the
-configuration, you want to run, use "conf/examples/OSRdynamic.xml". To start
-the gui, use the main-class "net.sf.shox.visual.ShoX" with no arguments.
+"shox/conf" directory. Have a look at "shox/conf/examples/OSRdynamic.xml",
+which is used as example in this documentation. To start a simulation, you
+have to add a new run-configuration to Eclipse (open menu "Run/Run
+Configurations..." and add a new Java Application). On the main-tab, you add
+the project shox (depending on your choice, when creating the shox project).
+The main class is "net.sf.shox.simulator.kernel.Simulator". In the Arguments-
+tab, you add the configuration, you want to run, use "conf/examples/OSRdynamic.xml".
+To start the gui, use the main-class "net.sf.shox.visual.ShoX" with no arguments.
2 sections of a configuration file
@@ -26,8 +26,8 @@
Although each class can create its own pseudo random number generator (PRNG),
shox offers a central instance, which can be defined in the randomgenerator-
-section (l. 4-9). The example generator is currently the best choice. It will
-generate a random seed for each simulation run, which is dumped on several
+section (lines 4-9). The example generator is currently the best choice. It
+will generate a random seed for each simulation run, which is dumped on several
occasions. If you only use the standard random number generator, you can
reproduce a run to a large extend by specifying the dumped seed. Just uncomment
the seed parameter in line 7 and enter the value. The PRNG offers several
@@ -111,9 +111,9 @@
f.) VariableDisc + PeakNoiseMangler|AddedNoiseMangler
-Simulates a quadratic decaying radio signal with two thresholds. One for
-the reachable distance, the other for the interference distance, by the
-minimum needed RSSI, to have an effect.
+Simulates a quadratic decaying radio signal with two thresholds. One for the minimum
+needed signal strength at which a packet is still received successfully, the other
+for the signal strength at which a transmission still interferes with other signals.
The easiest way to get some more realism, compared to the
example, is choice c or f.
@@ -141,7 +141,7 @@
2.4.2 MAC layers
Likewise to the physical layer, only the dummy and the 802.11bg implementation
-are available. The 802.11bg MAC of course needs the 802.11bg physical
+are currently available. The 802.11bg MAC of course needs the 802.11bg physical
layer and the MACdebug class works with the PhysicalDebug class.
2.4.3 logical link layers
@@ -154,9 +154,9 @@
implementation of a layer, which aggregates multiple packets to the same receiver
to a larger one, to reduce the overhead, when many packets are sent. To do so,
small packets are delayed for some time and combined with other small packets
-for the same receiver, until they are sent. Although this is not a logical link task,
-this class can be used as an example, how to implement a layer and how to do
-logging and statistics.
+for the same receiver, until they are sent. Although this is not a logical link
+task, this class can be used as an example, how to implement a layer and how to
+do logging and statistics.
2.4.4 network layers
@@ -167,18 +167,18 @@
b.) OptimalSourceRouting: Used in the example and determines the next hop by
questioning an oracle. This class is applicable for static and for moving nodes
-and is the real dummy-implementation, since it performes real routing.
+and is the real dummy-implementation, since it performs real routing.
c.) AodvNetworkLayer: implements the aodv protocol.
(timing parameters seem to be simulation steps, instead of seconds, thus be
-carefull, when you change the resolution of the simulation to another value)
+careful, when you change the resolution of the simulation to another value)
d.) AodvmNetworkLayer: currently incomplete multipath variant of the aodv implementation.
e.) Threephase: implements a geographic routing scheme.
If you do not care about routing, or want to eliminate the influence of routing
-on your personal layers, you wand to analyze, use b. Implementation a makes
+on your personal layers, you want to analyze, use b. Implementation a makes
not much sense for nontrivial setups, but d and e should be usable.
2.4.5 operating system layers
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|