dpGet()

Reads values of datapoint attributes in variables.

Synopsis

int dpGet(string dp1 | dyn_string dp1, <type1> &var1 [, string dp2, <type2> &var2,...]);

Parameter

Parameter Meaning
dp1, dp2, ...

datapoint attributes to be read.

Note:

Do not use datapoints of different systems! The function dpGet only works for one system. If the dpGet is used for at least two systems, it does not work and the following error message is shown:

WCCOAui (1), 2006.09.26 14:11:19.266, PARAM,SEVERE, 175, this request cannot address more than one system, DP: dist_789:ExampleDP_Arg1.:_original.._value WCCOAui (1), 2006.09.26 14:11:19.266, CTRL, WARNING, 76, Invalid argument in function,
var1, var2, ... variables to be written.
Note:
dp1 is a list of datapoint elements, the variable type1 type has to be dyn_anytype!

Return Value

If the function was successfully executed, it returns 0 and in the event of a failure -1. The return value 0 only indicates that the message was correctly sent to Event Manager.

Error

Independently of the return value, errors can be retrieved with getLastError() (nonexistent data points, missing arguments or no read permission).

Description

The function dpGet() writes the values of the datapoint attributes dp1, dp2, ... to the variables var1, var2, ... of the appropriate type.

Querying attributes of the datapoint config:

With the help of the function dpGet() attributes of the config can be queried for an existing datapoint element (cf. dpSet()). The tables with the various Control constants can be found in the appendix.

  • dpGet checks whether a DPE exists but not if a config exists.

  • Please consider that, with increased number of value pairs, a quadratic decrease of the functions performance will occur.

If no definition for a config or attribute exists, the following defaults are used and added internal:

Function Default
dpSet*() _original.._value
dpGet() _online.._value
dpGetAsynch() _offline.._value
dpGetPeriod() _offline.._value
dpConnect() _online.._value
dpDisconnect() _online.._value

If you use a dpGet() on another system (not the local) and the dist connection does not exist, the dpGet returns 0 (OK). This also applies when you execute a dpGet without read permission for the queried datapoint. Query the error by using getLastError(). GetLastError() returns the following error message: "Message could not be sent, DP: System1:ap.:_original.._value, MAN: (SYS: 1 Dist -num 1 CONN: 1), Could not send message DP_MSG_SIMPLE_REQUEST #326"

_alert_hdl attributes which can be queried via dpGet()

You can use dpGet to see if a config exists by querying the _type attribute which contains all configs of the DP. A return value of 0 indicates that the config does not exist. Any other value than 0 indicates that the config exists (see example below).

Following example checks whether the DP ExampleDP_Arg1.:_default.._type config exists or not.

 main()
{
  int rc, x;
  rc=dpGet("ExampleDP_Arg1.:_default.._type", x);
  DebugN(rc, x); /*The return value of x is either 0 if the config does not exist or another value if it exists */
}
main()
{
  dpGet("Valve17.opening:_online.._value", x);
}

Assignment

Datapoint functions, waiting Control functions

Availability

UI, CTRL