⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 nido.tex

📁 无线通信的主要编程软件,是无线通信工作人员的必备工具,关天相关教程我会在后续传上.
💻 TEX
📖 第 1 页 / 共 4 页
字号:
\documentclass[10pt,fleqn]{article}\usepackage{graphicx}\usepackage{graphics}\usepackage{multicol}\usepackage{epsfig,amsmath,amsfonts}\usepackage{xspace}\usepackage{url}\usepackage{subfigure}\makeatletter                                   % Make '@' accessible. \oddsidemargin=0in                              % Left margin minus 1 inch.\evensidemargin=0in                             % Same for even-numbered pages.\marginparsep=0pt                               % Space between margin & text\renewcommand{\baselinestretch}{1.2}              % Double spacing\textwidth=6.5in                                % Text width (8.5in - margins).\textheight=9in                                 % Body height (incl. footnotes)\topmargin=0in                                  % Top margin minus 1 inch.\headsep=0.0in                                  % Distance from header to body.\skip\footins=4ex                               % Space above first footnote.\hbadness=10000                                 % No "underfull hbox" messages.\makeatother                                    % Make '@' special again.\def\sim{TOSSIM\xspace}\def\tinyviz{TinyViz\xspace}\def\mote{mote\xspace}\def\motes{motes\xspace}\def\Mote{Mote\xspace}\def\Motes{Motes\xspace}\begin{document}\fontfamily{cmss}                               % Make text sans serif.\fontseries{m}                                  % Medium spacing.\fontshape{n}                                   % Normal: not bold, etc.\fontsize{10}{10}                               % 10pt font, 10pt line spacing \title{\vspace{2.5in}\sim: A Simulator for TinyOS Networks}\author{Philip Levis and Nelson Lee\\ pal@cs.berkeley.edu}\maketitle\vspace{2in}\begin{center}Version 1.0\\June 26, 2003\end{center}\newpage\fontfamily{cmr}                                % Make text Roman (serif).\fontseries{m}                                  % Medium spacing.\fontshape{n}                                   % Normal: not bold, etc.\fontsize{10}{10}                               % 10pt font, 10pt line spacing\tableofcontents\section{Introduction}\sim is a discrete event simulator for TinyOS sensornetworks. Instead of compiling a TinyOS application for a mote, userscan compile it into the \sim framework, which runs on a PC. Thisallows users to debug, test, and analyze algorithms in a controlledand repeatable environment. As \sim runs on a PC, users can examinetheir TinyOS code using debuggers and other development tools. Thisdocument briefly describes the design philosophy of\sim, its capabilities, its structure. It also provides a brieftutorial on how to use \sim for testing or analysis.\sim's primary goal is to provide a high fidelity simulation of TinyOSapplications. For this reason, it focuses on simulating TinyOS and itsexecution, rather than simulating the real world. While \sim can beused to understand the causes of behavior observed in the real world,it does not capture all of them, and should not be used for absoluteevaluations.\sim is not always the right simulation solution; like anysimulation, it makes several assumptions, focusing on making somebehaviors accurate while simplying others. One of the most commonquestions about \sim is whether it can ``simulate X'' or whether it``has an accurate X model.'' In hope of answering most of suchquestions, here is a brief summmary of its characteristics:\begin{itemize}\item{\bf Fidelity:} By default, \sim captures TinyOS' behavior at avery low level. It simulates the network at the bit level, simulateseach individual ADC capture, and every interrupt in the system.\item{\bf Time:} While \sim precisely times interrupts (allowingthings like bit-level radio simulation), it does not model executiontime. From \sim's perspective, a piece of code runsinstantaneously. Time is kept at a 4MHz granularity (the CPU clockrate of the rene and mica platforms). This also means that spin locksor task spin locks will never exit: as the code runs instantaneously,the event that would allow the spin to stop will not occur until thecode completes (never).\item{\bf Models:} \sim itself does not model the real world. Instead,it provides abstractions of certain real-world phenomena (such as biterror). With tools outside the simulation itself, users can thenmanipulate these abstractions to implement whatever models they wantto use. By making complex models exterior to the simulation, \simremains flexible to the needs of many users without trying toestablish what is ``correct.'' Additionally, it keeps the simulationsimple and efficient.\begin{itemize}\item{\bf Radio:} \sim does not model radio propagation;instead, it provides a radio abstraction of directed independent biterrors between two nodes. An external program can provide a desiredradio model and map it to these bit errors. Having directed bit errorrates means that asymmetric links can be easily modeled. Independentbit errors mean longer packets have a higher probability ofcorruption, and each packet's loss probability is independent.\item{\bf Power/Energy:} \sim does not model power draw or energyconsumption. However, it is very simple to add annotations tocomponents that consume power to provide information on when theirpower states change (e.g., turned on or off). After a simulation isrun, a user can apply a energy or power model to these transitions,calculating overall energy consumption. Because \sim does not modelCPU execution time, it cannot easily provide accurate information forcalculating CPU energy consumption.\end{itemize}\item{\bf Building:} \sim builds directly from TinyOS code. To simulatea protocol or system, you must write a TinyOS implementation of it. Onone hand, this is often more difficult than an abstract simulation; onthe other, it means you can then take your implementation and run iton actual motes.\item{\bf Imperfections:} Although \sim captures TinyOSbehavior at a very low level, it makes several simplifyingassumptions. This means that it is very possible that code which runsin a simulation might not run on a real mote. For example, in \siminterrupts are non-preemptive (a result of being a discrete eventsimulator). On a real mote, an interrupt can fire while other code isrunning. If pre-emption can put a mote in an unrecoverable state, thensimulated motes will run without mishap while real-world motes mayfail. Also, if interrupt handlers run too long, a real-world mote maycrash; as code in \sim runs instantaneously, no problems will appearin simulation. \item{\bf Networking:} Currently, \sim simulates the 40Kbit RFM micanetworking stack, including the MAC, encoding, timing, and synchronousacknowledgements. It does not simulate the mica2 ChipCon CC1000 stack.We are waiting to have a better understanding of the behavior ofCC1000 before writing a simulation implementation.\item{\bf Authority:} Initial experience from real-world deployments has shownthat TinyOS networks have very complex and highly variable behavior.While \sim is useful to get a sense of how algorithms perform incomparison to one another, \sim results shouldn't be consideredauthoritative. For example, \sim can tell you that one algorithmbehaves better than another under high loss, but the question remainsas to whether the specified loss scenario has any basis in the realworld. \sim should not be considered an end-point of evaluation;instead, it is a system that allows the user to separate outenvironmental noise to better understand algortithms.\end{itemize}\section{Compiling and Running a Simulation}\sim is automatically built when you compile anapplication. Applications are compiled by entering an applicationdirectory (e.g. {\tt /apps/Blink}) and typing {\ttmake}. Alternatively, when in an application directory, you can type{\tt make pc}, which will only compile a simulation of theapplication.There are several compilation options to {\tt ncc} when compiling forTOSSIM, including the maximum number of motes that can besimulated. The default options in the TinyOS 1.1 makefile should fitalmost any need; refer to the nesC manual for further information onthe options available.The \sim executable is named {\tt main.exe}, and resides in {\ttbuild/pc}. It has the following usage:\begin{verbatim}Usage: ./build/pc/main.exe [options] num_nodes  [options] are:  -h, --help        Display this message.  -gui              pauses simulation waiting for GUI to connect  -a=<model>        specifies ADC model (generic is default)                    options: generic random  -b=<sec>          motes boot over first <sec> seconds (default: 10)  -ef=<file>        use <file> for eeprom; otherwise anonymous file is used  -l=<scale>        run sim at <scale> times real time (fp constant)  -r=<model>        specifies a radio model (simple is default)                    options: simple static lossy  -rf=<file>        specifies file input for lossy model (lossy.nss is default)  -s=<num>          only boot <num> of nodes  -t=<sec>          run simulation for <sec> virtual seconds  num_nodes         number of nodes to simulate\end{verbatim}The {\tt -h} or {\tt --help} options prints out the above usagemessage, and some additional information.The {\tt -a} option specifies the ADC model to use. \sim currentlysupports two models: generic and random. Section~\ref{sec:adc}describes these models.The {\tt -b} option specifies the interval over which motesboot. Their boot times are uniformly distributed over thisinterval. The default value is ten seconds.The {\tt -e} option is for named EEPROM files. If {\tt -e} isn'tspecified, the logger component stores and reads data, but this datais not persistent across simulator invocations: it uses an anonymousfile. Section~\ref{sec:eeprom} describes how the EEPROM in \sim works.The {\tt -l} option is for making \sim run at a rate representative ofreal time. The {\tt scale} argument specifies what relative rateshould be used. For example, {\tt -l=2.0} means twice as fast as realtime (two virtual seconds run in one real second), while {\tt -l=0.1}means one tenth of real time (one virtual seconds runs in ten realseconds.). \sim can only run so fast; specifying it to run faster thanit can will cause it to run as quickly as possible. Using this optionimposes a significant performance overhead; it shouldn't be used whentrying to run simulations quickly.The {\tt -r} option specifies the radio model to use. \sim currentlysupports two models: simple and lossy. Earlier versions also supporteda ``static'' model, but this has been subsumed by the lossymodel. Section~\ref{sec:radio} describes these modelsThe {\tt -s} option tells \sim to only boot a subset of the number ofnodes specified. This is useful if you want some to boot later, inresponse to user input. If the {\tt -s} option is specified, \simboots mote IDs 0-{\tt (num - 1)}.The {\tt -t} option tells \sim to run for a specified number ofvirtual seconds. After {\tt sec} seconds have passed, \sim exits cleanly.The {\tt num\_nodes} option specifies how many nodes should besimulated. A compile-time upper bound is specified in {\tt/apps/Makerules}. The standard TinyOS distribution sets this value tobe 1000. By default, all {\tt num\_nodes} boot in the first tenseconds of simulation, with bootup times uniformly distributed.\sim catches SIGINT (control-C) to exit cleanly. This is useful whenprofiling code.\subsection{dbg}\sim provides configuration of debugging output at run-time. Much of theTinyOS source contains debugging statements. Each debugging statementis accompanied by one or more modal flags. When the simulator starts,it reads in the DBG environment variable to determine which modesshould be enabled. Modes are stored and processed as entries in abit-mask, so a single output can be enabled for multiple modes, and auser can specify multiple modes to be displayed. The set of DBG modesrecognized by \sim can be identified by using the {\tt -h} option; allavailable modes are printed. The current modes are:\scriptsize

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -