3.6.09 MC_GearInPos

Version 3.1 by xingzhi lin on 2025/12/04 20:20

Set the electronic gear ratio between the master axis and the slave axis, and perform the electronic gear operation.

Specify the master axis position to start synchronization, the master axis position and the master axis start synchronization distance, and use this to complete the cutting-in electronic gear action.

Instruction format

InstructionMC_GearInPos(FB)
NameCut-in electronic gear coupling at designated position
Graphical performanceST performance

1764850756453-662.png

MC_GearInPos(

Master: =,

Slave: =,

Execute: =,

RatioNumerator: =,

RatioDenominator: =,

MasterSyncPosition: =,

SlaveSyncPosition: =,

MasterStartDistance =,

BufferMode: =,

AvoidReversal: =,

StartSync=>,

InSync=>,

Busy=>,

Active=>,

CommandAborted=>,

Error=>,

ErrorID=>);

Related variables

Input and output variablesNameData typeEffective rangeInitial valueDescription
MasterMaster axisAXIS_REF_SM3--Map to an axis, i.e. an instance of AXIS_REF_SM3
SlaveSlave axisAXIS_REF_SM3

-

 

-Map to an axis, i.e. an instance of AXIS_REF_SM3
Input variablesNameData typeEffective rangeInitial valueDescription
ExecuteInstruction executionBOOL[FALSE, TRUE]FALSERising edge, start executing instruction
RatioNumeratorGear ratio moleculeDINT-1Numerator of master-slave axis velocity ratio
RatioDenominatorGear ratio denominatorDINT-1Denominator of master-slave axis speed ratio
MasterSyncPositionMain axis synchronization positionLREAL--Master axis position when master-slave gear ratio is coupled
SlaveSyncPositionSlave axis synchronization positionLREAL--Slave axis position when master-slave axis gear ratio is coupled
MasterStartDistancePerform synchronous master axis positionLREAL--

Salve axis according to the position value and MasterSync

Position and SlaveSyncPosition calculate a smooth curve so that the slave axis is in Slave SyncPosition is synchronized with the master axis gear, and the curve master axis range is [MasterStartDistance, MasterSyncPosition]

BufferModeCache ModeMC_BUFFIR_MODE

Aborting=0 Buffered=1

BlendingPrevious=3

0Define the temporal order of FB with respect to the previous block. Only BufferMode Abort, Buffering, and BlendingPrevious are supported. BlendingPrevious means using the configured speed (including direction) of the previous motion as the blending speed, even if the motion has the opposite direction. Only BufferMode=Aborting is allowed if the function block is busy.
AvoidReversalProhibit reverseBOOL[FALSE, TRUE]FALSESet to FALSE, if reversed from the physical position of the axis ahead. Set to TRUE if the axis physically does not achieve reverse or causes damage. Only applicable to the modal axis. If the reversal cannot be avoided, then the axis will stop erroneously.
Output variablesNameData typeEffective rangeInitial valueDescription
StartSyncStart coupling processingBOOL[FALSE, TRUE]FALSETRUE, start electronic gear coupling process
InSyncIn couplingBOOL[FALSE, TRUE]FALSETRUE, the electronic gear coupling process is complete, and the gear ratio of the master and slave axis is coupled
BusExecution flagBOOL[FALSE, TRUE]FALSETRUE, instruction is being processed
ActiveUnder controlBOOL[FALSE, TRUE]FALSETRUE, under control
CommandAbortedInstruction abortBOOL[FALSE, TRUE]FALSEInterrupted by other control instructions
ErrorErrorBOOL[FALSE, TRUE]FALSEWhen an error occurs, set to TRUE
ErrorIDError IDSMC_ERRORRefer to SMC_ERROR0When an error occurs, the error ID is output.

Function description

(1) The operation target axis is designated by Slave, and the RatioNumerator, the RatioDenominator, the Acceleration, and the Deceleration are designated to perform the gear operation.

(2) An instruction position, a feedback position, and a latest instruction position can be specified to the Master axis.

(3) Execute rising edge starts the electronic gear action.

(4) After the operation is started, the Slave axis performs an acceleration/deceleration operation with the speed obtained by multiplying the Master axis speed by the gear ratio as the target speed.

(5) The process from the start to the end of synchronization in this function block is essentially an electronic cam thatthe slave axis follows the master axis within the synchronization interval.. At this time, according to the master axis range (MasterSyncPosition-MasterStartDistance, MasterSyncPosition), from the axis range (current position, SlaveSyncPosition), the instruction will automatically design a cam curve according to the set gear ratio and the above three parameters, and slave axis follows the master axis to complete the cam action when performing synchronization.

(6) Note : If the master-slave axis works in linear mode, it is necessary to ensure that the above parameters are set reasonably, otherwise the gear action cannot be carried out correctly. Therefore, it is recommended that the master-slave axis works in periodic mode when using this instruction.

For example: Both the master and slave axes move forward in linear mode. When the instruction is executed, if the master axis position >MasterSyncPosition-MasterStartDistance, or slave axis position>SlaveSyncPosition cannot cut in the electronic gear action.

Sample sequence diagrams in several different parameters are given below:

When the master axis is operating in periodic mode (360 cycles) and the slave is operating in periodic mode (360 cycles):

1. MasterSyncPosition=280, MasterStartDistance=50, SlaveSyncPosition =60, spindle speed is 50, AvoidReversa=FALSE.

1764850663732-268.png

2. MasterSyncPosition=300, MasterStartDistance=370, SlaveSyncPosition=60, spindle speed is 50, AvoidReversal=FALSE.

1764850690324-919.png

3. MasterSyncPosition=300, MasterStartDistance=50, SlaveSyncPosition=60, master axis speed is 50, AvoidReversal=FALSE, from axis start position greater than 60.

1764850718648-576.png

The target speed is reached while the synchronization is completed (InSync is TRUE), then the amount of movement from slave axis=amount of movement from master axis*RatioNumerator/RatioDenominator.

For AvoidReversal: If the slave axis is a modal axis and the master axis speed (a multiple of the gear ratio) is not a speed relationship with respect to the slave axis, then MC_GearInPos instruction attempts to avoid the reversal of the slave axis. It attempts to "stretch" the motion of the slave axis by adding 5 slave axis cycles. If this "stretch" is not valid, then an error will occur and stop from the axis incorrectly.

If the master axis speed is associated with the slave axis speed (which is a multiple of the gear ratio), an error occurs and the axis stops in error.

If the slave axis is a linear axis mode axis, an error will occur when the Execute input rising edge is processed.

Precautions

When you want to use MC_SetPosition insturction for Master axis, disengage the relationship between the spindle and the slave axes and execute the instruction.

Sequence diagram

On the rising edge of starting Execute, the electronic gear action is started. Busy becomes TRUE at the same time as Execute is started. Once the action is started, Active (in control) and StartSync (in tracking) start the gear action. When you reach MasterSyncPosition, SlaveSyncPosition, InSync becomes TRUE. When this instruction is interrupted with another instruction, CommandAborted becomes TRUE and Busy, Active, StartSync, and InSync becomes FALSE.

1764850822636-437.png

This instruction starts in other instruction execution

Start this instruction for the currently executing instruction, which can be switched or cached to this instruction.

The action at launch of multiple instances of this instruction is specified by BufferMode.

Buffer mode selectionDescription
Aborting

Immediately abort the currently executing instruction and switch to this instruction.

When the operation direction of the axis is reversed due to the instruction switching, the operation direction of the axis is reversed according to "operation at the time of reverse" in the axis parameter.

Buffered

The function block is started immediately after the last instruction motion is terminated. No blending is done here. When the end condition (Done, InVelocity, InEndVelocity, InGear, InSync, EndOfProfile, etc.) is reached, the new motion starts at the speed of the previous motion. If the previous motion was MC_MoveAbsolute or MC_Move

Relative, then the new movement begins at rest.