kernelv_ch_get_variable_value()

Prototype

[ret, data, var]

ch_get_variable_value(vnck: ctypes.CDLL,
chan_index: int,
variable_name: str)

Description

Reads a variable out of the CNC kernel. Currently, the following variable types can be read.

Type

Example

External variables

V.E.VAR_1

Global variables, see (1)

V.G.CNC_RELEASE

Axis-specific variables

V.A.+SWE.X

Program global, self-defined variables

V.P.VAR_1

Cross-program, self-defined variables

V.S.VAR_1

Program non-global, self-defined variables

V.L.VAR_1

Currently, it is not possible to read Type V.G.WZ[]. variables.

The variable to be read is identified on the basis of its name and the channel index.

The complete name (including the V.E. prefix and the array index in the case of array variables) must be specified as the name.

Example: "V.E.VAR_FLOAT_ARRAY[3]"

The value is returned in the structure KERNELV_VARIABLE * var.

An error code is returned if an error occurred while reading the variables.

Parameter

Name

Type

Meaning

vnck

ctypes.CDLL

Instance of the loaded KernelV DLL.

chan_index

int (unsigned)

Channel index

variable_name

str

Name of the variable to be read.

Return values

Name

Type

Meaning

ret

KERNELV_RETURN

Return value of the native integrated C function.

data

Any

Returns the value of the variable in the corresponding data format.

var

KERNELV_VARIABLE

Returns variable.

KERNELV_RETURN

Symbol

Value

Meaning

RET_FINISHED

0

The function was executed without error.

ERR_INVALID_CHAN

-1

The transferred channel index is higher than the number of configured channels -1.

ERR_CNC_NOT_INIT

-3

The simulation CNC kernel was not yet initialised.

ERR_CNC_RET_MEMORY

-4

The return value(s) does/do not fit into the memory provided.

ERR_INTERNAL_ERROR

-11

An internal error has occurred in the DLL.

ERR_UNKNOWN_VARIABLE

-12

The variable name is not known in the CNC kernel.

ERR_VARIABLE_SYNTAX

-13

The variable name is syntactically incorrect, e.g. no closing bracket in the case of an array variable.

ERR_VAR_NAME_LENGTH

-18

The variable name passed on to the function exceeds the maximum permissible length (KERNELV_VAR_NAME_LENGTH).

ERR_ARRAY_NOT_SUPPORTED

-21

With many CNC real-time variants, an array can be read ‘en block’ by omitting the array index on access. The kernelv DLL does not currently support this access type.