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
SMC_SetForecast (FB) ¶ FUNCTION_BLOCK SMC_SetForecast This function block sets a forecast for a given axis. The forecast is limited to a maximum of 512 task cycles. By setting a forecast, information about the status of the axis in the future can be retrieved. - The duration up to a certain axis position can be obtained using SMC_GetTravelTime . The axis dynamics at a certain point of time can be obtained using SMC_ReadSetValues . The current forecast duration can be read using SMC_GetForecast . InOut: Scope Name Type Comment Inout Axis AXIS_REF_SM3 Reference to the axis Input Execute BOOL Rising edge: sets the forecast duration ForecastDuration LREAL The duration of the trajectory forecast in seconds Output Done BOOL TRUE : The forecast is set successfully Error BOOL TRUE : Error has occurred during execution ErrorID SMC_ERROR Error identification
SMC_SetMovementType (FB) ¶ FUNCTION_BLOCK SMC_SetMovementType Sets the movement type of a virtual axis to linear or modulo. 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 Axis Input bExecute BOOL FALSE iMovementType INT 0 The new drive type, 0 for modulo, 1 for linear fPositionPeriod LREAL 1 The new position period for modulo movement, must be positive Output bDone BOOL FALSE TRUE : Success bError BOOL FALSE TRUE : Error has occured within function block. eErrorID SMC_ERROR SMC_NO_ERROR Error identification
SMC_SetRampType (FB) ¶ FUNCTION_BLOCK SMC_SetRampType Sets the ramp type of an axis to a new value. 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 Axis Input bExecute BOOL FALSE eRampType SMC_RAMPTYPE trapez Defines the new ramp type. Output bDone BOOL FALSE TRUE : Success bError BOOL FALSE TRUE : Error has occured within function block. eErrorID SMC_ERROR SMC_NO_ERROR Error identification
SMC_VIRTUAL_AXIS (FB) ¶ FUNCTION_BLOCK SMC_VIRTUAL_AXIS This function block has been created in order to use a virtual axis without the need to add a virtual axis device to the “Softmotion general axis pool”. Use the output variable Axis of type AXIS_REF_VIRTUAL_SM3 instead of a virtual axis. Axis is being initialized by once calling this FB with the desired axis properties (the default values correspond to the virtual axis device description). Calling this FB again does not have any effect (apart from changing the input variables): Axis won’t be touched again. InOut: Scope Name Type Initial Comment Input wDriveID WORD 1 Identifier of drive iMovementType SMC_MOVEMENTTYPE ANY_TO_INT(SMC_AXIS_TYPE.finite) fPositionPeriod LREAL 360.0 Length of Period for modulo drives in technical units [u] eRampType SMC_RAMPTYPE trapez Velocity ramp fSWMaxVelocity LREAL Maximum velocity (software limit) in [u/s] fSWMaxAcceleration LREAL Maximum acceleration (software limit) in [u/s²] fSWMaxDeceleration LREAL Maximum deceleration (software limit) in [u/s²] fSWMaxJerk LREAL Maximum jerk (software limit) in [u/s³] fSWMaxTorque LREAL FPU.GetLRealSpecialVal(FPU.ESpecial_FP_Value.PosInf) Maximum torque or force (software limit) in [Nu] or [N] fSWLimitPositive LREAL 1000.0 Position limit in positive direction in techn. units [u] fSWLimitNegative LREAL 0.0 Position limit in negative direction in techn. units [u] fSWLimitDeceleration LREAL 0 Deceleration [techn. units/s²] which the system will brake with in case of a software limit. bSWLimitEnable BOOL FALSE TRUE : Enables software end switches. fSWErrorMaxDistance LREAL 0 Maximum deceleration distance for ramping down in case of an error [u]. Output Axis AXIS_REF_VIRTUAL_SM3 bError BOOL
Administrative/Configuration ¶ MC_Power (FunctionBlock) MC_Reset (FunctionBlock) MC_SetPosition (FunctionBlock) SMC3_BrakeControl (FunctionBlock) SMC3_PersistPosition (FunctionBlock) SMC3_PersistPositionLogical (FunctionBlock) SMC3_PersistPositionSingleturn (FunctionBlock) SMC_ChangeDynamicLimits (FunctionBlock) SMC_ChangeGearingRatio (FunctionBlock) SMC_GetForecast (FunctionBlock) SMC_GetTravelTime (FunctionBlock) SMC_SetAdditionalConversionFactors (FunctionBlock) SMC_SetControllerMode (FunctionBlock) SMC_SetCustomRampType (FunctionBlock) SMC_SetForecast (FunctionBlock) SMC_SetMovementType (FunctionBlock) SMC_SetRampType (FunctionBlock) SMC_SetSoftwareLimits (FunctionBlock)
MC_Power (FB) ¶ FUNCTION_BLOCK MC_Power MC_Power is designed for controlling the power stage (“on” or “off”). Note The inputs are only processed if Enable is TRUE . A call of MC_Power with bRegulatorOn = FALSE sets nAxisState of the referenced axis always into state (disabled) power_off . Then the axis isn’t ready for motion. A call of MC_Power with bRegulatorOn = TRUE on a disabled axis sets its nAxisState to standstill if there is no error on the axis. If an error is detected, the state of the axis is set to errorstop . If the inputs Enable , bRegulatorOn and bDriveStart are TRUE but the output Status remains FALSE for a long time, a possible reason is a hardware problem with the power stage of the drive. If power fails (also during operation), nAxisState of the referenced axis is set to errorstop . InOut: Scope Name Type Comment Inout Axis AXIS_REF_SM3 Reference to axis Input Enable BOOL TRUE : Enables the execution of the function block. bRegulatorOn BOOL TRUE : Enables the power stage. bDriveStart BOOL TRUE : Disables the quickstop mechanism. Output Status BOOL TRUE : Axis is ready to move. bRegulatorRealState BOOL TRUE : The power stage has been switched on. bDriveStartRealState BOOL TRUE : Drive is not blocked by the quickstop mechanism. Busy BOOL TRUE : Execution of the function block has not been finished yet. Error BOOL TRUE : Error has occurred within the function block during execution. ErrorID SMC_ERROR Error identification
MC_Reset (FB) ¶ FUNCTION_BLOCK MC_Reset This function block brings an axis from state errorstop to state standstill by resetting (acknowledging) all errors. Both errors of the drive and software errors are reset. When called in a state other than errorstop , the error SMC_R_NO_ERROR_TO_RESET is returned by the function block. InOut: Scope Name Type Initial Comment Inout Axis AXIS_REF_SM3 Reference to axis Input Execute BOOL Rising edge: Starts the execution of the function block. Output Done BOOL TRUE : Reset has been executed. Busy BOOL TRUE : Execution of the function block has not been finished. Error BOOL TRUE : Error has occurred within the function block. ErrorID SMC_ERROR SMC_NO_ERROR Error identification
MC_SetPosition (FB) ¶ FUNCTION_BLOCK MC_SetPosition This function block shifts the coordinate system of an axis. Both the set and actual position of the axis are offset by the same amount. No movement is caused by this operation. This recalibration can be used, for instance, for referencing an axis. The function block can be called while the axis is moving. In this case, the resulting movement of the drive is not affected. The same set positions in increments are sent to the drive as if MC_SetPosition had not been called. Only the set positions in technical units (fSetPosition) are shifted. Important ABSOLUTE (mode = FALSE) means that the new axis position is the value of input Position . RELATIVE (mode = TRUE) means that the new axis position is the sum of the current axis position and the value of input Position . Note This function block does not affect the trajectory of already commanded movements. However, the target position of absolute movements commanded after MC_SetPosition will be considered relative to the shifted coordinate system. InOut: Scope Name Type Comment Inout Axis AXIS_REF_SM3 Reference to axis Input Execute BOOL Rising edge: Starts the execution of the function block. Position LREAL Position unit [u] (means ‘Distance’ if Mode = RELATIVE) Mode BOOL TRUE = RELATIVE, FALSE = ABSOLUTE Output Done BOOL TRUE : The position has been shifted. Busy BOOL TRUE : Execution of function block is not finished yet. Error BOOL TRUE : An error has occurred within the function block. ErrorID SMC_ERROR Error identification