12.07.2015 Views

The ns Manual (formerly ns Notes and Documentation)1 - NM Lab at ...

The ns Manual (formerly ns Notes and Documentation)1 - NM Lab at ...

The ns Manual (formerly ns Notes and Documentation)1 - NM Lab at ...

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

v 0.8123 link-up 3 5v 0.8123 link-up 5 3v 3.5124 link-down 3 5v 3.5124 link-down 5 3<strong>The</strong>se lines above indic<strong>at</strong>e th<strong>at</strong> Link 〈3, 5〉 failed <strong>at</strong> 0.8123s., <strong>and</strong> recovered <strong>at</strong> time 3.5124s.31.2 <strong>The</strong> Internal ArchitectureEach model of network dynamics is implemented as a separ<strong>at</strong>e class, derived from the base class rtModel. We beginby describing the base class rtModel <strong>and</strong> the derived classes (Section 31.2.1). <strong>The</strong> network dynamics models use an internalqueuing structure to e<strong>ns</strong>ure th<strong>at</strong> simultaneous events are correctly h<strong>and</strong>led, the class rtQueue. <strong>The</strong> next subsection (Section31.2.2) describes the internals of this structure. Finally, we describe the exte<strong>ns</strong>io<strong>ns</strong> to the existing classes (Section 31.3.1):the Node, Link, <strong>and</strong> others.31.2.1 <strong>The</strong> class rtModelTo use a new route model, the routine rtmodel{} cre<strong>at</strong>es an i<strong>ns</strong>tance of the appropri<strong>at</strong>e type, defines the node or link th<strong>at</strong>the model will oper<strong>at</strong>e upon, configures the model, <strong>and</strong> possibly enables tracing; <strong>The</strong> individual i<strong>ns</strong>tance procedures th<strong>at</strong>accomplish this in pieces are:<strong>The</strong> co<strong>ns</strong>tructor for the base class stores a reference to the Simul<strong>at</strong>or in its i<strong>ns</strong>tance variable, <strong>ns</strong>_. It also initializes thestartTime_ <strong>and</strong> finishTime_ from the class variables of the same name.<strong>The</strong> i<strong>ns</strong>tance procedure set-elements identifies the node or link th<strong>at</strong> the model will oper<strong>at</strong>e upon. <strong>The</strong> comm<strong>and</strong> storestwo arrays: links_, of the links th<strong>at</strong> the model will act upon; nodes_, of the incident nodes th<strong>at</strong> will be affected bythe link failure or recovery caused by the model.<strong>The</strong> default procedure in the base class to set the model configur<strong>at</strong>ion parameters is set-parms. It assumes a well definedstart time, up interval, down interval, <strong>and</strong> a finish time, <strong>and</strong> sets up configur<strong>at</strong>ion parameters for some class of models.It stores these values in the i<strong>ns</strong>tance variables: startTime_, upInterval_, downInterval_, finishTime_.<strong>The</strong> exponential <strong>and</strong> deterministic models use this default routine, the trace based <strong>and</strong> manual models define their ownprocedures.<strong>The</strong> i<strong>ns</strong>tance procedure trace{} enables trace-dynamics{} on each of the links th<strong>at</strong> it affects. Additional detailson trace-dynamics{} is discussed in the section on exte<strong>ns</strong>io<strong>ns</strong> to the class Link (Section 31.3.1).<strong>The</strong> next sequence of configur<strong>at</strong>ion steps are taken just prior to the start of the simul<strong>at</strong>or. <strong>ns</strong> invokes rtmodel-configure{}just before starting the simul<strong>at</strong>ion. This i<strong>ns</strong>tance procedure first acquires an i<strong>ns</strong>tance of the class rtQueue, <strong>and</strong> then invokesconfigure{} for each route model in its list, rtModel_.<strong>The</strong> i<strong>ns</strong>tance procedure configure{} makes each link th<strong>at</strong> is is applied to dynamic; this is the set of links stored inits i<strong>ns</strong>tance variable array, links_. <strong>The</strong>n the procedure schedules its first event.<strong>The</strong> default i<strong>ns</strong>tance procedure set-first-event{} schedules the first event to take all the links “down” <strong>at</strong>$startTime_ + upInterval_. Individual types of route models derived from this base class should redefine tihsfunction.276

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!