예제 #1
0
        public void Get_s_SignalType(string strWaveform, string strWaveformName, out s_SignalType value)
        {
            //Get the all value from 'struct s_SignalType'
            NoiseFloorWaveformMode ModulationType;

            ModulationType = (NoiseFloorWaveformMode)Enum.Parse(typeof(NoiseFloorWaveformMode), strWaveformName.ToUpper());
            int arrayNo = (int)Enum.Parse(ModulationType.GetType(), ModulationType.ToString());         //to get the int value from System.Enum

            value = NF_VSTDriver.SignalType[arrayNo];
        }
예제 #2
0
        public void Mod_FormatCheck(string strWaveform, string strWaveformName, string strmutateCond, bool WaveformInitalLoad)
        {
            #region Variable
            double          papr_dB;
            ComplexDouble[] iqDataArr;

            string org_SG_IPath = NF_VSTDriver.SG_Path + strWaveform + @"\I_" + strWaveformName + ".txt";
            string org_SG_QPath = NF_VSTDriver.SG_Path + strWaveform + @"\Q_" + strWaveformName + ".txt";
            string mut_SG_IPath = NF_VSTDriver.SG_Path + strWaveform + @"\MUTSIG\I_" + strWaveformName + ".txt";
            string mut_SG_QPath = NF_VSTDriver.SG_Path + strWaveform + @"\MUTSIG\Q_" + strWaveformName + ".txt";
            //check mutate signal folder
            if (!Directory.Exists(NF_VSTDriver.SG_Path + strWaveform + @"\MUTSIG\"))
            {
                Directory.CreateDirectory(NF_VSTDriver.SG_Path + strWaveform + @"\MUTSIG\");
            }
            #endregion

            #region set IQ Rate and status
            NoiseFloorWaveformMode ModulationType;
            ModulationType = (NoiseFloorWaveformMode)Enum.Parse(typeof(NoiseFloorWaveformMode), strWaveform.ToUpper());
            int arrayNo = (int)Enum.Parse(ModulationType.GetType(), ModulationType.ToString());         //to get the int value from System.Enum

            NF_VSTDriver.SignalType[arrayNo].signalMode = ModulationType.ToString();

            switch (ModulationType)
            {
            case NoiseFloorWaveformMode.CW:
                NF_VSTDriver.SignalType[arrayNo].status    = true;
                NF_VSTDriver.SignalType[arrayNo].SG_IQRate = 1e6;            //set to default CW Rate
                break;

            case NoiseFloorWaveformMode.CDMA2K:
                NF_VSTDriver.SignalType[arrayNo].status    = true;
                NF_VSTDriver.SignalType[arrayNo].SG_IQRate = 4.9152e6;
                break;

            case NoiseFloorWaveformMode.CDMA2KRC1:
                NF_VSTDriver.SignalType[arrayNo].status    = true;
                NF_VSTDriver.SignalType[arrayNo].SG_IQRate = 4.9152e6;
                break;

            case NoiseFloorWaveformMode.GSM850:
                NF_VSTDriver.SignalType[arrayNo].status = true;
                break;

            case NoiseFloorWaveformMode.GSM900:
                NF_VSTDriver.SignalType[arrayNo].status = true;
                break;

            case NoiseFloorWaveformMode.GSM1800:
                NF_VSTDriver.SignalType[arrayNo].status = true;
                break;

            case NoiseFloorWaveformMode.GSM1900:
                NF_VSTDriver.SignalType[arrayNo].status = true;
                break;

            case NoiseFloorWaveformMode.GSM850A:
                NF_VSTDriver.SignalType[arrayNo].status = true;
                break;

            case NoiseFloorWaveformMode.GSM900A:
                NF_VSTDriver.SignalType[arrayNo].status = true;
                break;

            case NoiseFloorWaveformMode.GSM1800A:
                NF_VSTDriver.SignalType[arrayNo].status = true;
                break;

            case NoiseFloorWaveformMode.GSM1900A:
                NF_VSTDriver.SignalType[arrayNo].status = true;
                break;

            case NoiseFloorWaveformMode.IS95A:
                NF_VSTDriver.SignalType[arrayNo].status    = true;
                NF_VSTDriver.SignalType[arrayNo].SG_IQRate = 4.9152e6;
                break;

            case NoiseFloorWaveformMode.WCDMA:
                NF_VSTDriver.SignalType[arrayNo].status    = true;
                NF_VSTDriver.SignalType[arrayNo].SG_IQRate = 7.68e6;
                break;

            case NoiseFloorWaveformMode.WCDMAUL:
                NF_VSTDriver.SignalType[arrayNo].status    = true;
                NF_VSTDriver.SignalType[arrayNo].SG_IQRate = 7.68e6;
                break;

            case NoiseFloorWaveformMode.WCDMAGTC1:
                NF_VSTDriver.SignalType[arrayNo].status    = true;
                NF_VSTDriver.SignalType[arrayNo].SG_IQRate = 7.68e6;
                break;

            case NoiseFloorWaveformMode.LTE10M1RB:
                NF_VSTDriver.SignalType[arrayNo].status    = true;
                NF_VSTDriver.SignalType[arrayNo].SG_IQRate = 15.36e6;
                break;

            case NoiseFloorWaveformMode.LTE10M12RB:
                NF_VSTDriver.SignalType[arrayNo].status    = true;
                NF_VSTDriver.SignalType[arrayNo].SG_IQRate = 15.36e6;
                break;

            case NoiseFloorWaveformMode.LTE10M20RB:
                NF_VSTDriver.SignalType[arrayNo].status    = true;
                NF_VSTDriver.SignalType[arrayNo].SG_IQRate = 15.36e6;
                break;

            case NoiseFloorWaveformMode.LTE10M48RB:
                NF_VSTDriver.SignalType[arrayNo].status    = true;
                NF_VSTDriver.SignalType[arrayNo].SG_IQRate = 15.36e6;
                break;

            case NoiseFloorWaveformMode.LTE10M50RB:
                NF_VSTDriver.SignalType[arrayNo].status    = true;
                NF_VSTDriver.SignalType[arrayNo].SG_IQRate = 15.36e6;
                break;

            case NoiseFloorWaveformMode.LTE15M75RB:
                NF_VSTDriver.SignalType[arrayNo].status    = true;
                NF_VSTDriver.SignalType[arrayNo].SG_IQRate = 23.04e6;
                break;

            case NoiseFloorWaveformMode.LTE5M25RB:
                NF_VSTDriver.SignalType[arrayNo].status    = true;
                NF_VSTDriver.SignalType[arrayNo].SG_IQRate = 7.68e6;
                break;

            case NoiseFloorWaveformMode.LTE5M8RB:
                NF_VSTDriver.SignalType[arrayNo].status    = true;
                NF_VSTDriver.SignalType[arrayNo].SG_IQRate = 7.68e6;
                break;

            case NoiseFloorWaveformMode.LTE20M100RB:
                NF_VSTDriver.SignalType[arrayNo].status    = true;
                NF_VSTDriver.SignalType[arrayNo].SG_IQRate = 30.72e6;
                break;

            case NoiseFloorWaveformMode.LTE20M18RB:
                NF_VSTDriver.SignalType[arrayNo].status    = true;
                NF_VSTDriver.SignalType[arrayNo].SG_IQRate = 30.72e6;
                break;

            case NoiseFloorWaveformMode.LTE20M48RB:
                NF_VSTDriver.SignalType[arrayNo].status    = true;
                NF_VSTDriver.SignalType[arrayNo].SG_IQRate = 30.72e6;
                break;

            case NoiseFloorWaveformMode.LTE5MCUSTOM:
                NF_VSTDriver.SignalType[arrayNo].status    = true;
                NF_VSTDriver.SignalType[arrayNo].SG_IQRate = 7.68e6;
                break;

            case NoiseFloorWaveformMode.LTE10MCUSTOM:
                NF_VSTDriver.SignalType[arrayNo].status    = true;
                NF_VSTDriver.SignalType[arrayNo].SG_IQRate = 15.36e6;
                break;

            case NoiseFloorWaveformMode.LTE15MCUSTOM:
                NF_VSTDriver.SignalType[arrayNo].status    = true;
                NF_VSTDriver.SignalType[arrayNo].SG_IQRate = 23.04e6;
                break;

            case NoiseFloorWaveformMode.LTE20MCUSTOM:
                NF_VSTDriver.SignalType[arrayNo].status    = true;
                NF_VSTDriver.SignalType[arrayNo].SG_IQRate = 30.72e6;
                break;

            case NoiseFloorWaveformMode.CDMA2KCUSTOM:
                NF_VSTDriver.SignalType[arrayNo].status    = true;
                NF_VSTDriver.SignalType[arrayNo].SG_IQRate = 4.9152e6;
                break;

            case NoiseFloorWaveformMode.WCDMACUSTOM:
                NF_VSTDriver.SignalType[arrayNo].status    = true;
                NF_VSTDriver.SignalType[arrayNo].SG_IQRate = 7.68e6;
                break;

            default: throw new Exception("Not such a waveform!");
            }
            #endregion

            #region Normal or Mutate Modulation Signal Generation

            if (NF_VSTDriver.SignalType[arrayNo].status)
            {
                if (NF_VSTDriver.SignalType[arrayNo].signalMode == "CW")
                {
                    NF_VSTDriver.SignalType[arrayNo].SG_papr_dB = 0;
                }
                else
                {
                    // Read IQ data and calculate PAPR offset for given modulation
                    //Read original waveform
                    iqData_Array(org_SG_IPath, org_SG_IPath, out iqDataArr);
                    papr_dB = SignalAnalysis.PAPR(iqDataArr);
                    NF_VSTDriver.SignalType[arrayNo].SG_papr_dB = Math.Round(papr_dB, 3);

                    // Read IQ data and calculate PAPR offset for given modulation
                    //double[] SG_Idata, SG_Qdata;
                    //ComplexDouble.DecomposeArray(iqDataArr, out SG_Idata, out SG_Qdata);
                    //Filters.PAPR(SG_Idata, SG_Qdata, out papr_dB);
                    //NF_VSTDriver.SignalType[arrayNo].SG_papr_dB = papr_dB;

                    if (MutSignal_Setting.enable)
                    {
                        //NF_VSTDriver.SignalType[arrayNo].SG_IPath = mut_SG_IPath;
                        //NF_VSTDriver.SignalType[arrayNo].SG_QPath = mut_SG_QPath;

                        //var mutSG_Idata = new double[iqDataArr.Length];
                        //var mutSG_Qdata = new double[iqDataArr.Length];

                        //Filters.MutateWaveform(SG_Idata.ToArray(), SG_Qdata.ToArray(), NF_VSTDriver.SignalType[arrayNo].SG_IQRate, total_time_sec, mod_time_sec, mod_offset_sec, freq_offset_hz, f_off_delay_sec, out mutSG_Idata, out mutSG_Qdata);

                        //string[] tempIdata = Array.ConvertAll(mutSG_Idata, Convert.ToString);
                        //System.IO.File.WriteAllLines(mut_SG_IPath, tempIdata);

                        //string[] tempQdata = Array.ConvertAll(mutSG_Qdata, Convert.ToString);
                        //System.IO.File.WriteAllLines(mut_SG_QPath, tempQdata);
                    }
                    else
                    {
                        // Set the modulation file path to default if mutate signal no required
                        NF_VSTDriver.SignalType[arrayNo].SG_IPath = org_SG_IPath;
                        NF_VSTDriver.SignalType[arrayNo].SG_QPath = org_SG_QPath;
                    }
                }
            }

            #endregion
        }