MC_CamIn (FB)¶
FUNCTION_BLOCK MC_CamIn
Executes a given cam table.
Note
MC_CamIn
should be called after the motion FB controlling
the Master
axis has been called. Otherwise, the Slave
axis
will lag behind the Master
axis.
- InOut:
Scope
Name
Type
Initial
Comment
Inout
Master
Reference to master axis. Master need not be stationary.
Slave
Reference to slave axis
Input
Execute
BOOL
Rising edge: Starts the execution of the function block.
MasterOffset
LREAL
Offset on master table in master cam table units.
SlaveOffset
LREAL
Offset on slave table in slave axis units.
Mechanical analogy to the slave offset is a cam plate, which is welded with additional constant layer thickness. Therefore slave positions have a constant offset. The offset can be interpreted as an axis offset of the master axis on the assumption that the slave cam is linearly guided.
MasterScaling
LREAL
1
Scaling factor for master profile. Must not be 0.
SlaveScaling
LREAL
1
Scaling factor for slave profile. Must not be 0.
MasterStartDistance
LREAL
The master distance (in master cam table units) from the
MasterSyncPosition
where the slave axis starts synchronization. Only used inStartMode
ramp_in_dist.If
MasterStartDistance
is 0 (or negative), then the slave movement is started immediately, provided that the master is not in standstill. If BufferMode <> Aborting, then the MasterStartDistance must be 0 (or negative).MasterSyncPosition
LREAL
The master position in the cam table where the slave axis has to be synchronized to the master. Must be a valid position in the cam table, otherwise the error SMC_CI_MASTER_SYNC_POSITION_OUT_OF_SCALE will be reported. Only used in
StartMode
ramp_in_dist.AvoidReversal
BOOL
FALSE
: Signals that the reversal of the slave is physically possible and acceptable.TRUE
: Signals that a reversal of the modulo slave has to be avoided, e.g. because it is physically impossible or might lead to damage.It works only with modulo slave axes.If a reversal cannot be avoided, the axis is stopped with an error.Only used inStartMode
ramp_in_dist.Behavior:
- If the slave axis is a modulo axis and the master velocity (times the slope of the cam table at the
MasterSyncPosition
) is not oppositeto the slave velocity, thenMC_CamIn
tries to avoid a reversal of the slave.It tries to “stretch” the slave movement by increasing the distance the slave travels by up to 5 slave periods.If this “stretching” is not successful, i.e. does not avoid a reversal, an error is reported. - If the slave velocity is opposite to the master velocity times the slope of the cam table at the
MasterSyncPosition
,an error is reported. If the slave axis is not a modulo axis, an error is reported on the rising edge of the Execute input.
StartMode
absolute
Start mode
Possible values:
absolute, relative: The
Slave
will immediately beInSync
and follow the trajectory defined by cam table andMaster
. Depending on the current state of theSlave
, this can lead to a jump in position, velocity, and/or acceleration. If the StartMode is absolute, the value ofSlaveAbsolute
set by MC_CamTableSelect will be used. If the StartMode is relative, relative coordinates will be used for the slave position, effectively overwriting of the value ofSlaveAbsolute
.ramp_in, ramp_in_pos, ramp_in_neg: The
Slave
will synchronize to the cam as fast as possible using the configuredVelocityDiff
,Acceleration
,Deceleration
, andJerk
. If theSlave
is a modulo axis, ramp_in_pos and ramp_in_neg define the direction for ramping in. For a finiteSlave
, all three StartModes behave the same.ramp_in_dist: The
Slave
will synchronize to the cam so that it follows the trajectory defined by cam table andMaster
as soon as theMaster
reaches theMasterSyncPosition
. Synchronization will start when theMaster
is within theMasterStartDistance
of theMasterSyncPosition
.
Please note that the ramping-in StartModes only have an effect on a rising edge of input Execute. If the cam table is changed by modifying input
CamTableID
, no ramping-in is performed.CamTableID
Identification of the cam table. The input is connected with the output of MC_CamTableSelect.
While camming is active, this input can be used to change cam tables on the fly without a new rising edge on
Execute
. Compared to restarting camming with a rising edge onExecute
, there are a few differences:If ramping with
StartMode
ramp_in, ramp_in_pos, or ramp_in_neg is active, it is not aborted.Even if the
StartMode
is ramp_in, ramp_in_pos, or ramp_in_neg, no new ramping in is initiated.If
EndOfProfile
has been set in the same cycle, the new cam table is automatically offset so that no gap occurs between the two tables.
Please note that when using distance based ramping in (
StartMode
ramp_in_dist), the errorSMC_CI_CAM_CHANGED_DURING_RAMP_IN_DIST
is returned if theCamTableID
changes while ramping in is still active.BufferMode
MC_BUFFER_MODE
Defines the chronological sequence of the FB relative to the previous block. Only the BufferModes
Aborting
,Buffered
andBlendingPrevious
are supported.BlendingPrevious
means that the configured velocity (including the direction) of the previous movement is used as the blending velocity, even if this movement has the opposite direction. If the function block is Busy, then only BufferMode=Aborting is allowed.VelocityDiff
LREAL
Maximum velocity difference in u/s for ``StartMode``s ramp_in, ramp_in_pos, and ramp_in_neg.
Acceleration
LREAL
Acceleration in u/s² for ``StartMode``s ramp_in, ramp_in_pos, and ramp_in_neg.
Deceleration
LREAL
Deceleration in u/s² for ``StartMode``s ramp_in, ramp_in_pos, and ramp_in_neg.
Jerk
LREAL
Jerk in u/s³ for ``StartMode``s ramp_in, ramp_in_pos, and ramp_in_neg.
TappetHysteresis
LREAL
Size of the hysteresis for tappets in u. A positive value means that the tappet cannot fire immediately after it has fired. The master position first needs to move away from the tappet by more than the value given for
TappetHysteresis
.For example, if the master is an encoder, the master position may oscillate by a few increments around the tappet position. Without a hysteresis, the tappet may fire all the time.
Output
InSync
BOOL
Indicates that the
Slave
follows the cam profile.Busy
BOOL
Execution of the function block has not finished.
Active
BOOL
Indicates that the FB has control on the axis
CommandAborted
BOOL
Command has been aborted by another command
Error
BOOL
Signals that an error has occured within the function block.
ErrorID
SMC_ERROR
Error identification
EndOfProfile
BOOL
Indicates that the
Master
has reached a border of the cam table. (This can be either the start or the end of the cam table, depending on theMaster
direction.)For periodic cams, the output is set for one cycle for each new period.
For non-periodic cams, the output stays TRUE while the
Master
is outside the cam range. TheSlave
will remain in synchronized_motion. If theSlave
is not in standstill whenEndOfProfile
is reached, another movement must be commanded that takes control of theSlave
. MC_CamIn does not stop theSlave
onEndOfProfile
.A buffered movement that has been commanded after this movement is started as soon as
EndOfProfile
is set. This behavior is the same for periodic and non-periodic cams.Note: With
StartMode
ramp_in, ramp_in_pos, or ramp_in_neg and depending on the configuredVelocityDiff
,Acceleration
,Deceleration
, andJerk
, it is possible that theMaster
reachesEndOfProfile
before the slave isInSync
.Tappets
SMC_TappetData
Tappets: Has to be evaluated by SMC_GetTappetValue function blocks.