function outData = commobslibAmplifierTransform(inData)
    %COMMOBSLIBAMPLIFIERTRANSFORM Transformation function from commobslib
    %Amplifier block to the commrflib2 Memoryless Nonlinearity block
    %only when noise addition is enabled.

    % Copyright 2022 The MathWorks, Inc.

    InstanceData = inData.InstanceData;
    oldBlockParams = {InstanceData.Name};
    newBlockPath = 'commobslib/Amplifier';

    for p=1:length(oldBlockParams)
        if strcmp(oldBlockParams{p}, 'IncludeNoise')
            if strncmp(InstanceData(p).Value, 'off', 3)
                newBlockPath = sprintf('commrflib2/Memoryless\nNonlinearity');
            end
        end
    end

    if strncmp(newBlockPath, 'commrf', 6)
        % Remove noise related parameters
        for p=length(oldBlockParams):-1:1
            switch oldBlockParams{p}
                case {'IncludeNoise', 'NoiseType', 'NoiseTemperature', ...
                        'NoiseFigure', 'NoiseFactor', 'SeedSource', 'Seed'}
                    InstanceData(p) = [];
            end
        end
    end

    outData.NewBlockPath = newBlockPath;
    outData.NewInstanceData = InstanceData;
end
