MC_GearInPos (FB)¶
FUNCTION_BLOCK MC_GearInPos
MC_GearInPos
couples the slave axis to the master axis taking into
account a specific positional relationship.
Important
In certain cases, it may be impossible to avoid a reversal of the slave. (Even if the slave velocity is not opposite to the master.) One example is a slave with a small positive velocity and a large negative acceleration. It may not be possible to ramp down the acceleration fast enough to prevent the velocity from becoming negative.
Note
MC_GearInPos
should be called after the motion FB controlling
the Master
axis has been called. Otherwise, the Slave
axis
will lag behind the Master
axis.
Timing diagram
With BufferMode
Aborting, any previous motion is continued until the
master crosses the position MasterSyncPosition
– MasterStartDistance
in the correct direction.
At that point in time the output StartSync
is set. When a stop
command is executed on the slave axis before the synchronization
has happened, it will inhibit the synchronization and the function block
issues CommandAborted
= TRUE
.
If the MasterStartDistance
is not specified (indicated by a non-positive
value), the function block calculates the setting start distancepoint so
that synchronization starts at the current master position.
With BufferMode
Buffered or BlendingPrevious, the input
MasterStartDistance
cannot be provided (i.e. must be set to 0).
The reason for this is that as soon as the previous movement finished,
MC_GearInPos must take over the axis and continue the movement, it cannot
wait until the master sync position has been reached.
(If the master is in standstill when the previous movement is finished,
then an error SMC_GIP_CANNOT_START_SYNC
is reported.)

Timing Diagram of MC_GearInPos
¶

Different examples of gearing¶
- InOut:
Scope
Name
Type
Initial
Comment
Inout
Master
Reference to master axis
Slave
Reference to slave axis
Input
Execute
BOOL
Rising edge: Starts the execution of the function block.
RatioNumerator
DINT
1
Gear ratio numerator
RatioDenominator
DINT
1
Gear ratio denominator
MasterSyncPosition
LREAL
Master position where the axes run in sync.
SlaveSyncPosition
LREAL
Slave position where the axes run in sync.
MasterStartDistance
LREAL
Master distance for the gear in procedure (where the slave axis will be started for getting into synchronization). In other words, the slave is brought into sync with the master during this distance, i.e. from
MasterSyncPosition - MasterStartDistance
untilMasterSyncPosition
.If
MasterStartDistance
is 0 (or negative), then the slave movement is started immediately, provided that the master is not in standstill. If BufferMode <> Aborting, then the MasterStartDistance must be 0 (or negative).BufferMode
MC_BUFFER_MODE
Defines the chronological sequence of the FB relative to the previous block. Only the BufferModes
Aborting
,Buffered
andBlendingPrevious
are supported.BlendingPrevious
means that the configured velocity (including the direction) of the previous movement is used as the blending velocity, even if this movement has the opposite direction. If the function block is Busy, then only BufferMode=Aborting is allowed.AvoidReversal
BOOL
FALSE
: Signals that the reversal of the slave is physically possible and acceptable.TRUE
: Signals that a reversal of the modulo slave has to be avoided, e.g. because it is physically impossible or might lead to damage.It works only with modulo slave axes.If a reversal cannot be avoided, the axis is stopped with an error.Behavior:
- If the slave axis is a modulo axis and the master velocity (times the sign of the gear ratio) is not oppositeto the
slave velocity
, thenMC_GearInPos
tries to avoid a reversal of the slave.It tries to “stretch” the slave movement by increasing the distance the slave travels by up to 5 slave periods.If this “stretching” is not successful, an error is reported. - If the slave velocity is opposite to the master velocity times the sign of the gear ratio,an error is reported.
If the slave axis is not a modulo axis, an error is reported on the rising edge of the Execute input.
Output
StartSync
BOOL
TRUE
: Commanded gearing has been started.InSync
BOOL
TRUE
: Cmmanded gearing has been completed.Busy
BOOL
TRUE
: Execution of the function block has not been finished.Active
BOOL
Indicates that the FB has control on the axis
CommandAborted
BOOL
FALSE
TRUE
: Execution has been interrupted by another function block instance operating on the axis.Error
BOOL
TRUE
: Error has occurred within the function block.ErrorID
SMC_ERROR
Error identification