% Calculate STGWA19N60 diode forward voltage drop.            18-9-14

% File Power_Elect\Matlab\STGWA19N60_v.m

% NB Function is characterised for I < 50. Larger I will give errors.
%   For I < 0 complex number returned.

function [vd] = STGWA19N60_vd(t,i)                      % diode v

% The diode voltages use the coefficients from STGWA19N60_v_data.m:
vd1 = 0.87*log(1.13*i + 1) + 0.028*i;                   % 125C
vd2 = 1.06*log(2.5*i + 1) + 0.015*i;                    % 25C

% Interpolate for temperature range
vd = vd1 + (vd2 - vd1)*(125 - t)/100;                   
if vd < 0
    vd = 0;
end

end

% For multiple I values use Binary Singleton Expansion
% bsxfun(@power,i',e)*w'; where i, e, w are row vectors for current,
% exponent and weighting of i.^e respectively