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
MasterReference to master axis
SlaveReference to slave axis
Input
ExecuteBOOLRising edge: Starts the execution of the function block.
RatioNumeratorDINT1
Gear ratio numerator
RatioDenominatorDINT1
Gear ratio denominator
MasterSyncPositionLREALMaster position where the axes run in sync.
SlaveSyncPositionLREALSlave position where the axes run in sync.
MasterStartDistanceLREALMaster 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 - MasterStartDistanceuntilMasterSyncPosition.If
MasterStartDistanceis 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).BufferModeMC_BUFFER_MODEDefines the chronological sequence of the FB relative to the previous block. Only the BufferModes
Aborting,BufferedandBlendingPreviousare supported.BlendingPreviousmeans 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.AvoidReversalBOOLFALSE: 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_GearInPostries 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
StartSyncBOOLTRUE: Commanded gearing has been started.InSyncBOOLTRUE: Cmmanded gearing has been completed.BusyBOOLTRUE: Execution of the function block has not been finished.ActiveBOOLIndicates that the FB has control on the axis
CommandAbortedBOOLFALSE
TRUE: Execution has been interrupted by another function block instance operating on the axis.ErrorBOOLTRUE: Error has occurred within the function block.ErrorIDSMC_ERRORError identification