Project

General

Profile

TIMEAV

TIMEAV is the Java Open Access Client (OAC) process which provides time-averaged device values. You can view log files for TIMEAV in the directory 'daesrv\\engines\files\oac'.

Usage

The expression directing the averaging consists of a string with five fields, separated by the '|' (pipe) character.

deviceName | sampleEvent | computeEvent | maxPoints | calcDirection

The fields are:

  1. deviceName - the name of the device to average
  2. sampleEvent - event on which to sample deviceName's reading
  3. computeEvent - event on which to calculate the average of the samples collected since the last computeEvent
  4. maxPoints - maximum number of points to go into an average
  5. calcDirection - whether to output difference of means rather than means or a sum instead of average

If maxPoints is specified and no computeEvent was specified (you can enter the string "null" for computeEvent), then at every point after maxPoints we update the output value (a sliding boxcar average). If both maxPoints and computeEvent were specified, then we just make sure that at most maxPoints (the most recent maxPoints) go into the total average, and the output average is only calculated upon computeEvent occurring. If no maxPoints was specified, then we keep accumulating samples until the computeEvent occurs, at which point the output average is calculated and set.

Events are specified with the syntax of the Data Request Format: Event Format. Its Clock Event and Periodic Event specifications are the ones most commonly used here. For example:

  • M:BLOW | p,2000,true | p,10000,true | 0 | diff
  • M:TOR109 | e,81,s,10 | e,00,s,0 | 0 | sum |

An oddity of the parsing: If you only specify the first three fields, you can NOT have a trailing '|'. In other words, this will work:

  • M:BLOW | p,2000,true | p,10000,true

This won't:

  • M:BLOW | p,2000,true | p,10000,true |

If you have some mistake in your TIMEAV expression and the OAC is restarted using that bad equation, you should see a DAE_INVALID_SETTING error for the device with the bad equation.

calcDirection

Average

If calcDirection is not specified or "null", then at every computeEvent, we calculate the mean.

There are two kinds of averaging that this supports:
  • Running averages - These have no computeEvent specified. A queue of length maxPoints is maintained and the average is re-calculated after each sample.
  • Fixed period average - All the points are collected between computeEvents at the specified sampleEvent. At the next computeEvent, the average is computed and the buffer of samples is reset.

Difference

If calcDirection is "diff", then at every computeEvent, we calculate the mean and subtract from it the mean calculated at the previous computeEvent, and output the difference.

Summation

If calcDirection is "sum", then at every computeEvent, we don't take an average, we just output the accumulated sum. If the first three fields are supplied, the last two are not required.

Lifetime

If calcDirection is "life", then at every computeEvent we perform a lifetime calculation.

The end goal is to calculate a value tau = T/(ln (Xi/Xf)) where tau is some device assigned to this OAC Xi is some initial reading of a parameter Xf is a later reading of the same parameter T is the time between the readings. This actually solves for tau in the equation Xf = Xi exp(-T/tau).

Other requirements: X can be an array device, in which case tau also is an array device and the calculation is repeated for each element of the array. (This Array part of things hasn't been implemented yet.) T, the time between calculations should be a settable parameter. The time window T is sliding, not a jumping box. I.e., if T is 10 seconds and we are reading X every second, we calculate tau every second using the current sample and the one 10 seconds back. After a reset (t-To < T), the lifetime is calculated over the smaller interval t-To. The time T is specified with the "Max number of points" part of the "equation" T will be the maxPoints times the sampleEvent interval.

Lifetime for electrons

This calculation doesn't work with increasing values so when calculating electron lifetime we multiply by -1 to make this work. The "nlife" calcdirection will make this work.

Standard deviation

If calcDirection is "sd", then at every computeEvent we perform a standard deviation calculation.

The sampleEvent should be less or equal to the rate of the deviceName readings. Otherwise, the readings will be over-sampled and give an inaccurate result.

Restarting

TIMEAV is restarted when its DAE is restarted.

Giving a reset command to the device U:O58RST causes TIMEAV to stop all its calculation jobs (calculating the expression for each Timeav device), and relaunch each device with its latest expression. U:O58RST is spelled with letter-O, five, eight.

Each Timeav device should be constructed with Control and Status properties. The Control should have a Reset command, which causes the Timeav OAC to stop the old data collection for that device and restart it with the latest expression. The Status property isn't terribly useful, but is necessary as an oddity of the OAC architecture that requires the Status to be present for Control to work.

Node

DCE10