3.6.09 MC_GearInPos

Version 1.2 by xingzhi lin on 2025/12/04 20:17

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
file:///C:/Users/111/AppData/Local/Temp/msohtmlclip1/01/clip_image001.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