../pvss.htm menu.gif basics.gif

dpTypeChange()

The function changes data point types.

Synopsis

int dpTypeChange(dyn_dyn_string names, dyn_dyn_int types [, dyn_string elementNames]);

Parameters

Parameter

Meaning

names

Name of data point elements

types

Types of data point elements (must have the same structure as its DPT, see below)

elementName

For renaming elements. Therefore you have to write the path of the element that you want to rename. The structure is like this:

 

elementName = makeDynString(elementPathOld1, elementName1[, elementPathOld2, elementName2,...] )

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 type names or missing arguments.

Description

The function dpTypeChange() changes a DPT into the indicated type with the appropriate data types. With defining a path you can change an existing data point element without a new given ID.

IconExample

Data point type with elements:

DPTventil.gif

Table: Display of the above DPT

valve

 

 

 

 

defaults

 

 

 

 

regratio

 

 

returns

 

 

 

 

faults

 

 

 

 

id

 

 

 

text

 

 

states

 

 

 

 

endpos_open

 

 

 

motor_running

 

 

 

endpos_closed

 

 

regratio

 

Data types: Use the WinCC OA constants (see DPE 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)

 

IconExample

Change the data type of the data point element "regratio" (cf. data point type above) from float to int.

 

main()

 

 

 // Create the data type

int n;

dyn_dyn_string xxdepes;

dyn_dyn_int xxdepei;

 

//Erstellen des Datentypen

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_INT);

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_INT);

 // Create the data point type

n = dpTypeChange (xxdepes,xxdepei);

DebugN ("valve data point type changed, result: ",n);

}

IconExample

Changing the name of a data point element

 

main()

{

dyn_dyn_string names;

dyn_dyn_int types;

dyn_string elementNames;

 

names[1][1] = "valve";

elementNames = makeDynString( "valve.defaults.regratio", "regratio_renamed", "valve.defaults", "defaults_renamed");

 

dpTypeChange(names, types, elementNames);

}

 

Relates to

Data point functions, waiting Control functions

Availability

UI, CTRL, DP, W

See also

    dpTypeCreate(), dpTypeDelete(), dpGetDpTypeRefs(), dpGetRefsToDpType()

Top Of Page

 

V 3.11

Copyright ETM professional control GmbH 2013 All Rights Reserved