UAHADataValue

This function block acts as a data object. An instance represents a value for the OPC UA Historical Access function. A whole field of these values is transferred to the UA_HistoryUpdate function block on calling.

Syntax

aDataValues : ARRAY [1..50] OF UAHADataValue(ValueSize:=SIZEOF(LREAL));

Each data object is initialized with the expected size (in bytes) of the value.

UAHADataValue 1: Properties

Name

Type

Access

Initial value

Description

Value

PVOID

Set

-

Specifies the address of a variable containing the desired value. This is usually assigned with the help of the operator ADR(). The value itself is hereby assigned at the same time and copied into the data object.

StatusCode

UAHAUpdateStatusCode

Get, Set

UAHAUpdateStatusCode.HistorianRaw

Indicates the status code of the value.

SourceTimeStamp

ULINT

Get, Set

0

Indicates the timestamp of the source in UTC format. This can be determined with the help of the function F_GetSystemTime (Tc2_System PLC library).

ServerTimeStamp

ULINT

Get, Set

0

Indicates the timestamp of the OPC UA Server in UTC format. This function is not currently supported.

UAHADataValue 2:

Data type size of the value

The size of the data type used is already indicated and thus defined in the declaration of the data object. This size is taken as the basis when assigning a value later.

Values of the type STRING are accordingly also saved and transmitted with a fixed initialized size. An indication of the current text length cannot be made.

Sample

{attribute 'OPC.UA.DA' := '1'}
fMyValue    : LREAL;       // Variable for HistorcalAccess
aDataValues : ARRAY [1..50] OF UAHADataValue(ValueSize:=SIZEOF(LREAL));
fMyValue := 27.75;
aDataValues[1].Value           := ADR(fMyValue);
aDataValues[1].StatusCode      := UAHAUpdateStatusCode.HistorianRaw;
aDataValues[1].SourceTimeStamp := F_GetSystemTime();

In this sample a field of 50 values is defined, of which each is represented by a data object. The current content of the variable fMyValue (= 27.75) is assigned to the first value.

The field can now be filled by means of further assignments in subsequent PLC cycles.

Requirements

Development environment

Target platform

PLC libraries to include

TwinCAT 3.1 >= 4024.1

Win32, Win64, WinCE-x86

Tc3_PLCopen_OpcUa

>= v3.1.9.0