CMM
CMM
CMM
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 one big comment
block.
*/
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 // integer
0 // integer
0x3EF2 // integer in hexadecimal format
-300 // integer
3.14 //float
-3.45e-20 // float
‘A’ // byte
‘\033’ // 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.
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.
After variables has been assigned, they can be treated as their data type. So after these statements:
Basic Arithmetic
= assignment: sets a variable’s value
i = 2; // i is 2
* multiplication:
i =i * 5; // i is now (2 * 5) or 10
/ division:
i= i / 3 // i is now (10/3) or 3 (no remainder)
* multiplication:
i *= 5; // i is now (2 * 5) or 10
/ division:
i /= 3 // i is now (10/3) or 3 (no remainder)
i = 4; // i is initialized to 4
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:
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”;
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;
To demonstrate:
printf () syntax
printf () prints to the Cmm output window, providing useful feedback from your program. The
basic syntax of printf () is:
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.
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.
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.
printf (“DONE\r\n”);
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 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:
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
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;
Functions
A function takes a form such as this:
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);
}
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
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.
Max (a,b)
{
result = ( a < b) ? b : a;
return result;
}
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.
liquid = “toluene”;
if (liquid == “toluene”)
printf (“The liquid is toluene.\r\n”);
doghouse
doghouse
doghouse
doghouse
doghouse
doghouse
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;
};
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);
}
main ()
{
CQuadruple (&i);
}
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);
main ()
{
printf (“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 Calculate the hyperbolic cosine.
exp Compute the exponential function.
fabs Absolute value.
fmod Modulus; calculate remainder.
floor Round down.
labs Return absolute value of an integer (non-negative).
log Calculate the natural logarithm.
log10 Calculate the base-ten logarithm.
max Return the largest of two values.
min Return the minimum of two values.
pow Calculates x to the power of y
rand Generate a random number..
max Return the largest of two values.
min Return the minimum of two values.
pow Calculates x to the power of y
sin Calculate the sine.
sinh Calculate the hyperbolic sine.
sqrt Calculate the square root.
srand Intitialze randonm
sin Calculate the sine.
sinh Calculate the hyperbolic sine.
sqrt Calculate the square root.
tan Calculate the tangent.
tanh Calculate the hyperbolic tangent.
strod Convert a string to a floating-point value.
strol Convert a string to an integer value.
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
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;
**********************************************************************
* 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.
**********************************************************************