The Cmm language is an interpreted language based on a

advertisement
Cmm Introduction
The Cmm language is an interpreted language based on a streamlined version of “C”. It has a
simplified syntax that does not require pointers or declarations. The purpose of including the
interpreter in this software is to provide a mechanism for the user to automate correlator data
collection sequences. Typically, the user will execute a script that will automate a sequence such
as sweeping a goniometer through a list of pre-defined angles, stopping to collect correlation
functions along the way, which are saved to the database for future analysis.
To activate the interface for the Cmm scripting environment, choose Cmm from the Tools menu
option of the main menu. The interface to the scripting language consists of three windows. The
first window, titled Cmm 1 (Source Code), is a simple text editor. You may load programs into
this window from disk files or type source code directly into the window. You will not be able to
modify a program while it is running.
The next window, titled Cmm 1 (Output), is used to provide a place for printed output from your
program. This is often useful when the user is interested in inspecting the status of a data
collection sequence. The script may make use of the printf () function in order to provide a record
of the progress of a running program. The printed results may be copied into the clipboard and
pasted into a text editor to be saved as a file for a more permanent record. The Cmm output
window can hold approximately 30000 characters before it is full. When it is full then future
output will result in the loss of earlier printf () statements to make room for the new text.
The last window, titled Cmm 1, is used to control the program flow. You may Run the program
or Single Step through the code. You may also Pause the program and restart it or terminate
execution of the script by pressing End. This window will also indicate the Line number of the
script that is being executed while the script is running.
The reaminder of this manual is devided into four sections. The first section of this manual is for
people who are not familiar with the C language. If you are already comfortable with C
programming then you may wish skip to the section two, “Cmm vs. C”, which discusses the
differences between Cmm and C. Section three provides actual correlator control programming
examples. Section four covers additional commands in the scripting language that allow control
of the Dynamic Light Scattering Software interface from within user programs.
Section 1: Cmm
Cmm Comments
Any text on a line following two slash characters (//) is considered a comment and is ignored by
the Cmm interpreter. Likewise, anything between a slash-asterisk (/*) and an asterisk-slash (*/) is
a comment. Here are examples of comments:
// this is a comment line
/*
This is one big comment
block.
*/
Liquid = “Aqueous”; // This is another comment
Cmm primary data types
There are three basic data types in Cmm
Byte: A character (e.g., ‘A’, ‘B’, ‘C’, ‘D’) or a whole number between 0 and 255
Integer: A whole number value: this is the most common numeric data type (examples: 0, -100,
567)
Float: A floating point numbers; any number containing a decimal point (examples: 0.567,
3.14159, -5.456e-12)
Cmm determines the data type of a number by how it is used; for example in the following the
“1” on the first line is an integer because that is the default type for numbers without a decimal
point.
1
0
0x3EF2
-300
3.14
-3.45e-20
‘A’
‘\033’
// integer
// integer
// integer in hexadecimal format
// integer
//float
// float
// byte
// byte in octal format
Cmm Variables
A Cmm variable is a symbol that may be assigned data. Variables may be named within the
following guidelines.
variables names cannot start with a number
variable names may not include the following characters “+-<>&|=!*/%^~?:{};()[].’”’#”
variable names may not include imbedded spaces or tabs
The assignment of data to a Cmm variable is usually performed by the equal sign (=). The first
time a variable is used, its type is determined.
Count = 1;
Character = ‘A’;
Viscosity = 0.89;
// Count is an integer
// Character is a byte
// Viscosity is a float
After variables has been assigned, they can be treated as their data type. So after these statements:
Count2 = 1;
// assign Count2 as the integer 1
Count2 = Count2 + 2; // same as: Count2 = 1 + 2
Basic Arithmetic
=
assignment: sets a variable’s value
i = 2;
// i is 2
+
addition: adds two numbers
i = i + 3;
// i is now (2 + 3) or 5
-
subtraction: subtracts a number
i =i - 3;
// i is now (5-3) or 2 again
*
multiplication:
i =i * 5;
// i is now (2 * 5) or 10
/
division:
i= i / 3
%
// i is now (10/3) or 3 (no remainder)
remainder: remainder after division
i = 10;
i = i % 3;
// i is now (10%3) or 1
Assignment Arithmetic
Each of the above operators can be combined with the assignment operator (=) as a shortcut for
performing the operation with the first variable and then assigning the result to the first variable.
Using assignment arithmetic operators, the above code can be simplified as follows:
=
assignment: sets a variable’s value
i = 2;
// i is 2
+
addition: adds two numbers
i += 3;
// i is now (2 + 3) or 5
-
subtraction: subtracts a number
i -= 3;
// i is now (5-3) or 2 again
*
multiplication:
i *= 5;
// i is now (2 * 5) or 10
/
division:
i /= 3
%
// i is now (10/3) or 3 (no remainder)
remainder: remainder after division
i = 10;
i %= 3;
// i is now (10%3) or 1
Auto-Increment and Auto-Decrement (--)
Other arithmetic shortcuts are the auto-increment (++) and auto-decrement (--) operators. These
operators ass or subtract 1 (one) from the value to which they are applied. These operators can be
use before (prefix) or after (postfix) their variables. If used before, then the variable is altered
before it is used in the statement; if used after, then the variable is altered after it is used in the
statement. This is demonstrated by the following code sequence.
i = 4;
j = ++i;
// i is initialized to 4
// j is 5, i is 5 (i was incremented before use)
j = i ++;
// j is 5, i is 6 (i was incremented after use)
j = --i;
// j is 5, i is 5 (i was decremented before use)
j = i--;
// j is 5, i is 4 (i was decremented after use)
Arrays
An array is a group of individual data elements. Each individual item in the array is called an
array element. An element of an array is itself a variable, much like any other variable. Any
particular element of the array is selected by specifying the element’s offset in the array. This
offset is an integer in square brackets ([]). It is important to note that the first element is an array
is found at the 0th offset. For example:
prime [0] = 2;
prime [1] = 3;
prime [2] = 5;
month [0] = “January”;
month [1] = “February”;
month [2] = “March”;
An array in Cmm does not need to be pre-defined for size and data type, as it does in other
languages. Arrays can be initialized by initializing specific elements as in:
my_data [5]= 7;
my_data [2] = -100;
my_data [1] = 43;
or by enclosing all the initial statements in curly braces, which will cause the array to start
initializing at the element 0, as in:
angle_list = { 15.0, 45.0, 60.0, 45.0, 90.0};
Strings
Strings are arrays of bytes that end in a null-byte (zero). “String” is just a shorthand way to
specify this array of bytes. A string is most commonly specified by writing test within two quote
characters.
The statement:
my_string = “word”;
is equivalent to the statement:
my_string (‘w’, ‘o’, ‘r’, ‘d’);
In both cases, the value of my_string [0] is ‘w’, and at my_string [2] is ‘r’.
When one array is assigned to the other, as in:
string1 = “water”;
string2 = string1;
both variables define the same array and start at the same offset 0. In this case, if string1 [2] is
changed then you will find that string2 [2] has also been changed.
Integer addition and subtraction can also be performed on arrays. Array addition or subtraction
sets where the array is based. By altering the previous code to:
string1 = “water”;
string2 = string1 + 1;
string1 [2] refers to the same array element as string2 [1].
To demonstrate:
string1 = “cat”;
string2 = string1 + 1;
string2 [0] = ‘u’;
string2--;
// string1 [0] is ‘c’, string1 [1] is ‘a’
// string2 [0] is ‘a’, string2 [1] is ‘t’
// string2 [0] is ‘u’, string1 [1] is ‘u’
// string1 [0] is ‘c’, string2 [0] is ‘c’
printf () syntax
printf () prints to the Cmm output window, providing useful feedback from your program. The
basic syntax of printf () is:
printf (FormatString, data1, data2, data3,...);
FormatString is the string that will be printed on the screen. When FormatString contains a
percent character (%) followed by another character, then instead of printing those characters
printf () will print the next data item (data1, data2, data3,...). The way the data will be presented
is determined by the characters immediately following the percent sign (%). There are many such
data formats, but here are a few of the more common ones.
%%
%d
%x
%c
%f
%e
%s
prints a percentage sign
prints a decimal integer
prints a hexadecimal integer
prints a character
prints a floating point value
prints a floating point value in scientific format
prints a string
There are also special characters that cause unique screen behavior when they are printed, some
of which are:
\n
goto next line
\t
tab
\r
carriage-return
\”
print the quote character
\\
print a backslash
Here are some examples of printf () statements:
printf (“The variable count contains %d\r\n”, count);
printf (“a character = %c, an integer = %d, a float = %f\r\n”, ‘a’, 2, 4.26);
printf (“%d in hexadecimal is %x\r\n”,16, 16);
printf (“The suspension fluid is %s\r\n”, “aqueous”);
my_string = “aqueous”; // define a string to print
printf (“The suspension fluid is %s\r\n”, my_string);
Note that the Cmm output window requires both the \r and \n to advance to the beginning of the
next line. As previously stated, the Cmm output window can hold approximately 30000
characters before it is full. When it is full then future output will result in the loss of earlier printf
() statements to make room for the new text.
Logical Operators and Conditional Expressions
A conditional expression can be evaluated as TRUE or FALSE, where FALSE is represented by
zero, and TRUE means anything that is not FALSE (not zero). A variable or any other expression
by itself can be TRUE or FALSE (non-zero or zero). TRUE and FALSE are keywords defined as
part of the Cmm language. With logic operators, these expressions can be combined to make
complex TRUE/FALSE decisions.
The logic operators are:
!
NOT: opposite of decision
!TRUE
!FALSE
!(‘D’)
!(5-5)
&&
// FALSE
// TRUE
// FALSE
// TRUE
AND: TRUE if and only if both expressions are true
TRUE && FALSE // FALSE
TRUE && TRUE
// TRUE
0 && (x + 2)
// FALSE
!(5-5) && 4
// TRUE
||
OR: TRUE if either expression is true
TRUE || FALSE
// TRUE
TRUE || (4 + 2)
// TRUE
FALSE || (4 + 2)
// TRUE
FALSE || 0
// FALSE
0 || 0.345
// TRUE
0 || !(5 - 5)
// FALSE
==
EQUALITY: TRUE if both values are equal, else FALSE
5 == 5
// TRUE
5 == 6
// FALSE
!=
INEQUALITY: TRUE if both values not equal, else false
5 != 5
// FALSE
5 != 6
// TRUE
<
LESS THAN
5<5
5<6
// FALSE
// TRUE
GREATER THAN
5>5
5 > -1
// FALSE
// TRUE
>
<=
LESS THAN OR EQUAL TO
5 <= 5
// TRUE
5 <= 6
// TRUE
5 <= -1
// FALSE
>=
GREATER THAN OR EQUAL TO
5 >= 5
// TRUE
5 >= 6
// FALSE
5 >= -1
// TRUE
IF statement
The IF statement is the most commonly used mechanism for making decisions in a Cmm
program. It allows to test a condition and act on it. If an IF statement finds the condition you test
to be TRUE (not FALSE), the block or statement of Cmm code following it will be executed. The
format for the if statement is:
count = 0;
if (count < 10)
{
count++;
}
Because there is only one statement in the block of code following the IF statement, the example
above could also be written as:
count = 0;
if (count < 10)
count++;
ELSE statement
The Else statement is an extension of the if statement. It allow you to tell the program to do
something else if the condition in the if statement is FALSE. To make more complex decisions,
ELSE can be combined with IF to match one of a number of possible conditions. For example:
count = 0;
if (count < 10)
{
count++;
if (count < 5)
printf (“count < 5”);
if (count == 5)
printf (“count = 5”);
else
printf (“count > 5”);
}
WHILE statement
The WHILE is used to execute a particular section of Cmm code over and over again while the
condition being tested is found to be TRUE. The test statement is checked before every execution
of the Cmm code associated with the WHILE statement. If the test evaluates to FALSE,. the
Cmm program will continue after the block of code associated with the WHILE statement.
test_string = “WHO ARE YOU?”;
while ( test_string[0] != ‘A’)
{
printf (“%s\r\n”, test_string);
test_string++;
}
printf (“DONE\r\n”);
The output of the above code would be:
WHO ARE YOU?
HO ARE YOU?
O ARE YOU?
ARE YOU?
DONE
DO...WHILE
This is different form the WHILE statement in that the Cmm code block is executed at lease once,
before the test condition is checked.
number = 1;
do
{
number *= 5;
printf (“number = %d\r\n”, number);
} while (number < 100);
printf (“DONE\r\n”);
The output of the above code would be:
5
25
125
DONE
FOR statement
The FOR statement is a special looping statement. The FOR statement takes on the following
form:
for ( initialization; conditional; loop_expression)
statement
The initialization is performed first. Then the conditional is tested. If the conditional is TRUE
(or if there is no conditional expression) then statement is executed. Then the loop_expression is
executed, and so on back to the testing conditional. If the conditional is FALSE then statement is
not executed and the program continues beyond statement. The FOR statement is a shortcut for
this form of WHILE:
initialization;
while (conditional)
{
statement;
loop_expression;
}
The previous code demonstrating the WHILE statement could be rewritten this way if you used
the FOR statement:
for (test_string = “WHO ARE YOU?”; test_string[0] != ‘A’; test_string++)
printf (“%s\r\n”, test_string);
printf (“DONE\r\n”);
Conditional Operator ?:
The conditional operator is simply a useful shortcut. It is a limited variation or the If statement.
The syntax is:
test_expression ? expression_if_true : expression_if_false
First, test_expression is evaluated. If test_expression is non-zero (TRUE) the expression_if_true
is evaluated and the value of the entire expression is replaced by the value of expression_if_true.
If test_expression is FALSE, then expression_if_false is evaluated ant the value of the entire
expression is that of expression_if_false.
For example:
number = (5 < 6) ? 100 : 200; // number is set to 100
To see how the conditional operator is a shortcut, consider that this if/else code to get the
maximum of two numbers:
if (Num1 < Num2)
MaxNum = Num2;
else
MaxNum = Num1;
is equivalent to this conditional operator code:
MaxNum = (Num1 < Num2) ? Num2 : Num1;
Functions
A function takes a form such as this:
FunctionName (Parameter1, Parameter2, Parameter3)
{
statements...
return result;
}
where the function name is followed by a list of input parameters in parentheses.
A call is made to a function in this format:
returned_result = FunctionName (Value1, Vlaue2, Value3);
The return statement causes a function to return to the code that initially called the function. A
function may indicate more than one return statement. The return statement may also return a
value.
minimum (a, b)
{
if (a < b)
return a;
else
return b;
}
By default. parameters to functions are passed by reference. If a function alters the parameter
variable, then the variable in the calling function is altered as well. This function returns a value
(n * 2.5), and it changes the value of the input parameter (n).
test_func (n)
{
n *= 4.0;
return n * 2.5;
}
main ()
{
number1 = 3.0;
number2 = test_func (number1);
printf ( “number1 = %f, number2 = %f \r\n”, number1, number2);
}
The code above would result in output of:
number1 = 12.000000, number2 = 30.000000
Variable Scope
A variable in Cmm is either global or local. A global variable is any variable that is referenced
outside of any function, making it visible to all functions. A local variable is declared inside a
function and only has meaning within that function.
scope_test (n)
{
n *= 4;
n2 = 7; // local variable seen only in this function... not the same as n2 in main ()
n3 = n3 * 5; // global variable
}
n3 = 3; // global variable
main ()
{
n1 = 1; // local variable seen only in this function
n2 = 2; // local variable seen only in this function
printf ("n1 = %d, n2 = %d, n3 = %d\r\n", n1, n2, n3);
scope_test (n1);
printf ("n1 = %d, n2 = %d, n3 = %d\r\n", n1, n2, n3);
}
The printed results this program would be:
n1 = 1, n2 = 2, n3 = 3
n1 = 4, n2 = 2, n3 = 15
In the main () function the variable n1 is modified by the function scope_test (). The scope_test ()
function refers to the variable n1 from main () as n. When n is modified in the scope_test ()
function the modified value remains altered in the variable n1 of the main () function. The
variable n2 is defined and used in both the functions main () and scope_test (). These are different
local variables and both may contain different values. Notice that the value of n2 in main () is not
modified after the use of the local variable n2 in the scope_test (). The variable n3 is defined
outside any function and is seen as the same variable in all functions.
Section 2: Cmm vs. C
Case Sensitivity
Cmm is not case sensitive. This holds true for function and variable names.
Data Types
The only recognized data types are Float, Long, and Byte. The words “Float”, “Long” and “Byte”
do not appear in Cmm source code; instead, the data types are determined by context. For
instance 6 is a Long, 6.0 is a Float, and ‘6’ is a Byte. Byte is unsigned, and the other types are
signed.
Automatic Type Deceleration
There are no type declarators and no type casting. Types are determined from context. If the code
says “n = 6” then n is Long, unless a previous statement has indicated otherwise.
For instance, this C code:
int Max (int a, int b)
{
int result;
result = (a < b) ? b : a;
return result;
}
could become this Cmm code:
Max (a,b)
{
result = ( a < b) ? b : a;
return result;
}
Automatic Array Allocation
Arrays are dynamic. Any index (positive or negative) into an array is valid. If an element of an
array is referred to, then Cmm must see to it that such an element will exist. For instance if the
first statement in the Cmm source code is:
a [4] = 7;
then the Cmm interpreter will make an array of 5 integers referred to by the variable a. If a
statement further on refers to a[6] then the Cmm interpreter will expand a, if is has to, to ensure
that the element a[6] exists.
Literal Strings
A Cmm literal string is any byte array (string) appearing in source code within double quotes.
When comparing strings, if either side of the comparison operator is a literal string, then the
comparison is performed as if you were using strcmp (). If one or both vars are a literal string then
the following comparison operation translation is performed.
if (liquid == “aqueous”)
if (liquid < “aqueous)
if (“aqueous” > liquid)
// i.e. if (strcmp (liquid, “aqueous”) == 0)
// i.e. if (strcmp (liquid, “aqueous”) < 0)
// i.e. if (strcmp (“aqueous”, liquid) > 0)
In Cmm, this code:
liquid = “toluene”;
if (liquid == “toluene”)
printf (“The liquid is toluene.\r\n”);
would print “The liquid is toluene.”
Function Parameters and Literal Strings
When a literal string is a parameter to a function, then it is always passed as a copy. For example,
this code:
for (n = 0; n < 3; n++)
{
str = strcat (“dog” , “house”);
printf (“%s\r\n”, str);
}
results in this output:
doghouse
doghouse
doghouse
Return and Literal Strings
When a literal string is returned from a function with the return statement, then it is returned as a
copy of the string. This code:
dog ()
{
return “dog”;
}
for (n = 0; n < 3; n++)
{
str = strcat (dog (), “house”);
printf (“%s\r\n”, str);
}
results in this output:
doghouse
doghouse
doghouse
Switch/Case and Literal Strings
If either switch expression or the case expression or the case are a literal string, then the case
statement will match based on a string comparison (strcmp()) of the two variables. This may be
used in code such as:
switch (str)
{
case “add”:
DoTheAddThing ();
break;
case “remove”:
DoTheRemoveThing ();
break:
}
Structures
Structures are created dynamically, and there elements are not necessarily contiguous in memory.
This C code:
struct Point
{
int Row;
int Column;
};
struct Square
{
struct Point BottomLeft;
struct Point TopRight;
};
int AreaOfASquare (struct Square s)
{
int width, height;
width = s.TopRight.Column - s.BottomLeft.Column + 1;
height = s.TopRight.Row - s.BottomLeft.Row + 1;
return (width * height);
}
void main ()
{
struct Square sq;
int Area;
sq.BottomLeft.Row = 1;
sq.BottomLeft.Column = 15;
sq.TopRight.Row = 82;
sq.TopRight.Column = 120;
Area = AreaOfASquare (sq);
}
can be changed to the equivalent Cmm code simply by removing the declaration lines, resulting
in:
AreaOfASquare (s)
{
width = s.TopRight.Column - s.BottomLeft.Column + 1;
height = s.TopRight.Row - s.BottomLeft.Row + 1;
return (width * height);
}
main ()
{
sq.BottomLeft.Row = 1;
sq.BottomLeft.Column = 15;
sq.TopRight.Row = 82;
sq.TopRight.Column = 120;
Area = AreaOfASquare (sq);
}
Passing Variables By Reference
By default, LValues in Cmm are passed to functions by reference, so if the function alters a
variable, then the variable in the calling function is altered as well IF IT IS AN LVALUE. So
instead of this C code:
void CQuadruple (int *j)
{
*j *= 4;
}
main ()
{
CQuadruple (&i);
}
the Cmm code would be:
Quadruple (j)
{
j *= 4;
}
main ()
{
Quadruple (i);
}
If the circumstance arises that you want to pass a copy of an LValue to a function, instead of
passing the variable by reference, then you can use the “copy-of” operator “=“. foo (=i) can be
interpreted as saying “pass a value equal to i, but not i itself”; so that “foo (=i) ... foo (j) {j *=4;}”
would not change the value at i.
Note the following Cmm calls to Quadruple () would be valid, but no value will have changes
upon return from Quadruple () because an LValue is not being passed:
Quadruple (8);
Quadruple (i+1);
Quadruple (=1);
Data Pointers(*) and Addresses (&)
No pointers. None. The “*” symbol NEVER means “pointer” and the “&” symbol NEVER means
“address”. This may cause experienced C programmers some surprise, but it turns out to be
relatively insignificant for simple programs, after considering these two rules:
1) “*var” can be replaced by “var[0]”
2) variables are passed by reference
Initialization: Code external to functions
All code that is not inside any function block is interpreted before main () is called. So the
following Cmm code:
printf (“hey there “);
main ()
{
printf (“ho there “);
}
printf (“hi there “);
would print the output “hey there Hi there Ho there”);
Math Functions
abs Return the absolute value of an integer (non-negative).
asin Calculate the arc sin.
acos Calculate the arc cosine.
atan Calculate the arc tangent.
atan2 Calculate the arc tangent of a fraction.
atof Convert ascii string to a floating-point number.
atoi Convert ascii string to an integer.
atol Convert ascii string to an integer.
ceil Celing; round up.
cos Calculate the cosine.
cosh
exp
fabs
fmod
floor
labs
log
log10
max
min
pow
rand
max
min
pow
sin
sinh
sqrt
srand
sin
sinh
sqrt
tan
tanh
strod
strol
Calculate the hyperbolic cosine.
Compute the exponential function.
Absolute value.
Modulus; calculate remainder.
Round down.
Return absolute value of an integer (non-negative).
Calculate the natural logarithm.
Calculate the base-ten logarithm.
Return the largest of two values.
Return the minimum of two values.
Calculates x to the power of y
Generate a random number..
Return the largest of two values.
Return the minimum of two values.
Calculates x to the power of y
Calculate the sine.
Calculate the hyperbolic sine.
Calculate the square root.
Intitialze randonm
Calculate the sine.
Calculate the hyperbolic sine.
Calculate the square root.
Calculate the tangent.
Calculate the hyperbolic tangent.
Convert a string to a floating-point value.
Convert a string to an integer value.
Section 3: Correlator Control
The Cmm scripting language has been integrated into the dynamic light scattering software in
order to automate data acquisition. Generally it is recommended to use the normal program
interface to setup the correlator layout and measurement parameters. A program is then started to
automate multiple measurements. All of the BOLDFACE program statements are commands
that affect the correlator or program settings. They are keywords that have been added to the
language for your use. A simple example of a correlator control script is:
main ()
{
Clear (); // clear the correlator data
Start (); // start the correlator
do
{
} while (Running ()); // this loop waits until data collection is completed
Save (); // save the function to the database
}
The script will clear the correlator if any previous data is still in it. Then the correlator is started
and the script waits until the data collection is completed. The duration of the measurement is the
same duration that is indicated through the normal program interface.
A few simple modifications to this script will allow it to make multiple measurements and save
each one to the database. Note that the SetSampleId command is used to change the sample name
so that each measurement will be more easily recognized in the database.
main ()
{
runs = 3;
for (current_run = 0; current_run < runs; current_run++)
{
sprintf (SampleId, "My Sample - Run %d", current_run + 1);
SetSampleId (SampleId);
Clear (); // clear the correlator data
Start (); // start the correlator
do
{
} while (Running ()); // this loop waits until data collection is completed
Save (); // save the function to the database
}
}
It is often useful to stagger measurements in time. The following modifications will record the
start time a the current measurement, and then delay the start of the next measurement. The Cmm
interpreter allows monitoring of time with the clock () function. The clock () function returns a
processor and operating-system independent value for the clock (). This value is incremented
CLOCKS_PER_SEC times per second. Clock value starts at 0 when a Cmm program begins. The
SetMeasurementDuration ( seconds) correlator command is used to set the measurement duration
from within the script.
main ()
{
runs = 3;
run_delay = 5.0 *
// 5 minutes between each runs start time
60.0 *
// 60 seconds per minute
CLOCKS_PER_SEC;
run_duration_seconds = 2.0 *
// 2 minutes per run
60.0;
// 60 seconds per minute
// set the duration for data acquisition in seconds
SetMeasurementDuration (run_duration_seconds);
for (current_run = 0; current_run < runs; current_run++)
{
sprintf (SampleId, "My Sample - Run %d", current_run + 1);
SetSampleId (SampleId);
Clear (); // clear the correlator data
current_run_start_time = clock ();
next_run_start_time = current_run_start_time + run_delay.
Start (); // start the correlator
do
{
} while (Running ()); // this loop waits until data collection is completed
Save (); // save the function to the database
printf ( “ Saving %s\r\n”, SampleId); // print status to Cmm output window
// now wait until next run start time occurs
do
{
} while (clock () < next_run_start_time);
}
}
The next example is a short program that uses the goniometer to make measurements at multiple
angles.
do_measurement ()
{
Start (); // start the correlator
do
{
} while (Running());
Save (); // save data to database
Clear (); // clear the correlator
}
main ()
{
for (Angle = 60; Angle <= 120; Angle += 10)
{
SetGoniometerAngle (Angle); // move to next angle
do_measurement ();
}
}
A list of goniometer angles could be use if the main function was changed to:
main ()
{
angle_list = {15.00, 20.00, 30.00, 45.00, 60.00, 70.00, 80.00, 90.00};
angle_list_size = 8;
for (n = 0; n < angle_list_size; n++)
{
SetGoniometerAngle (angle_list [n]); // move to next angle in list
do_measurement ();
}
}
Section 3: Correlator Commands
**********************************************************************
* Function Name:
* Start()
*
* Description:
* Start current correlator function.
*
* Parameters:
* None
*
* Return Value:
* None
**********************************************************************
**********************************************************************
* Function Name:
* Stop()
*
* Description:
* Stop current correlator function.
*
* Parameters:
* None
*
* Return Value:
* None
**********************************************************************
**********************************************************************
* Function Name:
* Clear()
*
* Description:
* Clear current correlator function.
*
* Parameters:
* None
*
* Return Value:
* None
**********************************************************************
**********************************************************************
* Function Name:
* Running()
*
* Description:
* Checks to see if current function is collecting data.
*
* Parameters:
* None
*
* Return Value:
* TRUE/FALSE
*
**********************************************************************
**********************************************************************
* Function Name:
* RestoreDefaultConfiguration()
*
* Description:
* Closes all open windows and allocate a single correlator function and
* a single correlation function graph
*
* Parameters:
* None
*
* Return Value:
* None
*
**********************************************************************
**********************************************************************
* Function Name:
* GetFirstDelay()
*
* Description:
* Returns first delay for current function in micro seconds
*
* Parameters:
* None
*
* Return Value:
* See description.
**********************************************************************
**********************************************************************
* Function Name:
* GetLastDelay()
*
* Description:
* Returns first delay for current function in micro seconds
*
* Parameters:
* None
*
* Return Value:
* See description.
**********************************************************************
**********************************************************************
* Function Name:
* GetChannels()
*
* Description:
* Returns number of channels allocated to current function
*
* Parameters:
* None
*
* Return Value:
* See description.
**********************************************************************
**********************************************************************
* Function Name:
* GetChannelSpacing()
*
* Description:
* Returns channel spacing for current function
*
* Parameters:
* None
*
* Return Value:
* 0 = Linear
* 1 = Linear with offset
* 2 = Ratio
**********************************************************************
**********************************************************************
* Function Name:
* SetFirstDelay()
*
* Description:
* Request first delay in micro seconds for current function.
* Delay requested will be validated for legitimacy based on
* limits of circuits currently allocated to the function.
*
* Parameters:
* SetFirstDelay (Delay /* micro seconds */)
* Requested first delay in micro seconds.
*
* Return Value:
* First delay selected.
**********************************************************************
**********************************************************************
* Function Name:
* SetLastDelay()
*
* Description:
* Request last delay in micro seconds for current function.
* Delay requested will be validated for legitimacy based on
* limits of circuits currently allocated to the function.
*
* Parameters:
* SetLastDelay(Delay /* micro seconds */)
* Requested last delay in micro seconds.
*
* Return Value:
* Last delay selected.
**********************************************************************
**********************************************************************
* Function Name:
* SetChannels()
*
* Description:
* Request number of channels for current function.
* Delay requested will be validated for legitimacy based on
* limits of circuits currently allocated to the function.
*
* Parameters:
* Channels requested.
*
* Return Value:
* Channels selected.
**********************************************************************
**********************************************************************
* Function Name:
* SetChannelSpacing()
*
* Description:
* Request the correlator to use the current settings
* for First Delay, Last Delay and Channels to be spaced
* in the requested spacing.
*
* Parameters:
* SetChannelSpacing(Spacing)
* 0 = Linear
* 1 = Linear with offset
* 2 = Ratio
*
* Return Value:
* -1 = FAIL
* 0 = Linear
* 1 = Linear with offset
* 2 = Ratio
**********************************************************************
**********************************************************************
* Function Name:
* SetLayout()
*
* Description:
* Request the current function to be reconfigured to use
* parameters as described. Request will be serviced within the limits of the correlator
* hardware.
* User should query resulting layout using GetFirstDelay (), GetLastDelay () to
* determine actual layout that has been implemented.
*
* Parameters:
* SetLayout (FirstDelayRequested /* micro seconds */ ,
*
LastDelayRequested /* micro seconds */,
*
ChannelsRequested)
*
* Return Value:
* Channels selected.
**********************************************************************
**********************************************************************
* Function Name:
* SetExtendedChannels()
*
* Description:
* Request extended channels for current function.
*
* Parameters:
* SetExtendedChannels (ExtendedChannelsRequested)
* Maximum extended channels is 8. A value of 0 will
* use no extended channels.
*
* Return Value:
* Extended channels selected.
**********************************************************************
**********************************************************************
* Function Name:
* SetExtendedChannelMultiplier()
*
* Description:
* Request multiplier to be used in layout of extended channels.
* Extended channels will be placed so last extended channel
* is set at the Last Delay * Multiplier.
*
* Parameters:
* SetExtendedChannelMultiplier(MultiplierRequested)
* MultiplierRequested should be a whole number between 2 and 10.
*
* Return Value:
* Extended channels selected.
**********************************************************************
**********************************************************************
* Function Name:
* UseHiSpeedCircuit()
*
* Description:
* Allocate/de-allocate the hi speed circuit for use in the current function.
* Call to allocate will fail if hi speed circuit is already allocated to a different function.
* Call to allocate will fail if channel spacing is set to linear.
* Call to allocate will fail if low speed circuit is allocated and mid speed circuit is not.
* Call to de-allocate will fail if neither mid or low speed circuits are currently allocated.
*
* Parameters:
* TRUE or non zero value to allocate.
* FALSE or zero to de-allocate.
*
* Return Value:
* TRUE/FALSE
**********************************************************************
**********************************************************************
* Function Name:
* UseMidSpeedCircuit()
*
* Description:
* Allocate/de-allocate the mid speed circuit for use in the current function.
* Call to allocate will fail if mid speed circuit is already allocated to a different function.
* Call to allocate will fail if channel spacing is already set to linear using the low speed
* circuit.
* Call to de-allocate will fail if both hi and low speed circuits are currently allocated.
* Call to de-allocate will fail if neither hi or low speed circuits are currently allocated.
*
* Parameters:
* TRUE or non zero value to allocate.
* FALSE or zero to de-allocate.
*
* Return Value:
* TRUE/FALSE
**********************************************************************
**********************************************************************
* Function Name:
* UseLowSpeedCircuit()
*
* Description:
* Allocate/de-allocate the low speed circuit for use in the current function.
* Call to allocate will fail if low speed circuit is already allocated to a different function.
* Call to allocate will fail if channel spacing is already set to linear using the mid speed
* circuit.
* Call to de-allocate will fail if neither hi or mid speed circuits are currently allocated.
*
* Parameters:
* TRUE or non zero value to allocate.
* FALSE or zero to de-allocate.
*
* Return Value:
* TRUE/FALSE
**********************************************************************
**********************************************************************
* Function Name:
* GetMeasuredBaselineChannels()
*
* Description:
* Returns the number of channels to be used for the measured baseline.
*
* Parameters:
* None
*
* Return Value:
* Measured baseline channels.
**********************************************************************
**********************************************************************
* Function Name:
* GetMeasuredBaselineFirstChannel()
*
* Description:
* Returns the channel number of the first baseline channel.
* The first channel in the function is channel 1.
*
* Parameters:
* None
*
* Return Value:
* First measured baseline channel number.
**********************************************************************
**********************************************************************
* Function Name:
* SetMeasuredBaselineChannels()
*
* Description:
* Request the number of channels to be used for measured baseline.
*
* Parameters:
* SetMeasuredBaselineChannels(ChannelsRequested)
* Minimum value is 1.
* Maximum value is 32.
* The last measured baseline channel must not extend past last circuit channel.
*
* Return Value:
* Measured baseline channels.
**********************************************************************
**********************************************************************
* Function Name:
* SetMeasuredBaselineFirstChannel()
*
* Description:
* Request first channel for measured baseline calculation.
*
* Parameters:
* SetMeasuredBaselineFirstChannel(ChannelRequested).
* A call to this function will cause the measured baseline to remain in a fixed position.
*
* The last measured baseline channel must not extend past last circuit channel.
*
* Return Value:
* First measured baseline channel.
**********************************************************************
**********************************************************************
* Function Name:
* SetMeasuredBaselineAutomatic()
*
* Description:
* Set the measured baseline to use the automatic placement algorithm.
*
* Parameters:
* None
*
* Return Value:
* None
**********************************************************************
**********************************************************************
* Function Name:
* SetMeasuredBaselineExtended()
*
* Description:
* Set the measured baseline to use the extended channels.
*
* Parameters:
* None
*
* Return Value:
* TRUE or non zero value if extended channels are allocated in current function.
* FALSE or zero if extended channels are not allocated in current function.
**********************************************************************
**********************************************************************
* Function Name:
* SetMeasurementDuration()
*
* Description:
* Set measurement duration in seconds
*
* Parameters:
* Duration in seconds.
*
* Return Value:
* Duration in seconds.
**********************************************************************
**********************************************************************
* Function Name:
* SetMeasurementSamples()
* Description:
* Set measurement duration in samples
*
* Parameters:
* Duration in samples to collect
*
* Return Value:
* Duration in Samples.
**********************************************************************
**********************************************************************
* Function Name:
* SetMeasurementBaselineDifference()
*
* Description:
* Set measurement duration to be evaluated as specified percentage difference between
* measured and calculated baselines
*
* Parameters:
* Percentage difference to use for measurement termination.
*
* Return Value:
* Percentage difference to use for measurement termination.
**********************************************************************
**********************************************************************
* Function Name:
* GetExtendedChannels()
*
* Description:
* Returns the number of extended channels allocated in current function.
*
* Parameters:
* None
*
* Return Value:
* See description.
**********************************************************************
**********************************************************************
* Function Name:
* GetExtendedChannelMultiplier()
*
* Description:
* Returns the multiplier used for layout of extended channels allocated in current
* function.
*
* Parameters:
* None
*
* Return Value:
* See description.
**********************************************************************
**********************************************************************
* Function Name:
* GetChannelDelay ()
*
* Description:
* Returns delay in micro seconds for a correlator channel.
*
* Parameters:
* GetChannelDelay (ChannelNumber)
* Channel number must be between 1 and the last channel allocated in current function.
*
* Return Value:
* Delay value for channel if in range of allocated channels.
* -1 if channel is out of range of allocated channels.
**********************************************************************
**********************************************************************
* Function Name:
* GetRawData()
*
* Description:
* Return raw data for a correlator channel
*
* Parameters:
* GetRawData(ChannelNumber)
* Channel number must be between 1 and the last channel allocated in current function.
*
* Return Value:
* Raw data value for channel if in range of allocated channels.
* -1 if no data collected or channel is out of range of allocated channels.
**********************************************************************
**********************************************************************
* Function Name:
* GetFnRawData()
*
* Description:
* Loads a numeric array with the raw data from ALL the channels allocated in current
* function.
*
* Parameters:
* GetFnRawData(ArrayToLoad)
* Array to load must be defined as an array before call to this function.
*
* Example:
* RawData [1] = 0.0; // initialize variable as a numeric array
* GetFnRawData (RawData);
* Channels = GetChannels ();
* for (Channel = 1; Channel <= Channels; Channel++)
* printf ("Channel = %d RawData = %f\r\n", Channel, RawData[Channel]);
*
* Return Value:
* None
**********************************************************************
**********************************************************************
* Function Name:
* GetNormalizedData()
*
* Description:
* Return normalized data for a correlator channel.
*
* Parameters:
* GetNormalizedData(ChannelNumber)
* Channel number must be between 1 and the last channel allocated in current function.
*
* Return Value:
* Normalized data value for channel if in range of allocated channels.
* -1 if no data collected or baseline for normalization is undefined
* or channel is out of range of allocated channels.
**********************************************************************
**********************************************************************
* Function Name:
* GetFnNormalizedData()
*
* Description:
* Loads a numeric array with the normalized data from ALL the channels allocated in
* current function.
*
* Parameters:
* GetFnNormalizedData(ArrayToLoad)
* Array to load must be defined as an array before call to this function.
*
* Example:
* NormalizedData [1] = 0.0; // initialize variable as a numeric array
* GetFnRawData (Normalized);
* Channels = GetChannels ();
* for (Channel = 1; Channel <= Channels; Channel++)
* printf ("Channel = %d RawData = %f\r\n", Channel, Normalized[Channel]);
*
* Return Value:
* None
**********************************************************************
**********************************************************************
* Function Name:
* GetSamples()
*
* Description:
* Return the number of samples collected in current function.
*
* Parameters:
* None
*
* Return Value:
* See description.
**********************************************************************
**********************************************************************
* Function Name:
* GetSampleTime()
*
* Description:
* Return the sample time from current function in micro seconds.
*
* Parameters:
* None
*
* Return Value:
* See description.
**********************************************************************
**********************************************************************
* Function Name:
* GetTotalsA()
*
* Description:
* Return A totals for current function.
*
* Parameters:
* None
*
* Return Value:
* See description.
**********************************************************************
**********************************************************************
* Function Name:
* GetTotalsB()
*
* Description:
* Return B totals for current function.
*
* Parameters:
* None
*
* Return Value:
* See description.
**********************************************************************
**********************************************************************
* Function Name:
* GetCountRateA()
*
* Description:
* Returns current A count rate for current function if function is running.
* Returns average A count rate for current function if function is not running.
*
* Parameters:
* None
*
* Return Value:
* See description.
**********************************************************************
**********************************************************************
* Function Name:
* GetCountRateB()
*
* Description:
* Returns current B count rate for current function if function is running.
* Returns average B count rate for current function if function is not running.
*
* Parameters:
* None
*
* Return Value:
* See description.
**********************************************************************
**********************************************************************
* Function Name:
* StartAll()
*
* Description:
* Start all allocated correlator functions.
*
* Parameters:
* None
*
* Return Value:
* None
**********************************************************************
**********************************************************************
* Function Name:
* StopAll()
*
* Description:
* Stop all allocated correlator functions.
*
* Parameters:
* None
*
* Return Value:
* None
**********************************************************************
**********************************************************************
* Function Name:
* ClearAll()
*
* Description:
* Clear all allocated correlator functions.
*
* Parameters:
* None
*
* Return Value:
* None
**********************************************************************
**********************************************************************
* Function Name:
* GetSignalSource()
*
* Description:
* returns the setting for signal source for the current function.
* 0 = Auto A
* 1 = Auto C
* 2 = Cross A/B
* 3 = Cross C/D
* 4 = test signal (generates a square wave which correlates to a triangular wave)
* Parameters:
* None
*
* Return Value:
* See description.
**********************************************************************
**********************************************************************
* Function Name:
* SetSignalSource()
*
* Description:
* sets the signal source for the current function.
*
* Parameters:
* 0 = Auto A
* 1 = Auto C
* 2 = Cross A/B
* 3 = Cross C/D
* 4 = test signal (generates a square wave which correlates to a triangular wave)
*
* This call will fail if circuits from the correlator are allocated to different
* functions that would conflict with the signal source request.
* For example, you may not run the mid speed circuit in test mode while the
* low speed circuit is allocated to a different function and is not set in test mode.
*
* Return Value:
* Signal source or -1 if function call fails.
*********************************************************************
**********************************************************************
* Function Name:
* LoadDelayFile()
*
* Description:
* Loads a .dly file from the \BICW\DLYFIL directory.
*
* Parameters:
* File name to load.
* LoadDelayFile("FILENAME.DLY");
*
* Return Value:
* TRUE if file was successfully loaded.
* FASE if file can not be used.
**********************************************************************
**********************************************************************
* Function Name:
* GetCurrentFnSource()
*
* Description:
* Returns a string that describes the current function.
* for example:
* "Ctrl BD1 (HML)"
* where (HML) represents the circuits allocated.
* This string will match the title bar of the window used to control the
* when operating in a non control file environment.
* Parameters:
* None
*
* Return Value:
* See description.
**********************************************************************
**********************************************************************
* Function Name:
* SetCurrentFnSource()
*
* Description:
* Sets the current function to function described in the parameter.
* A window must already be open that matches the function description in
* it's title bar.
*
* Parameters:
* String of characters matching the description in the tile bar
* of the correlation function to make "current".
* For example:
* SetCurrentFnSource("Ctrl BD2 (HML)");
* Notice the sample id is not included in the function description.
* Return Value:
* TRUE if description matches an existing data source
* FALSE if description can not be matched in any existing data source.
**********************************************************************
**********************************************************************
* Function Name:
* GetNewFnSource()
*
* Description:
* Attempts to open a new correlator window.
*
* Parameters:
* GetNewFnSource("ML");
* This call will attempt to allocate the circuits requested, Mid and Low speed,
* in any available correlator.
*
* Return Value:
* TRUE if description of function could be used to create a new data source.
* FALSE if description of function could not be used to create a new data source.
**********************************************************************
**********************************************************************
* Function Name:
* GetSampleId()
*
* Description:
* Returns a string with the sample id of the current function.
*
* Parameters:
* None
*
* Return Value:
* See description.
**********************************************************************
**********************************************************************
* Function Name:
* GetOperatorId()
*
* Description:
* Returns a string with the operator id of the current function.
*
* Parameters:
* None
*
* Return Value:
* See description.
**********************************************************************
**********************************************************************
* Function Name:
* GetNotes()
*
* Description:
* Returns a string with the contents of the notes field
* of the current function (from the parameters page).
*
* Parameters:
* None
* Return Value:
* See description.
**********************************************************************
**********************************************************************
* Function Name:
* GetTempCelsius()
*
* Description:
* Return the temperature for the current function (from the parameters page).
*
* Parameters:
* None
*
* Return Value:
* See description.
**********************************************************************
**********************************************************************
* Function Name:
* GetSuspension()
*
* Description:
* Returns a string describing the name of the suspension for the current function
* as shown in the parameters page.
*
* Parameters:
* None
*
* Return Value:
* See description.
**********************************************************************
**********************************************************************
* Function Name:
* GetViscosity()
*
* Description:
* Return the viscosity for the current function (from the parameters page).
*
* Parameters:
* None
*
* Return Value:
* See description.
**********************************************************************
**********************************************************************
* Function Name:
* GetRefractiveIndex()
*
* Description:
* Return the refractive index for the current function (from the parameters page).
*
* Parameters:
* None
*
* Return Value:
* See description.
**********************************************************************
**********************************************************************
* Function Name:
* GetAngle()
*
* Description:
* Returns the last known angle for the goniometer in this program.
* This value may of may not be accurate if goniometer has been moved
* manually or with other software.
*
* Parameters:
* None
*
* Return Value:
* See description.
**********************************************************************
**********************************************************************
* Function Name:
* GetWavelength();
*
* Description:
* Returns wavelength in nanometers. Used in cumulants calculations.
*
* Parameters:
* None
*
* Return Value:
* See description.
**********************************************************************
**********************************************************************
* Function Name:
* GetRefractiveIndexReal()
*
* Description:
* Returns real component for refractive index of particles to be measured.
*
* Parameters:
* None
*
* Return Value:
* See description.
**********************************************************************
**********************************************************************
* Function Name:
* GetRefractiveIndexImaginary()
*
* Description:
* Returns imaginary component for refractive index of particles to be measured.
*
* Parameters:
* None
*
* Return Value:
* See description.
**********************************************************************
**********************************************************************
* Function Name:
* GetFirstCalcChannel()
*
* Description:
* Returns channel number of first channel to be used in
* cumulants analysis. Channels are numbered 1 through last channel.
*
* Parameters:
* None
*
* Return Value:
* See description.
**********************************************************************
**********************************************************************
* Function Name:
* GetDustCutoff()
*
* Description:
* Returns current sigma multiplier value used for software dust rejection algorithm.
*
* Parameters:
* None
*
* Return Value:
* See description.
**********************************************************************
**********************************************************************
* Function Name:
* SetSampleId()
*
* Description:
* Set current Sample Id.
*
* Parameters:
* String value. 30 character max length.
*
* Return Value:
* None
**********************************************************************
**********************************************************************
* Function Name:
* SetOperatorId()
*
* Description:
* Set current Operator Id.
*
* Parameters:
* String value. 30 character max length.
*
* Return Value:
* None
**********************************************************************
**********************************************************************
* Function Name:
* SetNotes()
*
* Description:
* Set notes field of parameters dialog.
*
* Parameters:
* String value. 50 character max length.
*
* Return Value:
* None
**********************************************************************
**********************************************************************
* Function Name:
* SetTempCelsius()
*
* Description:
* Sets temperature for calculation of cumulants.
*
* Parameters:
* Degrees Celsius.
*
* Return Value:
* None
**********************************************************************
**********************************************************************
* Function Name:
* SetSuspension()
*
* Description:
* Set current suspension type.
*
* Parameters:
* String. 15 character max length.
*
* Return Value:
* None
**********************************************************************
**********************************************************************
* Function Name:
* SetViscosity()
*
* Description:
* Set viscosity for current sample.
*
* Parameters:
* Viscosity in cp.
*
* Return Value:
* None
**********************************************************************
**********************************************************************
* Function Name:
* SetRefractiveIndex()
*
* Description:
* Set refractive index for suspension for current sample.
*
* Parameters:
* refractive index.
*
* Return Value:
* None
**********************************************************************
**********************************************************************
* Function Name:
* SetAngle()
*
* Description:
* Set angle of scattered light for cumulants calculations.
*
* Parameters:
* Angle in degrees.
*
* Return Value:
* None
**********************************************************************
**********************************************************************
* Function Name:
* SetWavelength()
*
* Description:
* Set wavelength of laser light for cumulants calculations.
*
* Parameters:
* Wavelength in nanometers.
*
* Return Value:
* None
**********************************************************************
**********************************************************************
* Function Name:
* SetRefractiveIndexReal()
*
* Description:
* Set real component for refractive index of particles to be measured.
*
* Parameters:
* Refractive Index.
*
* Return Value:
* None
**********************************************************************
**********************************************************************
* Function Name:
* SetRefractiveIndexImaginary()
*
* Description:
* Set imaginary component for refractive index of particles to be measured.
*
* Parameters:
* Refractive Index.
*
* Return Value:
* None
**********************************************************************
**********************************************************************
* Function Name:
* SetFirstCalcChannel()
*
* Description:
* Sets channel number of first channel to be used in
* cumulants analysis. Channels are numbered 1 through last channel.
*
* Parameters:
* See description.
*
* Return Value:
* None
**********************************************************************
**********************************************************************
* Function Name:
* SetDustCutoff()
*
* Description:
* Sets current sigma multiplier value used for software dust rejection algorithm.
*
* Parameters:
* See description.
*
* Return Value:
* None
**********************************************************************
**********************************************************************
* Function Name:
* UseDustFilter()
*
* Description:
* Setting determines if user will view output of software dust
* rejection algorithm or the full correlation function.
*
* Parameters:
* TRUE or non zero value to use dust rejection algorithm.
* FALSE or zero to suppress dust rejection algorithm.
* Return Value:
* None
**********************************************************************
**********************************************************************
* Function Name:
* SetHomodyne()
*
* Description:
* Setting determines if software should use homodyne
* adjustments for cumulants calculations.
*
* Parameters:
* TRUE or non zero value to use Homodyne calculations.
* FALSE or zero to suppress Homodyne calculations.
* Return Value:
* None
**********************************************************************
**********************************************************************
* Function Name:
* SetNormalization()
*
* Description:
* Sets normalization to use calculated or measured baseline.
*
* Parameters:
* TRUE or non zero value to use measured baseline.
* FALSE or zero to use calculated baseline.
*
* Return Value:
* None
**********************************************************************
**********************************************************************
* Function Name:
* GetGamma()
*
* Description:
* Returns gamma from cumulants.
*
* Parameters:
* 1 = Linear fit
* 2 = Quadratic fit
* 3 = Cubic fit
* 4 = Quartic fit
*
* Return Value:
* Gamma if cumulants are calculated successfully.
* -1 if cumulants results are undefined.
**********************************************************************
**********************************************************************
* Function Name:
* GetDiffusionCoefficient()
*
* Description:
* Returns diffusion coefficient from cumulants.
*
* Parameters:
* 1 = Linear fit
* 2 = Quadratic fit
* 3 = Cubic fit
* 4 = Quartic fit
*
* Return Value:
* Diffusion coefficient if cumulants are calculated successfully.
* -1 if cumulants results are undefined.
**********************************************************************
**********************************************************************
* Function Name:
* GetPolydispersity()
*
* Description:
* Returns polydispersity from cumulants.
*
* Parameters:
* 2 = Quadratic fit
* 3 = Cubic fit
* 4 = Quartic fit
*
* Return Value:
* Polydispersity if cumulants are calculated successfully.
* -1 if cumulants results are undefined.
**********************************************************************
**********************************************************************
* Function Name:
* GetEffectiveDiameter()
*
* Description:
* Returns effective diameter (nm) from cumulants.
*
* Parameters:
* 1 = Linear fit
* 2 = Quadratic fit
* 3 = Cubic fit
* 4 = Quartic fit
*
* Return Value:
* Effective diameter (nm) if cumulants are calculated successfully.
* -1 if cumulants results are undefined.
**********************************************************************
**********************************************************************
* Function Name:
* GetSkew()
*
* Description:
* Returns skew from cumulants.
*
* Parameters:
* 3 = Cubic fit
* 4 = Quartic fit
*
* Return Value:
* Skew if cumulants are calculated successfully.
* -1 if cumulants results are undefined.
**********************************************************************
**********************************************************************
* Function Name:
* GetKurtosis()
*
* Description:
* Returns kurtosis from cumulants.
*
* Parameters:
* None
*
* Return Value:
* Kurtosis if cumulants are calculated successfully.
* -1 if cumulants results are undefined.
**********************************************************************
**********************************************************************
* Function Name:
* GetRMSError()
*
* Description:
* Returns RMS error of residual fit from cumulants.
*
* Parameters:
* 1 = Linear fit
* 2 = Quadratic fit
* 3 = Cubic fit
* 4 = Quartic fit
*
* Return Value:
* RMS error if cumulants are calculated successfully.
* -1 if cumulants results are undefined.
**********************************************************************
**********************************************************************
* Function Name:
* GetAmplitude()
*
* Description:
* Returns amplitude of residual fit from cumulants.
*
* Parameters:
* 1 = Linear fit
* 2 = Quadratic fit
* 3 = Cubic fit
* 4 = Quartic fit
*
* Return Value:
* Amplitude if cumulants are calculated successfully.
* -1 if cumulants results are undefined.
**********************************************************************
**********************************************************************
* Function Name:
* Save()
*
* Description:
* Save current function to database
*
* Parameters:
* None
*
* Return Value:
* TRUE or non zero if successful.
* FALSE or zero if unsuccessful .
**********************************************************************
**********************************************************************
* Function Name:
* SaveAscii()
*
* Description:
* Save correlation function data in ASCII format.
*
* Parameters:
* path to save data to
* SaveAscii("c:\\data\\filename.dat");
*
* Return Value:
* TRUE or non zero if successful.
* FALSE or zero if unsuccessful.
**********************************************************************
**********************************************************************
* Function Name:
* SaveCountRateHistory()
*
* Description:
* Save correlation function count rate history in ASCII format.
*
* Parameters:
* Path to save data to.
* SaveCountRateHistory("c:\\data\\filename.rat");
*
* Return Value:
* TRUE or non zero if successful.
* FALSE or zero if unsuccessful.
**********************************************************************
**********************************************************************
* Function Name:
* PrintReport()
*
* Description:
* Prints a report for current function using format defined in Print Options.
*
* Parameters:
* None
*
* Return Value:
* TRUE or non zero if successful.
* FALSE or zero if unsuccessful.
**********************************************************************
**********************************************************************
* Function Name:
* GetCurrentFolder()
*
* Description:
* Returns a string with name of current folder that data will
* be saved to from Save () command.
*
* Parameters:
* None
*
* Return Value:
* See description.
**********************************************************************
**********************************************************************
* Function Name:
* SetCurrentFolder()
*
* Description:
* Sets current folder to save data to. If requested folder
* does not exist then an attempt is made to create it.
*
* Parameters:
* Name of folder to sat as current folder.
*
* Return Value:
* String with name of current folder.
**********************************************************************
/**********************************************************************
* Function Name:
* SetGoniometerAngle()
*
* Description:
* Moves goniometer to requested angle.
*
* Parameters:
* Angle to move to in degrees.
*
* Return Value:
* Goniometer position in degrees.
**********************************************************************
/**********************************************************************
* Function Name:
* GetGoniometerAngle()
*
* Description:
* Get the angle that the goniometer is currently located at.
*
* Parameters:
* None
*
* Return Value:
* Goniometer position in degrees.
**********************************************************************
/**********************************************************************
* Function Name:
* SetBI90Temperature()
*
* Description:
* Set temperature on BI-90 in degrees Celsius.
*
* Parameters:
* Degrees Celsius.
*
* Return Value:
* TRUE or non zero if successful.
* FALSE or zero if unsuccessful.
**********************************************************************
**********************************************************************
* Function Name:
* SetZPlusTemperature()
*
* Description:
* Set temperature on ZetaPlus in degrees Celsius.
*
* Parameters:
* Degrees Celsius.
*
* Return Value:
* TRUE or non zero if successful.
* FALSE or zero if unsuccessful.
**********************************************************************
/**********************************************************************
* Function Name:
* Set90PlusTemperature()
*
* Description:
* Set temperature on 90Plus in degrees Celsius.
*
* Parameters:
* Degrees Celsius.
*
* Return Value:
* TRUE or non zero if successful.
* FALSE or zero if unsuccessful.
**********************************************************************
Download