2 sm_drivebasic.lib and automatic code generation, 1 mathematical auxiliary blocks, Sm_drivebasic.lib and automatic code generation – Lenze PLC Designer PLC-Designer (R2-x) SoftMotion User Manual

Page 26: Mathematical auxiliary blocks, L-force | plc designer - softmotion

Advertising
background image

L-force | PLC Designer - SoftMotion

The SoftMotion drive interface

SM_DriveBasic.lib and automatic code generation

26

L

DMS 5.2 EN 03/2011 TD17

3.2

SM_DriveBasic.lib and automatic code generation

If the SM_DriveBasic.lib library is integrated into the IEC1131 application in the »PLC

Designer«, structure objects which the IEC program can access are created automatically

from the drive image that has been entered in the control configuration using the

corresponding parameters. (For this see also

Variables of the AXIS_REF structure

( 56)

and

The structure of LenzeECS_AXIS_REF

( 50)

.)

In the IEC1131 application furthermore the manufacturer-specific library that matches the

control system used has to be integrated with the name <BusInterfaceName>Drive.lib. It

supports the hardware-specific drive interface function. The BusInterface designation

results from the entry selected in the control configuration in the module parameters of

the bus interface at 'InterfaceType' The left part to the first space character of its string

designation provides the name (example: "CAN (Peak)" => "CAN" => manufacturer-

specific library is called: "CANDrive.lib").
When the application is started, the implicit call of the functions

<BusInterfaceName>DriveExecute_Start and <BusInterfaceName>DriveInit at the task

start and <BusInterfaceName>DriveExecute_End at the task end provides for the

transmission and maintenance of the AXIS_REF structure variables. In case that errors

occur during the initialisation of the drives, the global variable g_strBootupError contains

an error description generated by the <BusInterfaceName>Drive.lib library.
In addition to its main function, the representation of the drives within the IEC program,

the SM_DriveBasic.lib library contains some auxiliary blocks.

3.2.1

Mathematical auxiliary blocks

The SMC_sgn function returns the sign value of the input, i. e. -1 for a negative, +1 for a

positive, and 0 for a zero entry.
The SMC_fmod function calculates the modulo value of the input x to the period m. The

return value is always in the interval [0, m].
The SMC_atan2 function calculates and returns the angle which solves the following

equations:

In contrast to the common ATAN function the value range here covers the complete

interval [0; 2π].

sin( ) * f = sine and cos( ) * f = cosine

Advertising