Changeset 8367

Show
Ignore:
Timestamp:
10/13/08 13:06:11 (5 years ago)
Author:
hvolos
Message:

added fading capability

Location:
ossiedev/branches/hvolos/components/Channel
Files:
2 modified

Legend:

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

    r8364 r8367  
    3333    dataOut = new standardInterfaces_i::complexShort_u("data_out"); 
    3434 
     35    fading=false; 
     36 
     37    noise_sigma=0; 
     38    K_factor=1; 
     39    MaxDopplerRate=0; 
     40 
    3541    //Create the thread for the writer's processing function  
    3642    processing_thread = new omni_thread(Run, (void *) this); 
     
    3844    //Start the thread containing the writer's processing function  
    3945    processing_thread->start(); 
     46 
    4047 
    4148} 
     
    112119        std::cout << "Property id : " << props[i].id << std::endl; 
    113120 
    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 
    116123            CORBA::Short simple_temp; 
    117124            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(); 
    123151        } 
    124152    } 
     
    134162    PortTypes::ShortSequence *I_in(NULL), *Q_in(NULL); 
    135163    CORBA::UShort Data_length,NumberOfMultipath; 
    136     CORBA::Double noise_sigma,K,MaxDopplerRate; 
    137164 
    138165    NumberOfMultipath=50; 
     
    169196 
    170197        /*insert code here to do work*/ 
    171         noise_sigma=0; 
     198 
    172199 
    173200 
     
    175202        for (unsigned int i=0; i<Data_length;i++) 
    176203        { 
     204             
     205            if (fading){ 
    177206            pI=0; 
    178207            pQ=0; 
     
    180209            for (unsigned int j=0;j<NumberOfMultipath;j++) 
    181210            { 
    182                 totalphi=2*PI*(DopplerFreq[j]*(i+packetno*Data_length)   +phi); 
     211                totalphi=2*PI*(DopplerFreq[j]*(i+packetno*Data_length)+phi); 
    183212                pI+=cos(totalphi); 
    184213                pQ+=sin(totalphi); 
     
    188217            pI/=PathPower; 
    189218            pQ/=PathPower; 
     219            } 
     220            else { 
     221             pI=1; 
     222             pQ=1; 
     223            }; 
    190224        
    191225        //Add AWGN Noise 
  • ossiedev/branches/hvolos/components/Channel/Channel.h

    r8328 r8367  
    9797        standardInterfaces_i::complexShort_u *dataOut; 
    9898 
     99    bool fading; 
     100 
     101    double noise_sigma,K_factor,MaxDopplerRate; 
     102 
    99103    float randn(); 
    100104    float randf();