Skip to content
This repository has been archived by the owner on Mar 16, 2022. It is now read-only.

Nanosemidpd #147

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Examples/LTE_NanosemiDPD_EVM_ACP_UL/App.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
</configuration>
198 changes: 198 additions & 0 deletions Examples/LTE_NanosemiDPD_EVM_ACP_UL/LTE_NanosemiDPD_EVM_ACP_UL.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,198 @@
using NationalInstruments.ModularInstruments.NIRfsg;
using NationalInstruments.RFmx.InstrMX;
using NationalInstruments.RFmx.LteMX;
using NationalInstruments.RFmx.SpecAnMX;
using System;
using static NationalInstruments.ReferenceDesignLibraries.SA.RFmxLTE;
using static NationalInstruments.ReferenceDesignLibraries.SG;

namespace NationalInstruments.ReferenceDesignLibraries.Examples
{
public class LTE_NanosemiDPD_EVM_ACP_UL
{
#region Declaring Parameters
//shared Parameters
public string resourceName;
public double centerFrequency;
public string signalStringSpecan, signalStringLte;
public string resultStringSpecan, resultStringLte;

//Generator Configuration
public SG.InstrumentConfiguration SgInstrConfig;

public string filePath;

//Analyzer Configuration
public SA.RFmxInstr.InstrumentConfiguration saInstrConfig;
public SA.CommonConfiguration saCommonConfig;
public SA.AutoLevelConfiguration saAutolevelConfig;

public SA.RFmxLTE.StandardConfiguration StandardConfigLte = new SA.RFmxLTE.StandardConfiguration();


//Measurements Configuration
public SA.RFmxLTE.AcpConfiguration AcpConfigLte;
public SA.RFmxLTE.AcpResults AcpResultsLte = new SA.RFmxLTE.AcpResults();

public SA.RFmxLTE.ModAccConfiguration ModaccConfigLte;
public SA.RFmxLTE.ModAccResults ModaccResultsLte = new SA.RFmxLTE.ModAccResults();

//Methods Configuration
public Methods.NanosemiDPD.NanosemiDPDConfiguration nsDPDConfig;
public Methods.NanosemiDPD.PreDpdCrestFactorReductionConfiguration preDpdCrestFactorReductionConfig;
public bool EnableDpd;
#endregion

public LTE_NanosemiDPD_EVM_ACP_UL()
{
InitializeParameters();
}

public void InitializeParameters()
{
//shared Parameters
centerFrequency = 1.95e9; //Hz
resourceName = "5840";
filePath = @"C:\Users\Public\Documents\National Instruments\RFIC Test Software\Waveforms\LTE_FDD_UL_1x20MHz_256QAM_OS4.tdms";
signalStringSpecan = "specanSig0";
signalStringLte = "lteSig0";
resultStringSpecan = "specanResult0";
resultStringLte = "lteResult0";

//Generator Configuiration
SgInstrConfig = SG.InstrumentConfiguration.GetDefault();
SgInstrConfig.CarrierFrequency_Hz = centerFrequency;
SgInstrConfig.DutAverageInputPower_dBm = -10.0;
SgInstrConfig.ExternalAttenuation_dB = 0;

//Analyzer Configuration
saInstrConfig = SA.RFmxInstr.InstrumentConfiguration.GetDefault();
saCommonConfig = SA.CommonConfiguration.GetDefault();
saCommonConfig.ExternalAttenuation_dB = 0;
saCommonConfig.CenterFrequency_Hz = centerFrequency;
saCommonConfig.ReferenceLevel_dBm = 0;

saAutolevelConfig = SA.AutoLevelConfiguration.GetDefault();
saAutolevelConfig.Enabled = true;


StandardConfigLte = SA.RFmxLTE.StandardConfiguration.GetDefault();
StandardConfigLte.ComponentCarrierConfigurations[0].Bandwidth_Hz = 20.0e6;
StandardConfigLte.ComponentCarrierConfigurations[0].PuschModulationType = RFmxLteMXPuschModulationType.ModulationType256Qam;

AcpConfigLte = SA.RFmxLTE.AcpConfiguration.GetDefault();

ModaccConfigLte = SA.RFmxLTE.ModAccConfiguration.GetDefault();

//Methods Configuration
nsDPDConfig = Methods.NanosemiDPD.NanosemiDPDConfiguration.GetDefault();
nsDPDConfig.DpdConfiguration = NanoSemiLinearizer.Interop.nstdpd.DpdGetDefaultConfig();
nsDPDConfig.NumberOfIterations = 3;
nsDPDConfig.DpdConfiguration.lvl = NanoSemiLinearizer.Interop.nstdpd.DpdLevel.NST_DPD_LEVEL0;
nsDPDConfig.DpdConfiguration.rho = 0.1f;
nsDPDConfig.DpdConfiguration.training_samples = 25000;
EnableDpd = true;

}

public void Run()
{
#region Create Sessions
NIRfsg nIRfsg = new NIRfsg(resourceName, false, false);
RFmxInstrMX instr = new RFmxInstrMX(resourceName, "");
RFmxSpecAnMX specAn = instr.GetSpecAnSignalConfiguration(signalStringSpecan);
RFmxLteMX lte = instr.GetLteSignalConfiguration(signalStringLte);
#endregion

#region Configure Generation
ConfigureInstrument(nIRfsg, SgInstrConfig);
Waveform waveform = LoadWaveformFromTDMS(filePath);

DownloadWaveform(nIRfsg, waveform);
ConfigureContinuousGeneration(nIRfsg, waveform);
nIRfsg.Initiate();
#endregion

#region Configure Analyzer
saAutolevelConfig.MeasurementInterval_s = waveform.BurstLength_s;
SA.RFmxInstr.ConfigureInstrument(instr, saInstrConfig);

SA.RFmxSpecAn.ConfigureCommon(specAn, saCommonConfig);


SA.RFmxLTE.ConfigureCommon(lte, saCommonConfig);
SA.RFmxLTE.ConfigureStandard(lte, StandardConfigLte);
#endregion

#region Configure and Measure DPD
if (EnableDpd)
{
Methods.NanosemiDPD.ConfigureNanosemi(specAn, nsDPDConfig, waveform, "");
Console.WriteLine("\n--------------- Measurement Results with DPD --------------\n");
Methods.NanosemiDPD.PerformNanosemiDPD(specAn, nIRfsg, waveform, nsDPDConfig, "");
}
else
{
Console.WriteLine("\n------------- Measurement Results without DPD -------------\n");
}
#endregion

#region Measure

ConfigureAcp(lte, AcpConfigLte);
RFmxLteMXMeasurementTypes[] lteMeasurements = new RFmxLteMXMeasurementTypes[1] { RFmxLteMXMeasurementTypes.Acp };
SA.RFmxLTE.SelectAndInitiateMeasurements(lte, lteMeasurements, saAutolevelConfig, false, "", resultStringLte);
AcpResultsLte = FetchAcp(lte, RFmxLteMX.BuildResultString(resultStringLte));
PrintACPResults();

ConfigureModAcc(lte, ModaccConfigLte);
lteMeasurements[0] = RFmxLteMXMeasurementTypes.ModAcc;
SA.RFmxLTE.SelectAndInitiateMeasurements(lte, lteMeasurements, saAutolevelConfig, false, "", resultStringLte);
ModaccResultsLte = FetchModAcc(lte, RFmxLteMX.BuildResultString(resultStringLte));
PrintModAccResults();
#endregion

specAn.Dispose();
specAn = null;
lte.Dispose();
instr.Close();

AbortGeneration(nIRfsg);
CloseInstrument(nIRfsg);
}

#region Utilities
private void PrintACPResults()
{
Console.WriteLine("\n----------------------- ACP Results -----------------------\n");
Console.WriteLine("Carrier Absolute Power (dBm): {0:0.00}\n", AcpResultsLte.ComponentCarrierResults[0].AbsolutePower_dBm);
Console.WriteLine("\n-----------Offset Channel Measurements----------- \n");

for (int i = 0; i < AcpResultsLte.OffsetResults.Length; i++)
{
Console.WriteLine("Offset {0}", i);
Console.WriteLine("Lower Absolute Power (dBm) : {0:0.000}", AcpResultsLte.OffsetResults[i].LowerAbsolutePower_dBm);
Console.WriteLine("Upper Absolute Power (dBm) : {0:0.000}", AcpResultsLte.OffsetResults[i].UpperAbsolutePower_dBm);
Console.WriteLine("Lower Relative Power (dB) : {0:0.000}", AcpResultsLte.OffsetResults[i].LowerRelativePower_dB);
Console.WriteLine("Upper Relative Power (dB) : {0:0.000}", AcpResultsLte.OffsetResults[i].UpperRelativePower_dB);
Console.WriteLine("Offset Frequency (Hz) : {0:0.000}", AcpResultsLte.OffsetResults[i].Frequency_Hz);
Console.WriteLine("Offset Integration Bandwidth (Hz) : {0:0.000}", AcpResultsLte.OffsetResults[i].IntegrationBandwidth_Hz);
Console.WriteLine("-------------------------------------------------\n");
}
}
private void PrintModAccResults()
{
for (int i = 0; i < ModaccResultsLte.ComponentCarrierResults.Length; i++)
{
Console.WriteLine("\n----------------------- EVM Results CC {0} -----------------------\n", i);
Console.WriteLine("Composite RMS EVM Mean (% or dB) : {0:0.000}", ModaccResultsLte.ComponentCarrierResults[i].MeanRmsCompositeEvm);
Console.WriteLine("Composite Peak EVM Maximum (% or dB) : {0:0.000}", ModaccResultsLte.ComponentCarrierResults[i].MaxPeakCompositeEvm);
Console.WriteLine("Composite Peak EVM Slot Index : {0}", ModaccResultsLte.ComponentCarrierResults[i].PeakCompositeEvmSlotIndex);
Console.WriteLine("Composite Peak EVM Symbol Index : {0}", ModaccResultsLte.ComponentCarrierResults[i].PeakCompositeEvmSymbolIndex);
Console.WriteLine("Composite Peak EVM Subcarrier Index : {0}", ModaccResultsLte.ComponentCarrierResults[i].PeakCompositeEvmSubcarrierIndex);
Console.WriteLine("Component Carrier Frequency Error Mean (Hz) : {0:0.000}", ModaccResultsLte.ComponentCarrierResults[i].MeanFrequencyError_Hz);
}
}
#endregion
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{C95B388B-A9DD-4019-B4A1-64BC0188083D}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>LTE_NanosemiDPD_EVM_ACP_UL</RootNamespace>
<AssemblyName>LTE_NanosemiDPD_EVM_ACP_UL</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>x64</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</PropertyGroup>
<ItemGroup>
<Reference Include="NationalInstruments.Common, Version=19.0.40.49152, Culture=neutral, PublicKeyToken=dc6ad606294fc298, processorArchitecture=MSIL" />
<Reference Include="NationalInstruments.ModularInstruments.NIRfsg.Fx45, Version=19.6.0.49152, Culture=neutral, PublicKeyToken=4febd62461bf11a4, processorArchitecture=MSIL" />
<Reference Include="NationalInstruments.RFmx.InstrMX.Fx40, Version=20.0.0.16384, Culture=neutral, PublicKeyToken=dc6ad606294fc298, processorArchitecture=MSIL" />
<Reference Include="NationalInstruments.RFmx.LteMX.Fx40, Version=20.0.0.16384, Culture=neutral, PublicKeyToken=dc6ad606294fc298, processorArchitecture=MSIL" />
<Reference Include="NationalInstruments.RFmx.SpecAnMX.Fx40, Version=20.0.0.16384, Culture=neutral, PublicKeyToken=dc6ad606294fc298, processorArchitecture=MSIL" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="LTE_NanosemiDPD_EVM_ACP_UL.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Source\Common\Common.csproj">
<Project>{8e7d5092-b685-4ad3-9da3-7c53e56f0f32}</Project>
<Name>Common</Name>
</ProjectReference>
<ProjectReference Include="..\..\Source\Methods\NanosemiDPD\NanosemiDPD.csproj">
<Project>{7fdb7cdb-4281-4b0d-a407-a6d4c63fcd36}</Project>
<Name>NanosemiDPD</Name>
</ProjectReference>
<ProjectReference Include="..\..\Source\SA\RFmx Instr\RFmxInstr.csproj">
<Project>{ab49d5a9-9585-445a-ae8a-e4dd2b8956aa}</Project>
<Name>RFmxInstr</Name>
</ProjectReference>
<ProjectReference Include="..\..\Source\SA\RFmx LTE\RFmxLTE.csproj">
<Project>{1eb6f1ae-2eea-4dc8-8cdb-09b5fadf2236}</Project>
<Name>RFmxLTE</Name>
</ProjectReference>
<ProjectReference Include="..\..\Source\SA\RFmx SpecAn\RFmxSpecAn.csproj">
<Project>{3d1bc0f6-273c-4a44-82f6-3bb933862ffb}</Project>
<Name>RFmxSpecAn</Name>
</ProjectReference>
<ProjectReference Include="..\..\Source\SG\SG.csproj">
<Project>{89abcac5-cedb-4535-bd58-e205a97834d9}</Project>
<Name>SG</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
Loading