rSum:=aData[0];
rMin:=aData[0];
rMax:=aData[0];
FOR index:=1 TO 20 BY 1 DO
IF rMin > aData[index] THEN
rMin:=aData[index];
END_IF;
IF rMax < aData[index] THEN
rMax:=aData[index];
END_IF;
rSum:=rSum+aData[index];
END_FOR;
rSum:=rSum-rMax;
rSum:=rSum-rMin;
rAve:=rSum/20.0;