SMC_Interpolator (FB)¶
FUNCTION_BLOCK SMC_Interpolator
This function block is used to convert a continuous path described by SMC_GEOINFO objects into discrete path position points taking into account a defined velocity profile and time pattern. Afterwards, these position points will typically be transformed by the IEC-program (e.g. to drive-axis-positions) and sent to the drives.
Note
At the end of a path run, the input path queue is empty. If you want to process the same outline once again, you either have to transform the CNC program via decoder and path preprocessing modules to a SMC_OUTQUEUE structure, or you have to use the function block SMC_RestoreQueue (also part of SM3_CNC). This is only possible if the path queue is big enough to hold the complete path.
- InOut:
Scope
Name
Type
Initial
Comment
Input
bExecute
BOOL
Execution starts on the rising edge.
poqDataIn
POINTER TO SMC_OUTQUEUE
This variable points to the SMC_OUTQUEUE structure object, which contains the SMC_GEOINFO objects of the path; typically it points to the output
poqDataOut
of SMC_CheckVelocities .bSlow_Stop
BOOL
If this variable is set to
FALSE
, the path will be passed non-stop. Otherwise, theSMC_Interpolator
will be caused to reduce the velocity to 0 according to the defined velocity profile (byVelMode
), and the maximum delay of the current SMC_GEOINFO object (dDecel
, see below) and to wait untilbSlow_Stop
will be reset toFALSE
.bEmergency_Stop
BOOL
As soon as this input gets
TRUE
, theSMC_Interpolator
will cause an immediate stop, this means that the position will be retained. Hence, the velocity will be set to 0 immediately.bWaitAtNextStop
BOOL
As long as this variable is
FALSE
(default), the path is passed non-stop. Otherwise, theSMC_Interpolator
will be caused to retain the position at the next regular stop this means at position points where the velocity is 0, typically at path angles and to pause untilbWaitAtNextStop
will be reset toFALSE
.dOverride
LREAL
1
This variable can be used to handle the override. The active override is determined by
MAX(0, dOverride)
. The scheduled velocity of the particular objects will get scaled bydOverride
; thus the scheduled velocity can be increased resp. reduced in online mode. For exampledOverride=1
(default) effects that the programmed scheduled velocities will be executed, whereasdOverride=2
would double them.Please regard: The override can be modified at any time, but the modification will only be applied, if no acceleration or deceleration is currently in progress.
iVelMode
TRAPEZOID
This input defines the velocity profile as defined in SMC_INT_VELMODE.
dwIpoTime
DWORD
This variable has to be set for each call. It represents the cycle time in μsec.
dLastWayPos
LREAL
This input allows the user to measure the stretch of the path that is racked out by the interpolator. Output
dWayPos
is the sum ofdLastWayPos
and the distance covered within the current cycle. IfdLastWayPos
is set equal to outputdWayPos
,dWayPos
will always be incremented by the current path segment and the result will be the total length of the path travelled.dLastWayPos
can be (re)set to 0 or to a different value at any time.bAbort
BOOL
This input set to
TRUE
will abort the function block and reset the outputs. A rising edge ofbExecute
is required to start the interpolator again after aborting.bSingleStep
BOOL
This input effects that the interpolator will stop at the transition between two path objects (also at transitions with identical tangent) for the duration of one cycle. If
bSingleStep
is set toTRUE
during the move, the interpolator will stop at the end of that object, that can be reached without exceeding the scheduled deceleration value.If the interpolator should stop at the next possible stop position (i.e. at points where the velocity is 0),
bWaitAtNextStop
must be used.bAcknM
BOOL
This input can be used to acknowledge an M-function. If the input is
TRUE
, the outputwM
will be cleared and the path processing will be continued.bQuick_Stop
BOOL
If this input is
TRUE
, the interpolator will reduce the velocity to zero, untilbQuick_Stop
is reset toFALSE
. The reduction is done according to the defined velocity profile (byVelMode
) and the deceleration given by the maximum ofdQuickDeceleration
and the delay currently programmed in the path. If a quadratic velocity mode is used, then the jerk is limited bymax(dJerkMax, dQuickStopJerk)
.dQuickDeceleration
LREAL
Deceleration value used for
bQuick_Stop
dJerkMax
LREAL
Magnitude of the maximum allowed jerk: It’s only used for the quadratic velocity modes. It must be positive and can be changed while the interpolator is running. The value will become active - at the start of the interpolator - or once a standstill has been reached (between two G-code commands,
due to a stop or caused by a
dOverride
value of 0).dQuickStopJerk
LREAL
The magnitude of the jerk is used by a quick stop for ramping down the acceleration if one of the quadratic velocity modes is selected.
bSuppressSystemMFunctions
BOOL
If this option is set, then the output wM will not be set for internal M-functions created by G75 or G4 commands.
Output
bDone
BOOL
This variable will be set to
TRUE
as soon as the input data (poqDataIn
) has been processed completely. The function block will not perform any further actions until a reset is done. If inputbExecute
isFALSE
,bDone
will be reset toFALSE
.bBusy
BOOL
TRUE
while execution of function block is not finishedbError
BOOL
Signals that an error has occurred within the function block
wErrorID
SMC_ERROR
Error identification
piSetPosition
It reflects the calculated set position and contains the cartesian coordinates of the next position as well as the state of the additional axis. SMC_POSINFO
iStatus
IPO_INIT
This enumeration variable reflects the current status of the function block defined in SMC_INT_STATUS .
Possible states:
IPO_UNKNOWN
(0): internal state that may not occur after a complete pass of theSMC_Interpolator
.IPO_INIT
(1): initialization state; poqDataIn is not filled completely.IPO_ACCEL
(2): acceleratingIPO_CONSTANT
(3): moving with constant velocityIPO_DECEL
(4): deceleratingIPO_FINISHED
(5): path is finished. Any further SMC_GEOINFO objects arriving afterwards inpoqDataIn
will not be processed.IPO_WAIT
(6): waiting because one of the following situations has occurred:bEmergency_Stop = TRUE
bSlow_Stop = TRUE
anddVel = 0
bWait_At_Next_Stop = TRUE
anddVel = 0
IPO_INCREASING_ACCEL
(7): increasing accelerationIPO_DECREASING_ACCEL
(8): decreasing accelerationIPO_INCREASING_DECEL
(9): increasing decelerationIPO_DECREASING_DECEL
(10): decreasing deceleration
bWorking
BOOL
This output is intended to be connected to input
bEnable
of SMC_ControlAxisByPos .It will be
TRUE
if (and only if) the processing of the list has been started and not yet finishediActObjectSourceNo
DINT
-1
Value of member
iSourceLine_No
of active SMC_GEOINFO object ofpoqDataIn
-queue. If theSMC_Interpolator
does not work (any longer) (bWorking = FALSE
), the value is set to “-1”.dActObjectLength
LREAL
The length of the current object; valid if
bWorking = TRUE
.dActObjectLengthRemaining
LREAL
The remaning length of the current object; valid if
bWorking = TRUE
.dVel
LREAL
This variable contains the current path velocity.
vecActTangent
SMC_VECTOR3D
This structure contains the path tangent, a unit vector.
iLastSwitch
INT
This output contains the number of the last switch passed.
Note: If several switches have been passed within one cycle, only the last one will be mentioned.
dwSwitches
DWORD
This
DWORD
describes the current switch status of all switches 1 32. Bit0 of theDWORD
represents switch1, Bit31 represents switch32. In contrast toiLastSwitch
, this bit-field will also hold multiple switches in one cycle.dWayPos
LREAL
See input
dLastWAyPos
.wM
WORD
If the interpolator passes an M-function, this output will be set to the value associated to the M-function. The interpolator will stop until the M-function is acknowledged by input
bAcknM
.adToolLength
ARRAY [0..2] OF LREAL
Parameters for tool length compensation (set by G43 I/J/K)
Act_Object
POINTER TO SMC_GEOINFO
Pointer to the currently interpolated path element. Possibly 0.
actObjectId
The identifier of the currently interpolated path object.
Structure: