//**********************************************************//
FUNCTION FC201 : VOID //Speed_block
TITLE = 'Speed Block '
VERSION: '3.1'
AUTHOR:fhqdnvl
NAME: Name
FAMILY: Family
VAR_INPUT // Input Parameters
//all key
Speed_SV : REAL; //Speed SV
Number_PV :INT; //6RA70 chack number 16384=100%
Gearshift :REAL; // unit M for example:1.2M
Drive_Number:REAL; //Drive big number for example:16384=100%
Pi :REAL; //3.1415926
D :REAL; // roller diameter
Motor_RPM :REAL; //motor data
END_VAR
VAR_IN_OUT // I/O Parameters
END_VAR
VAR_OUTPUT // Output Parameters
Number_Give: INT; //6RA70 give number 16384=100%
Speed_PV : REAL; //Speed PV
END_VAR
VAR_TEMP //Temp Parameters
Temp1:real; // Temp value1 Number_PV
Temp3:REAL; //Number_Give
Temp2:REAL; //Speed_Sv限制
END_VAR
//*******************************************************************************//
IF Temp2 <= 1200 THEN //High 1200M/S
Temp2:=Speed_SV;
ELSE
Temp2:=1200;
END_IF;
//*******************************************************************************//
Temp3:=(Temp2*Gearshift*Drive_Number)/(Pi*D*Motor_RPM); //**************** speed give drive**********//
IF Temp3 >= 16384 THEN // give number drive
Temp3:=16384;
END_IF;
Number_Give:=DINT_TO_INT(REAL_TO_DINT(Temp3)); //int number give drive
//*******************************************************************************//
Temp1:=DINT_TO_REAL(INT_TO_DINT(Number_PV)) ; // real number //****************** Speed PV number drive*******//
Speed_PV:=(Temp1*Pi*D*Motor_RPM)/(Drive_number*Gearshift); //reselt
;
END_FUNCTION