Performance ¶ SMC_PerfStat (FunctionBlock) SMC_PerfTimerSum (Function) SMC_SeriesStat (FunctionBlock)
Parameter access ¶ MC_ReadBoolParameter (FunctionBlock) MC_ReadParameter (FunctionBlock) MC_WriteBoolParameter (FunctionBlock) MC_WriteParameter (FunctionBlock) SMC_ParameterNumber_CoE (Function) SMC_ParameterNumber_SoE (Function)
MC_ReadBoolParameter (FB) ¶ FUNCTION_BLOCK MC_ReadBoolParameter MC_ReadBoolParameter returns the value of the SoftMotion parameter specified in input ParameterNumber . The boolean variable Value contains the read value. InOut: Scope Name Type Comment Inout Axis AXIS_REF_SM3 Reference to axis Input Enable BOOL TRUE : Enables the execution of the function block. While TRUE , the output value provides the parameter value continuously for reading out. ParameterNumber DINT You can find a description of the most used parameter numbers in AXIS_REF_SM3 . Negative values are fieldbus specific parameters. See SMC_ParameterNumber_CoE and SMC_ParameterNumber_SoE to translate fieldbus object identifiers to parameter numbers. Output Valid BOOL TRUE : Specified parameter is available. Busy BOOL TRUE : Execution of the function block has not finished yet. Error BOOL TRUE : Error has occurred during execution. ErrorID SMC_ERROR Error identification Value BOOL Boolean value of the parameter specified in input``ParameterNumber``.
MC_ReadParameter (FB) ¶ FUNCTION_BLOCK MC_ReadParameter MC_ReadParameter returns the value of the SoftMotion parameter specified in input ParameterNumber . If necessary, the returned variable Value will be converted to LREAL . InOut: Scope Name Type Comment Inout Axis AXIS_REF_SM3 Reference to axis Input Enable BOOL TRUE : Enables the execution of the function block. While TRUE , the output value provides the parameter value continuously for reading out. ParameterNumber DINT You can find a description of the most used parameter numbers in AXIS_REF_SM3 . Negative values are fieldbus specific parameters. See SMC_ParameterNumber_CoE and SMC_ParameterNumber_SoE to translate fieldbus object identifiers to parameter numbers. Output Valid BOOL TRUE : Parameter is available. Busy BOOL TRUE : Execution of the function block has not been finished yet. Error BOOL TRUE : Error has occurred during execution. ErrorID SMC_ERROR Error identification Value LREAL Value of the parameter specified in input``ParameterNumber``.
MC_WriteBoolParameter (FB) ¶ FUNCTION_BLOCK MC_WriteBoolParameter MC_WriteBoolParameter writes the value of the SoftMotion parameter specified in ParameterNumber . The boolean variable Value contains the value for writing. InOut: Scope Name Type Comment Inout Axis AXIS_REF_SM3 Reference to axis Input Execute BOOL Rising edge: starts the execution of MC_WriteBoolParameter . ParameterNumber DINT You can find a description of the most used parameter numbers in AXIS_REF_SM3 . Negative values are fieldbus specific parameters. See SMC_ParameterNumber_CoE and SMC_ParameterNumber_SoE to translate fieldbus object identifiers to parameter numbers. Value BOOL Boolean value to be written. Output Done BOOL TRUE : Parameter has been written successfully. Busy BOOL TRUE : Execution of the function block has not been finished. Error BOOL TRUE : Error has occurred during execution. ErrorID SMC_ERROR Error identification
SMC_ReadSetValues (FB) ¶ FUNCTION_BLOCK FINAL SMC_ReadSetValues Reads the set position, velocity, acceleration, and jerk of an axis. Allows setting a positive TimeOffset to read future set values. With TimeOffset = 0 the set values from the beginning of the current cycle are read. Note Reading future set values requires setting a ForecastDuration using SMC_SetForecast . InOut: Scope Name Type Comment Inout Axis AXIS_REF_SM3 Reference to the axis Input Enable BOOL Read the set values continuously while enabled. TimeOffset LREAL Time offset relative to the current cycle for which the set values should be read. The TimeOffset must be between 0 and the ForecastDuration set using SMC_SetForecast . If the TimeOffset is outside this range the error SMC_INVALID_PARAMETER is reported. Output Valid BOOL TRUE : Valid outputs are available. Busy BOOL TRUE : Execution of the function block has not been finished yet. Error BOOL TRUE : Error has occurred within the function block. ErrorID SMC_ERROR Error identification Position LREAL The set position Velocity LREAL The set velocity Acceleration LREAL The set acceleration Jerk LREAL The set jerk
Movement ¶ Direct SMC_FollowPosition (FunctionBlock) SMC_FollowPositionVelocity (FunctionBlock) SMC_FollowSetValues (FunctionBlock) SMC_FollowVelocity (FunctionBlock) SMC_SetTorque (FunctionBlock) SMC_TrackAxis (FunctionBlock) SMC_TrackSetValues (FunctionBlock) MC_AccelerationProfile (FunctionBlock) MC_Halt (FunctionBlock) MC_HaltSuperImposed (FunctionBlock) MC_Home (FunctionBlock) MC_Jog (FunctionBlock) MC_MoveAbsolute (FunctionBlock) MC_MoveAdditive (FunctionBlock) MC_MoveRelative (FunctionBlock) MC_MoveSuperImposed (FunctionBlock) MC_MoveVelocity (FunctionBlock) MC_PositionProfile (FunctionBlock) MC_SetOverride (FunctionBlock) MC_Stop (FunctionBlock) MC_VelocityProfile (FunctionBlock) Master/Slave MC_CamIn (FunctionBlock) MC_CamOut (FunctionBlock) MC_GearIn (FunctionBlock) MC_GearInPos (FunctionBlock) MC_GearOut (FunctionBlock) MC_Phasing (FunctionBlock) SMC_BacklashCompensation (FunctionBlock) SMC_GetOverride (FunctionBlock) SMC_Homing (FunctionBlock) SMC_Inch (FunctionBlock) SMC_MoveContinuousAbsolute (FunctionBlock) SMC_MoveContinuousRelative (FunctionBlock)
SMC_SmoothPath (FB) ¶ FUNCTION_BLOCK SMC_SmoothPath SMC_SmoothPath smoothes corners between adjacent elements by inserting splines. See SMC_RoundPath for an alternative corner rounding with circular arcs. The cut distance, the distance between the start or end of the spline and the corner, is always limited to the sum of dEdgeDistance and the value of the g-code word D . If input bSymmetricalDistances is set, the cut distance is further limited to the minimum of half the length of the first element and half the length of the second element. If the sum of input variable dEdgeDistance and G-code word D is 0, then no smoothing is done. If one of the two elements is a G0 element, then no smoothing is done. Details All SMC_GEOINFO elements of the input structure SMC_OUTQUEUE are checked one after the other. The smooth-path functionality is executed for all elements between G51 and G50. M-function at the smoothed corner If there is a M-function at the corner that will be smoothed, then the M-function remains but is moved to the end of the smoothed corner. This behavior is consistent with the behavior of SMC_RoundPath . H-function at a smoothed corner If there is a H-function bewtween the first cut point and the corner (1), the point is moved to the smoothed path (1’). The distance to the start point remains the same. If there a H-function between the corner and the second cut point (3) the point is also moved to the smoothed path (3’), so that the distance to the end point remains the same. The position of the moved H-functions is limited so that they don’t cross the center of smoothed path. Otherwise the order of the H-functions might change (2’, 4’). Example 1: Smoothing with splines G-Code N000 G01 X10 Y0 F100 N010 G51 D2 (smoothing with cut distance 2) N020 G01 X10 Y20 N030 G01 X20 Y20 N040 G01 X20 Y0 N050 G50 (smoothing off) N060 G01 X30 The following figure shows a path with smoothed corners. The smoothing is turned on at position X10 Y0 and is turned off at position X20 Y0. All corners between these positions are replaced by splines. Example 2: Input bSymmetricalDistances G-Code N000 G01 X10 Y0 F100 N010 G51 D10 (smoothing with cut distance 2) N020 G01 X10 Y20 N030 G01 X20 Y20 N040 G01 X20 Y0 N050 G50 (smoothing off) N060 G01 X30 The example shows the result when the cut distance is larger than half of the element. The following figure shows the resulting path with bSymmetricalDistances = FALSE . The element is too short, so it is completely replaced by two splines. In the following figure bSymmetricalDistances is set, together with bImprovedSymmetricCuts . At both corners, half the length of the horizontal line limits the cut distance to 5. Example 3: Input eMode G-Code N000 G51 D10 (smoothing with cut distance 10) N010 G01 X0 Y10 N020 G01 X10 Y10 N030 G01 X10 Y0 N040 G50 (smoothing off) The default spline type for smoothing is SP_SPLINE3 , i.e. a third-degree polynomial in each dimension. It is recommended to use SP_SPLINE5_MIN_CURVATURE . Fifth-degree polynomials have the advantage that they are smooth up to the curvature (second derivative). This results in a limited jerk. Dynamic curves along the X-axis with eMode = SP_SPLINE3 Dynamic curves along the X-axis with eMode = SP_SPLINE5 A smoothing element always uses the tool correction information (i.e. lengths and diameter) of the preceding element. InOut: Scope Name Type Initial Comment Input bExecute BOOL Starts on rising edge. bAbort BOOL If TRUE , the current processing of this function block is aborted bAppend BOOL As long as this input is set to FALSE , the poqDataOut queue will be cleared at each reset. As long as it is set to TRUE , newly incoming data will be written to the end of the poqDataOut -queue. poqDataIn POINTER TO SMC_OUTQUEUE The input path queue dEdgeDistance LREAL This input variable contains the value, which – added to the value of the D word – determines the (maximum) cut distance to the corner. This value may be modified online. dAngleTol LREAL 0.001 This input defines the value for the angle tolerance, up to which a path bend should not be smoothed. nSizeOutQueue UDINT This variable contains the size of the data buffer pbyBufferOutQueue in bytes. The list of SMC_GEOINFO structure objects will be written to. This buffer must be large enough to hold at least five SMC_GEOINFO objects. Otherwise, the function block will not execute any actions at all. Its size may be predefined, but may be modified later only during a reset. It is recommended to create the buffer as described by the example below: ExampleBuf: ARRAY[1..50] OF SMC_GeoInfo; The correct buffer size will then be retrieved by use of the operator sizeof(ExampleBuf) . pbyBufferOutQueue POINTER TO ARRAY [0..0] OF SMC_GEOINFO This input must point to the first byte of the memory area being allocated for the SMC_OUTQUEUE structure. This area must be at least as big as defined in nSizeOutQueue . Typically the allocation of the memory buffer is done within the declaration part of the IEC-program by defining a byte-array (ExampleBuf: ARRAY[1..50] OF SMC_GEOINFO; ). The value may be predefined, but may then be modified during a reset only. eMode SMC_SMOOTHPATHMODE SP_SPLINE3 Determines which kind of spline is used for smoothing. It is recommended to use SMC_SMOOTHPATHMODE.SP_SPLINE5_MIN_CURVATURE . bSymmetricalDistances BOOL TRUE If bSymmetricalDistances is set, the cut distance is limited to half the length of the shorter element. Otherwise the cut distance defined in the D word is used. bImprovedSymmetricCuts BOOL If bSymmetricalDistances is set, the first element is cut at most in half. If the option bImprovedSymmetricCuts is set, this limitation is lifted. In some cases this results in a better smoothing. Only has an effect if bSymmetricalDistances is set. It is recommended to set this input to TRUE if bSymmetricalDistances is set. eAddAxMode SMC_SMOOTHPATHADDAXMODE SPAA_LATE The way how additional axis are treated. If SMC_SmoothMerge is used, this parameter should be set to mode SPAA_EXACT . dMinimumCurvatureRadius LREAL If a spline, that would be inserted in a edge, contains a position where its curvature radius is less than this parameter, this edge is not smoothed. In this situation no spline is inserted, but the original path is maintained and a stop is executed in the edge. bCheckCurvature BOOL If TRUE , it is checked if the curvature of adjacent elements is equal. If this is not the case, the path will be smoothed. dRelativeCurvatureTol LREAL 0.001 The maximum allowed relative difference in the curvature. Only used if bCheckCurvature is TRUE . bCheckAddAxVelJump BOOL If TRUE the axis A, B and C are checked for velocity jumps. Should be set if SMC_SmoothMerge is used. dMaxAddAxVelDifference LREAL The maximum allowed velocity jump [units/sec]. This input is evaluated if bCheckAddAxVelJump is TRUE . Recommended: maxAcceleration * taskCycleTime Output bDone BOOL This output will be set to TRUE as soon as the input data from poqDataIn has been processed completely. Thereafter, the module will not perform any further actions until it gets reset. If input bExecute is FALSE , bDone will be reset to FALSE . bBusy BOOL TRUE , while execution of function block is not finished bError BOOL Signals, that an error has occurred within the function block wErrorID SMC_ERROR Error identification poqDataOut POINTER TO SMC_OUTQUEUE The output path queue udiStopsDueToCurvatureRadius UDINT Number of edges that could not be smoothed because of the dMinimumCurvatureRadius setting Structure: SMC_DoBeforeLeave (Action) SMC_SmoothPathInit (Action)
SMC_ToolCorr (FB) ¶ FUNCTION_BLOCK SMC_ToolCorr This function block is replaced by SMC_ToolRadiusCorr . SMC_ToolCorr creates a shifted path. In the shifted path each point has a defined distance to the original point (tool radius correction). A typical application is the milling of a programmed contour with a milling drill of a certain diameter. In order to compensate the radius of the drill, the milling drill must follow a shifted path. Note The shifted path may contain self-intersections or loops That would mean that the desired contour would be destroyed during passing the shifted path. (See the example below.) To avoid such intersections, use SMC_AvoidLoop . Proceeding of SMC_ToolCorr All SMC_GEOINFO objects found in the Input SMC_OUTQUEUE structure will be checked one after the other. If Bit1 (Bit2) of the variable Intern_Mark is set in one of these objects, then starting from there – in direction of motion - the path will be shifted to the left (right) by the currently set tool radius. In order to get a continuous path the input eMode have to set on one the desired mode: TC_RAMP_IN : this mode is used to ramp into the offset path, which means that the start position stays unchanged, but the end position is offset. All further objects are offset as well until the tool radius correction is switched off by setting Bit0 of Intern_Mark . Then, the start position of the object is still offset, but the end position is the original one. TC_BLIND_POS : this mode is used for insetting a positioning object (SMC_GEOINFO.iMoveType = 100), resp. if such a positioning object is already preceding the object. It will be shifted directly to the start point of the shifted path. Each further object will then be offset as well, until Bit0 of Intern_Mark gets set, what will stop the tool radius correction. A further positioning object will be inserted. SMC_NCDecoder will set these bits in reaction on the instructions G41/G42/G40. In other words: The tool radius correction will be done for all objects located between the instructions G41 and G40 resp. G42 and G40. Example 1: Simple tool correction G-Code: N0 G0 X10 Y-10 F10 E100 E-100 N1 G41 D10 N2 G1 X20 Y-10 N2 G1 X30 Y-10 CNC path without tool correction: CNC path with tool correction, eMode=TC_BLIND_POS: Example 2: Tool correction with eMode=TC_BLIND_POS G-Code N000 G41 D1 (WRK an) N010 G00 X3 F100 E1000 E-1000 N020 G01 X5 Y10 N030 G01 X7 Y10 N040 G01 X10 Y0 N050 G00 X20 N060 G40 (WRK off) In the example above the element in sentence N010 ramps in the shifted path. The element in sentence N050 is used for ramping out. The following figure shows the CNC path with tool correction and eMode=TC_BLIND_POS : It is highly recommended, that the first and last element in the parenthesis is a positioning element (G0). If this is not the case, the first move is to the original starting point of the object, and the next move is to the offset start point. Example 3: Tool correction with eMode=TC_RAMP_IN G-Code % G-code RampIn and Rampout in radius correction N0 G0 X10.0 Y-15.0 F10.0 E100 E-100.0 N1 G41 D10.0 N2 G1 X20.0 Y-15.0 (RampIn) N3 G1 X30.0 Y-15 N4 G40 N5 G1 X40.0 Y-15.0 (RampOut) Condition for RampIn and RampOut is a linear movement (G1 in sentence N1 and sentence N5). The following figure shows the CNC path with radius correction eMode=TC_RAMP_IN : Example 4: Tool correction with eMode=TC_RAMP_IN G-Code N000 G41 D3 (WRK an) N010 G01 X3 Y10 F100 E1000 E-1000 N020 G01 X7 Y10 N030 G01 X10 Y0 N040 G40 (WRK off) N050 G01 X20 In the example above the element in sentence N010 ramps in the shifted path. The element in sentence N050 is used for ramping out. Note the first element inside the G41/G40 parenthesis is used for ramping in and the next is used for ramping out and must be a line (G01). Example 5: Milling a contour with a milling drill moved in Z-direction G-Code (First section) N000 G41 D1 (WRK on) F100 E1000 E-1000 N010 G00 X3 N020 G01 Z10 N030 G01 X5 Y10 (Beginning of the milling contour) N040 G01 X7 Y10 N050 G01 X10 Y0 (End of the milling contour) N060 G01 Z0 N070 G40 (WRK off) N080 G00 X20 (Second section) N080 G42 D1 (WRK on) N090 G00 X23 N100 G01 Z10 N110 G01 X25 Y10 N120 G01 X27 Y10 N130 G01 X30 Y0 N140 G01 Z0 N150 G40 (WRK off) N160 G00 X40 The example above shows the using of the tool radius correction (WRK) together with the cutter positioning in Z-direction. The mode is set to BLIND_POS . The first element in the G41/G42-G40 parenthesis is to be a positioning to the start point of the contour. The next step is the positioning of the shaping tool in Z. Then the contour starts. At last the Z-axis is positioned off the workpiece and the tool radius correction is turned off. The second section of the example shows a tool radius correction in another direction. The following figure shows the milling CNC path along the Z-axis: InOut: Scope Name Type Initial Comment Input bExecute BOOL Starts on rising edge. bAbort BOOL If TRUE , the current processing of this function block is aborted bAppend BOOL As long as this input remains FALSE , the DataOutQueue will be cleared at each reset. As long as it remains TRUE , newly incoming data will be written to the end of the DataOutQueue. poqDataIn POINTER TO SMC_OUTQUEUE The input path queue. dToolRadius LREAL This variable contains the value, which – added to the current ToolRadius of the SMC_GEOINFO object – will determine the tool radius by which the path is to be shifted (see above). This value can be modified online. Thus it is possible to predefine the value offline (by the SMC_GEOINFO structure) and to modulate it online. Note that a tool radius correction that gets initiated during a shift of the block will cause the abort of the path correction and therefore should be avoided! But it is possible to do the radius correction during a reset or within a phase guaranteeing that the module is not currently shifting a block ( Status = TC_ORIG ). Default-Value: 0. nSizeOutQueue UDINT This variable contains the size of the data buffer, the list of SMC_GEOINFO structure objects will be written to. This buffer must be at least five times as big as a SMC_GEOINFO structure itself. Otherwise, SMC_NCDecoder will not execute any actions at all. Its size may be predefined, but may be modified later only during a reset. It is recommended to create the buffer as described by the example below. ExampleBuf: Array[1..50] of SMC_GeoInfo . The correct buffer size will then be retrieved by use of the operator sizeof(ExampleBuf) . pbyBufferOutQueue POINTER TO ARRAY [0..0] OF SMC_GEOINFO This input must point to the first byte of the memory area that is allocated for the SMC_OUTQUEUE structure. This area must be at least as big as defined in nSizeOutQueue . Typically the allocation of the memory buffer is done in the declaration part of the IEC-program by defining an array of SMC_GEOINFO (for example BUF: ARRAY[1..50] OF SMC_GEOINFO; for a buffer that can store 50 path elements). The value may be predefined, but may be modified later on only during a reset. eMode SMC_TOOLCORRMODE TC_RAMP_IN Mode that defines the transition between offset and non- offset path. Output bDone BOOL This variable is be set to TRUE as soon as the input path has been processed completely. The function block does not perform any further actions until it gets a reset. bBusy BOOL TRUE , while execution of function block is not finished bError BOOL Signals, that an error has occurred within the function block wErrorID SMC_ERROR Error identification poqDataOut POINTER TO SMC_OUTQUEUE This variable points to the SMC_OUTQUEUE structure that manages the decoded SMC_GEOINFO objects. iStatus SMC_TC_STATUS TC_ORIG Shows the current status of the module. TC_ORIG (0): No tool radius correction at the object. TC_RIGHT (1): Shift objects to the right. TC_LEFT (2): Shift objects to the left. TC_END (4): Processing of the objects is terminated. Structure: SMC_DoBeforeLeave (Action) SMC_ToolCorrInit (Action)
SMC_ToolLengthCorr (FB) ¶ FUNCTION_BLOCK SMC_ToolLengthCorr This function block compensates the tool length offset (e.g. of a drill, commanded with G43 ) relative to the tool holder flange. In other words, it creates a shifted path by substracting the given tool length offset vector adToolLength from the machine’s flange to the TCP from the set position pi , taking into account its current orientation. The orientation of the flange’s coordinate system given by piIn.dA , piIn.dB , piIn.dC gets interpreted according to eOriConv . The following illustration shows a drill mounted to the flange with offset. Note, that in this common example the tool length points into negative z-direction. With bForwardTrafo set to FALSE (default) this function block is intented to be used between SMC_Interpolator and a backward transformation: V flange = V TCP - R ABC * V tool With bForwardTrafo set to TRUE this function block can also be used with a forward transformation: V TCP = V flange + R ABC * V tool Note This function block does not perform a tool radius correction. Furthermore the tool length should not be changed while a tool radius correction is active, since this would lead to a jump in the path. Note If the tool length correction creates a path shifted in a 3D direction without having activated 3D mode, SMC_NCDecoder signals error SMC_SMB_ONLY_3DMODE . InOut: Scope Name Type Initial Comment Inout Const pi SMC_PosInfo The set position as calculated by SMC_Interpolator . The orientation A/B/C of the tool is epxected in degrees. adToolLength ARRAY [0..2] OF LREAL The tool lenght offset vector V tool from flange V:sub:’flange’to TCP V:sub:’TCP’. Input eOriConv SMC_ORI_CONVENTION SMC_ORI_CONVENTION.ZYZ Defines the way the orientation piIn.dA , piIn.dB , piIn.dC is interpreted. If the value is SMC_ORI_CONVENTION.ADDAXES, then no tool length correction will be performed. bForwardTrafo BOOL FALSE If TRUE, the calculated set position piOut is the input of the forward transformation instead of the backward transformation Output piOut SMC_PosInfo