Hi,
I have some doubts about using Dynamic Calculator Adapter. How we can write a expressionText? Or VariableList? And the other parameters.
Best Regards,
Aleixo
Hi,
I have some doubts about using Dynamic Calculator Adapter. How we can write a expressionText? Or VariableList? And the other parameters.
Best Regards,
Aleixo
Hi Aleixo,
The ExpressionText defines the calculation to be performed in order to calculate the data for the output signal. The VariableList defines the input measurements as well as their aliases which will be used in the expression text.
The following example defines PPA:1 and PPA:2 as input signals, defines aliases x and y to refer to the two input signals respectively, and then specifies the data for the output signal will be the sum of these two input signals.
VariableList={x = PPA:1; y = PPA:2};
ExpressionText=x+y
Because there will be an output signal, you will need to create a new measurement and configure the adapter appropriately using the OutputMeasurements parameter. Also, the input data is time-aligned using openPDC’s concentration engine in order to ensure that calculations are performed on data during the same timeslice. Thus, you will need to define the FramesPerSecond, LagTime, and LeadTime appropriately based on the concentration rules defined by the engine.
Here is a more complete example I dug up from an old CodePlex discussion.
VariableList={frq=PPA:3860;slp=PPA:4223};
ExpressionText=If(ABS(frq - 60.0) < 0.01, 0.0, ABS((((frq - 60.0) * (360.0/30)) - slp)/((frq - 60.0) * (360.0/30))));
FramesPerSecond=1
LagTime=20
LeadTime=3
OutputMeasurements=PPA:4339
Finally, there is actually a new mode of operation for the dynamic calculator which executes the calculation expression without concentration. The results of using it in this mode of operation may be spurious and undesirable so I would generally not recommend it. However, it can be a good way to set up the dynamic calculator if the data source for all your input measurements is already concentrated. You can also set it up on a timer if you need to make the calculation interval slower or more predictable. These parameters are controlled using the UseLatestValues and CalculationInterval settings.
The following adjusts the previous example to run the calculation every five seconds without concentration.
VariableList={frq=PPA:3860;slp=PPA:4223};
ExpressionText=If(ABS(frq - 60.0) < 0.01, 0.0, ABS((((frq - 60.0) * (360.0/30)) - slp)/((frq - 60.0) * (360.0/30))));
UseLatestValues=True;
CalculationInterval=5;
OutputMeasurements=PPA:4339
Note also that the measurements in the VariableList must be referenced using either their signal ID (GUID) or their measurement key (as shown). OutputMeasurements is a standard filter expression.
Thanks,
Stephen