00001
00002
00003
00004
00005
00006
00007
00008 #ifndef DECIDER802154NARROW_H_
00009 #define DECIDER802154NARROW_H_
00010
00011 #include <BaseDecider.h>
00012 #include <BaseArp.h>
00013
00021 class Decider802154Narrow: public BaseDecider {
00022 public:
00023 enum Decider802154NarrowControlKinds {
00024 RECEPTION_STARTED=LAST_BASE_DECIDER_CONTROL_KIND,
00025 LAST_DECIDER802154NARROW_CONTROL_KIND
00026 };
00027 protected:
00029 int sfdLength;
00030
00034 double BER_LOWER_BOUND;
00035
00037 std::string modulation;
00038
00040 int phyHeaderLength;
00041
00044 unsigned long nbFramesWithInterference;
00045 unsigned long nbFramesWithoutInterference;
00046
00047 unsigned long nbFramesWithInterferenceDropped;
00048 unsigned long nbFramesWithoutInterferenceDropped;
00051 cOutVector snirDropped;
00052
00054 cOutVector snirReceived;
00055
00056
00058 cOutVector snrlog;
00059
00061 cOutVector berlog;
00062
00063 protected:
00065 virtual simtime_t processNewSignal(AirFrame* frame);
00066
00067 virtual simtime_t processSignalHeader(AirFrame* frame);
00068
00075 virtual simtime_t processSignalEnd(AirFrame* frame);
00076
00077 double getBERFromSNR(double snr);
00078
00079 bool syncOnSFD(AirFrame* frame);
00080
00081 double evalBER(AirFrame* frame);
00082
00084 double n_choose_k(int n, int k);
00085
00086 bool recordStats;
00087
00088 public:
00089
00094 Decider802154Narrow(DeciderToPhyInterface* phy,
00095 int myIndex,
00096 bool debug,
00097 int sfdLength,
00098 double BER_LOWER_BOUND,
00099 const std::string& modulation, int phyHeaderLength, bool recordStats):
00100 BaseDecider(phy, 0, myIndex, debug),
00101 sfdLength(sfdLength),
00102 BER_LOWER_BOUND(BER_LOWER_BOUND),
00103 modulation(modulation),
00104 phyHeaderLength(phyHeaderLength),
00105 nbFramesWithInterference(0),
00106 nbFramesWithoutInterference(0),
00107 nbFramesWithInterferenceDropped(0),
00108 nbFramesWithoutInterferenceDropped(0),
00109 recordStats(recordStats)
00110 {
00111
00112
00113 snirDropped.setName("snirDropped");
00114 snirReceived.setName("snirReceived");
00115 berlog.setName("berlog");
00116 snrlog.setName("snrlog");
00117 }
00118
00119 virtual ~Decider802154Narrow() {};
00120
00121 virtual void channelChanged(int newChannel);
00122
00127 virtual void finish();
00128 };
00129
00130 #endif