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

📄 printout.ps

📁 obs网络试验平台
💻 PS
📖 第 1 页 / 共 5 页
字号:
(            sprintf\( s, "\(%d\) BHP== %ld", value, key \);) N(        else {) N(            debug\( "Error" \);) N(            exit \(-1\);) N(        }) N(        // Turn of trace marking for now . need to build custom traces for nam l) N(ater TODO::) N(        // debug\( s \);) N(        return;) N(    }) N(}) N() N(// the name of the source file and the line number with message) N(void Debug::debug\( char *filename, int line_num, char *message \) {) N(    if\( filename == NULL || message == NULL \)) N(        return;) N(    else {) N(        char s[400];) N(        sprintf\( s, "%s: %d = > %s", filename, line_num, message \);) N(        Debug::debug\( s \);) N(    }) N(}) N() N() N(void Debug::debug_\(char *message\) {) N(  if\( message == NULL \)) N(    return;) N(#ifdef DEBUG) N(  char out[1000] = "puts \\"  "; // GMG -- changed length of out from 120 to) N(                                // 1000, to accommodate longer messages) N(  char trail[4]  = " \\" ";) N(  strcat\(out,message\);) N(  strcat\( out, trail \);) N(  Tcl::instance\(\).evalc\(out\);) N(#endif) N(}) N() N() N() N() N() N() N() N() N() N(stdin) (Page 5/122) (Mar 01, 04 20:25) titleborder/v 1 store/x0 x v get 3.362408 add sx cw mul add store/y0 y v get bfs th add sub storex0 y0 moveto(debug.cc) K(  Feb 29 18:09 2004                                 Page:   3) p n() N() N() N() N() N() N(stdin) (Page 6/122) (Mar 01, 04 20:25) titlebordergrestore(Printed by U-GMGPC2\\Geoffrey M. Garner) rhead(stdin) (3/61) (Monday March 01, 2004) footerend % of iso1dictpagesave restoreshowpage%%Page: (7-8) 4%%BeginPageSetup/pagesave save defsh 0 translate 90 rotate%%EndPageSetupiso1dict begingsavellx lly 12 add translate/v 0 store/x0 x v get 3.362408 add sx cw mul add store/y0 y v get bfs th add sub storex0 y0 moveto(fiber-delay.cc) K(  Feb 29 18:09 2004                           Page:   4) p n() N(/* Copyright \(c\) University of Maryland, Baltimore County, 2003.) N( * Original Authors: Ramakrishna Shenai, Sunil Gowda and Krishna Sivalingam.) N( *) N( * This software is developed at the University of Maryland, Baltimore County un) N(der) N( * grants from Cisco Systems Inc and the University of Maryland, Baltimore Count) N(y.) N( *) N( * Permission to use, copy, modify, and distribute this software and its) N( * documentation in source and binary forms for non-commercial purposes) N( * and without fee is hereby granted, provided that the above copyright) N( * notice appear in all copies and that both the copyright notice and) N( * this permission notice appear in supporting documentation. and that) N( * any documentation, advertising materials, and other materials related) N( * to such distribution and use acknowledge that the software was) N( * developed by the University of Maryland, Baltimore County.  The name of) N( * the University may not be used to endorse or promote products derived from) N( * this software without specific prior written permission.) N( *) N( * Copyright \(C\) 2000-2003 Washington State University. All rights reserved.) N( * This software was originally developed at Alcatel USA and subsequently modifi) N(ed) N( * at Washington State University, Pullman, WA  through research work which was) N( * supported by Alcatel USA, Inc and Cisco Systems Inc.) N() N( * The  following notice is in adherence to the Washington State University) N( * copyright policy follows.) N( *) N( * License is granted to copy, to use, and to make and to use derivative) N( * works for research and evaluation purposes, provided that Washington) N( * State University is acknowledged in all documentation pertaining to any such) N( * copy or derivative work. Washington State University grants no other) N( * licenses expressed or implied. The Washington State University name) N( * should not be used in any advertising without its written permission.) N( *) N( * WASHINGTON STATE UNIVERSITY MAKES NO REPRESENTATIONS CONCERNING EITHER) N( * THE MERCHANTABILITY OF THIS SOFTWARE OR THE SUITABILITY OF THIS SOFTWARE) N( * FOR ANY PARTICULAR PURPOSE.  The software is provided "as is") N( *  without express or implied warranty of any kind. These notices must) N( * be retained in any copies of any part of this software.) N( */) N(#ifndef lint) N(static const char rcsid[] =) N(    "@\(#\) $Header: /home/bwen/src/ns/ns-2/fiber-delay.cc,v 1.3 2000/09/01 04:22:) N(44 bwen Exp $ \(LBL\)";) N(#endif) N() N(#include "fiber-delay.h") N() N(static class OBSFiberLinkDelayClass : public TclClass {) N(public:) N() S 8 T (OBSFiberLinkDelayClass\(\) : TclClass\("OBSFiberDelayLink"\) {}) N() S 8 T (TclObject* create\(int /* argc */, const char*const* /* argv */\) {) N() S 8 T () S 16 T (return \(new OBSFiberLinkDelay\(\)\);) N() S 8 T (}) N(} class_fiber_delay_link;) N() N() N(OBSFiberLinkDelay::OBSFiberLinkDelay\(\) ) N() N(stdin) (Page 7/122) (Mar 01, 04 20:25) titleborder/v 1 store/x0 x v get 3.362408 add sx cw mul add store/y0 y v get bfs th add sub storex0 y0 moveto(fiber-delay.cc) K(  Feb 29 18:09 2004                           Page:   5) p n() N({) N() S 8 T (bind\("wvlen_num_", &wvlen_num_\);) N() S 8 T (bind\("FDLdelay", &FDL_delay_\);) N(}) N() N(void OBSFiberLinkDelay::recv\(Packet* p, Handler* h\)) N({) N(     double txt = txtime_fiber\(p\);) N(     double link_service_time;) N(     Scheduler& s = Scheduler::instance\(\);) N(     int prio;) N() N(     if \(dynamic_\)) N(     {) N(        Event* e = \(Event*\)p;) N(        e->time_= txt + delay_;) N(        itq_->enque\(p\); // for convinience, use a queue to store packets in) N(                        // transit) N(        s.schedule\(this, p, txt + delay_\);) N(     }) N(     else //GMG -- changed this part of the function, to calc link service) N(          // time as prop del for DB, but prop+trans del for BCP \(since) N(          // DB "cuts through" the node, while BCP is buffered and processed.) N(          // Note that a single DB trans del must be added at final edge node;) N(          // this is done separately and is not part of link serv time.) N(          // Also added potential FDL at end of link for DB) N(     {) N(        Debug::markTr\( 1000, p \);) N(        hdr_ip *iph = hdr_ip::access \(p\);) N(        hdr_IPKT *ipkt = hdr_IPKT::access \(p\);) N(        ipkt->tx_delay_ = txt; //GMG - use this field) N(                              // of the IPKT header) N(                              // to store the trans delay so it is) N(                              // accessible to the next node, which will) N(                              // need the value.  This is purely a) N(                              // mechanism for the simulator; it is) N(                              // much easier than having the next node) N(                              // figure out which link object to get this) N(                              // value from.) N() N(        if \(iph->prio_ == 1\) //BHP; set link service time = trans + prop del) N(        {) N(           link_service_time = txt + delay_;) N(           ipkt->FDL_delay_ = FDL_delay_; //GMG - use the FDL_delay_ field) N(                                 // of the IPKT header) N(                                 // to store the FDL delay so it is easily) N(                                 // accessible to the next node, which will) N(                                 // need the value.  This is purely a) N(                                 // mechanism for the simulator; it is) N(                                 // much easier than having the next node) N(                                 // figure out which link object to get this) N(                                 // value from.) N(        }) N(        else //DB; set link service time = prop del + FDL at end of link.) N(             //Also, check whether to decrement ingress node electronic) N(             //        buffer fill) N() N(stdin) (Page 8/122) (Mar 01, 04 20:25) titlebordergrestore(Printed by U-GMGPC2\\Geoffrey M. Garner) rhead(stdin) (4/61) (Monday March 01, 2004) footerend % of iso1dictpagesave restoreshowpage%%Page: (9-10) 5%%BeginPageSetup/pagesave save defsh 0 translate 90 rotate%%EndPageSetupiso1dict begingsavellx lly 12 add translate/v 0 store/x0 x v get 3.362408 add sx cw mul add store/y0 y v get bfs th add sub storex0 y0 moveto(fiber-delay.cc) K(  Feb 29 18:09 2004                           Page:   6) p n() N(        {) N(           if \(ipkt->ebuf_ind\)) N(           {) N(              prio = ipkt->prio_;) N(              ipkt->bc_ingress->bufsize_[prio] -= ipkt->C_burst_size\(\);) N(              ipkt->ebuf_ind = 0;) N(           }) N(           link_service_time = delay_ + FDL_delay_;) N(        }) N() N(        s.schedule\(target_, p, link_service_time\);) N(     }) N(}) N() N() N(stdin) (Page 9/122) (Mar 01, 04 20:25) titleborder/v 1 store/x0 x v get 3.362408 add sx cw mul add store/y0 y v get bfs th add sub storex0 y0 moveto(fract_flick.cc) K(  Feb 29 18:09 2004                           Page:   7) p n() N(/****************************************************************) N(**                     fract_flick.cc                          **) N(*****************************************************************) N(**) N(**) N(**  Filename:   fract_flick.cc) N(**  Purpose:    Create a fractional flicker noise random proccess) N(**              This is a random process whose power spectral density) N(**              is of the form S\(f\) = 1/f**gamma, where gamma is) N(**              a \(fractional\) exponent between 0 and 2 \(0 < gamma < 2\).) N(**              Note that we do not allow the cases gamma = 0 \(white) N(**              noise\) and gamma = 2 \(random walk\) here, as these are) N(**              dealt with more simply as special cases.) N(**) N(**              The user specifies the number of frequency decades for the) N(**              filter, the number of poles per decade, and supplies) N(**              pointers to arrays of appropriate size to hold filter) N(**              coefficients and states.  The highest frequency zero is) N(**              automatically placed at a frequency corresponding to 1/10) N(**              the sampling rate.  The lowest frequency zero and pole) N(**              are then determined by the number of frequency decades the) N(**              user supplies.  The generated noise will have the above PSD) N(**              over time intervals that do not exceed the order of) N(**              1/\(lowest frequency\).) N(**) N(**              The noise process is generated using a bank of filters) N(**              as described by Corsini and Saletti \(IEEE Trans Instrum) N(**              and Measuremetn, vol. 37, no. 4, Dec. 1988\), which is) N(**              a generalization of the Barnes/Jarvis/Greenhall technique) N(**              used for the case gamma = 1.) N(**) N(**) N(** Author:      G. M. Garner) N(**) N(******************************************************************) N(*/) N(#include <stdio.h>) N(#include <stdlib.h>) N(#include <math.h>) N() N(#define TWO_PI   6.28318530718 /* 2*PI    */) N() N(     init_flick ) S(^H) L(^H) K(void init_flick \(int n, double h, double *a, double *b, dou) p n(ble gamma\)) N(/*) N( * Initialize the arrays of filter coefficients) N( *) N( * n = number of frequency decades for the filter) N( * h = number of poles per decade \(may be a fraction;) N( *     ceil\(n*h\) = N = number of filter stages\)) N( * a = pointer to array of poles \(array size = N\)) N( *     \(phi array of Barnes and Greenhall\)) N( * b = pointer to array of zeros \(array size = N\)) N( *     \(theta array of Barnes and Greenhall\)) N( * gamma = noise exponent in power spectral density \(1/f**gamma\)) N( */) N() N(stdin) (Page 10/122) (Mar 01, 04 20:25) titlebordergrestore(Printed by U-GMGPC2\\Geoffrey M. Garner) rhead(stdin) (5/61) (Monday March 01, 2004) footerend % of iso1dictpagesave restoreshowpage%%Page: (11-12) 6%%BeginPageSetup/pagesave save defsh 0 translate 90 rotate%%EndPageSetupiso1dict begingsavellx lly 12 add translate/v 0 store/x0 x v get 3.362408 add sx cw mul add store/y0 y v get bfs th add sub storex0 y0 moveto(fract_flick.cc) K(  Feb 29 18:09 2004                           Page:   8) p n() N({) N(     int N;       /* filter order */) N(     int i;) N(     double f, ae, be;) N(     double *apt, *bpt;) N(     double W, R;) N() N(     N = ceil \(n*h\);) N(     *a = 0.13;  /* From Barnes and Greenhall paper */) N(     R = pow \(10.0, 1/\(2.0*h\)\);) N(     W = \(\(1.0 - \(*a\)\)/sqrt\(*a\)\);) N(     *b = 0.0;) N() N(     for \(i = 2, apt = a+1, bpt = b+1; i <= N; i++, apt++, bpt++\)) N(     {) N(        W = W / pow \(R, 2.0 - gamma\);) N(        \(*bpt\) = 1.0 + \(\(0.5*W\) * \(W - sqrt\(\(W * W\) + 4.0\)\)\);) N(        W = W / pow \(R, gamma\);) N(        \(*apt\) = 1.0 + \(\(0.5*W\) * \(W - sqrt\(\(W * W\) + 4.0\)\)\);) N(     }) N(}) N() N() N() N() N() N() N() N(     flicker ) S(^H) L(^H) K(^Hvoid flicker \(int N, double *y, double *y_old, double *a, do) p n(uble *b\)) N(/*) N( * Inegrate fractional flicker noise generator over 1 time step) N( *) N( * N = number of filter stages \(= n*h, see init_flick above\)) N( * y = pointer to array of current state vector plus white noise input in) N( *     element zero \(array size = N+1\)) N( * y_old = pointer to array of previous time step state vector plus white) N( *         noise input in element zero \(array size = N+1\)) N( * a = pointer to array of poles \(array size = N\)) N( *     \(phi array of Barnes and Greenhall\)) N( * b = pointer to array of zeros \(array size = N\)) N( *     \(theta array of Barnes and Greenhall\)) N( */) N({) N() N(     int i;) N(     double *ypt, *y_oldpt, *apt, *bpt;) N() N(     *\(y+1\) = \( \(*a\) - \(*b\) \) * \(*\(y_old+1\)\) + \(*\(y\)\);) N(     for \(i = 2, ypt =  y+2, y_oldpt = y_old+2, apt = a+1, bpt = b+1; i <= N;) N(                                   i++, ypt++, y_oldpt++, apt++, bpt++\)) N(     {) N(        *ypt = \(*apt\) * \(*y_oldpt\) + \( \(*\(ypt-1\)\) -) N(                                            \(*bpt\) * \(*\(y_oldpt - 1\)\) \);) N(     }) N() N(     for \(i = 0, ypt =  y, y_oldpt = y_old, apt = a, bpt = b; i <= N;) N() N(stdin) (Page 11/122) (Mar 01, 04 20:25) titleborder/v 1 store/x0 x v get 3.362408 add sx cw mul add store/y0 y v get bfs th add sub storex0 y0 moveto(fract_flick.cc) K(  Feb 29 18:09 2004                           Page:   9) p n() N(          i++, ypt++, y_oldpt++, apt++, bpt++\)) N(        *y_oldpt = \(*ypt\);) N(}) N() N

⌨️ 快捷键说明

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