Image Acquisition

This group contains function blocks for acquiring images with Vision devices (GigE Vision cameras and File Source objects).

Function blocks

General

The function blocks in this group represent a proxy for the Image Provider TcCOM objects. Accordingly, they need not be called cyclically. Instead, the TcCOM object is controlled via the methods of the function block.

State machine

All function blocks for image acquisition include a state machine to manage the state of the represented device. Essentially, a function block must be placed in the ACQUIRING state in order to receive images continuously. The INITIAL state represents the starting point, after a restart or reset, from which the INITIALIZING can be triggered. From the OPENED state, the communication channel to the device is open in order, for example, to read or write register values.

Image Acquisition 1:

All states are represented by the enum ETcVnCameraState and are explained below:

Main states

The main states are stationary states. They essentially indicate whether there is a connection to a Vision device (OPENED), whether the device is capturing images (ACQUIRING) and whether there is an error with the connection to the device (ERROR). You can switch between these states with the methods of the FBs. As a rule, the transition between two main states does not take place immediately, but over at least one cycle. In this intermediate time, the Vision device is in an intermediate state.

State

Description

ERROR

Error state from which every device can only be reactivated by calling the method Reset.

INITIAL

Initial state of each device.

INITIALIZED

Similar to INITIAL, where the camera was manually initialized (e.g. with Force-IP and the initialization commands)

OPENED

There is a connection to the camera, individual images can be triggered and camera registers can be read and written.

This state can be skipped with the method StartAcquisition.

ACQUIRING

Device is in the acquisition state and is sending images depending on the settings.

Intermediate states

The intermediate states are necessary as most actions cannot be completed immediately (e.g. image acquisition). If the function blocks are in one of these intermediate states, the respective method must be called again in order to complete the transition to the respective main state.

State

Description

INITIALIZING

INITIAL > INITIALIZED

OPENING

INITIAL > OPENED and INITIALIZED > OPENED

STARTACQUISITION

OPENED > ACQUIRING.

STOPACQUISITION

ACQUIRING > OPENED

RESETTINGFEATURES

OPENED > OPENED

TRIGGERING

OPENED > OPENED and ACQUIRING > ACQUIRING

CLOSING

OPENED > INITIALIZED

Image Acquisition 2:

Methods must be called in intermediate states!

A respective method for state transitions must also be called in the intermediate states. The state transition is only complete and the method no longer needs to be called when a stationary state is detected using the GetState method after a corresponding method call. Triggering a method once and subsequently waiting does not result in the desired state transition.

A state machine in the PLC can then be implemented either with a CASE … OF structure or with a IF … ELSIF … structure.

Samples