@Giamba This sometimes happens, I recommend using a filtering function block for each temperature sensors. Something like this, this is a old filter that one of our customers used:
FUNCTION_BLOCK check_1w_temp
(*
EXTENDS //base type
IMPLEMENTS //interface type list
*)
VAR NON_RETAIN
(* add local variables here *)
first_run: bool:= TRUE;
prev_temp: real:= 999.99;
filter: LIB.CORE.V1_0.B86_FILTER;
END_VAR
VAR_INPUT
(* add in variables here *)
actual_temp: real:= 0;
err_diff: real:= 5;
por_diff: real:= 1;
filter_const: real:= 60;
min_temp_allowed: real:= -55;
max_temp_allowed: real:= 125;
END_VAR
VAR_OUTPUT
outtemp: real;
err_measure: bool:=FALSE;
(* add out variables here *)
END_VAR
(*function block body*)
//first run
IF first_run THEN
outtemp:=actual_temp;
prev_temp:=actual_temp;
err_measure:=FALSE;
first_run:=FALSE;
RETURN;
END_IF;
//filter out impossible values
IF actual_temp > max_temp_allowed OR actual_temp < min_temp_allowed THEN
outtemp:=prev_temp;
err_measure:=TRUE;
RETURN;
END_IF;
//filter out POR 85.0C errorrs
IF abs(prev_temp-actual_temp)>=por_diff AND actual_temp = 85.0 THEN
err_measure:= TRUE;
outtemp:=prev_temp;
//and filter measurre errors
ELSIF abs(prev_temp-actual_temp)>=err_diff THEN
err_measure:=TRUE;
outtemp:=prev_temp;
//prev_temp:=actual_temp;
ELSE
outtemp:=actual_temp;
prev_temp:=actual_temp;
err_measure:=FALSE;
END_IF;
//apply analog filer -> smooth the signal
IF err_measure = FALSE AND filter_const > 0 THEN
filter(IN:= actual_temp, INDT:= filter_const, OUT=>outtemp);
END_IF;
END_FUNCTION_BLOCK
And the graph:
0_1510556313991_1w_graph.png