/home/ltracy/workspace/NSUAN/uan/uan-prop-bhp.h

00001 #ifndef UANPROPBHP_H_
00002 #define UANPROPBHP_H_
00003 
00004 #define UAN_PROPBHP_IPL  1000000.00             //Infinite path loss
00005 
00006 #undef NDEBUG
00007 
00008 #include <cassert>
00009 #include <complex>
00010 #include <set>
00011 #include <map>
00012 #include <cstdlib>
00013 
00014 
00015 #include "uan-prop.h"
00016 #include "uan-phy.h"
00017 
00018 
00019 #define UAN_BHP_BHEXPATH "/home/ltracy/workspace/bellhop/Bellhop/bellhop.exe"
00020 
00021 using namespace std;
00022 
00023 /* \class ArrResults
00024  * 
00025  * \brief Keeps information obtained from a Bellhop run
00026  * 
00027  * This class keeps information about the transmitter and receiver
00028  * configured in the Bellhop run as well as all of the arrivals.
00029  * 
00030  * The entire class is public and is only designed to be used inside
00031  * UanPropagationBhp and possible some Phy layers that require it.
00032  * 
00033  * \author Leonard Tracy
00034  * \date 9-28-2007
00035  * 
00036  * Contact: lentracy@u.washington.edu
00037  * Created on:  June 2007
00038  */
00039 struct ArrResults {
00040 public:
00042         ArrResults();
00044         ArrResults(int nume);
00045         ~ArrResults();
00047         void printe(int e);
00048         
00050         void doInit(int nume);
00052         void freeVars(void);
00058         double compPLoss(double tsym);
00066         double compISI(double tsym, double tclear);
00067         
00074         double sumArrivals(double min, double max);
00075         
00077         int numarr;
00079         double freq;
00081         double srcDepth;
00083         double recDepth;
00085         double range;
00087         double propdelay;
00088         
00090         complex<double> *amp;
00092         double *delay;
00094         double *srcAngle;
00096         double *recAngle;
00098         double *topBounce;
00100         double *botBounce;
00101         private:
00103         bool init;
00104         
00105 };
00106 
00121 class BhRun {
00122 public:
00124         BhRun() : valid(false), srcDepth(-1), freq(-1) { }
00125         
00135         BhRun(double src, double f, set<double> d, set<double> r, char *path) :
00136                 valid(true), srcDepth(src), freq(f), depths(d), ranges(r) { 
00137                 res = new ArrResults[depths.size()*ranges.size()];
00138                 
00139                 runBH(path);
00140         }
00142         BhRun(const BhRun &other) {
00143                 srcDepth = other.srcDepth;
00144                 freq = other.freq;
00145                 depths = other.depths;
00146                 ranges = other.ranges;
00147                 valid = other.valid;
00148 
00149                 res = new ArrResults[depths.size()*ranges.size()];
00150                 memcpy(res, other.res, sizeof(struct ArrResults)*depths.size()*ranges.size());
00151         }
00152         ~BhRun() { delete [] res; }
00153         
00154         //TODO:  Verify that shallowest depth is d=0!
00163         ArrResults &getRes(int d, int r) { assert(valid); return *(res + d*depths.size() + r); }
00165         const set<double> &getDepths() {return depths;}
00167         const set<double> &getRanges() {return ranges;}
00169         double getSD() {return srcDepth;}
00171         double getF() {return freq;}
00172         
00173         
00174 private:
00176         bool valid;
00178         double srcDepth;
00180         double freq;
00182         ArrResults *res;
00184         set<double> depths;
00186         set<double> ranges;
00187         
00196         void runBH(char *path);
00197 
00198 };
00199 
00200 
00228 class UanPropagationBhp : public UanPropagation {
00229 public:
00231         UanPropagationBhp();
00232         
00234         virtual double getPr(UanPhy *txif, UanPhy *rxif);
00235         //virtual void getPlMat(ArrResults res[], set<double> depths, set<double> ranges, double srcDepth);
00236         
00252         void updateResults(int addr, double srcDepth, double freq, set<double> depths, set<double> ranges);
00253         
00266         double getPLossRes(int addr, double depth, double range, double tsym);
00267 
00281         double getISIRes(int addr, double depth, double range, double tsym, double tclear);
00282 
00287         ArrResults &getDat(int addr, double depth, double range);
00288         
00289 protected:
00291         double recDepthTol;
00293         double srcDepthTol;
00295         double rangeTol;
00297         double freqTol;
00299         double maxDepth;                //TODO:  Implement these in env file
00300         
00302         double maxRange;                //TODO:  Do we want this??? Probably not = REMOVE THIS
00303         
00305         char *bhExPath;
00306         
00311         void getResults(ArrResults &res, char *fileName);
00312         
00314         map<int, BhRun> bhData;
00315         
00316 };
00317 
00318 
00319 
00320 #endif /*UANPROPBHP_H_*/
00321 

Generated on Mon Oct 1 12:12:43 2007 for UANModule by  doxygen 1.5.1