Changeset 8328

Show
Ignore:
Timestamp:
09/29/08 13:46:23 (5 years ago)
Author:
hvolos
Message:

directory for waveforms

Location:
ossiedev/branches/hvolos
Files:
1 added
3 modified

Legend:

Unmodified
Added
Removed
  • ossiedev/branches/hvolos/components/Channel/Channel.cpp

    r8325 r8328  
    2424#include <string> 
    2525#include <iostream> 
     26#include "math.h" 
    2627#include "Channel.h" 
    2728 
     
    2930    Resource_impl(uuid), component_running(condition)  
    3031{ 
    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"); 
    3334 
    3435    //Create the thread for the writer's processing function  
     
    4243Channel_i::~Channel_i(void) 
    4344{    
    44     delete dataIn_0; 
    45     delete dataOut_0; 
     45    delete dataIn; 
     46    delete dataOut; 
    4647} 
    4748 
     
    5960    CORBA::Object_var p; 
    6061 
    61     p = dataIn_0->getPort(portName); 
     62    p = dataIn->getPort(portName); 
    6263 
    6364    if (!CORBA::is_nil(p)) 
    6465        return p._retn(); 
    6566 
    66     p = dataOut_0->getPort(portName); 
     67    p = dataOut->getPort(portName); 
    6768 
    6869    if (!CORBA::is_nil(p)) 
     
    120121        if (strcmp(props[i].id, "DCE:3bbc0656-8a83-11dd-bcd3-0016769e497b") == 0) 
    121122        { 
     123        } 
     124    } 
    122125} 
    123126 
     
    126129    DEBUG(3, Channel, "ProcessData() invoked") 
    127130 
    128     PortTypes::ShortSequence I_out_0, Q_out_0; 
     131    PortTypes::ShortSequence I_out, Q_out; 
    129132 
    130133 
    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; 
    133137 
    134138    while(1) 
    135139    { 
    136         dataIn_0->getData(I_in_0, Q_in_0); 
     140        dataIn->getData(I_in, Q_in); 
    137141 
    138         I_in_0_length = I_in_0->length(); 
    139         Q_in_0_length = Q_in_0->length(); 
     142        Data_length = I_in->length(); 
    140143 
    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 
    143147 
    144148        /*insert code here to do work*/ 
     149        noise_sigma=1; 
     150 
     151        for (unsigned int i=0; i<Data_length;i++) 
     152        { 
    145153 
    146154 
    147155 
     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        } 
    148160 
    149161 
    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); 
    153164    } 
    154165} 
    155166 
     167float 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{ 
     172float 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; 
    156178 
     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 
     187float 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  
    7474            CF::PropertySet::PartialConfiguration); 
    7575 
    76  
    77   private: 
     76   private: 
    7877    /// Disallow default constructor 
    7978    Channel_i(); 
     
    8988         
    9089        CORBA::Short simple_0_value; 
    91         CORBA::String simple_1_value; 
     90        //CORBA::String simple_1_value; 
    9291        CORBA::Short simple_2_value; 
    9392        CORBA::Short simple_3_value; 
     
    9594     
    9695    // 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(); 
    99101     
    100102}; 
  • ossiedev/branches/hvolos/components/USRPSWDIV/USRPSWDIV.cpp

    r7168 r8328  
    231231             
    232232            //std::cout<<"ant:"<<ant<<"."; 
    233         } 
    234233 
    235234        rx_config[0].id = CORBA::string_dup("SET_RX_ANT_1"); 
     
    238237        rx_control->set_values(rx_config); 
    239238 
     239        } 
     240 
     241 
     242 
    240243 
    241244        rx_data_in->bufferEmptied();