如何使用Maxon EPOS库在IEC-61131结构化文本中编程插值位置模式序列?

时间:2014-05-01 00:29:54

标签: iec61131-3 structured-text

Maxon EPOS库定义了一些看似处理内插位置模式的功能块,但是根据我的判断,没有样本指定如何使用它们。

到目前为止,这是我所拥有的内容,但是当Execute设置为TRUE

时,它只是跳过它
FUNCTION_BLOCK FB_MAIN_Routine1

TYPE
    POSITIONS: ARRAY[1..64] OF DINT;
    VELOCITIES: ARRAY[1..64] OF DINT;
    TIME_VALUES: ARRAY[1..64] OF USINT;
END_TYPE

VAR_EXTERNAL
    Axis1: AXIS_REF;
END_VAR

VAR_INPUT
    Execute: BOOL;
END_VAR

VAR_OUTPUT
    Done: BOOL;
END_VAR

VAR

    Start: BOOL := FALSE;    
    LoadPointsAx1: BOOL := FALSE;

    fbClearIpmBufferAx1: MU_ClearIpmBuffer;
    fbAddPvtValuesAx1: MU_AddPvtValues;
    fbStartIpmTrajectoryAx1: MU_StartIpmTrajectory;
    fbGetIpmStatusAx1: MU_GetIpmStatus;
    fbGetIpmTrajectoryStatusAx1: MU_GetIpmTrajectoryStatus;

    PositionsAx1:  POSITIONS  := [49500, 47703, 45906, 44109, 42312, 40516, 38719, 36922, 35125, 33329, 31532, 29735, 27938, 26142, 24345, 22548, 20751, 21834, 23037, 24240, 25443, 26646, 27848, 29051, 30254, 31457, 32660, 33863, 35065, 36268, 37471, 38674, 39877, 41080, 42282, 43485, 44688, 45891, 47094, 48297, 49500, 49500, 49500, 49500, 49500, 49500, 49500, 49500, 49500, 49500, 49500, 49500, 49500, 49500, 49500, 49500, 49500, 49500, 49500, 49500, 49500, 49500, 49500, 49500];    
    VelocitiesAx1: VELOCITIES  := [-216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
    TimeValuesAx1: TIME_VALUES := [250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];

END_VAR

fbGetIpmStatusAx1(Axis := Axis1, Enable := Execute);

fbClearIpmBufferAx1(Axis := Axis1, Execute := Execute);

If fbClearIpmBufferAx1.Done Then    
    LoadPointsAx1 := TRUE;
END_IF;

fbAddPvtValuesAx1(Axis := Axis1, Execute := LoadPointsAx1, Position := PositionsAx1, Velocity := VelocitiesAx1, TimeValue := TimeValuesAx1);

If fbAddPvtValuesAx1.Done Then    
    Start := TRUE;
End_If; 

fbStartIpmTrajectoryAx1(Axis := Axis1, Execute := Start);

fbGetIpmTrajectoryStatusAx1(Axis := Axis1, Enable := fbStartIpmTrajectoryAx1.Done);

If (Execute = FALSE) Or fbGetIpmTrajectoryStatusAx1.TargetReached Then
    Done := Execute;
    Start := FALSE;
    LoadPointsAx1 := FALSE;
    fbAddPvtValuesAx1(Axis := Axis1, Execute := FALSE);
    fbStartIpmTrajectoryAx1(Axis := Axis1, Execute := FALSE);
    fbGetIpmTrajectoryStatusAx1(Axis := Axis1, Enable := FALSE);
End_If;

END_FUNCTION_BLOCK

1 个答案:

答案 0 :(得分:1)

与其他操作移动(例如速度模式或位置模式)不同,需要初始化插值位置模式。

致电MU_ActivateInterpolatedPositionMode解决了这个问题。