(* 初始化*)
IF bstart THEN
IF NOT bstartOld THEN
DataMax:=0.0;
DataMin:=0.0;
DataSun:=0.0;
bstartFlg:=TRUE;
END_IF;
ELSIF bstartOld THEN
bstartFlg:=FALSE;
DataMax:=0.0;
DataMin:=0.0;
DataSun:=0.0;
END_IF;
(* 計算*)
IF bstartFlg AND NOT bstartFlgOld THEN
FOR index:=0 TO 19 DO
IF DataMax<Data[index]THEN (*求最大值*)
DataMax:=Data[index];
END_IF;
IF DataMin>Data[index]THEN (*求最小值*)
DataMin:=Data[index];
END_IF;
DataSun:=Data[index]+DataSun;(*求和*)
DataAverage:=(DataSun-DataMax-DataMin)/18.0;(*求平均值*)
END_FOR;
END_IF;
bstartOld:= bstart ;
bstartFlgOld:=bstartFlg;