dpCreate()
Creates a data point.
Synopsis
int dpCreate(string dpname, string dptype [, int sysnum, unsigned
dpNo]]);
Parameters
Parameter | Meaning |
---|---|
dpname | Name of the data point to be created |
dptype | Type of data point to be created |
sysnum | When creating a data point on a remote system in a distributed system, this parameter must contain the system number. |
dpNo | The ID of the data point. If a data point with the given ID already exists, a random ID is chosen. |
Return Value
dpCreate() returns 0 on success and -1 on failure. In some cases the function returns 0 (success) but due to e.g.: name clashes the DP could not be created. This can be queried using getLastError().
Errors
Errors can be retrieved with getLastError(). This includes incorrect or missing arguments.
Description
The function dpCreate() create s a data point with the name dpname of the data point type dptype. The specified data point type must already exist. If a data point with the specified name already exists, the call of the function dpCreate() has no effect. dpCreate() is a waiting function, it waits until the DP has been created.
Refer to nameCheck() for not permitted characters in data point names.
Example
Creating the data point number_1 of the data point type ExampleDP_Int. If the data point already exists, a message is issued. Furthermore a data point named TestDP of the data point type PUMP1 is created on the system with number 2.
main()
{
if (dpExists("number_1")) DebugN("already exists");
else dpCreate("number_1","ExampleDP_Int"); // Create
dpCreate("TestDP", "PUMP1", 2); /*Create DP on the system with
number 2*/
}
Assignment
Data point function, Waiting Control function
Availability
UI, CTRL