Obsidean_VM/04-SIDEL/06 - E5.007363 - Modifica O.../Source/source/BrixTracking_ProdSamples.md

1.2 KiB

FUNCTION_BLOCK "BrixTracking_ProdSamples"
{ S7_Optimized_Access := 'FALSE' }
AUTHOR : 'Author'
FAMILY : TASK2
NAME : 'Name'
VERSION : 1.0
   VAR_IN_OUT 
      mTakeProdSample : Bool;
   END_VAR

   VAR 
      gProductTotalizerLt : "Integral";
      mProdInit : Real;
   END_VAR


BEGIN
	
	
	(* Calculates the product liters during blending. Every 60 Liters of product take a sample for the statistical analisys
	in order to correct the product brix *)
	
	IF "gBlenderBlending" THEN
	    #gProductTotalizerLt.i_NewValue   := "Blender_Variables".gActual_Prod_Flow ;
	    #gProductTotalizerLt.i_IntCycle   := "Time_250ms" ;
	    #gProductTotalizerLt(Out_Integral := "Blender_Variables".gProductLiters) ;
	END_IF;
	
	IF "gBlenderRinseMode" OR "gBlenderCIPMode" THEN
	    (* classic code: "Blender_Variables".gProductLiters := 0.0 ;*)
	    "Blender_Variables".gProductLiters := REAL#0.0 ;
	    #gProductTotalizerLt(Out_Integral   := "Blender_Variables".gProductLiters) ;
	END_IF;
	
	IF ("Blender_Variables".gProductLiters - #mProdInit) > 60 THEN
	    #mTakeProdSample := TRUE ;
	    #mProdInit := "Blender_Variables".gProductLiters ;
	END_IF;
	
	
END_FUNCTION_BLOCK