**Radio-SkyPipe Help**

Equations are entered on the Equation Set Up panel. For a good example of equations applied to convert to degrees Kelvin equivalent antenna temperature see Jim Brown's example at the NJ3BRO observatory.

**Variables**

You can define one letter variables. A=10 or B=SQR(2) for example. These can then be used in your subsequent equations. Be careful not to use the reserved variables below.
Watch your capitalization. Equations are parsed at semicolons, so you can add them to the front of the equation like:

A=sin(35); B=12; B*A*X

Note that the equal signs are used only in the variable definitions. There is no need to use then in the main equation as it is assumed that the result of the equation will be placed in the sample data for that channel.
*Do not place a semicolon after the equation portion of the entry!*

Each channel may have it's own separate equation associated with it. However, because it is possible to map the equations as data sources for any of the channels, there is almost totally
flexibility in how the equations are applied. You need to keep in mind though that the equation associated with channel 1 will be executed before the equation for channel 2 and that the equation mapped to channel 2 is executed before that of channel 3, etc. This can greatly affect your final results if you are referencing data in another channel. All equations are invoked after normal data collection occurs in each channel (ADC, Sound Card, etc). If a channel has an equation as it's data source nothing happens at this stage for that channel. Before the data is charted the program then checks to see if there is an equation that needs to be applied to it. These are applied (as mentioned above) from Channel 1 to the highest active channel. After all equations have been applied, the data is charted.

**Reserved Variables**

X = the data for the current channel prior to equation application. If you were using an ADC, for example, this would be the value retrieved from the ADC channel that is mapped to this strip chart channel.
Using the equation X*3 would multiply the data received by the device on this
channel by 3.

Z1, Z2, Z3,...Z8 = current data from other channels. So for example channel 3's equation could refer to the current data in channel 1 and channel 2 : (X+Z1*Z2 )/1000 which would multiply together channel 1 and channel 2 current data, add this value to its own current data and finally divide the result by 1000 for display.

ZC[n] where C is a channel 1-8 (Z1, Z2, etc) and n is an integer number representing an offset from the current data sample. Example:

Z2[-1] = data in the strip chart from channel 2 that was collected one sample into the past.

Z3[-35] = data in strip chart channel 3 that was collected 35 samples ago.

Z6[0] = Not Valid in live application of equations because the strip chart will not yet have been updated yet for the current sample when the equation is applied, however, this would be valid for application to saved strip chart data as a post collection process.

Z4[30] = peeks ahead in the chart 30 samples in channel 4. Valid only as a post collection process.

If you are using offset variables like these, note that if an offset refers to a sample number less than the first sample collected, the equation cannot be applied. The same is true for post collection processing where the equation may be peeking ahead to a sample number that does not exist. This can have strange results at the beginning and end of the chart where these situations are more likely to occur.

TDay = the decimal part of the day based on the current time logging of SkyPipe. Example: 06:00:00 = 0.25

TSDay = decimal days since the start of the observation.

Snum = current sample number.

**Operators**

+ = Add

- = Subtract

/ = Divided By

* = Multiply by

% or mod = Modulus

^ = To the power of - *Enclose negative powers in parentheses such as
2^(-3.1).*

( ) parentheses used for defining operands of functions and operation order

Numbers should be expressed in full decimal notation. Do not use
scientific notation.

**IF THEN ELSE**

You may
use an IF THEN ELSE statement to operate on data conditionally. The
"IF" clause is in the form of a comparison or logical operation of two
values. ( IF A>B or IF B=C for example). The IF clause is
evaluated as either true or false. When the IF clause evaluates to true
the THEN clause is evaluated. A false IF statement causes the optional
ELSE clause to be evaluated. Within the THEN and ELSE clauses you can
imagine an "X=" preceding the contents. This fits with the
functional form of all other types of equations. So **THEN{X*3.14} **
has the meaning X=X*3.14. Below are two examples:

**IF{[Z1]>[Z2]};
THEN{X-Z1}; ELSE{X-Z2}** : Here if the data in channel 1 is
greater than the data in channel 2 then subtract channel 1 data from this
channels (always represented by X) data. If Z1 is not greater than Z2 then
subtract Z2 from this channels data.

**IF{[X]=[0]};
THEN{1000} ** :Whenever the current channel's data
input is zero change it to 1000. There is no ELSE statement used in this
example. If X is not equal to zero then X is plotted without modification.

Note
the format is very strict. Parts of the IF THEN ELSE statement are
separated by semicolons. Curly brackets are used to enclose the values and
no space should appear between the IF, THEN, or ELSE and the leading curly
bracket. The two values to be compared in the IF clause must each be
encased in square brackets **[ ].** .The following comparisons and operations
are valid for the IF statement:

- > Greater than.
- < Less than.
- <> Greater or less than. (Same as not equal to.)
- >= Greater than or equal to.
- <= Less than or equal to.
- = Equal to.
- OR Logical OR operation.
- AND Logical AND operation.
- XOR Logical exclusive or operation.

**Common**

fix(X) = The difference between Int and Fix is that if number is negative, Int returns the first negative integer less than or equal to number, whereas Fix returns the first negative integer greater than or equal to number. For example, Int converts -8.4 to -9, and Fix converts -8.4 to -8.

int(X) = Integer or whole number portion of X

min(X,Y) returns the lesser of X or Y

max(X,Y) returns the greater of X or Y

Sgn(X) returns an integer depending on the sign of X : -1 for X<0 ; 0 for X=0 ; 1 for X>0

Sqr(X) square root of X

**
Randomization**

Rnd(X) non-integer random number <=X

random(X,Y)= (Rnd * (Y - X)) + X

rand(X) = Int(Rnd * X)

**
Log Functions**

log or ln = Log(X) natural log!!! not base 10!

logn(X,Y)= log base Y of X

log10(X) = log base 10

log2(X) = Log base2

exp(X) = e raised to power X - If the value of X exceeds 709.782712893, an error occurs.

**
Trigonometric Functions**

deg(X) convert radians to degrees

rad(X) convert degrees to radians

atn(X) or arctan(X)

tan(X)

cos(X)

sin(X)

sec(X)

cosec(X)

cotan(X)

arcsin(X)

arccos(X)

arcsec(X)

raccosec(X)

arccotan(X)

sinh(X)

cosh (X)

tanh (X)

sech (X)

cosech (X)

cotanh (X)

arcsinh(X)

arccosh(X)

arctanh(X)

arcsech(X)

arccosech(X)

arccotanh(X)

**
constants **

pi=3.14159...

e = 2.718281828