# MC_GearIn

The MC_GearIn FB commands gear coupling with a gear ratio. The gear ratio defines the speed ratio between the master and slave axes. Synchronisation to velocity is jerk-limited. The jerk value must be specified as an input at the FB.

If the optional parameters “Acceleration, “Deceleration” and “Jerk” are not specified or set to <= 0, the dynamic values are taken from the corresponding axis list.

The slave axis can be linked either to master command values or to actual master values. Selection is made in the "Mode" input parameter.

Block diagram

FB parameters

VAR_IN_OUT
Variable name | Data type | Description
Master | AXIS_REF | Axis reference of the master axis.
Slave | AXIS_REF | Axis reference of the slave axis

VAR_INPUT
Variable name | Data type | Description
Execute | BOOL | Starts the command on the rising edge.
RatioNumerator | DINT | Gear ratio numerator
RatioDenominator | DINT | Gear ratio denominator
Acceleration | LREAL | Acceleration value. This value must be always be specified positive. Value range [0.0, 2147483647.0] Default unit [1mm/s2 or 1°/s2]
Deceleration | LREAL | Deceleration value. This value must be always be specified positive. Value range [0.0, 2147483647.0] Default unit [1mm/s2 or 1°/s2]
Jerk | LREAL | Jerk value. This value must be always be specified positive. Value range [0.0, 2147483647.0] Default unit [1mm/s3 or 1°/s3]
Mode | UDINT | Possible values
0: (16#0) | Type of coupling between master axis and slave: Coupling on the command value side.
128: (16#80) | Type of coupling between master axis and slave: Coupling on the actual value side.

VAR_OUTPUT
Variable name | Data type | Description
InGear | BOOL | Commanded gearing completed.
Error | BOOL | Is TRUE if an error occurs in the FB.
ErrorID | WORD | Error identifier
CommandAborted | BOOL | TRUE indicates that the command was aborted by another command.

Behaviour of the FB:

- The command for gear coupling can only be issued only when the slave axis is in one of the following states:
- Standstill
- Continuous Motion
- Discrete Motion
- Synchronised Motion

If this is not the case, the “Error” output is set to FALSE and “ErrorID” indicates an error value that designates the state the axis is currently in.

- The value range of the “Acceleration”, “Deceleration” and “Jerk” input variables is monitored and, if it is exceeded, an error number referring to the variable is output at the “ErrorID” output and “Error” is set to TRUE. The “RatioDenominator” input variable is the denominator of the gear ratio and this is why it must be unequal to 0. In the event of the “RatioDenominator” = 0 error, the error P-ERR-44040 (ERR_PO_AX_RATIO_DENOM_ZERO) is output at the “ErrorID” output and "Error“ becomes TRUE.
- Values for jerk are practical when they correspond to a minimum ramp time of TA (cycle time of the IPO, e.g. 2 ms) and a maximum ramp time of 100s. The limit transition to non-jerk-limited velocity control lies at the minimum ramp time of TA. With a value of 0, the maximum ramp time from the axis MDS is used to determine the jerk.
- The function block is retriggerable. Therefore, it can send a command again in the active state.
- For an axis to work as a master axis and for it to transfer the necessary synchronisation information to all axes (slaves) cyclically, the cam_gear.is_master parameter (P-AXIS-00288) must be set to 1 for such a master axis in the axis parameter configuration. An axis configured as master can be simultaneously coupled to another master axis as slave.
- The "Mode" input parameter can be used to set whether the master/slave coupling should use the actual values or the command values of the master.

## Notice

The MC_GearIn FB can be used for linear and rotary slave axes. With linear slave axes, software limit switch monitoring is active after “Homing” is completed. For deceleration on approaching the software limit, the current limit ramp is used and gear coupling is released.

## Notice

In all other situations, gear coupling is "holy", i.e. axis-specific feedhold, axis-specific override CANNOT act on the cam slave because this would be contradictory to the coupling specification.

## Additional information

- Influence of axis parameters on the coupling process