Changeset 8328
- Timestamp:
- 09/29/08 13:46:23 (5 years ago)
- Location:
- ossiedev/branches/hvolos
- Files:
-
- 1 added
- 3 modified
-
components/Channel/Channel.cpp (modified) (6 diffs)
-
components/Channel/Channel.h (modified) (3 diffs)
-
components/USRPSWDIV/USRPSWDIV.cpp (modified) (2 diffs)
-
waveforms (added)
Legend:
- Unmodified
- Added
- Removed
-
ossiedev/branches/hvolos/components/Channel/Channel.cpp
r8325 r8328 24 24 #include <string> 25 25 #include <iostream> 26 #include "math.h" 26 27 #include "Channel.h" 27 28 … … 29 30 Resource_impl(uuid), component_running(condition) 30 31 { 31 dataIn _0= new standardInterfaces_i::complexShort_p("data_in");32 dataOut _0= new standardInterfaces_i::complexShort_u("data_out");32 dataIn = new standardInterfaces_i::complexShort_p("data_in"); 33 dataOut = new standardInterfaces_i::complexShort_u("data_out"); 33 34 34 35 //Create the thread for the writer's processing function … … 42 43 Channel_i::~Channel_i(void) 43 44 { 44 delete dataIn _0;45 delete dataOut _0;45 delete dataIn; 46 delete dataOut; 46 47 } 47 48 … … 59 60 CORBA::Object_var p; 60 61 61 p = dataIn _0->getPort(portName);62 p = dataIn->getPort(portName); 62 63 63 64 if (!CORBA::is_nil(p)) 64 65 return p._retn(); 65 66 66 p = dataOut _0->getPort(portName);67 p = dataOut->getPort(portName); 67 68 68 69 if (!CORBA::is_nil(p)) … … 120 121 if (strcmp(props[i].id, "DCE:3bbc0656-8a83-11dd-bcd3-0016769e497b") == 0) 121 122 { 123 } 124 } 122 125 } 123 126 … … 126 129 DEBUG(3, Channel, "ProcessData() invoked") 127 130 128 PortTypes::ShortSequence I_out _0, Q_out_0;131 PortTypes::ShortSequence I_out, Q_out; 129 132 130 133 131 PortTypes::ShortSequence *I_in_0(NULL), *Q_in_0(NULL); 132 CORBA::UShort I_in_0_length, Q_in_0_length; 134 PortTypes::ShortSequence *I_in(NULL), *Q_in(NULL); 135 CORBA::UShort Data_length; 136 CORBA::Double noise_sigma; 133 137 134 138 while(1) 135 139 { 136 dataIn _0->getData(I_in_0, Q_in_0);140 dataIn->getData(I_in, Q_in); 137 141 138 I_in_0_length = I_in_0->length(); 139 Q_in_0_length = Q_in_0->length(); 142 Data_length = I_in->length(); 140 143 141 I_out_0.length(); //must define length of output 142 Q_out_0.length(); //must define length of output 144 145 I_out.length(Data_length); //must define length of output 146 Q_out.length(Data_length); //must define length of output 143 147 144 148 /*insert code here to do work*/ 149 noise_sigma=1; 150 151 for (unsigned int i=0; i<Data_length;i++) 152 { 145 153 146 154 147 155 156 //Add AWGN Noise 157 I_out[i]=(*I_in)[i]+(CORBA::Short)(noise_sigma*randn()); 158 Q_out[i]=(*Q_in)[i]+(CORBA::Short)(noise_sigma*randn()); 159 } 148 160 149 161 150 151 dataIn_0->bufferEmptied(); 152 dataOut_0->pushPacket(I_out_0, Q_out_0); 162 dataIn->bufferEmptied(); 163 dataOut->pushPacket(I_out, Q_out); 153 164 } 154 165 } 155 166 167 float Channel_i::randn() 168 //Generates a Gaussian distributed number with zero mean and unit standard deviation 169 // Adapted from http://www.taygeta.com/random/gaussian.html 170 // Algorithm bny Dr. Everett (Skip) Carter, Jr 171 { 172 float x1,x2,w; 173 do 174 { 175 x1=2.0*randf()-1.0; 176 x2=2.0*randf()-1.0; 177 w=x1*x1+x2*x2; 156 178 179 }while (w>=1.0); 180 181 w=sqrt((-2.0*log(w))/w); 182 return x1*w; 183 //y2=x2*w; 184 185 } 186 187 float Channel_i::randf() 188 // Uniformly distributed number from 0 to 1 189 { 190 return rand()/(float)RAND_MAX; 191 } 192 193 -
ossiedev/branches/hvolos/components/Channel/Channel.h
r8325 r8328 74 74 CF::PropertySet::PartialConfiguration); 75 75 76 77 private: 76 private: 78 77 /// Disallow default constructor 79 78 Channel_i(); … … 89 88 90 89 CORBA::Short simple_0_value; 91 CORBA::String simple_1_value;90 //CORBA::String simple_1_value; 92 91 CORBA::Short simple_2_value; 93 92 CORBA::Short simple_3_value; … … 95 94 96 95 // list components provides and uses ports 97 standardInterfaces_i::complexShort_p *dataIn_0; 98 standardInterfaces_i::complexShort_u *dataOut_0; 96 standardInterfaces_i::complexShort_p *dataIn; 97 standardInterfaces_i::complexShort_u *dataOut; 98 99 float randn(); 100 float randf(); 99 101 100 102 }; -
ossiedev/branches/hvolos/components/USRPSWDIV/USRPSWDIV.cpp
r7168 r8328 231 231 232 232 //std::cout<<"ant:"<<ant<<"."; 233 }234 233 235 234 rx_config[0].id = CORBA::string_dup("SET_RX_ANT_1"); … … 238 237 rx_control->set_values(rx_config); 239 238 239 } 240 241 242 240 243 241 244 rx_data_in->bufferEmptied();