Read / Write access
Access methods P-/AEP-parameters V.L/V.P/V.S-variables
In general, there are two different methods to access the variables. The first one concerns the P-parameters, AEP-parameters, V.L.-variables, V.P.-variables, and V.S.-variables. This group has four properties: number of available variables, the name read by index, the value read by index and the value read by name. The index starts at 0 and is always without gap, which means you can read the name of all variables over the index from 0 to count-1. Reading the value should always be done by name, because the index of a variable can change, e.g. in the case that a variable is deleted from the middle. This group of variables can only contain numbers, so the data type is always REAL64.
Access methods V.A/V.G-variables
To the second group belong the V.A.-variables and the V.G.-variables. A specific characteristic of these variables is, that the name consists of two parts - a static part and a dynamic part. The static part is transmitted when the name is read by index. The dynamic part is either an axis name from the concerning channel or an array index, rare but also possible is a combination of both. The axis name must be attached behind the variable name (static part), separated with a dot. In case of an array variable the maximum index is transmitted with the name. On access this maximum index must be replaced by the requested index
Example: Variable completed with axis name
V.A-variable: V.A.+SWE_MDS.X_AX
Static part: V.A.+SWE_MDS
Dynamic part: X_AX
Example (rare case): Array access+ Variable completed with axis name
V.G.-variable: V.G.NP[5].V.X_AX
Static part: V.G.NP[98].V
Dynamic part: X_AX
Completion with an axis name
A completion with an axis name must always be done at V.A.-variables. At V.G.-variables the property “V.G-node by index” declares, whether to add an axis name or not. An ais name is to add when the property has the value “V_AXIS_NAME”. To detect an array, you can only check the name if there is the character “[“ or “]” in it.
![]() | To check the actual number of axis in a channel you can use the following variable: |
Identifying the variables type
Further on, the type of a variable is free choose able. That means, in addition to the read process, like by P-Parameters, you must check the type, to read a value successfully. Both variable types (V.A. and V.G.) support write access. The property “Mode” defines the access right (read / write) of the variable. When you write on a variable, you must use a memory stream according to the S_WRITE_VAR_DATA structure.
V.E.-variables
Another type of variables are the V.E.-variables. According to their handling, these variables are a mixture of V.A.- / V.G.-variables und P-parameters. The V.E.-variables are NC-Program independent, so they can only be read by index. The type can be different from variable to variable, but the type cannot change during runtime (see [EXTV]). The reading must also be managed according to their type (like P-parameters). V.E.-variables can also be an array.