% hMultiUserParameterSummary print the parameter summary in TM9 MU-MIMO
% hMultiUserParameterSummary(enb,muPDSCH,muNRxAnts) prints a summary of some 
% of the more relevant simulation parameters in the TM9 MU-MIMO transmission.

% Copyright 2018 The MathWorks, Inc.

function hMultiUserParameterSummary(enb,muPDSCH,muNumRxAnts)

    % Number of active users
    numUsers = size(muPDSCH,1);
    % Print
    disp(' Parameter summary for TM9 MU-MIMO Transmission');
    disp('------------------------------------------------------------------');
    disp(['                      Duplexing mode: ' enb.DuplexMode]);
    disp('                   Transmission mode: TM9(MU-MIMO)');
    disp(['                 Transmission scheme: ' muPDSCH{1}.TxScheme]);
    disp(['  Number of downlink resource blocks: ' num2str(enb.NDLRB)]);
    disp([' Number of allocated resource blocks: ' ...
        num2str(length(muPDSCH{1}.PRBSet))]);
    disp(['         Number of transmit antennas: ' ...
        num2str(muPDSCH{1}.NTxAnts)]);
    % user specific parameters
    for userIdx = 1:numUsers
        % Number of codewords
        ncw = length(muPDSCH{userIdx}.Modulation);
        % Print
        disp('------------------------------------------------------------------');
        disp(['Number of Transmission layers for UE-' ...
            num2str(userIdx) ': ' num2str(muPDSCH{userIdx}.NLayers)]);
        disp(['          Number of codewords for UE-' ...
            num2str(userIdx) ': ' num2str(ncw)]);
        disp(['   Number of receive antennas for UE-' ...
            num2str(userIdx) ': ' num2str(muNumRxAnts(userIdx))]);
        disp(['               Modulation codeword 1: ' ...
            muPDSCH{userIdx}.Modulation{1}]);
        disp(['    Transport block sizes codeword 1: ' sprintf('%8d'...
            ,muPDSCH{userIdx}.TrBlkSizes(1,:))]);
        disp(['                Code rate codeword 1: ' sprintf('%8.4g'...
            ,muPDSCH{userIdx}.ActualCodeRate(1,:))]);

        if size(muPDSCH{userIdx}.TrBlkSizes,1)==2
            disp(['               Modulation codeword 2: ' ...
                muPDSCH{userIdx}.Modulation{2}]);
            disp(['    Transport block sizes codeword 2: ' ...
                sprintf('%8d',muPDSCH{userIdx}.TrBlkSizes(2,:))]);
            disp(['                Code rate codeword 2: ' ...
                sprintf('%8.4g',muPDSCH{userIdx}.ActualCodeRate(2,:))]);
        end
    end
    
end
