fwConfigs  8.4.2
fwDpFunction DPE Connection

Modules

 fwDpFunction common functions and variables
 

Files

file  fwDpFunction.ctl
 

Utility functions

Used to access the configuration object attributes (object of type dyn_anytype).

 fwDpFunction_objectCreateDpeConnection (dyn_mixed &functionObject, dyn_string functionParams, dyn_string functionGlobals, string functionDefinition, dyn_string &exceptionInfo, bool runChecks=true)
 
 fwDpFunction_objectExtractDpeConnection (dyn_mixed functionObject, dyn_string &functionParams, dyn_string &functionGlobals, string &functionDefinition, dyn_string &exceptionInfo)
 
bool fwDpFunction_objectIsDpeConnection (dyn_mixed functionObject)
 

Detailed Description

Define dpFunctions of type dpe Connection. Please refer also to fwDpFunction common functions and variables. For type statistical, refer to fwDpFunction Statistical.

Use Examples

The fwDpFunctions library makes use of a configuration object. In order to configure a dpe with a dp function, the configuration setting object must be previously initialized with the dp function parameterization (using utility functions). Such object is then passed to the set function that will make the necessary dpSet.

Setting a dp function of type dpe connection

A function of type DPE Connection can be set in the following way: one should declare a configuration object of type dyn_anytype, then fill it with the dpFunction settings using the function fwDpFunction_objectCreateDpeConnection(), then set the setting to the dpe using the function fwDpFunction_objectSet().

Example:

dyn_string exc;
string dpe;
//func object containing one dpfunc set
dyn_mixed dpFuncObject;
//dp func parameters
dyn_string functionParams;
dyn_string functionGlobals;
string functionDefinition;
//dp function setting:
//parameters p1, p2
dynAppend(functionParams,"sys1:dp1.val2:_original.._value");
dynAppend(functionParams,"sys1:dp1.val3:_original.._value");
//global parameters g1, g2
dynAppend(functionGlobals,"sys1:dp1.val4:_original.._value");
dynAppend(functionGlobals,"sys1:dp1.val5:_original.._value");
//the function definition using the parameters
functionDefinition = "p1+p2+g1+g2";
//create the func object
functionParams,
functionGlobals,
functionDefinition,
exc);
//dpe where to set the dp function
dpe = "sys1:dp1.val";
//set the func object to the dpe
fwDpFunction_objectSet(dpe, dpFuncObject, exc, true);

Getting a dp function of type dpe connection

A function of type DPE Connection can be retrieved from a dpe in the following way: one should declare a configuration object of type dyn_anytype, then fill it with the dpFunction settings from the dpe using the function fwDpFunction_objectGet(), then extract the settings from the configuration object using the function fwDpFunction_objectExtractDpeConnection().. Before extracting the settings, it is possible to check that the settings are really of type dpeConnection (function fwDpFunction_objectIsDpeConnection()).

Example:

dyn_string exc;
string dpe;
dyn_mixed dpFuncObject;
dyn_string functionParams;
dyn_string functionGlobals;
string functionDefinition;
bool configExists;
//dpe containing the dp function
dpe = "sys1:dpe1.val";
//get the dp function, store it to the dp function settings object
fwDpFunction_objectGet(dpe, configExists, dpFuncObject, exc);
//extract the statistical function settings, if it exists
functionParams,
functionGlobals,
functionDefinition,
exc);
DebugN( "fwDpFunction_objectGet():",
functionParams,
functionGlobals,
functionDefinition,
exc);

Setting many dp functions of type dpe connection

Functions of type DPE Connection can be set in batch in the following way: one should declare a configuration object of type dyn_anytype (dpFuncObject). This object will be contained in an array of object (one object per dpe), of type dyn_anytype (call it dpFuncObjects). Each dpFuncObject then must be filled with the function fwDpFunction_objectCreateDpeConnection(), and stored into the array of objects dpFuncObjects. The array of objects is then passed together with the array of dpes to the function fwDpFunction_objectSetMany().

Example: set 2 dp configs into 2 dpes:

dyn_string exc, dpe;
//func object containing one dpfunc set
dyn_mixed dpFuncObject;
//this contains all the func objects
dyn_mixed dpFuncObjects;
//dp func parameters
dyn_string functionParams;
dyn_string functionGlobals;
string functionDefinition;
//dp function settings for dpe1:
//parameters p1, p2
dynAppend(functionParams,"sys1:dp1.val2:_original.._value");
dynAppend(functionParams,"sys1:dp1.val3:_original.._value");
//global parameters g1, g2
dynAppend(functionGlobals,"sys1:dp1.val4:_original.._value");
dynAppend(functionGlobals,"sys1:dp1.val5:_original.._value");
//the function definition using the parameters
functionDefinition = "p1+p2+g1+g2";
//create the func object
functionParams,
functionGlobals,
functionDefinition,
exc);
//add the first func object to the objects array
dpFuncObjects[1] = dpFuncObject;
//dp function settings for dpe2:
//clear temp parameters
dynClear(functionParams);
dynClear(functionGlobals);
dynClear(statTypes);
//parameters p1, p2
dynAppend(functionParams,"sys1:dp2.float2:_original.._value");
dynAppend(functionParams,"sys1:dp2.float3:_original.._value");
//global parameters g1, g2
dynAppend(functionGlobals,"sys1:dp2.float4:_original.._value");
dynAppend(functionGlobals,"sys1:dp2.int1:_original.._value");
//the function definition using the parameters
functionDefinition = "p1+p2/(g1-g2)";
//create the func object
functionParams,
functionGlobals,
functionDefinition,
exc);
//add the second func object to the objects array
dpFuncObjects[2] = dpFuncObject;
//list of dpes where to set the dp function
dpe = makeDynString("sys1:dp1.val", "sys1:dp2.val");
//set the func object array to the dpe array
fwDpFunction_objectSetMany(dpe, dpFuncObjects, exc, true);

It is also possible to set many dpes with the same dp function settings. In this case, the array of settings objects must contain one only object, at the index 1.

Getting many dp functions of type dpe connection

Functions of type DPE Connection can be retrieved in batch. This is more performing than looping into the dpes with the function fwDpFunction_objectGet(). It can be done in the following way: one should declare a configuration object of type dyn_anytype (dpFuncObject). This object will be contained in an array of object (one object per dpe), of type dyn_anytype (call it dpFuncObjects). The array of objects dpFuncObjects then must be filled with the function fwDpFunction_objectGetMany(). The array is the accessed in a loop, getting each element dpFuncObject inside dpFunctionObject. The parameters can be then accessed using fwDpFunction_objectEctractDpeConnection().

Example: get 2 dp configs into 2 dpes:

dyn_string exc;
dyn_string dpe;
dyn_mixed dpFuncObjects;
int i;
dyn_string functionParams;
dyn_string functionGlobals;
string functionDefinition;
dyn_bool configExists;
//list of dpes
makeDynString("sys1:dpe1.val","sys1:dpe2.val");
fwDpFunction_objectGetMany(dpe, configExists, dpFuncObjects, exc);
for(i=1 ; i<=dynlen(dpe) ; i++)
{
fwDpFunction_objectExtractDpeConnection(dpFuncObjects[i], functionParams, functionGlobals, functionDefinition, exc);
DebugN( "fwDpFunction_objectGetMany():", dpe[i],
functionParams, functionGlobals, functionDefinition, exc);
}

Function Documentation

fwDpFunction_objectCreateDpeConnection ( dyn_mixed &  functionObject,
dyn_string  functionParams,
dyn_string  functionGlobals,
string  functionDefinition,
dyn_string &  exceptionInfo,
bool  runChecks = true 
)

Configures the dp function object with dpe connection parameters See fwDpFunction_objectSet() for an example.

Constraints
It supports only dpe function functions (no statistical).
Usage
Public
PVSS managers
VISION, CTRL
Parameters
functionObjectThis object will contain the dp function parameters.
functionParamsThe list of dp elements to be used as parameters in the dp function. The # of elements must be = to the # of elements in fwDpFunction_OBJ_STAT_TYPE.
functionGlobalsThe list of dp elements to be used as globals in the dp function
functionDefinitionThe dp function is given here (in terms of p's (parameters) and g's (globals))
exceptionInfoDetails of any exceptions are returned here
runChecksPerform some consistency checks. Optional. Default value = true (recommended)
See Also
fwDpFunction_objectSet(), fwDpFunction_objectSetMany(), fwDpFunction_objectCreateStatistical()
fwDpFunction_objectExtractDpeConnection ( dyn_mixed  functionObject,
dyn_string &  functionParams,
dyn_string &  functionGlobals,
string &  functionDefinition,
dyn_string &  exceptionInfo 
)

Reads the dp function object

Constraints
It supports only dpe connection functions. For statistical funcitons see fwDpFunction_objectExtractStatistical()
Usage
Public
PVSS managers
VISION, CTRL
Parameters
functionObjectThis object will contain the dp function parameters.
functionParamsThe list of dp elements to be used as parameters in the dp function.
functionGlobalsThe list of dp elements to be used as globals in the dp function
functionDefinitionThe dp function is given here (in terms of p's (parameters) and g's (globals))
exceptionInfoDetails of any exceptions are returned here
bool fwDpFunction_objectIsDpeConnection ( dyn_mixed  functionObject)

Check wether the configuration object contains dpe connection function.

Constraints
None
Usage
Public
PVSS managers
VISION, CTRL
Parameters
functionObjectThis object containing the dp function parameters.
Returns
true if dp function is of type dpe connection, false else.