first working version with oaisim. This is prior to MAC interface reworking
This commit is contained in:
@@ -84,24 +84,33 @@ double dac_fixed_gain(double *s_re[2],
|
||||
uint32_t length_meas,
|
||||
uint8_t B,
|
||||
double txpwr_dBm,
|
||||
uint8_t do_amp_compute,
|
||||
double *amp1,
|
||||
int NB_RE)
|
||||
{
|
||||
|
||||
int i;
|
||||
int aa;
|
||||
double amp,amp1;
|
||||
double amp,amp1_local,*amp1p;
|
||||
|
||||
amp = //sqrt(NB_RE)*pow(10.0,.05*txpwr_dBm)/sqrt(nb_tx_antennas); //this is amp per tx antenna
|
||||
pow(10.0,.05*txpwr_dBm)/sqrt(nb_tx_antennas); //this is amp per tx antenna
|
||||
amp1 = 0;
|
||||
|
||||
for (aa=0; aa<nb_tx_antennas; aa++) {
|
||||
amp1 += sqrt((double)signal_energy((int32_t*)&input[aa][input_offset_meas],length_meas)/NB_RE);
|
||||
if (amp1==NULL) amp1p = &1_local;
|
||||
else amp1p = amp1;
|
||||
|
||||
if (do_amp_compute==1) {
|
||||
*amp1p = 0;
|
||||
for (aa=0; aa<nb_tx_antennas; aa++) {
|
||||
*amp1p += (double)signal_energy((int32_t*)&input[aa][input_offset_meas],length_meas)/NB_RE;
|
||||
}
|
||||
*amp1p/=nb_tx_antennas;
|
||||
*amp1p=sqrt(*amp1p);
|
||||
}
|
||||
|
||||
amp1/=nb_tx_antennas;
|
||||
|
||||
// printf("DAC: amp1 %f dB (%d,%d), tx_power %f\n",20*log10(amp1),input_offset,input_offset_meas,txpwr_dBm);
|
||||
|
||||
// printf("DAC: amp %f, amp1 %f dB (%d,%d), tx_power %f (%f),length %d,pos %d\n",20*log10(amp),20*log10(*amp1p),input_offset,input_offset_meas,txpwr_dBm,length, 10*log10((double)signal_energy((int32_t*)&input[0][input_offset_meas],length_meas)/NB_RE),input_offset_meas);
|
||||
|
||||
/*
|
||||
if (nb_tx_antennas==2)
|
||||
@@ -117,12 +126,12 @@ double dac_fixed_gain(double *s_re[2],
|
||||
|
||||
for (i=0; i<length; i++) {
|
||||
for (aa=0; aa<nb_tx_antennas; aa++) {
|
||||
s_re[aa][i] = amp*((double)(((short *)input[aa]))[((i+input_offset)<<1)])/amp1; ///(1<<(B-1));
|
||||
s_im[aa][i] = amp*((double)(((short *)input[aa]))[((i+input_offset)<<1)+1])/amp1; ///(1<<(B-1));
|
||||
s_re[aa][i] = amp*((double)(((short *)input[aa]))[((i+input_offset)<<1)])/(*amp1p);
|
||||
s_im[aa][i] = amp*((double)(((short *)input[aa]))[((i+input_offset)<<1)+1])/(*amp1p);
|
||||
}
|
||||
}
|
||||
|
||||
// printf("ener %e\n",signal_energy_fp(s_re,s_im,nb_tx_antennas,length,0));
|
||||
|
||||
return(signal_energy_fp(s_re,s_im,nb_tx_antennas,length_meas,0)/NB_RE);
|
||||
return(signal_energy_fp(s_re,s_im,nb_tx_antennas,length<length_meas?length:length_meas,0)/NB_RE);
|
||||
}
|
||||
|
||||
@@ -95,4 +95,6 @@ double dac_fixed_gain(double *s_re[2],
|
||||
unsigned int length_meas,
|
||||
unsigned char B,
|
||||
double gain,
|
||||
uint8_t do_amp_compute,
|
||||
double *amp1,
|
||||
int NB_RE);
|
||||
|
||||
Reference in New Issue
Block a user