Wiki source code of 3.6.09 MC_GearInPos
Version 1.2 by xingzhi lin on 2025/12/04 20:17
Show last authors
| author | version | line-number | content |
|---|---|---|---|
| 1 | Set the electronic gear ratio between the master axis and the slave axis, and perform the electronic gear operation. | ||
| 2 | |||
| 3 | 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. | ||
| 4 | |||
| 5 | |||
| 6 | == **Instruction format** == | ||
| 7 | |||
| 8 | |**Instruction**|(% colspan="2" %)MC_GearInPos(FB) | ||
| 9 | |**Name**|(% colspan="2" %)Cut-in electronic gear coupling at designated position | ||
| 10 | |(% colspan="2" %)**Graphical performance**|**ST performance** | ||
| 11 | |(% colspan="2" %)[[image:file:///C:/Users/111/AppData/Local/Temp/msohtmlclip1/01/clip_image001.png]]|((( | ||
| 12 | MC_GearInPos( | ||
| 13 | |||
| 14 | Master: =, | ||
| 15 | |||
| 16 | Slave: =, | ||
| 17 | |||
| 18 | Execute: =, | ||
| 19 | |||
| 20 | RatioNumerator: =, | ||
| 21 | |||
| 22 | RatioDenominator: =, | ||
| 23 | |||
| 24 | MasterSyncPosition: =, | ||
| 25 | |||
| 26 | SlaveSyncPosition: =, | ||
| 27 | |||
| 28 | MasterStartDistance =, | ||
| 29 | |||
| 30 | BufferMode: =, | ||
| 31 | |||
| 32 | AvoidReversal: =, | ||
| 33 | |||
| 34 | StartSync=>, | ||
| 35 | |||
| 36 | InSync=>, | ||
| 37 | |||
| 38 | Busy=>, | ||
| 39 | |||
| 40 | Active=>, | ||
| 41 | |||
| 42 | CommandAborted=>, | ||
| 43 | |||
| 44 | Error=>, | ||
| 45 | |||
| 46 | ErrorID=>); | ||
| 47 | ))) | ||
| 48 | |||
| 49 | |||
| 50 | |||
| 51 | == **Related variables** == | ||
| 52 | |||
| 53 | |**Input and output variables**|**Name**|**Data type**|**Effective range**|**Initial value**|**Description** | ||
| 54 | |Master|Master axis|AXIS_REF_SM3|-|-|Map to an axis, i.e. an instance of AXIS_REF_SM3 | ||
| 55 | |Slave|Slave axis|AXIS_REF_SM3|((( | ||
| 56 | - | ||
| 57 | |||
| 58 | |||
| 59 | )))|-|Map to an axis, i.e. an instance of AXIS_REF_SM3 | ||
| 60 | |||
| 61 | |||
| 62 | |||
| 63 | |**Input variables**|**Name**|**Data type**|**Effective range**|**Initial value**|**Description** | ||
| 64 | |Execute|Instruction execution|BOOL|[FALSE, TRUE]|FALSE|Rising edge, start executing instruction | ||
| 65 | |RatioNumerator|Gear ratio molecule|DINT|-|1|Numerator of master-slave axis velocity ratio | ||
| 66 | |RatioDenominator|Gear ratio denominator|DINT|-|1|Denominator of master-slave axis speed ratio | ||
| 67 | |MasterSyncPosition|Main axis synchronization position|LREAL|-|-|Master axis position when master-slave gear ratio is coupled | ||
| 68 | |SlaveSyncPosition|Slave axis synchronization position|LREAL|-|-|Slave axis position when master-slave axis gear ratio is coupled | ||
| 69 | |MasterStartDistance|Perform synchronous master axis position|LREAL|-|-|((( | ||
| 70 | Salve axis according to the position value and MasterSync | ||
| 71 | |||
| 72 | 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] | ||
| 73 | ))) | ||
| 74 | |BufferMode|Cache Mode|MC_BUFFIR_MODE|((( | ||
| 75 | Aborting=0 Buffered=1 | ||
| 76 | |||
| 77 | BlendingPrevious=3 | ||
| 78 | )))|0|Define 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. | ||
| 79 | |AvoidReversal|Prohibit reverse|BOOL|[FALSE, TRUE]|FALSE|Set 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. | ||
| 80 | |||
| 81 | |||
| 82 | |||
| 83 | |**Output variables**|**Name**|**Data type**|**Effective range**|**Initial value**|**Description** | ||
| 84 | |StartSync|Start coupling processing|BOOL|[FALSE, TRUE]|FALSE|TRUE, start electronic gear coupling process | ||
| 85 | |InSync|In coupling|BOOL|[FALSE, TRUE]|FALSE|TRUE, the electronic gear coupling process is complete, and the gear ratio of the master and slave axis is coupled | ||
| 86 | |Bus|Execution flag|BOOL|[FALSE, TRUE]|FALSE|TRUE, instruction is being processed | ||
| 87 | |Active|Under control|BOOL|[FALSE, TRUE]|FALSE|TRUE, under control | ||
| 88 | |CommandAborted|Instruction abort|BOOL|[FALSE, TRUE]|FALSE|Interrupted by other control instructions | ||
| 89 | |Error|Error|BOOL|[FALSE, TRUE]|FALSE|When an error occurs, set to TRUE | ||
| 90 | |ErrorID|Error ID|SMC_ERROR|Refer to SMC_ERROR|0|When an error occurs, the error ID is output. | ||
| 91 | |||
| 92 | |||
| 93 | |||
| 94 | == **Function description** == | ||
| 95 | |||
| 96 | (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. | ||
| 97 | |||
| 98 | (2) An instruction position, a feedback position, and a latest instruction position can be specified to the Master axis. | ||
| 99 | |||
| 100 | (3) Execute rising edge starts the electronic gear action. | ||
| 101 | |||
| 102 | (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. | ||
| 103 | |||
| 104 | (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. | ||
| 105 | |||
| 106 | (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. | ||
| 107 | |||
| 108 | 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. | ||
| 109 | |||
| 110 | Sample sequence diagrams in several different parameters are given below: | ||
| 111 | |||
| 112 | When the master axis is operating in periodic mode (360 cycles) and the slave is operating in periodic mode (360 cycles): | ||
| 113 | |||
| 114 | 1. MasterSyncPosition=280, MasterStartDistance=50, SlaveSyncPosition =60, spindle speed is 50, AvoidReversa=FALSE. | ||
| 115 | |||
| 116 | (% style="text-align:center" %) | ||
| 117 | [[image:1764850663732-268.png]] | ||
| 118 | |||
| 119 | |||
| 120 | |||
| 121 | |||
| 122 | |||
| 123 | |||
| 124 | |||
| 125 |