Exemple #1
0
        public void ConfigureNR(ComplexWaveform <ComplexSingle> niFormattedData)
        {
            NR = instrSession.GetNRSignalConfiguration();     /* Create a new RFmx Session */
            instrSession.ConfigureRFAttenuation("", RFmxInstrMXRFAttenuationAuto.True, 20);
            instrSession.ConfigureFrequencyReference("", RFmxInstrMXConstants.OnboardClock, 10e6);
            //instrSession.SetTriggerExportOutputTerminal("", "");
            NR.ConfigureDigitalEdgeTrigger("", "PXI_Trig2", RFmxNRMXDigitalEdgeTriggerEdge.Rising, 0, true);
            NR.SelectMeasurements("", RFmxNRMXMeasurementTypes.ModAcc, true);
            NR.ModAcc.Configuration.SetMeasurementEnabled("", true);
            NR.ModAcc.Configuration.SetAveragingEnabled("", averagingEnabled);
            NR.ModAcc.Configuration.SetAveragingCount("", averagingCount);
            //
            NR.SetBand("", band);
            // Signal COnfiguration
            NR.SetLinkDirection("", lnkDirection);
            // Carrier Definition
            NR.ComponentCarrier.SetNumberOfComponentCarriers("", 1);



#if false
            //***************************************************************
            //-------------DEVELOPMENT OF MULTI_CARRIER----------------------
            //***************************************************************

            // 2-CC
            // Carrier Definition
            string[] arrCC = new string[2];
            NR.ComponentCarrier.SetNumberOfComponentCarriers("", 2);

            for (int i = 0; i < arrCC.Length; i++)
            {
                arrCC[i] = RFmxNRMX.BuildCarrierString("", i);

                NR.ComponentCarrier.SetCellID(arrCC[i], cellID);
                NR.ComponentCarrier.SetBandwidth(arrCC[i], componentCarrierBandwidth);
                NR.ComponentCarrier.SetNumberOfBandwidthParts(arrCC[i], 1);
                NR.ComponentCarrier.SetBandwidthPartSubcarrierSpacing(arrCC[i], subcarrierSpacing);
                NR.SetAutoResourceBlockDetectionEnabled(arrCC[i], RFmxNRMXAutoResourceBlockDetectionEnabled.False);
                NR.ComponentCarrier.SetPuschResourceBlockOffset(arrCC[i], puschRBOffset);
                NR.ComponentCarrier.SetPuschNumberOfResourceBlocks(arrCC[i], puschNumberOfRBs);
            }

            //***************************************************************
#endif


            NR.ComponentCarrier.SetCellID("", cellID);
            NR.ComponentCarrier.SetBandwidth("", componentCarrierBandwidth);
            // BWP Setup
            NR.ComponentCarrier.SetNumberOfBandwidthParts("", 1);
            NR.ComponentCarrier.SetBandwidthPartSubcarrierSpacing("", subcarrierSpacing);
            NR.SetAutoResourceBlockDetectionEnabled("", RFmxNRMXAutoResourceBlockDetectionEnabled.False);
            NR.ComponentCarrier.SetPuschResourceBlockOffset("", puschRBOffset);
            NR.ComponentCarrier.SetPuschNumberOfResourceBlocks("", puschNumberOfRBs);
            // PUSCH Setup
            NR.ComponentCarrier.SetNumberOfPuschConfigurations("", 1);
            NR.ComponentCarrier.SetPuschSymbolAllocation("", puschSymbolAllocation);
            NR.ComponentCarrier.SetPuschSlotAllocation("", puschSlotAllocation);
            NR.ComponentCarrier.SetPuschNumberOfResourceBlockClusters("", puschNumberOfRBClusters);

            //int maxRBs = 0, offsetRBs = 0;
            //NR.ComponentCarrier.GetPuschResourceBlockOffset("", out offsetRBs);
            //NR.ComponentCarrier.GetPuschNumberOfResourceBlocks("", out maxRBs);

            // PUSCH Allocations
            //NR.ComponentCarrier.SetResourceBlockAlignmentMode("", RFmxNRMXResourceBlockAlignmentMode.Disabled);
            //for (int i = 0; i < NumberOfSubblocks; i++)
            //{
            //    subblockString = RFmxNRMX.BuildSubblockString("", 0);
            //    carrierString = RFmxNRMX.BuildCarrierString(subblockString, 0);
            //    puschClusterString = RFmxNRMX.BuildPuschClusterString(carrierString, i);
            //    NR.ComponentCarrier.SetPuschResourceBlockOffset(puschClusterString, puschRBOffset);
            //    NR.ComponentCarrier.SetPuschNumberOfResourceBlocks(puschClusterString, puschNumberOfRBs);
            //}

            NR.ComponentCarrier.SetPuschModulationType("", puschModulationType);
            NR.ComponentCarrier.SetPuschTransformPrecodingEnabled("", puschTransformPrecodingEnabled);
            // Missing DataScramblingIDMode Methods
            NR.ComponentCarrier.SetPuschDmrsScramblingIDMode("", RFmxNRMXPuschDmrsScramblingIDMode.CellID);
            NR.ComponentCarrier.SetPuschDmrsScramblingID("", 0);

            NR.ComponentCarrier.SetPuschMappingType("", puschDmrsMappingType);
            // PUSCH DM-RS
            NR.ComponentCarrier.SetPuschDmrsScramblingIDMode("", RFmxNRMXPuschDmrsScramblingIDMode.CellID);
            NR.ComponentCarrier.SetPuschDmrsScramblingID("", 0);
            // PUSCH---DMRS

            //I would like to add the following DMRS settings to the user configured EVM measurement:
            //DMRS Config type,
            //DMRS Mapping type,
            //DMRS Type A Position,
            //DMRS Duration,
            //DMRS Additional Positions,
            //Number of CDM Groups
            //*** DMRS Power only available if CP-OFDM

            NR.ComponentCarrier.SetPuschDmrsPowerMode("", puschDmrsPowerMode);
            if (puschDmrsPowerMode == RFmxNRMXPuschDmrsPowerMode.CdmGroups)
            {
                NR.ComponentCarrier.SetPuschDmrsPower("", 0);
                NR.ComponentCarrier.SetPuschDmrsConfigurationType("", RFmxNRMXPuschDmrsConfigurationType.Type1);
            }
            else
            {
                NR.ComponentCarrier.SetPuschDmrsPower("", puschDmrsPower);
            }

            if (puschTransformPrecodingEnabled == RFmxNRMXPuschTransformPrecodingEnabled.False)
            {
                NR.ComponentCarrier.SetPuschDmrsConfigurationType("", puschDmrsConfigurationType);
            }


            NR.ComponentCarrier.SetPuschDmrsDuration("", puschDmrsDuration);
            NR.ComponentCarrier.SetPuschDmrsTypeAPosition("", puschDmrsTypeAPosition);
            NR.ComponentCarrier.SetPuschDmrsAdditionalPositions("", puschDmrsAdditionalPositions);

            NR.ComponentCarrier.SetPuschMappingType("", puschDmrsMappingType);

            if (puschTransformPrecodingEnabled == RFmxNRMXPuschTransformPrecodingEnabled.True)
            {
                NR.ComponentCarrier.SetPuschDmrsNumberOfCdmGroups("", 2);
            }
            else
            {
                if (puschDmrsConfigurationType == RFmxNRMXPuschDmrsConfigurationType.Type1)
                {
                    NR.ComponentCarrier.SetPuschDmrsNumberOfCdmGroups("", MathHelper.Clamp <int>(puschDmrsNumCdmGroups, 1, 2));
                }
                else
                {
                    NR.ComponentCarrier.SetPuschDmrsNumberOfCdmGroups("", MathHelper.Clamp <int>(puschDmrsNumCdmGroups, 1, 3));
                }
            }

            // Why String???
            NR.ComponentCarrier.SetPuschDmrsAntennaPorts("", 0.ToString());

            if (puschTransformPrecodingEnabled == RFmxNRMXPuschTransformPrecodingEnabled.True)
            {
                NR.ComponentCarrier.SetPuschDmrsScramblingIDMode("", RFmxNRMXPuschDmrsScramblingIDMode.CellID);
                NR.ComponentCarrier.SetPuschDmrsScramblingID("", 0);
                NR.ComponentCarrier.SetPdschDmrsnScid("", 0);
            }

            NR.ComponentCarrier.SetPuschDmrsPuschIDMode("", RFmxNRMXPuschDmrsPuschIDMode.CellID);
            NR.ComponentCarrier.SetPuschDmrsPuschID("", 0);

            //NR.ModAcc.Configuration.SetFftWindowLength("", 10e-3);
            if (this.duplexScheme == frmRFmxSettings.RFmxDuplexMode.TDD)
            {
                NR.ModAcc.Configuration.SetMeasurementLengthUnit("", RFmxNRMXModAccMeasurementLengthUnit.Time);
                NR.ModAcc.Configuration.SetMeasurementOffset("", 0);
                NR.ModAcc.Configuration.SetMeasurementLength("", 1e-3);
            }
            else
            {
                NR.ModAcc.Configuration.SetMeasurementLengthUnit("", measurementLengthUnit);
                NR.ModAcc.Configuration.SetMeasurementOffset("", measurementOffset);
                NR.ModAcc.Configuration.SetMeasurementLength("", measurementLength);
            }

            NR.ModAcc.Configuration.SetEvmUnit("", evmUnit);

            //NR.ModAcc.Configuration.SetSynchronizationMode("", RFmxNRMXModAccSynchronizationMode.HalfSubframe);
            //NR.Initiate("", "");

            NR.Commit("");

            #region Run Analysis

            bool averagingDone;

            double recommendedPreTriggerTime;

            RFmxInstrMXRecommendedAcquisitionType recType;
            instrSession.GetRecommendedAcquisitionType("", out recType);
            double acquisitionTime;
            instrSession.GetRecommendedIQAcquisitionTime("", out acquisitionTime);
            int numberOfRecords;
            instrSession.GetRecommendedNumberOfRecords("", out numberOfRecords);
            //instrSession.GetRecommendedSpectralAcquisitionSpan("", out spectralAcquisitionSpan);
            double minimumSampleRate;
            instrSession.GetRecommendedIQMinimumSampleRate("", out minimumSampleRate);
            instrSession.GetRecommendedIQPreTriggerTime("", out recommendedPreTriggerTime);

            Console.WriteLine("Rec pre-trigger time = " + recommendedPreTriggerTime.ToString());

            //ComplexWaveform<ComplexSingle> niFormattedData;

            //if (!RIFileType)
            //    niFormattedData = ConvertIqDataToNiComplexFormat(traceData);
            //else
            //    niFormattedData = RIData;

            #endregion Run Analysis

            ///AnalyzeIQ reset must be true for for last or single AnalyzeIQ call.
            ///Note: averaging in offline mode is done in MXA (IQ data in this module has been averaged).
            NR.AnalyzeIQ("", "", niFormattedData, true, out averagingDone);
            //int err = NR.Initiate("", "");
            NR.WaitForMeasurementComplete("", 10);
        }