学习随笔#2 功能块FB_CTRL_SERVO_MOTOR_OUT的用法

2019_4_19更新
暂未找到此功能块可与Axis变量连接的方法,如是想通过此功能块控制伺服电机的朋友,可先从输出入手,否则此功能块并无实际应用的意义,我到目前为止只找到一个模拟输出模块FB_CTRL_SERVO_MOTOR_SIMULATION,如有朋友找到输出方法,欢迎与我交流,不胜感激。3015201069@tju.edu.cn

学习随笔#1中,我提到了一个需要解决的问题,即如何绕过NC模块,通过PLC直接控制电机?当时提出的解决方案是寻找NC中发送脉冲信号的功能块,经过寻找,找到了一个疑似功能块,这个块的名字是
FB_CTRL_SERVO_MOTOR_OUT
它在倍福infosys中的描述为
This function block generates pulses with which a servomotor can be driven to a defined position.
即该功能块可产生脉冲,用以驱动伺服电机至指定位置。

但在网上均为找到该功能块的使用说明,所以我把我的学习过程写下来。首先我们从它的输入输出入手:
FB_CTRL_SERVO_MOTOR_OUT的功能块图

输入

fln:
Control value of the controller over the range [ fCtrlOutMin … fCtrlOutMax ] (controller output).
控制器的控制值范围[fctrloutmin…fctrloutmax](控制器输出)。

bUpperLimitSwitch:
Limit switch: TRUE if the upper stop has been reached.
限位开关:如果达到上限,则为真。

bLowerLimitSwitch:
Limit switch: TRUE if the lower stop has been reached.
限位开关:如果达到下限,则为真。

fManSyncValue:
Input with which the internal state of the current motor setting can be adjusted, or whose value is adopted in manual mode.
可调整当前电机设置内部状态的输入,或在手动模式下采用的值。

bSync:
A rising edge at this input sets the internal motor position, which must agree with the actual position, to the value fManSyncValue.
此输入端的上升沿将内部电机位置(必须与实际位置一致)设置为值fmansyncvalue。

eMode:
Input that specifies the block’s operating mode.
指定块的操作模式。

输出

bOutBitPos:
Output required to drive the motor in a positive direction.
正向驱动电机的输出。

bOutBitNeg:
Output required to drive the motor in a negative direction.
反向驱动电机的输出。

fActualState:
Current motor setting over the range [ fCtrlOutMin … fCtrlOutMax ] in which the motor is currently positioned.
当前电机设置超出电机当前所在范围[fCtrlOutMin … fCtrlOutMax]。

eState:
State of the function block.
功能块的状态。

eErrorId:
Supplies the error number when the bError output is set.
设置bError输出时提供错误编号。

bError:
Becomes TRUE, as soon as an error occurs.
发生错误后立即变为TRUE。

输入及输出

stParams:
Parameter structure of the function block. This consists of the following elements:
功能块的参数结构。这包括以下要素:

tCtrlCycleTime:
Cycle time with which the control loop is processed. This must be greater than or equal to the TaskCycleTime. The function block uses this input variable to calculate internally whether the state and the output variables have to be updated in the current cycle.
处理控制回路的循环时间。这必须大于或等于TaskCycleTime。功能块使用此输入变量在内部计算是否必须在当前周期中更新状态和输出变量。

tTaskCycleTime:
Cycle time with which the function block is called. If the block is called in every cycle this corresponds to the task cycle time of the calling task.
调用功能块的周期时间。如果在每个循环中调用该块,则这对应于调用任务的任务循环时间。

tMovingTime:
The time required to move the actuator from one stop to the other.
将执行器从一个停止位置移动到另一个停止位置所需的时间。

tSignalExtension:
Signal extension by which each output pulse is extended in order to compensate for the dead time.
延长每个输出脉冲的信号扩展,以便补偿死区时间。

tAdditionalMovingTimeAtLimits:
Supplementary signal extension, output to reliably reach the limits when the actuator is to be driven to +/-100%. Only effective if bMoveOnLimitSwitch is FALSE.
补充信号扩展,输出可在致动器被驱动至+/- 100%时可靠地达到极限。 仅在bMoveOnLimitSwitch为FALSE时有效。

tMinWaitTimeBetweenDirectionChange:
Minimum waiting time between positive and negative output pulses.
正负输出脉冲之间的最短等待时间。

tMinimumPulseTime:
Minimum length of an output pulse.
输出脉冲的最小长度。

bMoveOnLimitSwitch:
If TRUE, then when the control value is either fCtrlOutMin or fCtrlOutMax a signal will continue to be output until the corresponding limit switch is reached
如果为TRUE,则当控制值为fCtrlOutMin或fCtrlOutMax时,将继续输出信号,直到达到相应的限位开关。

fCtrlOutMax:
Control value for which the valve will be driven to 100%.
阀门将被驱动至100%的控制值。

fCtrlOutMin:
Control value for which the valve will be driven to 0%.
阀门将被驱动至0%的控制值。

在这里插入图片描述此功能块只能控制电机的起止位置和运行时间,因为对于任何一个驱动器,都难以同时控制它的位置和速度。但是在驱动器的运行过程中,如果使用速度梯形曲线控制,那么在从加速到匀速的转折点处会出现加速度突变,从而造成机器人的震颤,为了减少震颤,我们常使用S曲线型的速度变化。由于此功能快不能直接控制速度,那我们不妨运用微积分的思想,将运动的加速和减速过程分成若干等长小段,对每一段规定不同的运动时间,那么每一段就可以有不同运动速度,我们将这些小段相连,就可以拟合速度的S曲线
在Tc3中,我使用此模块进行了模拟,发现了它确实可以根据输入变量输出对应的正向和反向输出信号,但是目前我只能通过TwinCAT NC控制伺服轴,没有办法将这个功能块与Axis变量链接,所以这条路只能暂时停止。

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值