Changeset 8367
- Timestamp:
- 10/13/08 13:06:11 (5 years ago)
- Location:
- ossiedev/branches/hvolos/components/Channel
- Files:
-
- 2 modified
-
Channel.cpp (modified) (8 diffs)
-
Channel.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
ossiedev/branches/hvolos/components/Channel/Channel.cpp
r8364 r8367 33 33 dataOut = new standardInterfaces_i::complexShort_u("data_out"); 34 34 35 fading=false; 36 37 noise_sigma=0; 38 K_factor=1; 39 MaxDopplerRate=0; 40 35 41 //Create the thread for the writer's processing function 36 42 processing_thread = new omni_thread(Run, (void *) this); … … 38 44 //Start the thread containing the writer's processing function 39 45 processing_thread->start(); 46 40 47 41 48 } … … 112 119 std::cout << "Property id : " << props[i].id << std::endl; 113 120 114 if (strcmp(props[i].id, "DCE:eddc66ce-8a82-11dd-ae05-0016769e497b") == 0) 115 {121 if (strcmp(props[i].id, "DCE:eddc66ce-8a82-11dd-ae05-0016769e497b") == 0) { 122 //The power of the AWGN noise 116 123 CORBA::Short simple_temp; 117 124 props[i].value >>= simple_temp; 118 simple_0_value = simple_temp; 119 } 120 121 if (strcmp(props[i].id, "DCE:3bbc0656-8a83-11dd-bcd3-0016769e497b") == 0) 122 { 125 noise_sigma = sqrt(simple_temp/2.0); 126 } else if (strcmp(props[i].id, "DCE:3bbc0656-8a83-11dd-bcd3-0016769e497b") == 0) { 127 //Specifies the fading type. Valid values are None and Ricean 128 const char * prop_str; 129 props[i].value >>= prop_str; 130 if ( strcmp(prop_str, "None") == 0 ) { 131 fading=false; 132 } else if ( strcmp(prop_str, "Ricean") == 0 ){ 133 fading=true; 134 } else { 135 std::cerr << "ERROR: Channel::configure() unknown fading type" << std::endl; 136 throw CF::PropertySet::InvalidConfiguration(); 137 }; 138 139 140 } } else if (strcmp(props[i].id, "DCE:25a1df92-7f22-43af-8720-ad37714a66db") == 0) { 141 // Frame size 142 CORBA::UShort simple_temp; 143 props[i].value >>= simple_temp; 144 145 ConfigureFrameSize(simple_temp); 146 147 } else { 148 // unknown property 149 std::cerr << "ERROR: Channel::configure() unknown property" << std::endl; 150 throw CF::PropertySet::InvalidConfiguration(); 123 151 } 124 152 } … … 134 162 PortTypes::ShortSequence *I_in(NULL), *Q_in(NULL); 135 163 CORBA::UShort Data_length,NumberOfMultipath; 136 CORBA::Double noise_sigma,K,MaxDopplerRate;137 164 138 165 NumberOfMultipath=50; … … 169 196 170 197 /*insert code here to do work*/ 171 noise_sigma=0; 198 172 199 173 200 … … 175 202 for (unsigned int i=0; i<Data_length;i++) 176 203 { 204 205 if (fading){ 177 206 pI=0; 178 207 pQ=0; … … 180 209 for (unsigned int j=0;j<NumberOfMultipath;j++) 181 210 { 182 totalphi=2*PI*(DopplerFreq[j]*(i+packetno*Data_length) +phi);211 totalphi=2*PI*(DopplerFreq[j]*(i+packetno*Data_length)+phi); 183 212 pI+=cos(totalphi); 184 213 pQ+=sin(totalphi); … … 188 217 pI/=PathPower; 189 218 pQ/=PathPower; 219 } 220 else { 221 pI=1; 222 pQ=1; 223 }; 190 224 191 225 //Add AWGN Noise -
ossiedev/branches/hvolos/components/Channel/Channel.h
r8328 r8367 97 97 standardInterfaces_i::complexShort_u *dataOut; 98 98 99 bool fading; 100 101 double noise_sigma,K_factor,MaxDopplerRate; 102 99 103 float randn(); 100 104 float randf();