zhou1211
級(jí)別: 略有小成
|
小弟初學(xué)scl編程,有很多不懂的地方,而且網(wǎng)上資料也很少,我在看資料學(xué)習(xí)過程中有個(gè)語句是這么寫的 FUNCTION FC1:VOID 還有種寫法是 FUNCTION_BLOCK FB1: 無論我怎么寫,都提示操作參數(shù)未定義 求解? function_block fb3 VAR_TEMP END_VAR END_FUNCTION_BLOCK |
---|---|
|
z061403
級(jí)別: 略有小成
|
//**********************************************************// 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 |
---|---|
|