function mcb_getCharacteristics(pmsm,inverter,varargin)
% mcb_getCharacteristics Computes the torque-speed characteristics for PMSM
%
%   mcb_getCharacteristics(pmsm,inverter) returns the following
%   characteristics for the given PMSM:
%   - Torque vs Speed
%   - Power vs Speed
%   - Idq vs Speed
%   - Ipeak vs Speed
%
%   The MCB_GETCHARACTERISTICS function accepts a pmsm object, an inverter object
%   and motor type ('spmsm' or ipmsm') as inputs.
%
%   mcb_getCharacteristics(pmsm,inverter,'motorType','ipmsm') returns the
%   charachteristics considering the motor to be an interior PMSM
%
%   The MCB_GETCHARACTERISTICS function, if no motor type is specified, considers
%   motor to be a surface mount PMSM.

% Copyright 2020-2023 The MathWorks, Inc.

%% Validate inputs
p = inputParser;
addParameter(p,'motorType','spmsm',@(x) any(ismember(lower(x),{'spmsm','ipmsm'})));
parse(p,varargin{:});
motorType = p.Results.motorType;
if strcmpi(motorType,'spmsm')
    FWCMethod='cvcp';
else
    FWCMethod='vclmt';
end
mcbPMSMCharacteristics(pmsm,inverter,"constraintCurves",0,"driveCharacteristics",1,"FWCMethod",FWCMethod,"voltageEquation","approximate");

end