各位大侠请棒我翻译一下这个到底什么意思,最好是每行每行解释,非常感谢
FUNCTION_BLOCK FB_Incremental_Homing
VAR_INPUT
i_toAxis : PosAxis;
i_sCMD : StructAxisOpe;
i_sPara : StructAxisPara;
END_VAR
VAR
l_i16CaseCount : INT := 0;
_MccRetDINT : DINT;
RT_increment_home_rtrig : R_TRIG;
END_VAR
RT_increment_home_rtrig(clk := i_sCMD.boAxisIncreHoming);
CASE l_i16CaseCount OF
0:
l_i16CaseCount := 1;
1:
IF i_toAxis.control = Active AND
i_toAxis.actormonitoring.drivestate = Active AND
i_toAxis.actormonitoring.Power = Active THEN
l_i16CaseCount := 10;
END_IF;
10:
IF (RT_increment_home_rtrig.q) THEN
l_i16CaseCount := 11;
END_IF;
11:
_MccRetDINT := _homing(axis := i_toAxis,
homingMode := ACTIVE_HOMING,
homePositionType := DIRECT,
homePosition := i_sPara.r64IncZeroOffset,
velocityType := DIRECT,
velocity := i_sPara.r64IncHomingVelocity,
velocityProfile := TRAPEZOIDAL,
mergeMode := IMMEDIATELY,
nextCommand := WHEN_BUFFER_READY,
commandId := _getCommandId());
l_i16CaseCount := 12;
12:
IF i_toAxis.motionstatedata.stillstandvelocity = active THEN
l_i16CaseCount := 16;
END_IF;
16:
l_i16CaseCount := 17;
17:
l_i16CaseCount := 0;
END_CASE;
END_FUNCTION_BLOCK
FUNCTION_BLOCK FB_Incremental_Homing
VAR_INPUT //定义输入
i_toAxis : PosAxis; //位置轴赋值给变量i_toAxis
i_sCMD : StructAxisOpe; //轴操作数据结构轴赋值给变量i_sCMD
i_sPara : StructAxisPara; //轴特性数据结构轴赋值给变量i_sPara
END_VAR //结束输入变量声明
VAR //声明临时变量
l_i16CaseCount : INT := 0; //l_i16CaseCount =0
_MccRetDINT : DINT; //_MccRetDINT为双整数
RT_increment_home_rtrig : R_TRIG; //R_TRIG为你程序里定义点数据类型
END_VAR
RT_increment_home_rtrig(clk := i_sCMD.boAxisIncreHoming);
//给函数 RT_increment_home_rtrig 输入实参 i_sCMD.boAxisIncreHoming
CASE l_i16CaseCount OF //case选择语句
0: //选择器0,执行下列语句
l_i16CaseCount := 1; //l_i16CaseCount为1时执行选择器1
1: //选择器1,执行下列语句
IF i_toAxis.control = Active AND
i_toAxis.actormonitoring.drivestate = Active AND
i_toAxis.actormonitoring.Power = Active THEN
l_i16CaseCount := 10; //l_i16CaseCount为10时执行选择器10
END_IF;
10: //选择器10,执行下列语句
IF (RT_increment_home_rtrig.q) THEN
l_i16CaseCount := 11; //l_i16CaseCount为11时执行选择器11
END_IF;
11: //选择器11,执行下列语句 _MccRetDINT := _homing(axis := i_toAxis,
homingMode := ACTIVE_HOMING,
homePositionType := DIRECT,
homePosition := i_sPara.r64IncZeroOffset,
velocityType := DIRECT,
velocity := i_sPara.r64IncHomingVelocity,
velocityProfile := TRAPEZOIDAL,
mergeMode := IMMEDIATELY,
nextCommand := WHEN_BUFFER_READY,
commandId := _getCommandId());
l_i16CaseCount := 12; //l_i16CaseCount为12时执行选择器12
12: //选择器12,执行下列语句
IF i_toAxis.motionstatedata.stillstandvelocity = active THEN
l_i16CaseCount := 16; //l_i16CaseCount为16时执行选择器16
END_IF;
16: //选择器16,执行下列语句
l_i16CaseCount := 17; //l_i16CaseCount为17时执行选择器17
17: //选择器17,执行下列语句
l_i16CaseCount := 0;
END_CASE;
END_FUNCTION_BLOCK
这个函数块看起来很简单啊,得看你里面点变量是啥,才知道干嘛用的