nr pdsch throughput -凯发k8网页登录
this reference simulation shows how to measure the physical downlink shared channel (pdsch) throughput of a 5g new radio (nr) link, as defined by the 3gpp nr standard. the example implements the pdsch and downlink shared channel (dl-sch). the transmitter model includes pdsch demodulation reference signals (dm-rs) and pdsch phase tracking reference signals (pt-rs). the example supports both clustered delay line (cdl) and tapped delay line (tdl) propagation channels. you can perform perfect or practical synchronization and channel estimation. to reduce the total simulation time, you can execute the snr points in the snr loop in parallel by using the parallel computing toolbox™.
introduction
this example measures the pdsch throughput of a 5g link, as defined by the 3gpp nr standard [ 1 ], [ 2 ], [ 3 ], [ 4 ].
the example models these 5g nr features:
dl-sch transport channel coding
multiple codewords, dependent on the number of layers
pdsch, pdsch dm-rs, and pdsch pt-rs generation
variable subcarrier spacing and frame numerologies (2^n * 15 khz)
normal and extended cyclic prefix
tdl and cdl propagation channel models
other features of the simulation are:
pdsch subband precoding using svd
cp-ofdm modulation
slot wise and non slot wise pdsch and dm-rs mapping
perfect or practical synchronization and channel estimation
harq operation with 16 processes
the example uses a single bandwidth part across the whole carrier
the figure shows the implemented processing chain. for clarity, the dm-rs and pt-rs generation are omitted.
for a more detailed explanation of the steps implemented in this example, see and .
this example supports both wideband and subband precoding. the precoding matrix is determined using svd by averaging the channel estimate across all pdsch prbs in the allocation (wideband case) or in the subband.
to reduce the total simulation time, you can use the parallel computing toolbox to execute the snr points of the snr loop in parallel.
simulation length and snr points
set the length of the simulation in terms of the number of 10ms frames. a large number of nframes should be used to produce meaningful throughput results. set the snr points to simulate. the snr for each layer is defined per re, and it includes the effect of signal and noise across all antennas. for an explanation of the snr definition that this example uses, see .
simparameters = struct(); % clear simparameters variable to contain all key simulation parameters simparameters.nframes = 2; % number of 10 ms frames simparameters.snrin = [-5 0 5]; % snr range (db)
channel estimator configuration
the logical variable perfectchannelestimator
controls channel estimation and synchronization behavior. when set to true
, perfect channel estimation and synchronization is used. otherwise, practical channel estimation and synchronization is used, based on the values of the received pdsch dm-rs.
simparameters.perfectchannelestimator = true;
simulation diagnostics
the variable displaysimulationinformation
controls the display of simulation information such as the harq process id used for each subframe. in case of crc error, the value of the index to the rv sequence is also displayed.
simparameters.displaysimulationinformation = true;
the displaydiagnostics
flag enables the plotting of the evm per layer. this plot monitors the quality of the received signal after equalization. the evm per layer figure shows:
the evm per layer per slot, which shows the evm evolving with time.
the evm per layer per resource block, which shows the evm in frequency.
this figure evolves with the simulation and is updated with each slot. typically, low snr or channel fades can result in decreased signal quality (high evm). the channel affects each layer differently, therefore, the evm values may differ across layers.
in some cases, some layers can have a much higher evm than others. these low-quality layers can result in crc errors. this behavior may be caused by low snr or by using too many layers for the channel conditions. you can avoid this situation by a combination of higher snr, lower number of layers, higher number of antennas, and more robust transmission (lower modulation scheme and target code rate).
simparameters.displaydiagnostics = false;
carrier and pdsch configuration
set the key parameters of the simulation. these include:
the bandwidth in resource blocks (12 subcarriers per resource block).
subcarrier spacing: 15, 30, 60, 120 (khz)
cyclic prefix length: normal or extended
cell id
number of transmit and receive antennas
a substructure containing the dl-sch and pdsch parameters is also specified. this includes:
target code rate
allocated resource blocks (prbset)
modulation scheme: 'qpsk', '16qam', '64qam', '256qam'
number of layers
pdsch mapping type
dm-rs configuration parameters
pt-rs configuration parameters
other simulation wide parameters are:
propagation channel model delay profile (tdl or cdl)
% set waveform type and pdsch numerology (scs and cp type) simparameters.carrier = nrcarrierconfig; % carrier resource grid configuration simparameters.carrier.nsizegrid = 51; % bandwidth in number of resource blocks (51 rbs at 30 khz scs for 20 mhz bw) simparameters.carrier.subcarrierspacing = 30; % 15, 30, 60, 120 (khz) simparameters.carrier.cyclicprefix = 'normal'; % 'normal' or 'extended' (extended cp is relevant for 60 khz scs only) simparameters.carrier.ncellid = 1; % cell identity % pdsch/dl-sch parameters simparameters.pdsch = nrpdschconfig; % this pdsch definition is the basis for all pdsch transmissions in the bler simulation simparameters.pdschextension = struct(); % this structure is to hold additional simulation parameters for the dl-sch and pdsch % define pdsch time-frequency resource allocation per slot to be full grid (single full grid bwp) simparameters.pdsch.prbset = 0:simparameters.carrier.nsizegrid-1; % pdsch prb allocation simparameters.pdsch.symbolallocation = [0,simparameters.carrier.symbolsperslot]; % starting symbol and number of symbols of each pdsch allocation simparameters.pdsch.mappingtype = 'a'; % pdsch mapping type ('a'(slot-wise),'b'(non slot-wise)) % scrambling identifiers simparameters.pdsch.nid = simparameters.carrier.ncellid; simparameters.pdsch.rnti = 1; % pdsch resource block mapping (ts 38.211 section 7.3.1.6) simparameters.pdsch.vrbtoprbinterleaving = 0; % disable interleaved resource mapping simparameters.pdsch.vrbbundlesize = 4; % define the number of transmission layers to be used simparameters.pdsch.numlayers = 2; % number of pdsch transmission layers % define codeword modulation and target coding rate % the number of codewords is directly dependent on the number of layers so ensure that % layers are set first before getting the codeword number if simparameters.pdsch.numcodewords > 1 % multicodeword transmission (when number of layers being > 4) simparameters.pdsch.modulation = {'16qam','16qam'}; % 'qpsk', '16qam', '64qam', '256qam' simparameters.pdschextension.targetcoderate = [490 490]/1024; % code rate used to calculate transport block sizes else simparameters.pdsch.modulation = '16qam'; % 'qpsk', '16qam', '64qam', '256qam' simparameters.pdschextension.targetcoderate = 490/1024; % code rate used to calculate transport block sizes end % dm-rs and antenna port configuration (ts 38.211 section 7.4.1.1) simparameters.pdsch.dmrs.dmrsportset = 0:simparameters.pdsch.numlayers-1; % dm-rs ports to use for the layers simparameters.pdsch.dmrs.dmrstypeaposition = 2; % mapping type a only. first dm-rs symbol position (2,3) simparameters.pdsch.dmrs.dmrslength = 1; % number of front-loaded dm-rs symbols (1(single symbol),2(double symbol)) simparameters.pdsch.dmrs.dmrsadditionalposition = 2; % additional dm-rs symbol positions (max range 0...3) simparameters.pdsch.dmrs.dmrsconfigurationtype = 2; % dm-rs configuration type (1,2) simparameters.pdsch.dmrs.numcdmgroupswithoutdata = 1;% number of cdm groups without data simparameters.pdsch.dmrs.nidnscid = 1; % scrambling identity (0...65535) simparameters.pdsch.dmrs.nscid = 0; % scrambling initialization (0,1) % pt-rs configuration (ts 38.211 section 7.4.1.2) simparameters.pdsch.enableptrs = 0; % enable or disable pt-rs (1 or 0) simparameters.pdsch.ptrs.timedensity = 1; % pt-rs time density (l_pt-rs) (1, 2, 4) simparameters.pdsch.ptrs.frequencydensity = 2; % pt-rs frequency density (k_pt-rs) (2 or 4) simparameters.pdsch.ptrs.reoffset = '00'; % pt-rs resource element offset ('00', '01', '10', '11') simparameters.pdsch.ptrs.ptrsportset = []; % pt-rs antenna port, subset of dm-rs port set. empty corresponds to lower dm-rs port number % reserved prb patterns, if required (for coresets, forward compatibility etc) simparameters.pdsch.reservedprb{1}.symbolset = []; % reserved pdsch symbols simparameters.pdsch.reservedprb{1}.prbset = []; % reserved pdsch prbs simparameters.pdsch.reservedprb{1}.period = []; % periodicity of reserved resources % additional simulation and dl-sch related parameters % % pdsch prb bundling (ts 38.214 section 5.1.2.3) simparameters.pdschextension.prgbundlesize = []; % 2, 4, or [] to signify "wideband" % % harq process and rate matching/tbs parameters simparameters.pdschextension.xoverhead = 6*simparameters.pdsch.enableptrs; % set pdsch rate matching overhead for tbs (xoh) to 6 when pt-rs is enabled, otherwise 0 simparameters.pdschextension.nharqprocesses = 16; % number of parallel harq processes to use simparameters.pdschextension.enableharq = true; % enable retransmissions for each process, using rv sequence [0,2,3,1] % ldpc decoder parameters % available algorithms: 'belief propagation', 'layered belief propagation', 'normalized min-sum', 'offset min-sum' simparameters.pdschextension.ldpcdecodingalgorithm = 'normalized min-sum'; simparameters.pdschextension.maximumldpciterationcount = 6; % define the overall transmission antenna geometry at end-points % if using a cdl propagation channel then the integer number of antenna elements is % turned into an antenna panel configured when the channel model object is created simparameters.ntxants = 8; % number of pdsch transmission antennas (1,2,4,8,16,32,64,128,256,512,1024) >= numlayers if simparameters.pdsch.numcodewords > 1 % multi-codeword transmission simparameters.nrxants = 8; % number of ue receive antennas (even number >= numlayers) else simparameters.nrxants = 2; % number of ue receive antennas (1 or even number >= numlayers) end % define the general cdl/tdl propagation channel parameters simparameters.delayprofile = 'cdl-c'; % use cdl-c model (urban macrocell model) simparameters.delayspread = 300e-9; simparameters.maximumdopplershift = 5; % cross-check the pdsch layering against the channel geometry validatenumlayers(simparameters);
the simulation relies on various pieces of information about the baseband waveform, such as sample rate.
waveforminfo = nrofdminfo(simparameters.carrier); % get information about the baseband waveform after ofdm modulation step
propagation channel model construction
create the channel model object for the simulation. both cdl and tdl channel models are supported [ 5 ].
% constructed the cdl or tdl channel model object if contains(simparameters.delayprofile,'cdl','ignorecase',true) channel = nrcdlchannel; % cdl channel object % turn the number of antennas into antenna panel array layouts. if % ntxants is not one of (1,2,4,8,16,32,64,128,256,512,1024), its value % is rounded up to the nearest value in the set. if nrxants is not 1 or % even, its value is rounded up to the nearest even number. channel = harraygeometry(channel,simparameters.ntxants,simparameters.nrxants); simparameters.ntxants = prod(channel.transmitantennaarray.size); simparameters.nrxants = prod(channel.receiveantennaarray.size); else channel = nrtdlchannel; % tdl channel object % set the channel geometry channel.numtransmitantennas = simparameters.ntxants; channel.numreceiveantennas = simparameters.nrxants; end % assign simulation channel parameters and waveform sample rate to the object channel.delayprofile = simparameters.delayprofile; channel.delayspread = simparameters.delayspread; channel.maximumdopplershift = simparameters.maximumdopplershift; channel.samplerate = waveforminfo.samplerate;
get the maximum number of delayed samples by a channel multipath component. this is calculated from the channel path with the largest delay and the implementation delay of the channel filter. this is required later to flush the channel filter to obtain the received signal.
chinfo = info(channel); maxchdelay = chinfo.maximumchanneldelay;
processing loop
to determine the throughput at each snr point, analyze the pdsch data per transmission instance using the following steps:
update current harq process. check the transmission status for the given harq process to determine whether a retransmission is required. if that is not the case then generate new data.
resource grid generation. perform channel coding by calling the system object. the object operates on the input transport block and keeps an internal copy of the transport block in case a retransmission is required. modulate the coded bits on the pdsch by using the function. then apply precoding to the resulting signal.
waveform generation. ofdm modulate the generated grid.
noisy channel modeling. pass the waveform through a cdl or tdl fading channel. add awgn. for an explanation of the snr definition that this example uses, see .
perform synchronization and ofdm demodulation. for perfect synchronization, reconstruct the channel impulse response to synchronize the received waveform. for practical synchronization, correlate the received waveform with the pdsch dm-rs. then ofdm demodulate the synchronized signal.
perform channel estimation. for perfect channel estimation, reconstruct the channel impulse response and perform ofdm demodulation. for practical channel estimation, use the pdsch dm-rs.
perform equalization and cpe compensation. mmse equalize the estimated channel. estimate the common phase error (cpe) by using the pt-rs symbols, then correct the error in each ofdm symbol within the range of reference pt-rs ofdm symbols.
precoding matrix calculation. generate the precoding matrix w for the next transmission by using singular value decomposition (svd).
decode the pdsch. to obtain an estimate of the received codewords, demodulate and descramble the recovered pdsch symbols for all transmit and receive antenna pairs, along with a noise estimate, by using the function.
decode the downlink shared channel (dl-sch) and update harq process with the block crc error. pass the vector of decoded soft bits to the system object. the object decodes the codeword and returns the block crc error used to determine the throughput of the system.
% array to store the maximum throughput for all snr points maxthroughput = zeros(length(simparameters.snrin),1); % array to store the simulation throughput for all snr points simthroughput = zeros(length(simparameters.snrin),1); % set up redundancy version (rv) sequence for all harq processes if simparameters.pdschextension.enableharq % in the final report of ran wg1 meeting #91 (r1-1719301), it was % observed in r1-1717405 that if performance is the priority, [0 2 3 1] % should be used. if self-decodability is the priority, it should be % taken into account that the upper limit of the code rate at which % each rv is self-decodable is in the following order: 0>3>2>1 rvseq = [0 2 3 1]; else % harq disabled - single transmission with rv=0, no retransmissions rvseq = 0; end % create dl-sch encoder system object to perform transport channel encoding encodedlsch = nrdlsch; encodedlsch.multipleharqprocesses = true; encodedlsch.targetcoderate = simparameters.pdschextension.targetcoderate; % create dl-sch decoder system object to perform transport channel decoding % use layered belief propagation for ldpc decoding, with half the number of % iterations as compared to the default for belief propagation decoding decodedlsch = nrdlschdecoder; decodedlsch.multipleharqprocesses = true; decodedlsch.targetcoderate = simparameters.pdschextension.targetcoderate; decodedlsch.ldpcdecodingalgorithm = simparameters.pdschextension.ldpcdecodingalgorithm; decodedlsch.maximumldpciterationcount = simparameters.pdschextension.maximumldpciterationcount; for snridx = 1:numel(simparameters.snrin) % comment out for parallel computing % parfor snridx = 1:numel(simparameters.snrin) % uncomment for parallel computing % to reduce the total simulation time, you can execute this loop in % parallel by using the parallel computing toolbox. comment out the 'for' % statement and uncomment the 'parfor' statement. if the parallel computing % toolbox is not installed, 'parfor' defaults to normal 'for' statement. % because parfor-loop iterations are executed in parallel in a % nondeterministic order, the simulation information displayed for each snr % point can be intertwined. to switch off simulation information display, % set the 'displaysimulationinformation' variable above to false % reset the random number generator so that each snr point will % experience the same noise realization rng('default'); % take full copies of the simulation-level parameter structures so that they are not % pct broadcast variables when using parfor simlocal = simparameters; waveinfolocal = waveforminfo; % take copies of channel-level parameters to simplify subsequent parameter referencing carrier = simlocal.carrier; pdsch = simlocal.pdsch; pdschextra = simlocal.pdschextension; decodedlschlocal = decodedlsch; % copy of the decoder handle to help pct classification of variable decodedlschlocal.reset(); % reset decoder at the start of each snr point pathfilters = []; % prepare simulation for new snr point snrdb = simlocal.snrin(snridx); fprintf('\nsimulating transmission scheme 1 (%dx%d) and scs=%dkhz with %s channel at %gdb snr for %d 10ms frame(s)\n', ... simlocal.ntxants,simlocal.nrxants,carrier.subcarrierspacing, ... simlocal.delayprofile,snrdb,simlocal.nframes); % specify the fixed order in which we cycle through the harq process ids harqsequence = 0:pdschextra.nharqprocesses-1; % initialize the state of all harq processes harqentity = harqentity(harqsequence,rvseq,pdsch.numcodewords); % reset the channel so that each snr point will experience the same % channel realization reset(channel); % total number of slots in the simulation period nslots = simlocal.nframes * carrier.slotsperframe; % obtain a precoding matrix (wtx) to be used in the transmission of the % first transport block estchannelgrid = getinitialchannelestimate(carrier,simlocal.ntxants,channel); newwtx = getprecodingmatrix(carrier,pdsch,estchannelgrid,pdschextra.prgbundlesize); % timing offset, updated in every slot for perfect synchronization and % when the correlation is strong for practical synchronization offset = 0; % loop over the entire waveform length for nslot = 0:nslots-1 % update the carrier slot numbers for new slot carrier.nslot = nslot; % calculate the transport block sizes for the transmission in the slot [pdschindices,pdschindicesinfo] = nrpdschindices(carrier,pdsch); trblksizes = nrtbs(pdsch.modulation,pdsch.numlayers,numel(pdsch.prbset),pdschindicesinfo.nreperprb,pdschextra.targetcoderate,pdschextra.xoverhead); % harq processing for cwidx = 1:pdsch.numcodewords % if new data for current process and codeword then create a new dl-sch transport block if harqentity.newdata(cwidx) trblk = randi([0 1],trblksizes(cwidx),1); settransportblock(encodedlsch,trblk,cwidx-1,harqentity.harqprocessid); % if new data because of previous rv sequence time out then flush decoder soft buffer explicitly if harqentity.sequencetimeout(cwidx) resetsoftbuffer(decodedlschlocal,cwidx-1,harqentity.harqprocessid); end end end % encode the dl-sch transport blocks codedtrblocks = encodedlsch(pdsch.modulation,pdsch.numlayers, ... pdschindicesinfo.g,harqentity.redundancyversion,harqentity.harqprocessid); % get precoding matrix (wtx) calculated in previous slot wtx = newwtx; % create resource grid for a slot pdschgrid = nrresourcegrid(carrier,simlocal.ntxants); % pdsch modulation and precoding pdschsymbols = nrpdsch(carrier,pdsch,codedtrblocks); [pdschantsymbols,pdschantindices] = hprgprecode(size(pdschgrid),carrier.nstartgrid,pdschsymbols,pdschindices,wtx); % pdsch mapping in grid associated with pdsch transmission period pdschgrid(pdschantindices) = pdschantsymbols; % pdsch dm-rs precoding and mapping dmrssymbols = nrpdschdmrs(carrier,pdsch); dmrsindices = nrpdschdmrsindices(carrier,pdsch); [dmrsantsymbols,dmrsantindices] = hprgprecode(size(pdschgrid),carrier.nstartgrid,dmrssymbols,dmrsindices,wtx); pdschgrid(dmrsantindices) = dmrsantsymbols; % pdsch pt-rs precoding and mapping ptrssymbols = nrpdschptrs(carrier,pdsch); ptrsindices = nrpdschptrsindices(carrier,pdsch); [ptrsantsymbols,ptrsantindices] = hprgprecode(size(pdschgrid),carrier.nstartgrid,ptrssymbols,ptrsindices,wtx); pdschgrid(ptrsantindices) = ptrsantsymbols; % ofdm modulation txwaveform = nrofdmmodulate(carrier,pdschgrid); % pass data through channel model. append zeros at the end of the % transmitted waveform to flush channel content. these zeros take % into account any delay introduced in the channel. this is a mix % of multipath delay and implementation delay. this value may % change depending on the sampling rate, delay profile and delay % spread txwaveform = [txwaveform; zeros(maxchdelay,size(txwaveform,2))]; %#ok[rxwaveform,pathgains,sampletimes] = channel(txwaveform); % add awgn to the received time domain waveform % normalize noise power by the ifft size used in ofdm modulation, % as the ofdm modulator applies this normalization to the % transmitted waveform. also normalize by the number of receive % antennas, as the channel model applies this normalization to the % received waveform, by default snr = 10^(snrdb/10); n0 = 1/sqrt(2.0*simlocal.nrxants*double(waveinfolocal.nfft)*snr); noise = n0*complex(randn(size(rxwaveform)),randn(size(rxwaveform))); rxwaveform = rxwaveform noise; if (simlocal.perfectchannelestimator) % perfect synchronization. use information provided by the % channel to find the strongest multipath component pathfilters = getpathfilters(channel); [offset,mag] = nrperfecttimingestimate(pathgains,pathfilters); else % practical synchronization. correlate the received waveform % with the pdsch dm-rs to give timing offset estimate 't' and % correlation magnitude 'mag'. the function % hskipweaktimingoffset is used to update the receiver timing % offset. if the correlation peak in 'mag' is weak, the current % timing estimate 't' is ignored and the previous estimate % 'offset' is used [t,mag] = nrtimingestimate(carrier,rxwaveform,dmrsindices,dmrssymbols); offset = hskipweaktimingoffset(offset,t,mag); % display a warning if the estimated timing offset exceeds the % maximum channel delay if offset > maxchdelay warning(['estimated timing offset (%d) is greater than the maximum channel delay (%d).' ... ' this will result in a decoding failure. this may be caused by low snr,' ... ' or not enough dm-rs symbols to synchronize successfully.'],offset,maxchdelay); end end rxwaveform = rxwaveform(1 offset:end,:); % perform ofdm demodulation on the received data to recreate the % resource grid, including padding in the event that practical % synchronization results in an incomplete slot being demodulated rxgrid = nrofdmdemodulate(carrier,rxwaveform); [k,l,r] = size(rxgrid); if (l < carrier.symbolsperslot) rxgrid = cat(2,rxgrid,zeros(k,carrier.symbolsperslot-l,r)); end if (simlocal.perfectchannelestimator) % perfect channel estimation, using the value of the path gains % provided by the channel. this channel estimate does not % include the effect of transmitter precoding estchannelgrid = nrperfectchannelestimate(carrier,pathgains,pathfilters,offset,sampletimes); % get perfect noise estimate (from the noise realization) noisegrid = nrofdmdemodulate(carrier,noise(1 offset:end ,:)); noiseest = var(noisegrid(:)); % get precoding matrix for next slot newwtx = getprecodingmatrix(carrier,pdsch,estchannelgrid,pdschextra.prgbundlesize); % get pdsch resource elements from the received grid and % channel estimate [pdschrx,pdschhest,~,pdschhestindices] = nrextractresources(pdschindices,rxgrid,estchannelgrid); % apply precoding to channel estimate pdschhest = hprgprecode(size(estchannelgrid),carrier.nstartgrid,pdschhest,pdschhestindices,permute(wtx,[2 1 3])); else % practical channel estimation between the received grid and % each transmission layer, using the pdsch dm-rs for each % layer. this channel estimate includes the effect of % transmitter precoding [estchannelgrid,noiseest] = hsubbandchannelestimate(carrier,rxgrid,dmrsindices,dmrssymbols,pdschextra.prgbundlesize,'cdmlengths',pdsch.dmrs.cdmlengths); % average noise estimate across prgs and layers noiseest = mean(noiseest,'all'); % get pdsch resource elements from the received grid and % channel estimate [pdschrx,pdschhest] = nrextractresources(pdschindices,rxgrid,estchannelgrid); % remove precoding from estchannelgrid prior to precoding % matrix calculation estchannelgridports = precodechannelestimate(carrier,estchannelgrid,conj(wtx)); % get precoding matrix for next slot newwtx = getprecodingmatrix(carrier,pdsch,estchannelgridports,pdschextra.prgbundlesize); end % equalization [pdscheq,csi] = nrequalizemmse(pdschrx,pdschhest,noiseest); % common phase error (cpe) compensation if ~isempty(ptrsindices) % initialize temporary grid to store equalized symbols tempgrid = nrresourcegrid(carrier,pdsch.numlayers); % extract pt-rs symbols from received grid and estimated % channel grid [ptrsrx,ptrshest,~,~,ptrshestindices,ptrslayerindices] = nrextractresources(ptrsindices,rxgrid,estchannelgrid,tempgrid); if (simlocal.perfectchannelestimator) % apply precoding to channel estimate ptrshest = hprgprecode(size(estchannelgrid),carrier.nstartgrid,ptrshest,ptrshestindices,permute(wtx,[2 1 3])); end % equalize pt-rs symbols and map them to tempgrid ptrseq = nrequalizemmse(ptrsrx,ptrshest,noiseest); tempgrid(ptrslayerindices) = ptrseq; % estimate the residual channel at the pt-rs locations in % tempgrid cpe = nrchannelestimate(tempgrid,ptrsindices,ptrssymbols); % sum estimates across subcarriers, receive antennas, and % layers. then, get the cpe by taking the angle of the % resultant sum cpe = angle(sum(cpe,[1 3 4])); % map the equalized pdsch symbols to tempgrid tempgrid(pdschindices) = pdscheq; % correct cpe in each ofdm symbol within the range of reference % pt-rs ofdm symbols symloc = pdschindicesinfo.ptrssymbolset(1) 1:pdschindicesinfo.ptrssymbolset(end) 1; tempgrid(:,symloc,:) = tempgrid(:,symloc,:).*exp(-1i*cpe(symloc)); % extract pdsch symbols pdscheq = tempgrid(pdschindices); end % decode pdsch physical channel [dlschllrs,rxsymbols] = nrpdschdecode(carrier,pdsch,pdscheq,noiseest); % display evm per layer, per slot and per rb if (simlocal.displaydiagnostics) plotlayerevm(nslots,nslot,pdsch,size(pdschgrid),pdschindices,pdschsymbols,pdscheq); end % scale llrs by csi csi = nrlayerdemap(csi); % csi layer demapping for cwidx = 1:pdsch.numcodewords qm = length(dlschllrs{cwidx})/length(rxsymbols{cwidx}); % bits per symbol csi{cwidx} = repmat(csi{cwidx}.',qm,1); % expand by each bit per symbol dlschllrs{cwidx} = dlschllrs{cwidx} .* csi{cwidx}(:); % scale by csi end % decode the dl-sch transport channel decodedlschlocal.transportblocklength = trblksizes; [decbits,blkerr] = decodedlschlocal(dlschllrs,pdsch.modulation,pdsch.numlayers,harqentity.redundancyversion,harqentity.harqprocessid); % store values to calculate throughput simthroughput(snridx) = simthroughput(snridx) sum(~blkerr .* trblksizes); maxthroughput(snridx) = maxthroughput(snridx) sum(trblksizes); % update current process with crc error and advance to next process procstatus = updateandadvance(harqentity,blkerr,trblksizes,pdschindicesinfo.g); if (simlocal.displaysimulationinformation) fprintf('\n(%3.2f%%) nslot=%d, %s',100*(nslot 1)/nslots,nslot,procstatus); end end % display the results dynamically in the command window if (simlocal.displaysimulationinformation) fprintf('\n'); end fprintf('\nthroughput(mbps) for %d frame(s) = %.4f\n',simlocal.nframes,1e-6*simthroughput(snridx)/(simlocal.nframes*10e-3)); fprintf('throughput(%%) for %d frame(s) = %.4f\n',simlocal.nframes,simthroughput(snridx)*100/maxthroughput(snridx)); end
simulating transmission scheme 1 (8x2) and scs=30khz with cdl-c channel at -5db snr for 2 10ms frame(s) (2.50%) nslot=0, harq proc 0: cw0: initial transmission failed (rv=0,cr=0.474736). (5.00%) nslot=1, harq proc 1: cw0: initial transmission failed (rv=0,cr=0.474736). (7.50%) nslot=2, harq proc 2: cw0: initial transmission failed (rv=0,cr=0.474736). (10.00%) nslot=3, harq proc 3: cw0: initial transmission failed (rv=0,cr=0.474736). (12.50%) nslot=4, harq proc 4: cw0: initial transmission failed (rv=0,cr=0.474736). (15.00%) nslot=5, harq proc 5: cw0: initial transmission failed (rv=0,cr=0.474736). (17.50%) nslot=6, harq proc 6: cw0: initial transmission failed (rv=0,cr=0.474736). (20.00%) nslot=7, harq proc 7: cw0: initial transmission failed (rv=0,cr=0.474736). (22.50%) nslot=8, harq proc 8: cw0: initial transmission failed (rv=0,cr=0.474736). (25.00%) nslot=9, harq proc 9: cw0: initial transmission failed (rv=0,cr=0.474736). (27.50%) nslot=10, harq proc 10: cw0: initial transmission failed (rv=0,cr=0.474736). (30.00%) nslot=11, harq proc 11: cw0: initial transmission failed (rv=0,cr=0.474736). (32.50%) nslot=12, harq proc 12: cw0: initial transmission failed (rv=0,cr=0.474736). (35.00%) nslot=13, harq proc 13: cw0: initial transmission failed (rv=0,cr=0.474736). (37.50%) nslot=14, harq proc 14: cw0: initial transmission failed (rv=0,cr=0.474736). (40.00%) nslot=15, harq proc 15: cw0: initial transmission failed (rv=0,cr=0.474736). (42.50%) nslot=16, harq proc 0: cw0: retransmission #1 passed (rv=2,cr=0.474736). (45.00%) nslot=17, harq proc 1: cw0: retransmission #1 passed (rv=2,cr=0.474736). (47.50%) nslot=18, harq proc 2: cw0: retransmission #1 passed (rv=2,cr=0.474736). (50.00%) nslot=19, harq proc 3: cw0: retransmission #1 passed (rv=2,cr=0.474736). (52.50%) nslot=20, harq proc 4: cw0: retransmission #1 passed (rv=2,cr=0.474736). (55.00%) nslot=21, harq proc 5: cw0: retransmission #1 passed (rv=2,cr=0.474736). (57.50%) nslot=22, harq proc 6: cw0: retransmission #1 passed (rv=2,cr=0.474736). (60.00%) nslot=23, harq proc 7: cw0: retransmission #1 passed (rv=2,cr=0.474736). (62.50%) nslot=24, harq proc 8: cw0: retransmission #1 passed (rv=2,cr=0.474736). (65.00%) nslot=25, harq proc 9: cw0: retransmission #1 passed (rv=2,cr=0.474736). (67.50%) nslot=26, harq proc 10: cw0: retransmission #1 passed (rv=2,cr=0.474736). (70.00%) nslot=27, harq proc 11: cw0: retransmission #1 passed (rv=2,cr=0.474736). (72.50%) nslot=28, harq proc 12: cw0: retransmission #1 passed (rv=2,cr=0.474736). (75.00%) nslot=29, harq proc 13: cw0: retransmission #1 passed (rv=2,cr=0.474736). (77.50%) nslot=30, harq proc 14: cw0: retransmission #1 passed (rv=2,cr=0.474736). (80.00%) nslot=31, harq proc 15: cw0: retransmission #1 passed (rv=2,cr=0.474736). (82.50%) nslot=32, harq proc 0: cw0: initial transmission failed (rv=0,cr=0.474736). (85.00%) nslot=33, harq proc 1: cw0: initial transmission failed (rv=0,cr=0.474736). (87.50%) nslot=34, harq proc 2: cw0: initial transmission failed (rv=0,cr=0.474736). (90.00%) nslot=35, harq proc 3: cw0: initial transmission failed (rv=0,cr=0.474736). (92.50%) nslot=36, harq proc 4: cw0: initial transmission failed (rv=0,cr=0.474736). (95.00%) nslot=37, harq proc 5: cw0: initial transmission failed (rv=0,cr=0.474736). (97.50%) nslot=38, harq proc 6: cw0: initial transmission failed (rv=0,cr=0.474736). (100.00%) nslot=39, harq proc 7: cw0: initial transmission failed (rv=0,cr=0.474736). throughput(mbps) for 2 frame(s) = 24.1728 throughput(%) for 2 frame(s) = 40.0000 simulating transmission scheme 1 (8x2) and scs=30khz with cdl-c channel at 0db snr for 2 10ms frame(s) (2.50%) nslot=0, harq proc 0: cw0: initial transmission passed (rv=0,cr=0.474736). (5.00%) nslot=1, harq proc 1: cw0: initial transmission passed (rv=0,cr=0.474736). (7.50%) nslot=2, harq proc 2: cw0: initial transmission passed (rv=0,cr=0.474736). (10.00%) nslot=3, harq proc 3: cw0: initial transmission passed (rv=0,cr=0.474736). (12.50%) nslot=4, harq proc 4: cw0: initial transmission passed (rv=0,cr=0.474736). (15.00%) nslot=5, harq proc 5: cw0: initial transmission passed (rv=0,cr=0.474736). (17.50%) nslot=6, harq proc 6: cw0: initial transmission passed (rv=0,cr=0.474736). (20.00%) nslot=7, harq proc 7: cw0: initial transmission passed (rv=0,cr=0.474736). (22.50%) nslot=8, harq proc 8: cw0: initial transmission passed (rv=0,cr=0.474736). (25.00%) nslot=9, harq proc 9: cw0: initial transmission passed (rv=0,cr=0.474736). (27.50%) nslot=10, harq proc 10: cw0: initial transmission passed (rv=0,cr=0.474736). (30.00%) nslot=11, harq proc 11: cw0: initial transmission passed (rv=0,cr=0.474736). (32.50%) nslot=12, harq proc 12: cw0: initial transmission passed (rv=0,cr=0.474736). (35.00%) nslot=13, harq proc 13: cw0: initial transmission passed (rv=0,cr=0.474736). (37.50%) nslot=14, harq proc 14: cw0: initial transmission passed (rv=0,cr=0.474736). (40.00%) nslot=15, harq proc 15: cw0: initial transmission passed (rv=0,cr=0.474736). (42.50%) nslot=16, harq proc 0: cw0: initial transmission passed (rv=0,cr=0.474736). (45.00%) nslot=17, harq proc 1: cw0: initial transmission passed (rv=0,cr=0.474736). (47.50%) nslot=18, harq proc 2: cw0: initial transmission passed (rv=0,cr=0.474736). (50.00%) nslot=19, harq proc 3: cw0: initial transmission passed (rv=0,cr=0.474736). (52.50%) nslot=20, harq proc 4: cw0: initial transmission passed (rv=0,cr=0.474736). (55.00%) nslot=21, harq proc 5: cw0: initial transmission passed (rv=0,cr=0.474736). (57.50%) nslot=22, harq proc 6: cw0: initial transmission passed (rv=0,cr=0.474736). (60.00%) nslot=23, harq proc 7: cw0: initial transmission passed (rv=0,cr=0.474736). (62.50%) nslot=24, harq proc 8: cw0: initial transmission passed (rv=0,cr=0.474736). (65.00%) nslot=25, harq proc 9: cw0: initial transmission passed (rv=0,cr=0.474736). (67.50%) nslot=26, harq proc 10: cw0: initial transmission passed (rv=0,cr=0.474736). (70.00%) nslot=27, harq proc 11: cw0: initial transmission passed (rv=0,cr=0.474736). (72.50%) nslot=28, harq proc 12: cw0: initial transmission passed (rv=0,cr=0.474736). (75.00%) nslot=29, harq proc 13: cw0: initial transmission passed (rv=0,cr=0.474736). (77.50%) nslot=30, harq proc 14: cw0: initial transmission passed (rv=0,cr=0.474736). (80.00%) nslot=31, harq proc 15: cw0: initial transmission passed (rv=0,cr=0.474736). (82.50%) nslot=32, harq proc 0: cw0: initial transmission passed (rv=0,cr=0.474736). (85.00%) nslot=33, harq proc 1: cw0: initial transmission passed (rv=0,cr=0.474736). (87.50%) nslot=34, harq proc 2: cw0: initial transmission passed (rv=0,cr=0.474736). (90.00%) nslot=35, harq proc 3: cw0: initial transmission passed (rv=0,cr=0.474736). (92.50%) nslot=36, harq proc 4: cw0: initial transmission passed (rv=0,cr=0.474736). (95.00%) nslot=37, harq proc 5: cw0: initial transmission passed (rv=0,cr=0.474736). (97.50%) nslot=38, harq proc 6: cw0: initial transmission passed (rv=0,cr=0.474736). (100.00%) nslot=39, harq proc 7: cw0: initial transmission passed (rv=0,cr=0.474736). throughput(mbps) for 2 frame(s) = 60.4320 throughput(%) for 2 frame(s) = 100.0000 simulating transmission scheme 1 (8x2) and scs=30khz with cdl-c channel at 5db snr for 2 10ms frame(s) (2.50%) nslot=0, harq proc 0: cw0: initial transmission passed (rv=0,cr=0.474736). (5.00%) nslot=1, harq proc 1: cw0: initial transmission passed (rv=0,cr=0.474736). (7.50%) nslot=2, harq proc 2: cw0: initial transmission passed (rv=0,cr=0.474736). (10.00%) nslot=3, harq proc 3: cw0: initial transmission passed (rv=0,cr=0.474736). (12.50%) nslot=4, harq proc 4: cw0: initial transmission passed (rv=0,cr=0.474736). (15.00%) nslot=5, harq proc 5: cw0: initial transmission passed (rv=0,cr=0.474736). (17.50%) nslot=6, harq proc 6: cw0: initial transmission passed (rv=0,cr=0.474736). (20.00%) nslot=7, harq proc 7: cw0: initial transmission passed (rv=0,cr=0.474736). (22.50%) nslot=8, harq proc 8: cw0: initial transmission passed (rv=0,cr=0.474736). (25.00%) nslot=9, harq proc 9: cw0: initial transmission passed (rv=0,cr=0.474736). (27.50%) nslot=10, harq proc 10: cw0: initial transmission passed (rv=0,cr=0.474736). (30.00%) nslot=11, harq proc 11: cw0: initial transmission passed (rv=0,cr=0.474736). (32.50%) nslot=12, harq proc 12: cw0: initial transmission passed (rv=0,cr=0.474736). (35.00%) nslot=13, harq proc 13: cw0: initial transmission passed (rv=0,cr=0.474736). (37.50%) nslot=14, harq proc 14: cw0: initial transmission passed (rv=0,cr=0.474736). (40.00%) nslot=15, harq proc 15: cw0: initial transmission passed (rv=0,cr=0.474736). (42.50%) nslot=16, harq proc 0: cw0: initial transmission passed (rv=0,cr=0.474736). (45.00%) nslot=17, harq proc 1: cw0: initial transmission passed (rv=0,cr=0.474736). (47.50%) nslot=18, harq proc 2: cw0: initial transmission passed (rv=0,cr=0.474736). (50.00%) nslot=19, harq proc 3: cw0: initial transmission passed (rv=0,cr=0.474736). (52.50%) nslot=20, harq proc 4: cw0: initial transmission passed (rv=0,cr=0.474736). (55.00%) nslot=21, harq proc 5: cw0: initial transmission passed (rv=0,cr=0.474736). (57.50%) nslot=22, harq proc 6: cw0: initial transmission passed (rv=0,cr=0.474736). (60.00%) nslot=23, harq proc 7: cw0: initial transmission passed (rv=0,cr=0.474736). (62.50%) nslot=24, harq proc 8: cw0: initial transmission passed (rv=0,cr=0.474736). (65.00%) nslot=25, harq proc 9: cw0: initial transmission passed (rv=0,cr=0.474736). (67.50%) nslot=26, harq proc 10: cw0: initial transmission passed (rv=0,cr=0.474736). (70.00%) nslot=27, harq proc 11: cw0: initial transmission passed (rv=0,cr=0.474736). (72.50%) nslot=28, harq proc 12: cw0: initial transmission passed (rv=0,cr=0.474736). (75.00%) nslot=29, harq proc 13: cw0: initial transmission passed (rv=0,cr=0.474736). (77.50%) nslot=30, harq proc 14: cw0: initial transmission passed (rv=0,cr=0.474736). (80.00%) nslot=31, harq proc 15: cw0: initial transmission passed (rv=0,cr=0.474736). (82.50%) nslot=32, harq proc 0: cw0: initial transmission passed (rv=0,cr=0.474736). (85.00%) nslot=33, harq proc 1: cw0: initial transmission passed (rv=0,cr=0.474736). (87.50%) nslot=34, harq proc 2: cw0: initial transmission passed (rv=0,cr=0.474736). (90.00%) nslot=35, harq proc 3: cw0: initial transmission passed (rv=0,cr=0.474736). (92.50%) nslot=36, harq proc 4: cw0: initial transmission passed (rv=0,cr=0.474736). (95.00%) nslot=37, harq proc 5: cw0: initial transmission passed (rv=0,cr=0.474736). (97.50%) nslot=38, harq proc 6: cw0: initial transmission passed (rv=0,cr=0.474736). (100.00%) nslot=39, harq proc 7: cw0: initial transmission passed (rv=0,cr=0.474736). throughput(mbps) for 2 frame(s) = 60.4320 throughput(%) for 2 frame(s) = 100.0000
results
display the measured throughput. this is calculated as the percentage of the maximum possible throughput of the link given the available resources for data transmission.
figure; plot(simparameters.snrin,simthroughput*100./maxthroughput,'o-.') xlabel('snr (db)'); ylabel('throughput (%)'); grid on; title(sprintf('%s (%dx%d) / nrb=%d / scs=%dkhz', ... simparameters.delayprofile,simparameters.ntxants,simparameters.nrxants, ... simparameters.carrier.nsizegrid,simparameters.carrier.subcarrierspacing)); % bundle key parameters and results into a combined structure for recording simresults.simparameters = simparameters; simresults.simthroughput = simthroughput; simresults.maxthroughput = maxthroughput;
the figure below shows throughput results obtained simulating 10000 subframes (nframes = 1000
, snrin = -18:2:16
).
selected bibliography
3gpp ts 38.211. "nr; physical channels and modulation." 3rd generation partnership project; technical specification group radio access network.
3gpp ts 38.212. "nr; multiplexing and channel coding." 3rd generation partnership project; technical specification group radio access network.
3gpp ts 38.213. "nr; physical layer procedures for control." 3rd generation partnership project; technical specification group radio access network.
3gpp ts 38.214. "nr; physical layer procedures for data." 3rd generation partnership project; technical specification group radio access network.
3gpp tr 38.901. "study on channel model for frequencies from 0.5 to 100 ghz." 3rd generation partnership project; technical specification group radio access network.
local functions
function validatenumlayers(simparameters) % validate the number of layers, relative to the antenna geometry numlayers = simparameters.pdsch.numlayers; ntxants = simparameters.ntxants; nrxants = simparameters.nrxants; antennadescription = sprintf('min(ntxants,nrxants) = min(%d,%d) = %d',ntxants,nrxants,min(ntxants,nrxants)); if numlayers > min(ntxants,nrxants) error('the number of layers (%d) must satisfy numlayers <= %s', ... numlayers,antennadescription); end % display a warning if the maximum possible rank of the channel equals % the number of layers if (numlayers > 2) && (numlayers == min(ntxants,nrxants)) warning(['the maximum possible rank of the channel, given by %s, is equal to numlayers (%d).' ... ' this may result in a decoding failure under some channel conditions.' ... ' try decreasing the number of layers or increasing the channel rank' ... ' (use more transmit or receive antennas).'],antennadescription,numlayers); %#okend end function estchannelgrid = getinitialchannelestimate(carrier,ntxants,propchannel) % obtain channel estimate before first transmission. this can be used to % obtain a precoding matrix for the first slot. ofdminfo = nrofdminfo(carrier); chinfo = info(propchannel); maxchdelay = chinfo.maximumchanneldelay; % temporary waveform (only needed for the sizes) tmpwaveform = zeros((ofdminfo.samplerate/1000/carrier.slotspersubframe) maxchdelay,ntxants); % filter through channel [~,pathgains,sampletimes] = propchannel(tmpwaveform); % perfect timing synch pathfilters = getpathfilters(propchannel); offset = nrperfecttimingestimate(pathgains,pathfilters); % perfect channel estimate estchannelgrid = nrperfectchannelestimate(carrier,pathgains,pathfilters,offset,sampletimes); end function wtx = getprecodingmatrix(carrier,pdsch,hestgrid,prgbundlesize) % calculate precoding matrices for all prgs in the carrier that overlap % with the pdsch allocation % maximum crb addressed by carrier grid maxcrb = carrier.nstartgrid carrier.nsizegrid - 1; % prg size if nargin==4 && ~isempty(prgbundlesize) pd_bwp = prgbundlesize; else pd_bwp = maxcrb 1; end % prg numbers (1-based) for each rb in the carrier grid nprg = ceil((maxcrb 1) / pd_bwp); prgset = repmat((1:nprg),pd_bwp,1); prgset = prgset(carrier.nstartgrid (1:carrier.nsizegrid).'); [~,~,r,p] = size(hestgrid); wtx = zeros([pdsch.numlayers p nprg]); for i = 1:nprg % subcarrier indices within current prg and within the pdsch % allocation thisprg = find(prgset==i) - 1; thisprg = intersect(thisprg,pdsch.prbset(:),'rows'); prgsc = (1:12)' 12*thisprg'; prgsc = prgsc(:); if (~isempty(prgsc)) % average channel estimate in prg estallocgrid = hestgrid(prgsc,:,:,:); hest = permute(mean(reshape(estallocgrid,[],r,p)),[2 3 1]); % svd decomposition [~,~,v] = svd(hest); wtx(:,:,i) = v(:,1:pdsch.numlayers).'; end end wtx = wtx / sqrt(pdsch.numlayers); % normalize by numlayers end function estchannelgrid = precodechannelestimate(carrier,estchannelgrid,w) % apply precoding matrix w to the last dimension of the channel estimate [k,l,r,p] = size(estchannelgrid); estchannelgrid = reshape(estchannelgrid,[k*l r p]); estchannelgrid = hprgprecode([k l r p],carrier.nstartgrid,estchannelgrid,reshape(1:numel(estchannelgrid),[k*l r p]),w); estchannelgrid = reshape(estchannelgrid,k,l,r,[]); end function plotlayerevm(nslots,nslot,pdsch,siz,pdschindices,pdschsymbols,pdscheq) % plot evm information persistent slotevm; persistent rbevm persistent evmperslot; if (nslot==0) slotevm = comm.evm; rbevm = comm.evm; evmperslot = nan(nslots,pdsch.numlayers); figure; end evmperslot(nslot 1,:) = slotevm(pdschsymbols,pdscheq); subplot(2,1,1); plot(0:(nslots-1),evmperslot,'o-'); xlabel('slot number'); ylabel('evm (%)'); legend("layer " (1:pdsch.numlayers),'location','eastoutside'); title('evm per layer per slot'); subplot(2,1,2); [k,~,p] = ind2sub(siz,pdschindices); rbsubs = floor((k-1) / 12); nrb = siz(1) / 12; evmperrb = nan(nrb,pdsch.numlayers); for nu = 1:pdsch.numlayers for rb = unique(rbsubs).' this = (rbsubs==rb & p==nu); evmperrb(rb 1,nu) = rbevm(pdschsymbols(this),pdscheq(this)); end end plot(0:(nrb-1),evmperrb,'x-'); xlabel('resource block'); ylabel('evm (%)'); legend("layer " (1:pdsch.numlayers),'location','eastoutside'); title(['evm per layer per resource block, slot #' num2str(nslot)]); drawnow; end
see also
objects
- |
functions
- | | |