00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef _IEEE802154A_H
00026 #define _IEEE802154A_H
00027
00028 #include "Signal_.h"
00029 #include <vector>
00030 #include <utility>
00031
00032 using namespace std;
00033
00044 class IEEE802154A {
00045 public:
00047 static const int mandatory_bitrate;
00049 static const_simtime_t mandatory_symbol;
00051 static const_simtime_t mandatory_timeShift;
00053 static const_simtime_t mandatory_pulse;
00055 static const_simtime_t mandatory_burst;
00057 static const int mandatory_pulses_per_burst;
00059 static const double mandatory_centerFreq;
00061 static const_simtime_t mandatory_preambleLength;
00063 static const double maxPulse;
00064
00065 static const short C31[8][31];
00066
00067 static const short Ci = 5;
00068
00069 static const short shortSFD[8];
00070
00071 static const_simtime_t MaxFrameDuration;
00072
00073
00074
00075 static const int maxS = 20000;
00076 static short s_array[maxS];
00077 static int last_s;
00078
00079 static double signalStart;
00080
00082 static const int NSync = 64;
00084 static const short CLength = 31;
00086 static const short spreadingdL = 16;
00088 static const_simtime_t Tpsym;
00089
00091 static const short RSSymbolLength = 6;
00093 static const short RSMaxSymbolErrors = 4;
00094
00096 static const int MaxPSDULength = 128;
00097
00099 static const_simtime_t tFirstSyncPulseMax;
00100
00101 enum UWBPRF {
00102 PRF_OFF,
00103 NOMINAL_4_M,
00104 NOMINAL_16_M,
00105 NOMINAL_64_M
00106 };
00107
00108 enum Ranging {
00109 NON_RANGING,
00110 ALL_RANGING,
00111 PHY_HEADER_ONLY
00112 };
00113
00114 enum UWBPreambleSymbolRepetitions {
00115 PSR_SHORT=16,
00116 PSR_DEFAULT=64,
00117 PSR_MEDIUM=1024,
00118 PSR_LONG=4096
00119 };
00120
00121 enum DataRate {
00122 DATA_RATE_0,
00123 DATA_RATE_1,
00124 DATA_RATE_2,
00125 DATA_RATE_3,
00126 DATA_RATE_4
00127 };
00128
00129 public:
00131 struct config {
00132 int channel;
00133 UWBPRF prf;
00134 Ranging ranging;
00135 UWBPreambleSymbolRepetitions NSync;
00136 int CLength;
00137 int spreadingdL;
00138 int Ncpb;
00139 int bitrate;
00140 int nbPulsesPerBurst;
00141
00142
00143
00144
00145
00146
00147
00148 double sync_symbol_duration;
00149 double data_symbol_duration;
00150 double shift_duration;
00151 double pulse_duration;
00152 double burst_duration;
00153 double preambleLength;
00154
00155 double centerFrequency;
00156 };
00157
00158
00159
00160
00161 typedef std::pair<Signal *, vector<bool> * > signalAndData;
00162
00163
00164
00165 static void setConfig(config newCfg);
00166
00167 static config getConfig() { return cfg; }
00168
00169
00170 static void setPSDULength(int _psduLength);
00171
00172
00173
00174
00175
00176
00177
00178
00179 static signalAndData generateIEEE802154AUWBSignal(simtime_t signalStart, bool allZeros=false);
00180
00181 static simtime_t getMaxFrameDuration();
00182
00183
00184
00185 static const int Nhdr = 16;
00186
00187
00188 protected:
00189 static void generateSyncPreamble(Mapping* mapping, Argument* arg);
00190 static void generateSFD(Mapping* mapping, Argument* arg);
00191 static void generatePhyHeader(Mapping* mapping, Argument* arg);
00192 static void generateBurst(Mapping* mapping, Argument* arg, simtime_t burstStart, short polarity);
00193 static void generatePulse(Mapping* mapping, Argument* arg, short polarity,
00194 double peak=IEEE802154A::maxPulse, simtime_t chip=IEEE802154A::mandatory_pulse);
00195 static void setBitRate(Signal* s);
00196 static int s(int n);
00197
00198
00199 public:
00200 static int psduLength;
00201 static config cfg;
00202 static const config cfg_mandatory_16M, cfg_mandatory_4M;
00203
00204
00205 static simtime_t getPhyMaxFrameDuration();
00206 static simtime_t getThdr();
00207 static int getHoppingPos(int sym);
00208
00209 };
00210
00211
00212 #endif
00213