Function BlockMC_GearInPosPLCopen motion icon

Description

This function block performs a slave axis move which follows the master axis based on the ratio specified by RatioNumerator and RatioDenominator.

SlaveCommandPosition = MasterActualPosition * RatioNumerator / RatioDenominator

This function block also allows the application to specify sync positions for the master and slave axes. It is the point in which the master and slave axes become engaged in synchronous motion. When the master axis reaches the MasterStartDistance from the MasterSyncPosition, the slave axis begins to accelerate to the target velocity determined by the master axis velocity and the ratio. The slave axis arrives at the target velocity and the SlaveSyncPosition at the same time the master axis arrives at the MasterSyncPosition. At that time, the slave is locked on to the master and follows the master at the ratio specified. The slave axis continues to follow the master axis until this move is aborted.

Aborting Gearing

Gearing functions can generate large accelerations while following the master. If the aborting function block has small, non-zero JerkClosedIn physics, jerk is the rate of change of acceleration; more precisely, the derivative of acceleration with respect to time, or small acceleration values, it can take a long time for an accelerating axis to reach the target velocity, or position of the aborting function block. If the Jerk and/or acceleration of the aborting function cannot be increased to suitable values, it may be desirable to:

Time to Reach the Target Velocity

While following the master, gearing functions can generate large accelerations. If the gearing function is aborted while the axis is currently accelerating, and the aborting function block has small non-zero Jerk or small acceleration values, it can take a long time to reach the target velocity, or position of the aborting function block. If the Jerk and/or acceleration of the aborting function cannot be increased to suitable values, it may be desirable to:

  • Abort the gearing function with an MC_GearOut with higher accelerations and/or Jerk values (or zero jerk value),
  • Execute the next MC motion function block such as MC_Halt.

MC_GearInPos

Figure 7-151: MC_GearInPos

Time Diagram

MC_GearInPos: Timing Diagram

Arguments

For more detail on how inputs and outputs work, refer to PLCopen Function Blocks - General Rules

Input

Execute Description Requests to queue the slave gear ratio move
  Data type BOOL
  Range 0, 1
  Unit N/A
  Default
Master Description

Name of a declared instance of the AXIS_REF library function

(for more details,About Axis Name and Number)

  Data type AXIS_REF
  Range [1,256]
  Unit N/A
  Default
Slave Description AXIS_REF.AXIS_NUM is the slave axis number
  Data type AXIS_REF
  Range [1,256]
  Unit N/A
  Default
RatioNumerator Description Numerator of master/slave ratio. The sign (+ or -) indicates the direction for the slave axis.
  Data type DINT
  Range [-2147483648, 2147483647]
  Unit N/A
  Default
RatioDenominator Description Denominator of master/slave ratio. The sign (+ or -) indicates the direction for the master axis. The direction determines the sync trigger comparison direction for the slave.
  • For a master moving in the positive direction, use a positive RatioDenominator.
  • For a master moving in the negative direction, use a negative RatioDenominator.
  Data type DINT
  Range [-2147483648, 2147483647]
  Unit N/A
  Default
MasterSyncPosition Description Master axis sync position
  Data type LREAL
  Range -1.7308 to 1.7308 (14 to 15 significant digits of accuracy)
  Unit N/A
  Default
SlaveSyncPosition Description Slave axis sync position
  Data type LREAL
  Range -1.7308 to 1.7308 (14 to 15 significant digits of accuracy)
  Unit N/A
  Default
SyncMode Description

SyncMode determines the allowed conditions for synchronization: 

0 = Normal synchronization. Prior to executing the MC_GearInPos function block, the Master axis position must be before the MasterSyncPosition by a distance greater than the MasterStartDistance. The Slave axis position must be before the SlaveSyncPosition.
In the case of axes that have a non-zero rollover, the MC_GearInPos function block will always assume the axes meet these conditions by assuming the sync point is in the next occurrence of the sync position. MasterStartDistance must be positive and greater than the distance the master axis is currently moving per axis update. If the master start distance and the slave axis distance from the SlaveSyncPosition are sufficiently large enough, the slave axis will ramp to the sync position. If not sufficiently large enough, acceleration of the slave axis may be excessive.

1 = Immediate synchronization allowed. This mode is only allowed if both the master and slave axes have rollover = 0. If the conditions of SyncMode = 0 are not met, Synchronization is allowed even though the axis positions may be beyond their respective Sync Positions. The MasterStartDistance may be 0. If the MasterStartDistance is zero, the Slave axis will synchronize with the master the instant the master axis crosses the MasterSyncPosition.
If either the master or slave axis are beyond their respective sync start positions, the slave axis will immediately synchronize to the master axis. If the master start distance and the slave axis distance from the SlaveSyncPosition are sufficiently large enough, the slave axis will ramp to the sync position. If not sufficiently large enough or immediate synchronization occurs, slave axis acceleration may be excessive.
Excessive slave acceleration may also occur if the master axis velocity is large or the master and slave axes have disproportionally different distances to their respective sync positions. If the slave axis is ahead of the master axis at the time of synchronization, the slave axis will move backwards.

  Data type INT
  Range 0-1
  Unit N/A
  Default
MasterStartDistance Description When the master axis reaches this distance before MasterSyncPosition, the slave axis begins its lock-on process.

  • The MasterStartDistance * (RatioNumerator/RatioDenominator) should be greater than (or equal to) the slave sync distance. The slave sync distance is defined as the distance between the slave position when MC_GearInPos executes and the SlaveSyncPosition. If the MasterStartDistance is too short, the MC_GearInPos may have excessive acceleration and a warning log message will be generated.
  Data type LREAL
  Range 1.7-308 to 1.7308 (14 to 15 significant digits of accuracy)
  Unit User unit
  Default
BufferMode Description 1 = buffer
See table in Buffer Modes
  Data type SINT
  Range [1]
  Unit N/A
  Default

Output

StartSync Description Indicates that the master axis has reached the MasterStartDistance from the MasterSyncPosition and the lock-on process has begun
  Data type BOOL
InSync Description Indicated the slave axis is locked on to the master axis
  Data type BOOL
Busy Description High from the moment the Execute input goes high until the time the move is ended
  Data type BOOL
Active Description Indicates this move is the Active move
  Data type BOOL
CommandAborted Description Indicates the move was aborted. If the abort arises because the inputs cause inconsistent motion, then this FB:
  • performs no motion
  • sets an error flag
  • set the ErrorID to 13
  Data type BOOL
Error Description Indicates an invalid input was specified or the move was terminated due to an error
  Data type BOOL
ErrorID Description Indicates the error if Error output is set to TRUE
See table in PLCopen Function Block ErrorID Output
  Data type INT

Example

Example Description

  • Master and Slave are rotary axes with rollovers at 360 degrees.
  • The Master initial position is 0 degrees and the slave initial position is 45 degrees.
  • The GearInPos FB commands the slave to accelerate up to the geared ratio (1:1) during the master start distance (90 degrees) and be synchronized with the master at the master and slave sync positions.

  1. Master Axis
  2. Slave Axis
  3. Master Start Distance
  4. Slave starts to accelerate
  5. Master Sync Position
  6. Slave Sync Position

Structured Text

            (* MC_GearInPos ST example *)
            
Inst_MC_GearInPos( GearInPosReq, Axis1, Axis2, 2, 1, 0, 0, 0, 100.0, 1 );
//Inst_MC_GearInPos is instance of MC_GearInPos
GearInPosSync:= Inst_MC_GearInPos.InSync; //store InSync output into user defined variable

Ladder Diagram

MC_GearInPos: LD example

Go back to the top of the page [Top]