Wiki source code of 3.6.09 MC_GearInPos

Last modified by xingzhi lin on 2025/12/26 17:18

Hide last authors
xingzhi lin 1.2 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**
xingzhi lin 3.1 11 |(% colspan="2" %)(((
12 (% style="text-align:center" %)
13 [[image:1764850756453-662.png]]
14 )))|(((
xingzhi lin 1.2 15 MC_GearInPos(
16
17 Master: =,
18
19 Slave: =,
20
21 Execute: =,
22
23 RatioNumerator: =,
24
25 RatioDenominator: =,
26
27 MasterSyncPosition: =,
28
29 SlaveSyncPosition: =,
30
31 MasterStartDistance =,
32
33 BufferMode: =,
34
35 AvoidReversal: =,
36
37 StartSync=>,
38
39 InSync=>,
40
41 Busy=>,
42
43 Active=>,
44
45 CommandAborted=>,
46
47 Error=>,
48
49 ErrorID=>);
50 )))
51
52
53
54 == **Related variables** ==
55
56 |**Input and output variables**|**Name**|**Data type**|**Effective range**|**Initial value**|**Description**
57 |Master|Master axis|AXIS_REF_SM3|-|-|Map to an axis, i.e. an instance of AXIS_REF_SM3
58 |Slave|Slave axis|AXIS_REF_SM3|(((
59 -
60
61
62 )))|-|Map to an axis, i.e. an instance of AXIS_REF_SM3
63
64
65
66 |**Input variables**|**Name**|**Data type**|**Effective range**|**Initial value**|**Description**
67 |Execute|Instruction execution|BOOL|[FALSE, TRUE]|FALSE|Rising edge, start executing instruction
68 |RatioNumerator|Gear ratio molecule|DINT|-|1|Numerator of master-slave axis velocity ratio
69 |RatioDenominator|Gear ratio denominator|DINT|-|1|Denominator of master-slave axis speed ratio
70 |MasterSyncPosition|Main axis synchronization position|LREAL|-|-|Master axis position when master-slave gear ratio is coupled
71 |SlaveSyncPosition|Slave axis synchronization position|LREAL|-|-|Slave axis position when master-slave axis gear ratio is coupled
72 |MasterStartDistance|Perform synchronous master axis position|LREAL|-|-|(((
73 Salve axis according to the position value and MasterSync
74
75 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]
76 )))
77 |BufferMode|Cache Mode|MC_BUFFIR_MODE|(((
78 Aborting=0 Buffered=1
79
80 BlendingPrevious=3
81 )))|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.
82 |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.
83
84
85
86 |**Output variables**|**Name**|**Data type**|**Effective range**|**Initial value**|**Description**
87 |StartSync|Start coupling processing|BOOL|[FALSE, TRUE]|FALSE|TRUE, start electronic gear coupling process
88 |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
89 |Bus|Execution flag|BOOL|[FALSE, TRUE]|FALSE|TRUE, instruction is being processed
90 |Active|Under control|BOOL|[FALSE, TRUE]|FALSE|TRUE, under control
91 |CommandAborted|Instruction abort|BOOL|[FALSE, TRUE]|FALSE|Interrupted by other control instructions
92 |Error|Error|BOOL|[FALSE, TRUE]|FALSE|When an error occurs, set to TRUE
93 |ErrorID|Error ID|SMC_ERROR|Refer to SMC_ERROR|0|When an error occurs, the error ID is output.
94
95
96
97 == **Function description** ==
98
99 (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.
100
101 (2) An instruction position, a feedback position, and a latest instruction position can be specified to the Master axis.
102
103 (3) Execute rising edge starts the electronic gear action.
104
105 (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.
106
107 (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.
108
109 (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.
110
111 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.
112
113 Sample sequence diagrams in several different parameters are given below:
114
115 When the master axis is operating in periodic mode (360 cycles) and the slave is operating in periodic mode (360 cycles):
116
117 1. MasterSyncPosition=280, MasterStartDistance=50, SlaveSyncPosition =60, spindle speed is 50, AvoidReversa=FALSE.
118
119 (% style="text-align:center" %)
120 [[image:1764850663732-268.png]]
121
122
xingzhi lin 2.1 123 2. MasterSyncPosition=300, MasterStartDistance=370, SlaveSyncPosition=60, spindle speed is 50, AvoidReversal=FALSE.
xingzhi lin 1.2 124
xingzhi lin 2.1 125 (% style="text-align:center" %)
126 [[image:1764850690324-919.png]]
xingzhi lin 1.2 127
128
xingzhi lin 2.1 129 3. MasterSyncPosition=300, MasterStartDistance=50, SlaveSyncPosition=60, master axis speed is 50, AvoidReversal=FALSE, from axis start position greater than 60.
xingzhi lin 1.2 130
xingzhi lin 2.1 131 (% style="text-align:center" %)
132 [[image:1764850718648-576.png]]
xingzhi lin 1.2 133
xingzhi lin 2.1 134 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.
135
136 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.
137
138 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.
139
140 If the slave axis is a linear axis mode axis, an error will occur when the Execute input rising edge is processed.
141
142
xingzhi lin 3.1 143 == **Precautions** ==
xingzhi lin 2.1 144
xingzhi lin 3.1 145 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.
xingzhi lin 2.1 146
147
xingzhi lin 3.1 148 == **Sequence diagram** ==
xingzhi lin 2.1 149
xingzhi lin 3.1 150 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.
xingzhi lin 2.1 151
xingzhi lin 3.1 152 (% style="text-align:center" %)
153 [[image:1764850822636-437.png]]
xingzhi lin 2.1 154
155
xingzhi lin 3.1 156 **This instruction starts in other instruction execution**
xingzhi lin 2.1 157
xingzhi lin 3.1 158 Start this instruction for the currently executing instruction, which can be switched or cached to this instruction.
159
160 The action at launch of multiple instances of this instruction is specified by BufferMode.
161
162 |**Buffer mode selection**|**Description**
163 |Aborting|(((
164 Immediately abort the currently executing instruction and switch to this instruction.
165
166 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.
167 )))
168 |Buffered|(((
169 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
170
171 Relative, then the new movement begins at rest.
172 )))
173
174
175
176
177
178
179
xingzhi lin 1.2 180