VGEN (FB)

The 'VGEN' function block is a velocity generator.
The output value is a position setpoint which changes in proportion with the velocity. It is also possible to output a defined number of increments.

The following functions are supported:

 

Abbildung 23: VGEN: Block diagram

User interface

Input variables

Name

Type

Description

boEnable

BOOL

Enable signal: With a positive edge, the initialisation of the block starts.

As long as 'boEnable' = TRUE, the block remains enabled and is processed by the PLC.

In the state 'boEnable' = FALSE the block is no longer enabled and is thus no longer processed.

boControl

BOOL

Start / Stop

Range

Meaning

enMode = VGEN_CONT

FALSE Velocity = 0
TRUE Velocity = 'diVelocity'

enMode = VGEN_CYCLE

FALSE -> TRUE Velocity = 'diVelocity'
for a series of 'udModPos' increments

enMode

ENUM

EN_VGEN_MODE

Selection mode of the operating mode

Default

VGEN_CONT

Range

Meaning

VGEN_CONT

Continuous increment increase,
as long as 'boControl' = TRUE

VGEN_CYCLE

Increment increase by the defined value 'udModPos' on a positive edge at 'boControl'

diVelocity

DINT

Setpoint velocity

Definition of the final velocity

Range

-300000000 ... 300000000

Unit

incr/s

Default

1000

udModPos

UDINT

Modulo position

Number of increments to be output in mode 'enMode' = VGEN_CYCLE

Unit

incr

Default

2000

siOverride

SINT

Velocity output factor

Range

-100 ... +100

Unit

%

Default

100

Output variables

Name

Type

Description

boEnabAck

BOOL

Acknowledgement: Function block is initialised and enabled

boErr

BOOL

The function block is in an error state

FALSE

No error (permitted commanding or warning)

TRUE

Error

iErrID

INT

Error identity number: Diagnostic number is output

iErrID = 0

No error

iErrID ≠ 0

boErr = TRUE

Error

iErrID ≠ 0

boErr = FALSE

Warning

Warning

Range

Meaning

1

Illegal mode

Error

Range

Meaning

1

Illegal setpoint velocity
(limited to minimum or maximum value)

2

Illegal override
(limited to minimum or maximum value)

boSetVel

BOOL

When 'boSetVel' is active, the target velocity has been reached.

diOutVal

DINT

Output value

Input and output variables

Name

Type

Description

stDevice

STRUCT

The device description structure assigns the block a device.

Description

Abbildung 24: VGEN: Principle of operation

'enMode' is used to differentiate between continuous and cyclic operation.