rnd_trip

Purpose:

Hard-wire an analog output (ao) on eblox or snapio to a analog input (ai) for eblox or snapio and record how long it takes after the ao change to see the value on the ai channel. It can also be used with other variables instead of just ai and ao by having 2 variables linked in some way. Additionally, it can be used to detect how long it takes a change for a single variable.

Enter:

To compare the ai channel to the ao channel example:

rnd_trip <ai_chan> <ao_chan> [p=priority] [t=interval] [c=count] [a=increment] [l=limit] [r=range] [s=scale] [i=initial] [f=file_name] [d] [v]

OR

check for any change of a single variable example:

rnd_trip <ai_chan> – [p=priority] [t=interval] [c=count] [d=debug] [v]

Where:

ai_chan

Required. Specify the ai_chan to read.

ao_chan

Required. Specify the ao_chan to set.

p

Optional. Specify the priority. The default is 13.

t

Optional. Specify the frequency in milliseconds to check for a change:  t=[val] in ms.  The default is 50 miliseconds.

c

Optional. Specify how may loops to perform until count changes have occurred: c=[val]. The default is 1000.

a

Optional.  Specify how many times to increment the ao chan by this amount a=[val]. The default is 1000.

l

Optional. Specify the limit that when reached, resets ao to 0: l=[val]. The default is 10000.

r

Optional. Specify the acceptable range to achieve: r=[val]. The default is 500.

s

Optional. Specify an amount to scale the that scales the ai_chan (or first argument): s=[val]. The default is 1.

i

Optional. Specify  an initial output value: i=[val]. The default is 0.

file_name

Optional. Specify the output filename. The file will be placed in the /tmp/.

d

Optional. Specify this option to display additional debug information. The default is to suppress additional information.

v

Optional. Specify this option to suppress additional information at the end of the program. The default is to display additional information.

Example:

rnd_trip i_snap_ch3ao_16p=10t=10c=10000l=5000r=250
This tests the speed between the variables ai_snap_ch3 and ao_16. ao_16 is what gets set, then ai_snap_ch3 is connected and changes its value based on ao_16. The ratio between ai_snap_ch3 and ao_16 is 1 to 1. So when ao_16 is 10000, ai_snap_ch3 is 10000, The 2 values are checked if they are equal every 10 milliseconds because we set t=10. If ai_snap_ch3 is within +/- 250 of ao_16, it is considered a match.

ao_16 is at 2000 and ai_snap_ch3 is at 1800, this would be considered a match. Once the two values have been matched, ao_16 has it value increased by the increment value. Using the above example, once we get the match, ao_16 would be set to 3000 since we are using the default value of 1000. Once ao_16 is greater than the limit, it is set back to the original value. Once ao_16 reaches 6000, it is set to 0 since we are using the default for init. Once we have reached 10000 matches, we report how how long it took.

rnd_trip ai_snap_ch3 ao_16 p=10 t=20 a=5000 l=10000 r=500 i=5000 s=.1
This tests the speed between the variables ai_snap_ch3 and ao_16. ao_16 is what gets set, then ai_snap_ch3 is connected and changes its value based on ao_16. The ratio between ai_snap_ch3 and ao_16 is 10 to 1. So when ao_16 is 1000, ai_snap_ch3 is 10000, we need to adjust ai_snap_ch3 so that the  the ratio is 1 to 1. We do this by using the scale option with [s]. This would take the ai_snap_ch3 value and multiple it by .1. So if ai_snap_ch3 was equal to 10000, it will be read as 1000. he 2 values will be checked if they are equal every 20 milliseconds because we set t=20. If ai_snap_ch3 is within +/- 500 of ao_16, it is considered a match.

ao_16 is at 5000 and ai_snap_ch3 is at 5400; this would be considered a match. Once the two values have been matched, ao_16 has its value increased by the increment value. Using the above example, once we get the match, ao_16 is set to 10000, since we are using a=5000. Once ao_16 would be greater than the limit l=10000, it is set back to the original value.

Once ao_16 reaches 15000, it is set to 5000, since we are using i=5000. Once we have reached 10000 matches, we report how how long it took.

Notes:

How to use:
Once started, it will automatically set the ao_chan and check the ai_chan every [interval]. The ao_chan and ai_chan must be within a certain [range] before it is accepted that it has reached the value. Ex: if I had a range of 500 and my ao_chan was set for 10000, then the ai_chan must be between 9500 and 10500 before it will set the new ao_chan value. You may need to [scale] the ai_chan if the ratio between the ai_chan and ao_chan are not 1 to 1, then you would need to set [scale] to so that their ratios are the same. Each time the criteria has been met, ao_chan has its current value increased by [increment] until the [limit] is reached. Once the limit is reached, the ao_chan is set to the [initial] value. Once the ai_chan and ao_chan match up [count] times, the application will output data and statistics about the time waiting.

NOTE: The identifier and the ‘=’ are required on the command line. The d option is required to turn ON debugging. The v option is required to turn OFF Verbose.

See Also: