MC_DigitalCamSwitch (FB) ¶ FUNCTION_BLOCK MC_DigitalCamSwitch This function block is analogous to switching on a motor shaft: The function block commands a group of discrete output bits to switch in analogy to a set of mechanical cam controlled switches connected to an axis. Forward and backward movements are allowed. Note Changing the VAR_IN_OUT -parameters requires a new rising edge of the Enable input. Hint This functionality is sometimes called PLS – Phase or Position or Programmable Limit Switch. Example Assume the following parameter values set: Parameter Type Switch01 Switch02 Switch03 Switch04 TrackNumber INT 1 1 1 2 FirstOnPosition [u] REAL 2000 2500 4000 3000 LastOnPosition [u] REAL 3000 3000 1000 - AxisDirection INT 1=Pos 2=Neg 0=Both 0=Both CamSwitchMode INT 0=Position 0=Position 0=Position 1=TIME Duration TIME - - - 1350 Assume further, that no on/off compensation nor hysteresis is employed. The figure demonstrates the behavior of the outputs, when the axis is moving continuously in positive direction. The axis is a modulo axis with a modulo length of 5000 u. Example of DigitalCamSwitch ¶ Now assume that on compensation (-125ms) and off compensation (+250ms) are employed. Detailed description of Switch01 ¶ The resulting behavior of the outputs, when the axis is moving continuously in negative direction without on/off compensation and without hysteresis. Example in negative direction ¶ InOut: Scope Name Type Initial Comment Inout Axis AXIS_REF_SM3 Reference to axis the switches are connected to Switches MC_CAMSWITCH_REF Reference to switching actions Outputs MC_OUTPUT_REF Reference to signal outputs that are directly related to the referenced tracks TrackOptions MC_TRACK_REF Reference to structure containing track related properties, e.g. the on/off compensations per output/track. Input Enable BOOL FALSE TRUE : Enables execution of function block. EnableMask DWORD 16#FFFFFFFF 32 bits of BOOL enabling the different tracks. Least significant data is related to the lowest TrackNumber . TappetMode MC_TAPPETMODE tp_mode_auto Mode for position outputs Output InOperation BOOL FALSE TRUE : Commanded tracks have been enabled. Busy BOOL FALSE TRUE : Execution of function block has not been finished yet. Error BOOL FALSE TRUE : Error has occurred within the function block. ErrorID SMC_ERROR 0 Error identification SwitchCorrupted INT Signalizes potential problems that arise from compensation times: Compensation times may lead to the case that the extrapolated position passes one switching point several times before passing the other switching point again. As a consequence, a non-inverted switch may become inverted (and the other way around). In this case, this variable indicates the switch in concern. There are two possible reasons: noisy velocity-values, “big” difference between on- and off-compensation. -1 means that such behaviour hasn’t occured. Structure: CheckHysteresis (Action) InitSwitch (Action)
MC_TouchProbe (FB) ¶ FUNCTION_BLOCK MC_TouchProbe This function block is designed for recording an axis position when a trigger event is raised. Note The function block is intended for single shot operation, that is, only the first event following on a rising edge of Execute is One function block instance should represent exactly one probing command. Example Timing and TouchProbe Example Defining a window, where trigger events are accepted (for modulo axes). InOut: Scope Name Type Comment Inout Axis AXIS_REF_SM3 Reference to axis, the position of which is to be recorded at a defined event at the trigger input. TriggerInput TRIGGER_REF Reference to trigger signal source Input Execute BOOL Rising edge: Starts the execution of the function block. WindowOnly BOOL TRUE : Trigger events will be accepted only within the specified window. FirstPosition LREAL Start position from whereon (in positive direction) trigger events will be accepted (in technical units [u]). Only used if WindowOnly = TRUE . LastPosition LREAL End position up to which trigger events will be accepted (in technical units [u]). Only used if WindowOnly = TRUE . Output Done BOOL TRUE : Trigger event has been recorded. Busy BOOL TRUE : Execution of function block has not been finished yet. Error BOOL TRUE : Error occurred within the function block. ErrorID SMC_ERROR Error identification RecordedPosition LREAL Position, where trigger event has occurred (in technical units [u]). CommandAborted BOOL TRUE : Command has been aborted by another command.
SMC_Logical_Axis (FB) ¶ FUNCTION_BLOCK SMC_Logical_Axis the need to add a logical axis to the device tree. Use the output variable Axis of type AXIS_REF_LOGICAL_SM3 instead of a logical axis. If the function block is restarted, the logical axis is reinitialized. The master axis can be changed by restarting the function block. InOut: Scope Name Type Initial Comment Input Execute BOOL Starts the execution of the function block. wDriveID WORD 1 Identifier of the logical drive. iMovementType SMC_AXIS_TYPE SMC_AXIS_TYPE.modulo The type (finite or modulo) of axis. fPositionPeriod LREAL 360.0 Length of period for modulo drives in technical units [u]. eValueReference SMC_ValueSelect actual Master reference value. usiFilterDepthPosition LREAL Number of cycles the position value is averaged over. usiFilterDepthVelocity LREAL Number of cycles the velocity value is averaged over. fTimeShiftCycles LREAL 3 Time shift relative to master values in cycles. RealAxis REFERENCE TO AXIS_REF_SM3 The real master axis. Output Initialized BOOL The logical axis is intialized and can be used. InSteadyState BOOL The filter of the logical axis is intialized. InSteadyState implies Initialized . Error BOOL There is an error. Axis AXIS_REF_LOGICAL_SM3 The logical axis.
SMC_StartupDrive (FB) ¶ FUNCTION_BLOCK SMC_StartupDrive This function block comprises a set of often used function blocks and is used for testing and commissioning an axis. Please note, that there is a compatible visualization template. InOut: Scope Name Type Inout Axis AXIS_REF_SM3
SMC_GetForecast (FB) ¶ FUNCTION_BLOCK SMC_GetForecast This function block returns the forecast duration of a given axis. The forecast duration can be set using SMC_SetForecast . InOut: Scope Name Type Comment Inout Axis AXIS_REF_SM3 Reference to the axis Input Enable BOOL TRUE : The forecast is read continuously Output Valid BOOL TRUE : The forecast has been read successfully Busy BOOL TRUE : Function block is in operation Error BOOL TRUE : Error has occurred during execution ErrorID SMC_ERROR Error identification ForecastDuration LREAL The forecast duration in seconds
SMC_GetTravelTime (FB) ¶ FUNCTION_BLOCK SMC_GetTravelTime Returns when the axis will pass through a given position in a given direction. The function block returns the duration after a single call with Enable=TRUE, provided no error has occurred and the position will be reached during the configured forecast duration. An error is returned in the following situations: SMC_AXIS_IS_NO_AXIS_REF if an invalid axis is passed to the function block. SMC_FB_CALLED_FROM_WRONG_TASK if the function block is not called in the bus task of the axis. SMC_AXIS_NOT_FOLLOWING_SETVALUES if the drive is not under control of SoftMotion, e.g. during quick stop, drive controlled homing or controller mode SMC_nocontrol. SMC_WRONG_CONTROLLER_MODE if the controller mode is not SMC_position or SMC_velocity. Note Reading the duration requires setting a forecast duration using SMC_SetForecast . The Axis must be within the forecast duration of the Position for the Duration output to be valid. If the axis does not move, then Valid is FALSE even if the axis is exactly at the given position. While the calculated Duration has sub-cycle accuracy, a position that is passed twice in one cycle will not be detected. InOut: Scope Name Type Initial Comment Inout Const Axis AXIS_REF_SM3 Reference to the axis Input Enable BOOL Get the duration continuously while enabled. Position LREAL The axis position. Direction SMC_CAMTAPPETTYPE SMC_CAMTAPPETTYPE.TAPPET_all The direction from which the position needs to be passed. If the position is reached from a different direction, it will not be returned by this function block. Output Valid BOOL Whether the duration output is valid. Duration LREAL The duration in seconds until the position is passed, relative to the start of the current cycle. The duration has sub-cycle accuracy. A value of 0s means that the position has been reached with the set values of the previous cycle. A value equal to the task interval means that the position will be reached with the set values computed in this cycle. Error BOOL Whether an error has occurred. ErrorId SMC_ERROR The error identifier.
SMC_SetAdditionalConversionFactors (FB) ¶ FUNCTION_BLOCK SMC_SetAdditionalConversionFactors Sets conversion factors for the dynamics of an axis. Set values are multiplied by the factors before being sent to the drive. Actual values are divided by the factors after having been received from the drive. InOut: Scope Name Type Initial Comment Inout Axis AXIS_REF_SM3 Reference to the axis. Input Execute BOOL Factors are set on a rising edge. TorqueFactor LREAL 1 The conversion factor for the torque. Must not be 0. Output Done BOOL Signals that the factors have been set. Busy BOOL Signals that the function block is working. Error BOOL Signals an error. ErrorID SMC_ERROR Error identification
SMC_SetControllerMode (FB) ¶ FUNCTION_BLOCK SMC_SetControllerMode This function block, if supported by the drive, can be used to switch to another controller mode. Preconditions: The axis must support the desired controlling mode. In order to check this, see the feature documentation PDF inside the corresponding SoftMotion driver library. The needed cyclic I/O data (e.g. for torque mode: set torque object) must be mapped. The axis must NOT be in the state errorstop , stopping or homing when this function block is called. Else, an error SMC_SCM_AXIS_IN_WRONG_STATE will be reported. Behavior when active: This function block sets the byControllerMode (command value of operation mode) parameter of the axis and waits until the parameter byRealControllerMode (actual value of operation mode) reflects this value. If this does not happen during 1000 cycles, the function block will abort with an error. When switching from a lower level to a higher level control mode (e.g. torque -> velocity, torque->position, velocity->position), the function block calculates the set values of the higher level signal. E.g. when switching from torque mode to position mode, the function block uses the actual position of the axis and adds an expected position distance, that compensates the time lag between actual and set values depending on the actual velocity and the time shift in cycles ( Axis.fSetActTimeLagCycles ). The later value depends strongly on the system (controller hardware, field bus, drive) and may need to be adjusted. What function blocks have to be called after SMC_SetControllerMode reports bDone ? As soon as byRealControllerMode reflects byControllerMode , the function block sets its Done output and stops any action. This means that the application program is immediately responsible for calculating the correct set values beginning with this cycle. E.g. an axis was torque controlled and shall be switched to position control. The axis was still moving when the function block SMC_SetControllerMode was started. During the switching time, the function block calculates the proper values for the set position. But as soon as it sets Done , no function block continues to provide set values and the axis would stop immediately and report an error. Therefore e.g. a function block MC_Halt , MC_MoveVelocity or MC_MoveAbsolute could be triggered by the Done output of SMC_ControllerMode and take over the control of the axis. InOut: Scope Name Type Initial Comment Inout Axis AXIS_REF_SM3 Axis Input bExecute BOOL FALSE TRUE : Starts changing the controlling mode. nControllerMode SMC_CONTROLLER_MODE SMC_position Output bDone BOOL TRUE : Mode switching has been done. bBusy BOOL TRUE : FB is not idle. bError BOOL TRUE : Error has occured within function block. nErrorID SMC_ERROR Error identification
SMC_SetCustomRampType (FB) ¶ FUNCTION_BLOCK SMC_SetCustomRampType Sets the ramp type of an axis to a new value. In contrast to SMC_SetRampType , user-defined ramptypes (implementing SMC_TG_IRAMPTYPE ) are possible. Usually, iRampType1 equals iRampType2 . Can only be used when the axis is in state standstill or power_off . The FB executes synchronously on the rising edge of bExecute . After the call, either bDone or bError are set. InOut: Scope Name Type Initial Comment Inout Axis AXIS_REF_SM3 Input bExecute BOOL FALSE iRampType1 SMC_TG_IRAMPTYPE The new ramp type for the first ramp of the trajectories, usually the acceleration-phase. iRampType2 SMC_TG_IRAMPTYPE The new ramp type for the second ramp of the trajectories, usually the deceleration phase. Output bDone BOOL bError BOOL eErrorID SMC_ERROR SMC_NO_ERROR
Globals ¶ LibParams (ParamList) SMC_Basic_Ranges (GVL) SMC_DriveBasic_GlobalVariables (GVL) SM_PLCOpen_GlobalVariables (GVL)