mfullpropagation.h

00001 /*
00002  * Copyright (c) 2007 Regents of the SIGNET lab, University of Padova.
00003  * All rights reserved.
00004  *
00005  * Redistribution and use in source and binary forms, with or without
00006  * modification, are permitted provided that the following conditions
00007  * are met:
00008  * 1. Redistributions of source code must retain the above copyright
00009  *    notice, this list of conditions and the following disclaimer.
00010  * 2. Redistributions in binary form must reproduce the above copyright
00011  *    notice, this list of conditions and the following disclaimer in the
00012  *    documentation and/or other materials provided with the distribution.
00013  * 3. Neither the name of the University of Padova (SIGNET lab) nor the 
00014  *    names of its contributors may be used to endorse or promote products 
00015  *    derived from this software without specific prior written permission.
00016  *
00017  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
00018  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 
00019  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
00020  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
00021  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
00022  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
00023  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 
00024  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
00025  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 
00026  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 
00027  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00028  */
00029 
00030 #ifndef MFULLPROPAGATION_H 
00031 #define MFULLPROPAGATION_H
00032 
00033 
00034 #include<tclcl.h>
00035 #include<timer-handler.h>
00036 #include"mpropagation.h"
00037 
00038 
00039 class MFullPropagation;
00044 class SampleTimer : public TimerHandler
00045 {
00046 public:
00047   SampleTimer(MFullPropagation *m) : TimerHandler() { module = m; }
00048         
00049 protected:
00050   virtual void expire(Event *e);
00051   MFullPropagation* module;
00052 };
00053 
00054 
00055 
00056 class Packet;
00057 class Position;
00058 
00059 
00070 class MFullPropagation : public MPropagation
00071 {
00072         friend class SampleTimer;
00073 public:
00074         MFullPropagation();
00079         virtual double getGain(Packet* p);
00080         virtual int command(int argc, const char*const* argv);
00081         
00082 protected:
00087         double Gaussian();
00098         void initialize_common(unsigned long int N0, double d, double **amp, double *incr);
00106         void initialize_phases(unsigned long int N0, double *phases);
00114         void initialize_all_phases(unsigned long int N0,double ****phases);
00126         void oscillators(unsigned long int N0,double *phases,double *incr, double **amp,double *x);
00131         void FadingInit();
00136         void ShadowInit();
00141         void Init();
00149         double Shadowing(Position* node1, Position* node2);
00158         double  Rayleigh(int txId, int rxId);
00165         double PathLoss(double distance, double lambda);
00172         int getSimulatedNodeId(Position* p);
00185         void compute_fading(unsigned long int N0,double ****phases,double *incr, double **amp,double **fad,double ***A2);
00191         void simulationStep();
00192         
00193         double** amp_;                                  
00194         double* incr_;                                  
00195         double**** phases_;                     
00196         double** fad_;                                  
00197         double maxDopplerShift_;                
00198         double d_;                                              
00199         double*** A2_;                                  
00200         unsigned int nRays_;                    
00201         int N0_;                                                
00202         double refDistance_;                    
00203 
00204         double beta_;                                   
00205 
00206 
00207 
00208 
00209 
00210 
00211 
00212 
00213         SampleTimer sampleTimer_;               
00214         double timeUnit_;                               
00215 
00216 
00217         int rayleighFading_;                    
00218         double xFieldWidth_;                    
00219         double yFieldWidth_;                    
00220         double* shadowMat_;                             
00221 
00222 
00223 
00224 
00225         double shadowSigma_;                    
00226         int nodesNum_;                                  
00227 
00228         Position** nodesIndexArray_;    
00229 
00230         int debug_;                                             
00231 };
00232 
00233 #endif /* MFULLPROPAGATION_H */

Generated on Wed Nov 26 15:47:28 2008 for NS-MIRACLE library by  doxygen 1.5.2