% ***************************************************************************
% COPYRIGHT BY DAVE JEWELL AND T.E. MARLIN 1994
% FILNAME : PERFORM.M
% Version 2.0
% LAST UPDATED : DECEMBER 1994
% DISCRIPTION OF FILE :
% THIS M-FILE IS ACCESSED FROM THE MAIN SIMULATION AND CALCULATES THE 
% PERFORMANCE OF THE PROCESS (CONTROLLED)
% ***************************************************************************

IAE=zeros(1,2);
ISE=zeros(1,2);
SAM=zeros(1,2);
SSM=zeros(1,2);
IE=zeros(1,2);
IAE1=sum(abs(error1))*delt;             % calculates and stores the IAE
IAE2=sum(abs(error2))*delt;             % calculates and stores the IAE
ISE1=sum(error1.^2)*delt;               % calculates and stores the ISE
ISE2=sum(error2.^2)*delt;               % calculates and stores the ISE
IE1=sum(error1)*delt;                   % calculates and stores the IE
IE2=sum(error2)*delt;                   % calculates and stores the IE

SAM1=(sum(abs(deltacontout1))/delt)*delt;     % calculates sum of absolute mv
SAM2=(sum(abs(deltacontout2))/delt)*delt;     % calculates sum of absolute mv
SSM1=(sum(deltacontout1.^2)/(delt^2))*delt;   % calculates sum of squared mv
SSM2=(sum(deltacontout2.^2)/(delt^2))*delt;   % calculates sum of squared mv

IAETOT = IAE1+IAE2;                     % sums & stores IAE for all controllers
ISETOT = ISE1+ISE2;                     % sums & stores ISE for all controllers 
SAMTOT= SAM1+SAM2;                      % sums & stores SAM for all mv
SSMTOT= SSM1+SSM2;                      % sums & stores SSM for all mv

