background image

PLC API

TS5066

14

Version: 1.0

AxisOut : Output axis structure with corrected axis set values.

3.2

FB_TimeSync

This function block is used for system synchronization. The phase difference of the systems is determined
based on the cycle index of received network variables, and a correction time is calculated.

Description

For synchronization of distributed systems the information is sent cyclically by one system and received by
the others. Phase differences between the cycle times of the sender and the respective receiver lead to beat
effects (see 

introduction [

}

 7]

) through information being missed or read twice. In the following section only

the case with nominally identical cycle times on the sender and receiver side is considered. For different
cycle times (even-numbered ratios are supported) the following description applies with different values.

Each send process is associated with a consecutive number, i.e. cycle index 

m

 of the network variables. The

following cases may occur for the difference Δm

i

 between the cycle index received during the current cycle

(i) and the previous cycle (i-1) (Δm

i

=m

i

-m

i-1

):

Δm=0: The same data are read during the current and the previous cycle.

Δm=1: The sent data are received continuously.

Δm>=2: One or several pieces of information were not received.

Figure 1 schematically shows the case for Δm=0, i.e. duplicate reading of information, at the position
indicated. Figure 2 shows case Δm=2, with sent information being skipped and not analysed.

Fig. 7: Figure 1: Beat effect if the cycle time of the sender (S) is greater than that of the receiver (E).
Corresponding sender and transmitter cycles are linked through lines.

Fig. 8: Figure 2: Beat effect if the cycle time of the sender (S) is smaller than that of the receiver (E).

Summary of Contents for TS5066

Page 1: ...Manual EN TS5066 TwinCAT 2 PLC Remote Synchronisation 2021 10 13 Version 1 0 ...

Page 2: ......

Page 3: ... ST_AxisSyncDiagnostic 20 3 6 E_Sync_FallBackMode 21 3 7 E_Sync_FilterMode 21 3 8 E_Sync_FilterState 21 3 9 E_Sync_StartUpMode 22 3 10 ST_TimeSyncParameters 22 3 11 ST_TimeSyncDiagnostic 24 3 12 ST_AxisExtrapolateDiagnostic 24 3 13 ST_AxisExtrapolateParameters 25 3 14 E_Sync_ExtrapolateMode 25 3 15 E_Sync_ExtrapolateState 26 3 16 E_Sync_ErrorCodes 26 3 17 E_Sync_WarningCodes 27 4 Example 28 4 1 Sy...

Page 4: ...Table of contents TS5066 4 Version 1 0 ...

Page 5: ...ave already been supplied may be made on the basis of the data diagrams and descriptions in this documentation Trademarks Beckhoff TwinCAT TwinCAT BSD TC BSD EtherCAT EtherCAT G EtherCAT G10 EtherCAT P Safety over EtherCAT TwinSAFE XFC XTS and XPlanar are registered trademarks of and licensed by Beckhoff Automation GmbH Other designations used in this publication may be trademarks whose use by thi...

Page 6: ...e familiar with the applicable national standards Description of symbols In this documentation the following symbols are used with an accompanying safety instruction or note The safety instructions must be read carefully and followed without fail DANGER Serious risk of injury Failure to follow the safety instructions associated with this symbol directly endangers the life and health of persons WAR...

Page 7: ...y different cycle times TS TR Distributed systems are synchronized through cyclic sending of information from the sender S to the receiver R Up to the point indicated in Figure 1 the sent information is receive sequentially then the information sent is read during two consecutive cycles and subsequently the system returns to sequential reception If the cycle time relationship is reversed i e cycle...

Page 8: ...ances are caused by step changes in the received set positions Fig 3 Figure 3 Actual velocity of an axis operated directly with received set values in the position interface The set position can be corrected in the receiver system prior to drive control commands being issued using the method described above To this end the received set position pS is extrapolated with the correction time Δt and th...

Page 9: ... system The function block FB_AxisSync 10 is used for axes synchronisation via a network The set position and if necessary the set velocity of the axis information sent are extrapolated as outlined above An example 28 is available for demonstration purposes Internally FB_AxisSync uses two function blocks FB_TimeSync and FB_AxisExtrapolateValues The block FB_TimeSync 14 is used for determining the ...

Page 10: ...twork variables If the receivers are operated directly with the transferred information beat effects caused by small phase differences in the real time clocks become apparent The beat effects manifest themselves as cyclic disturbance of the receiver axes since information may be analyzed twice or skipped depending on the phase difference The frequency and duration of the disturbances depends on th...

Page 11: ...velocity of an axis directly operated with the received axis information position interface Figure 2 shows the actual velocity of an axis operated with values corrected through this function block The previously observed disturbances have been corrected ...

Page 12: ...Sync 14 This block determines the frequency of the beat and a correction time for extrapolating the kinematic axis information such that the beat effects are compensated To this end the correction time is transferred to an instance of the function block FB_AxisExtrapolateValues 17 together with the received axis structure which calculates the corrected set positions and velocities Note that by def...

Page 13: ...nt fluctuations 2 b As soon a sufficient number stAxisSyncParameters stTimeSyncParameters iNoOfPeriodsForMe anDrift 1 of beat effects were detected the system switches to sync mode and the set values are extrapolated with the correction time 3 c If synchronization is lost for some reason the system switches to PT1 mode In this mode the trans ferred positions are filtered before being transferred t...

Page 14: ...red ratios are supported the following description applies with different values Each send process is associated with a consecutive number i e cycle index m of the network variables The following cases may occur for the difference Δmi between the cycle index received during the current cycle i and the previous cycle i 1 Δmi mi mi 1 Δm 0 The same data are read during the current and the previous cy...

Page 15: ...e applied with a delay In order to avoid discontinuities of the corrected cycle index even in the event of strong differences in clock times the drift used for the correction is gradually adjusted between the old valued and the new value once a discontinuity has been identified Another option for limiting the effects of strong changes in phase differences is non uniform correction of beat effects ...

Page 16: ...meSyncDiagnostic ST_TimeSyncDiagnostic END_VAR bError TRUE in the event of a fault iErrorId Returns error code E_Sync_ErrorCodes 26 in the event of a fault bWarning TRUE in the event of a warning i e operation continues under sub optimum conditions iWarningId Returns the corresponding warning code E_Sync_WarningCode 27 fCorrectionTime Correction time i e the time used for extrapolating the receive...

Page 17: ...uction 7 lead to loss or duplicate reading of sent information If this information contains set values for axes the result are step changes in the kinematic variables set position and set velocity In axes that are operated directly with these variables this will cause periodic disturbance The situation can be rectified by correcting the set values using higher derivative terms set velocity or set ...

Page 18: ...re shown in Table 1 Main axis operating mode Parameters required in AxisIn Parameters Comment Position interface Set position Set velocity set acceleration stAxisExtrapolateParamet ers bUseAccForExtrapola tion FALSE TRUE Acceleration can optionally be added as a parameter The acceleration requirements described above must be met Velocity interface Set position Set velocity Set acceleration stAxisE...

Page 19: ...ned through the position or velocity change that can be achieved with the current set velocity or set acceleration in stAxisExtrapolateParameters fMaxPositionDiffFactor cycles If the difference exceeds this value the configurable fallback mode is activated Bypass of PT1 mode is available for this purpose see description above VAR_INPUT VAR_INPUT fCorrectionTime LREAL fTaskCycleTime LREAL eMode E_S...

Page 20: ...structure 25 of the FB_AxisExtrapolateValues 17 block stTimeSyncParameters Configuration structure 22 of the FB_TimeSync 14 block 3 5 ST_AxisSyncDiagnostic Diagnostic structure for FB_AxisSync 10 TYPE ST_AxisSyncDiagnostic STRUCT fPositionDiff LREAL fVeloDiff LREAL fCorrectionTime LREAL bTimeMode BOOL stTimeSyncDiagnostic ST_TimeSyncDiagnostic stAxisExtrapolateDiagnostic ST_AxisExtrapolateDiagnost...

Page 21: ...ode is used E_Sync_FilterMode_Bypass The set values supplied by the sender including all beat effects are not modified E_Sync_FilterMode_PT1 A PT1 filter passes the set positions on to the receiver axis E_Sync_FilterMode_Time The time correction is calculated such that any beat effects and fluctuations are compensated 3 8 E_Sync_FilterState Specifies which mode is currently used for modifying the ...

Page 22: ...e tSender 2ms tReceiver 4ms or tReceiver 1ms for example IffDataCycleTime FB_TimeSync fTaskCycleTime the parameter fMaxCycleIndexDifference has to be adjusted accordingly either by deactivating 0 or be setting to a minimum value of FB_TimeSync fTaskCycleTime fDataCycleTime 2 The same applies to FB_TimeSync iAgeOfDataLimit fThresholdForSync Threshold value of the correction time from which synchron...

Page 23: ...tion that is executed within the time fSlope1denominator fTaskCycleTime In order to compensate the beat effects the received cycle indices have to be corrected by 1 between two step changes If a discontinuity occurs significantly earlier than expected the correction will not yet be completed leading to a large difference to be corrected during the next cycle The parameters fSlope1Numerator and fSl...

Page 24: ... the synchronisation conditions have been reached TimeMode is automatically active as long as synchronisation could not be achieved bSynced FALSE In this case the function blocks FB_AxisSync 10 or FB_AxisExtrapolateValues 17 used evaluating the correction time should be used as in sync mode or discarded bAutomaticReInit Automatic reinitialisation after a fault Faults are deleted and the startup ph...

Page 25: ... extrapolating the set velocity This is the default and must be deactivated for encoder or NCI path axes for example fT1factorPos Time constant of the PT1 filter for the set position specified in multiples of the fTaskCycleTime fT1factorVelo Time constant of the PT1 filter for the set velocity specified in multiples of the fTaskCycleTime fBlendingTime Time during which linear interpolation is used...

Page 26: ...currence 3 16 E_Sync_ErrorCodes Error Hex Error Dec Error type Error name Description 16 4b50 19280 16 4b51 19281 E_Sync_TimeSync_Error_MaxCycleI ndexDiffExceeded Maximum cycleindex difference exceeded The difference between the corrected and the calculated cycleindex is larger than allowed 16 4b52 19282 E_Sync_TimeSync_Error_MaxDataA geExceeded Maximum packet age exceeded The packet age is larger...

Page 27: ...PLC API TS5066 27 Version 1 0 3 17 E_Sync_WarningCodes Warning Hex Warning Dec Error name Description 16 1 1 E_Sync_Warning_DriftCh angedSignificantly ...

Page 28: ...nes the time difference between the beat effects Subsequently a correction time is calculated and used for extrapolating the received the information into the future or calculating back into the past in order to obtain equidistant corrected information without beat effects The step changes in the kinematic axis variables caused by the beat effect are corrected through small changes across the comp...

Page 29: ...LC project A simulated axis corrected master is linked with the PLC inputs Nc2PlcAxis and outputs Plc2NcAxis for external set value generation The corrected master information is available as PLC output MAIN MasterNcToPlcFeedback sample_axissync pro PLC project for the receiver FB_SyncAxis is called in MAIN Input iCycleIndex is of particularly significance since this cyclically updated index forms...

Page 30: ......

Page 31: ...Beckhoff Automation GmbH Co KG Hülshorstweg 20 33415 Verl Germany Phone 49 5246 9630 info beckhoff com www beckhoff com More Information www beckhoff com ...

Reviews: