summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--esds/platform.py8
-rwxr-xr-xmanual/assets/orchestrator.py17
-rw-r--r--manual/assets/output.txt4
-rw-r--r--manual/manual.pdfbin280551 -> 287999 bytes
-rw-r--r--manual/manual.tex42
5 files changed, 54 insertions, 17 deletions
diff --git a/esds/platform.py b/esds/platform.py
index 508fdc4..f878262 100644
--- a/esds/platform.py
+++ b/esds/platform.py
@@ -24,10 +24,10 @@ class UnitsParser:
break
number=float(bw[:i])
unit=bw[i:]
- number=number*1000 if unit == "Mbps" else number
- number=number*1000*8 if unit == "MBps" else number
- number=number*100 if unit == "kbps" else number
- number=number*100*8 if unit == "kBps" else number
+ number=number*1000*1000 if unit == "Mbps" else number
+ number=number*1000*1000*8 if unit == "MBps" else number
+ number=number*1000 if unit == "kbps" else number
+ number=number*1000*8 if unit == "kBps" else number
number=number*8 if unit == "Bps" else number
return(number)
diff --git a/manual/assets/orchestrator.py b/manual/assets/orchestrator.py
new file mode 100755
index 0000000..2886dd9
--- /dev/null
+++ b/manual/assets/orchestrator.py
@@ -0,0 +1,17 @@
+#!/usr/bin/env python
+
+import esds
+import numpy as np
+
+n=2 # 2 nodes
+B=np.full((n,n),50*1000) # Bandwith+txperfs 5bps
+L=np.full((n,n),0) # Latency 0s
+
+s=esds.Simulator({"wlan0":{"bandwidth":B, "latency":L, "is_wired":False}})
+
+##### Instantiate nodes with their implementation
+s.create_node("node",args="sender") # Use node.py for the first node with "sender" as argument
+s.create_node("node",args="receiver") # Now the second node
+
+##### Run the simulation
+s.run()
diff --git a/manual/assets/output.txt b/manual/assets/output.txt
index 858bd83..f3cc6c7 100644
--- a/manual/assets/output.txt
+++ b/manual/assets/output.txt
@@ -1,3 +1,3 @@
[t=0.000,src=n0] Send 10 bytes on wlan0
-[t=0.016,src=n1] Receive 10 bytes on wlan0
-[t=0.016,src=esds] Simulation ends
+[t=0.002,src=n1] Receive 10 bytes on wlan0
+[t=0.002,src=esds] Simulation ends
diff --git a/manual/manual.pdf b/manual/manual.pdf
index d8877e2..aac0fbd 100644
--- a/manual/manual.pdf
+++ b/manual/manual.pdf
Binary files differ
diff --git a/manual/manual.tex b/manual/manual.tex
index 9300e72..9d80be2 100644
--- a/manual/manual.tex
+++ b/manual/manual.tex
@@ -18,7 +18,7 @@
\newcommand{\stateoff}{"\textit{off}"\xspace}
\newcommand{\stateon}{"\textit{on}"\xspace}
\newcommand{\version}{\InputIfFileExists{version}{}{version}}
-\newcommand*{\addsource}[2]{\vspace{0.3cm}\begin{tcolorbox}[breakable,enhanced,arc=1.4mm,arc is angular,title=\textbf{\small#1}]\inputminted[fontsize=\scriptsize]{#2}{#1}\end{tcolorbox}}
+\newcommand*{\addsource}[2]{\vspace{0.3cm}\begin{tcolorbox}[breakable,enhanced,arc=1.4mm,arc is angular,title=\textbf{\small#1}]\inputminted[breaklines,fontsize=\scriptsize]{#2}{#1}\end{tcolorbox}}
% Document
\begin{document}
@@ -55,28 +55,35 @@
\label{architecture}
\end{figure}
-ESDS simulator comprises two major components: 1) The Simulation Orchestrator(SO) 2) The Simulated
+ESDS simulator comprises two major components: 1) The Simulation Orchestrator (SO) 2) The Simulated
Nodes (SN). This architecture is depicted in Figure \ref{architecture}. The SO is the main process
-in charge of implementing the simulation main loop. It instantiates the network (e.g bandwidths
-andlatencies), collects and processes the events (e.g communications,turn on/off). On the
-other hand, nodes are threads that implement the nodes behaviors.
+in charge of implementing the simulation main loop. It instantiates the network (e.g bandwidths and
+latencies), collects and processes the events (e.g communications,turn on/off). On the other hand,
+nodes are threads that implement the node behaviors.
\section{Running your first simulation}
To run a simulation, at least 2 files are required: 1) a platform file 2) a node implementation
-source code. The platform file defines the simulated network platform and sets various simulation
-parameters. The node implementation source code simply provide the logic of the simulated nodes.
+source code. The platform file defines the simulated network platform (network links and
+performances etc.) and sets various simulation parameters. The node implementation source code
+provides the logic of the simulated nodes.
\subsection{Platform file}
-Platform files are written in YAML and contains 3 sections: 1) \textit{general} 2) \textit{nodes} 3) \textit{interfaces}.
-The \textit{general} section is optional but all the others must be present. Here is a simple platform file to simulate 2 wireless nodes:
+
+Platform files are written in YAML and contains 3 sections namely: 1) \textit{general} 2)
+\textit{nodes} 3) \textit{interfaces}. The \textit{general} section is optional but all the other
+sections must be present. Here is an example of a simple platform file to simulate 2 wireless nodes:
\addsource{assets/platform.yaml}{yaml}
\subsection{Node implementation file}
-Nodes implementations are written using python. Here is the implementation of the node used in the previous platform.yaml file:
+
+Nodes implementations are written using python. Here is the implementation of the node mentioned in
+the last \verb|platform.yaml| file:
\addsource{assets/node.py}{python}
\subsection{Execution}
+\label{sec:firstsimulation:execution}
+
To execute our first simulation, the following command should be executed from the same folder
that contains \verb|platform.yaml| and \verb|node.py|:
\begin{verbatim}
@@ -84,7 +91,20 @@ that contains \verb|platform.yaml| and \verb|node.py|:
\end{verbatim}
Here is the output of the simulation:
\verbatiminput{assets/output.txt}
-In this case, simulation tooks $0.016s$ and $10$ bytes were sent on the wlan0 interface from node 0 (src=n0) to node 1 (src=n1).
+In this case, simulation tooks $0.002s$ and $10$ bytes were sent on the wlan0 interface from node 0
+(src=n0) to node 1 (src=n1).
+
+\subsection{Custom orchestrator instantiation}
+
+Instead of using a \verb|platform.yaml| file, it is possible to instantiate manually the esds
+orchestrator. To do so, you need to implement that procedure in a python file. Here is and example
+that performs the exact same simulation presented in Section \ref{sec:firstsimulation:execution} but
+with a custom instantiation of the orchestrator:
+\addsource{assets/orchestrator.py}{python}
+Next we can run the simulation:
+\begin{verbatim}
+ > ./orchestrator.py
+\end{verbatim}
\end{document}