dpTypeCreate()

The function creates a new data point type.

Synopsis

int dpTypeCreate(dyn_dyn_string elements, dyn_dyn_int types);

Parameters

Parameter Meaning
elements Name of data point types. For valid characters or to check the data point type names, refer to the nameCheck() function.
types Type of data point element (for example, same structure as DPT, see below)

Return Value

In the event of an error -1, 0 if everything is OK

Errors

Errors can be queried with getLastError(). An error message is issued in the event of incorrect data types or missing arguments!

Description

The function dpTypeCreate() creates a data point type of the indicated type with the respective data types. References are integrated into a data type with the respective name and type number 41 (reference).

Example

Data point type with elements:

Table : describes the above DPT

valve
defaults
regratio
returns
faults
id
text
states
endpos_open
motor_running
endpos_closed
regratio

Use the WinCC OA constants (see DPE data types).

Table : the respective data types.

structure, (DPEL_STRUCT)
structure (DPEL_STRUCT)
float (DPEL_FLOAT)
structure (DPEL_STRUCT)
structure (DPEL_STRUCT)
bit32 (DPEL_32)
string (DPEL_STRING)
structure (DPEL_STRUCT)
bool (DPEL_BOOL)
bool (DPEL_BOOL)
bool (DPEL_BOOL)
float (DPEL_FLOAT)

Example

Create the above DPT with following CTRL script:


main()
{
  int n;
  dyn_dyn_string xxdepes;
  dyn_dyn_int xxdepei;
  // Create the data type
  xxdepes[1] = makeDynString ("valve","","","");
  xxdepes[2] = makeDynString ("","defaults","","");
  xxdepes[3] = makeDynString ("","","regratio","");
  xxdepes[4] = makeDynString ("","returns","","");
  xxdepes[5] = makeDynString ("","","faults","");
  xxdepes[6] = makeDynString ("","","","id");
  xxdepes[7] = makeDynString ("","","","text");
  xxdepes[8] = makeDynString ("","","states","");
  xxdepes[9] = makeDynString ("","","","endpos_open");
  xxdepes[10] = makeDynString ("","","","motor_running");
  xxdepes[11] = makeDynString ("","","","endpos_closed");
  xxdepes[12] = makeDynString ("","","regratio","");
  xxdepei[1] = makeDynInt (DPEL_STRUCT);
  xxdepei[2] = makeDynInt (0,DPEL_STRUCT);
  xxdepei[3] = makeDynInt (0,0,DPEL_FLOAT);
  xxdepei[4] = makeDynInt (0,DPEL_STRUCT);
  xxdepei[5] = makeDynInt (0,0,DPEL_STRUCT);
  xxdepei[6] = makeDynInt (0,0,0,DPEL_BIT32);
  xxdepei[7] = makeDynInt (0,0,0,DPEL_STRING);
  xxdepei[8] = makeDynInt (0,0,DPEL_STRUCT);
  xxdepei[9] = makeDynInt (0,0,0,DPEL_BOOL);
  xxdepei[10] = makeDynInt (0,0,0,DPEL_BOOL);
  xxdepei[11] = makeDynInt (0,0,0,DPEL_BOOL);
  xxdepei[12] = makeDynInt (0,0,DPEL_FLOAT);
  // Create the data point type
  n = dpTypeCreate(xxdepes,xxdepei);
  DebugN ("valve data point type created, result: ",n);
}

Example

Create the above DPT with some type references:

main()
{
  int n;
  dyn_dyn_string xxdepes;
  dyn_dyn_int xxdepei;
  //create data type
  xxdepes[1] = makeDynString ("valve","","","");
  xxdepes[2] = makeDynString ("","defaults","","");
  xxdepes[3] = makeDynString ("","","regratio","");
  xxdepes[4] = makeDynString ("","returns","","");
  xxdepes[5] = makeDynString ("","","faults","");
  xxdepes[6] = makeDynString ("","","","id");
  xxdepes[7] = makeDynString ("","","","text");
  xxdepes[8] = makeDynString ("","","states","");
  xxdepes[9] = makeDynString ("","","","endpos_open");
  xxdepes[10] = makeDynString ("","","","motor_running");
  xxdepes[11] = makeDynString ("","","","endpos_closed");
  // paste type reference of type "ExampleDP_Float" for DPE
  "regratio"
  xxdepes[12] = makeDynString
  ("","","regratio","ExampleDP_Float","");
  xxdepei[1] = makeDynInt (DPEL_STRUCT);
  xxdepei[2] = makeDynInt (0,DPEL_STRUCT);
  xxdepei[3] = makeDynInt (0,0,DPEL_FLOAT);
  xxdepei[4] = makeDynInt (0,DPEL_STRUCT);
  xxdepei[5] = makeDynInt (0,0,DPEL_STRUCT);
  xxdepei[6] = makeDynInt (0,0,0,DPEL_BIT32);
  xxdepei[7] = makeDynInt (0,0,0,DPEL_STRING);
  xxdepei[8] = makeDynInt (0,0,DPEL_STRUCT);
  xxdepei[9] = makeDynInt (0,0,0,DPEL_BOOL);
  xxdepei[10] = makeDynInt (0,0,0,DPEL_BOOL);
  xxdepei[11] = makeDynInt (0,0,0,DPEL_BOOL);
  // paste type reference
  xxdepei[12] = makeDynInt (0,0,DPEL_TYPEREF);
  //create data point type
  n = dpTypeCreate(xxdepes,xxdepei);
  DebugN ("valve data point type created, result: ",n);
}

Assignment

Data point functions, waiting Control functions

Availability

UI, CTRL