MC_GearInPos
Synchronizes the slave onto the master's velocity and acceleration scaled by a constant gear ratio, anchoring at slave position = SlaveSyncPosition + (RatioNumerator / RatioDenominator) * (master position - MasterSyncPosition). Synchronizes as fast as the function block's inputs Velocity, Acceleration, Deceleration and Jerk allow. Once the slave has reached the scaled velocity and acceleration as well as the position described above, the slave is coupled to the master. From then on any dynamic restrictions (commanded dynamics as well as axis parameters) are ignored. If it is not necessary to configure the position relationship in advance, use MC_GearIn instead. Synchronicity is reached as early as possible and is thus independent of whether commanded synchronous positions have been reached by either master or slave. The outputs InSync and SyncState provide detailed information on the progress of synchronization. The direction in which the slave may move while synchronizing can be restricted via the input AllowedSlaveSyncDirections. The command may be ended by sending another command. Using input BufferMode := Aborting for the next command makes it take over immediately while input BufferMode := Buffered for the next command queues it. It will then take over as soon as output SyncState reaches InSync.
Syntax
Definition:
FUNCTION_BLOCK MC_GearInPos
VAR_INPUT
Master : Type_Master1D;
Slave : Reference To AXIS_REF;
Execute : BOOL;
RatioNumerator : LREAL;
RatioDenominator : UDINT;
MasterSyncPosition : LREAL;
SlaveSyncPosition : LREAL;
Velocity : LREAL;
Acceleration : LREAL;
Deceleration : LREAL;
Jerk : LREAL;
BufferMode : EBufferMode;
ReactionToMasterError : EReactionToMasterError;
ReactionToSlaveError : EReactionToSlaveError;
AllowedSlaveSyncDirections : ESyncDirection;
END_VAR
VAR_OUTPUT
InSync : BOOL;
SyncState : EGearInPosSyncState;
Busy : BOOL;
Active : BOOL;
CommandAborted : BOOL;
Error : BOOL;
ErrorId : UDINT;
MasterHasError : BOOL;
END_VAR
Inputs
Name | Type | Default | Description |
|---|---|---|---|
Master |
| Reference to the master axis | |
Slave | Reference To AXIS_REF |
| Reference to the slave axis |
Execute | BOOL |
| Trigger the command with rising edge. |
RatioNumerator | LREAL | 1.0 | The numerator of the gear ratio. Once synchronous the slave's velocity, acceleration and position changes are (RatioNumerator / RatioDenominator) times the master's. A negative value moves the slave opposite to the master. |
RatioDenominator | UDINT | 1 | The denominator of the gear ratio |
MasterSyncPosition | LREAL | #Invalid | Together with input SlaveSyncPosition it defines the position anchor, i.e. the position relation required for synchronicity: slave position = SlaveSyncPosition + (RatioNumerator / RatioDenominator) * (master position - MasterSyncPosition). |
SlaveSyncPosition | LREAL | #Invalid | Together with input MasterSyncPosition it defines the position anchor, i.e. the position relation required for synchronicity: slave position = SlaveSyncPosition + (RatioNumerator / RatioDenominator) * (master position - MasterSyncPosition). |
Velocity | LREAL | #Maximum | The input Velocity used for planning the synchronizing motion ([PosUnit]/s, positive). Not a strict maximum: it might be exceeded due to initial conditions. It has no effect once the slave is synchronous. When starting synchronization while the slave is in motion, input Velocity must equal the axis' maximum value. |
Acceleration | LREAL | #Default | The input Acceleration used for planning the synchronization ([PosUnit]/s^2, positive). Not a strict maximum: it might be exceeded due to initial conditions. It has no effect once the slave is synchronous. Must currently be equal to input Deceleration. When starting synchronization while the slave is in motion, input Acceleration must equal the axis' maximum value. |
Deceleration | LREAL | #Default | The input Deceleration used for planning the synchronization ([PosUnit]/s^2, positive). Not a strict maximum, see input Acceleration. Must currently be equal to input Acceleration. When starting synchronization while the slave is in motion, input Deceleration must equal the axis' maximum value. |
Jerk | LREAL | #Default | The input Jerk used to ramp up or down acceleration during planning the synchronization ([PosUnit]/s^3, positive). It has no effect once the slave is synchronous. When starting synchronization while the slave is in motion, Jerk must equal the axis' maximum value. |
BufferMode | Aborting | Whether the command shall take effect immediately (Aborting) or be queued (Buffered). | |
ReactionToMasterError | TriggerSlaveError | This input affects how the slave axis reacts to an error on the master axis. | |
ReactionToSlaveError | TriggerMasterError | This input affects how an error on the slave axis is propagated to the master axis. | |
AllowedSlaveSyncDirections | TowardsSlaveSyncPosition | Restricts the direction in which the slave may move while synchronizing. The value TowardsSlaveSyncPosition resolves at command start to the direction from the slave's position towards input SlaveSyncPosition. While the master moves such that synchronizing would require the slave to move in a forbidden direction, the slave waits (SyncState = Waiting). The axis' feed enable restricts the directions further. |
Outputs
Name | Type | Description |
|---|---|---|
InSync | BOOL | TRUE once the output SyncState reaches value InSync: the slave is coupled to the master and the master position has passed value of input MasterSyncPosition. |
SyncState | Synchronization state. See EGearInPosSyncState for details. | |
Busy | BOOL | Function block is not finished and new output values are to be expected. |
Active | BOOL | Function block has active control on the axis. |
CommandAborted | BOOL | Command is aborted by another command. |
Error | BOOL | Error occurred within function block. |
ErrorId | UDINT | Error identifier |
MasterHasError | BOOL | Master is in error state. |
Ergänzungen zu ReactionToSlaveError und ReactionToMasterError
Grundsätzlich gilt bei einem Fehler der Slave-Achse:
- Slave-Achse: Die Kopplung wird aufgelöst und die Reaktion ist abhängig vom Fehlertypen.
- Master-Achse: Die Master-Achse meldet einen Fehler und folgt einer Stopprampe der MC oder führt ihre laufende Bewegung ohne Beeinflussung fort.
Bei einem Fehler der Master-Achse gilt:
- Master-Achse: Reaktion ist abhängig vom Fehlertypen.
- Slave-Achse: Die Slave-Achse meldet einen Fehler und folgt einer Stopprampe der MC oder den Sollwerten der Master-Achse.
Ausführliche Informationen sind im Kapitel Fehlerverhalten dokumentiert.
Mögliche Fehlercodes
Für diesen Funktionsbaustein sind unter anderem die folgenden Werte für den Ausgang ErrorId möglich:
Fehler(Hex) | Fehler(Dez) | Fehlertyp | Beschreibung |
|---|---|---|---|
0x813c | 33084 | Parameter | Der Buffer-Modus ist ungültig. Der am Funktionsbaustein angegebene BufferMode ist unbekannt oder wird vom Kommando nicht unterstützt (einige Kommandos akzeptieren z.B. nur Aborting, andere nur Buffered). |
0x8143 | 33091 | Kommunikation | Funktionsbaustein oder das entsprechende Kommando wird vom Zielsystem nicht unterstützt. Das Zielobjekt (z.B. Achse, Gruppe oder Encoder-Achse) unterstützt das angeforderte Kommando nicht, etwa weil eine optionale Funktion nicht implementiert oder das Objekt vom falschen Typ ist. |
0x8146 | 33094 | Funktionsbaustein | Ungültiger Geschwindigkeits-Wert. Die Geschwindigkeit ist nicht gesetzt worden oder der eingegebene Wert ist ungültig. |
0x8151 | 33105 | Zustand | Das Kommando ist im gegenwärtigen Achszustand nicht erlaubt. Wenn die Achse keine Reglerfreigabe hat, sich im Fehler befindet oder einer Gruppe hinzugefügt wurde, sind einige Kommandos nicht erlaubt. |
0x8169 | 33129 | Funktionsbaustein | Masterachse existiert nicht oder kann nicht verwendet werden. Die als Master übergebene Achse ist nicht vorhanden oder hat keine zyklische Verknüpfung und kann daher nicht als Master (z.B. für Camming oder Gearing) verwendet werden. |
0x816f | 33135 | Zustand | Achskopplung würde eine zyklische Achsabhängigkeit verursachen (z.B. über MC_GearInPos). Die angeforderte Master-Slave-Kopplung würde einen Zyklus in der Kopplungs-Hierarchie erzeugen (eine Achse wäre direkt oder transitiv ihr eigener Master). |
0x818e | 33166 | Funktionsbaustein | Master-/Slave-Sync-Position inkompatibel zur Synchronisationsrichtung. Die angegebenen Sync-Positionen implizieren eine Bewegungsrichtung des Slaves während der Synchronisationsphase, die von der erlaubten Synchronisationsrichtung abweicht. |
0x81a9 | 33193 | Parameter | Ungültiger Beschleunigungs-Wert. Der übergebene Beschleunigungs-Wert ist ungültig (z.B. kein endlicher Wert, negativ oder außerhalb des zulässigen Bereichs). |
0x81aa | 33194 | Parameter | Ungültiger Verzögerungs-Wert. Der übergebene Verzögerungs-Wert ist ungültig (z.B. kein endlicher Wert, negativ oder außerhalb des zulässigen Bereichs). |
0x81ab | 33195 | Parameter | Ungültiger Ruck-Wert. Der für die Bewegung verwendete Ruck-Wert ist ungültig (z.B. negativ, Null oder außerhalb des erlaubten Bereichs des Movers bzw. der Achse). |
0x81b6 | 33206 | Funktionsbaustein | Die gegebene Fehler-Reaktion ist ungültig. Die am Bewegungsbaustein angegebene Fehler-Reaktion ist ungültig (z.B. unbekannter Wert in ErrorReactionToMaster oder ErrorReactionToSlave an Synchronisations-Bausteinen). |
0x81c0 | 33216 | Funktionsbaustein | Synchronisationsrichtung und Fahrtrichtungsfreigabe der Slave-Achse sind inkompatibel. Die Software-Freigabe für die in dem Baustein angegebene Synchronisationsrichtung ist nicht erteilt worden. |
0x8145 | 33093 | Funktionsbaustein | Die Verknüpfung des zyklischen Interfaces zwischen NC und SPS fehlt (z.B. AXIS_REF, AXES_GROUP_REF, ...). Eine vom Funktionsbaustein verwendete Referenz (z.B. auf eine Achse, Gruppe, einen Mover oder ein anderes Motion-Objekt) ist nicht mit dem zugehörigen NC-Objekt verknüpft oder die zyklische Verknüpfung ist unvollständig. |
0x813f | 33087 | Funktionsbaustein | Der Slave kann sich nicht synchronisieren. Der Slave kann die SlaveSyncPosition mit den gegebenen Dynamiken nicht erreichen. |
Eine Übersicht aller NC-Fehlercodes finden Sie hier:
Versionsinformation
- TwinCAT Standard >= v3.1.4026.23.1
- TF5500 MC3 Base >= v4.0.6