发布于 2004-10-05 21:34:58
0楼
FUNCTION FC503 : VOID
// This function is used for computing of AEC correction (Force and tension correction).
TITLE = 'AEC_Correction_Calculation'
VERSION : '0.0'
//KNOW_HOW_PROTECT
AUTHOR : BenBen
NAME : AEC_Cor
FAMILY : Common
VAR_INPUT
// Input
Pos_Limit_Force : BOOL; // The positive limit force is reached
Neg_Limit_Force : BOOL; // The negative limit force is reached
Pos_Limit_Tens : BOOL; // The positive limit tension is reached
Neg_Limit_Tens : BOOL; // The negative limit tension is reached
Elong_Force_Val : BOOL; // Elongation treatment in force is running
Elong_Tens_Val : BOOL; // Elongation treatment in tension is running
DF_Delg : REAL; // Force variation according to the elongation variation in Ton/%
DT_Delg : REAL; // Tension variation according to the elongation variation in Kg/%
Da_Dt : REAL; // Elongation variation according time variation (in %/S)
Corr_Tens_Min : REAL; // Minimum tension corretion in Kg
Corr_Tens_Max : REAL; // Maximum tension correction in Kg
New_Setpoint : BOOL; // New setpoint application (raisin edge)
//Parameter
Cycle_Time : INT; // Cycle Time in ms
END_VAR
VAR_IN_OUT
Intg_Out : REAL; // Tension speed Integrate output
END_VAR
VAR_TEMP
Elong_Var_Sgn : BOOL; // Sign of elongation correction (1 if correction is positive)
Temp2 : BOOL; // Bit to switch Force Correction to 0
Temp3 : BOOL; // Bit to switch Tension correction to 0
Temp4 : REAL;
END_VAR
VAR_OUTPUT
Force_AEC_Cor : REAL; // Force correction to reach elongation serpoint
Exit_Tens_AEC_Cor : REAL; // Exit tension correction to reach elongation correction
END_VAR
BEGIN
// Sign of elongation variation (1 if correction is positive)
IF Da_Dt > 0
THEN Elong_Var_Sgn :=1;
ELSE Elong_Var_Sgn :=0;
END_IF;
// Bit to switch Force_Aec_Cor to 0
Temp2:= (Pos_Limit_Force AND Elong_Var_Sgn) OR (Neg_Limit_Force AND NOT Elong_Var_Sgn) OR NOT Elong_Force_Val;
// AEC force correction computing in Ton/s
Force_AEC_Cor:= Da_Dt * DF_Delg;
IF Force_AEC_Cor > 5
THEN Force_AEC_Cor:=5;
ELSIF Force_AEC_Cor < -5
THEN Force_AEC_Cor:= -5;
ELSIF Temp2=1
THEN Force_AEC_Cor:= 0;
END_IF;
// Bit to switch Tension correction to 0
Temp3:= (Pos_Limit_Tens AND Elong_Var_Sgn) OR ( Neg_Limit_Tens AND NOT Elong_Var_Sgn) OR NOT Elong_Tens_Val;
// Tension correction
Temp4:= DT_Delg * Cycle_Time / 1000; // Tension variation according elongation variation for one Time Cycle period in Kg/% for 20ms
IF New_Setpoint
THEN Intg_Out := 0; // Integrate Gains
END_IF;
Exit_Tens_AEC_Cor := Intg_Out+ DT_Delg * Temp4; // Exit tension correction in Kg
Intg_Out := Exit_Tens_AEC_Cor;
IF Exit_Tens_AEC_Cor > Corr_Tens_Min // Tension correction limitation
THEN Exit_Tens_AEC_Cor:= Corr_Tens_Min;
ELSIF Exit_Tens_AEC_Cor > Corr_Tens_Max
THEN Exit_Tens_AEC_Cor:= Corr_Tens_Max;
END_IF;
END_FUNCTION