April 5, 1994 All That Fits is News to Print Vol. 8, No. 4

### Contents of Vol. 8, No. 4

Page contact and owner at end of this issue.

### Correlation Plots Arithmetic

December 16, 1993

 Author: Greg White Subsystem: SLC User Impact: Large Panel Changes: Few Documentation: Yes Help File: Yes

## Introduction and Simple Example

The Correlation Plots facility has been enhanced to allow vector-oriented arithmetic operations.

In outline, the Correlation Plots' user interface is now similar to familiar spreadsheet programs. Each ``cell'' or Sampled Variable (SV) button may contain either data that has been obtained directlyfrom an SLC device, PHYS variable, etc., or alternatively, a formula which may optionally involve other Sampled Variables.

For example, suppose BPMS LI01 141 TMIT is entered on button A1, the top lefthand corner SV button on the ``Correlation Plot Data Acq (1-20)'' panel, and BPMS LI01 901 TMIT is entered on button A2, the button immediately below A1. To calculate the positron transmission through unit 1, the ``= A2/A1'' expression could be entered on button (say) B1. Now, after the last data point is acquired for an auto acquisition or after the "EVAL ALL EXPRS" button on the "Correlation Plot Applications" panel is pressed, the ratio of the data taken for button A2 to that for A1 is calculated and put in button B1. The calculated data can now be displayed, copied to a file, or used in other calculations.

## Entering an Expression

When a Sampled Variable (SV) button is pressed, the user may enter either a database entity (as currently defined including PHYS variables, TIME, etc) or an expression using some of the other SVs. The entry of an expression, as opposed to a valid input as currently defined, is distinguished by the use of an equal sign ('=') in the input sequence. For instance, ``=cos(STV1)" could be entered for an SV button. If entered for button 19, this expression would be short for ``#19=cos(STV1)" and means ``the value of each element of Sampled Variable 19 is the result of the cosine function on the corresponding element of the primary step variable".

Expressions may only be entered for Sampled Variables and not step variables, though of course a step variable can be used in an expression as was done in the previous example.

The following are examples of valid entries for a Sampled Variable:

BPMS LI01

A ``partial'' device name has been assigned to the SV. The existing procedure for entering a device has not changed so Correlation Plots proceeds to ask for the remaining parts of the name.

= sin(#4)

SV is assigned from the result of the sine function on SV number 4.

= B1 / B2

SV is assigned from the value resulting from the data acquisition of two other SVs, one divided by the other.

Pyield1 = D3 / A6

SV is assigned from the value resulting from the data acquisition of two other SVs, and the result is labeled Pyield.

AverageYield = ( Pyield1 + Pyield2 + Pyield3 )/3

SV is assigned from three other SVs which themselves are defined by expressions.

The following are examples of invalid entries:

pstn = wire ca11 62 data 1

Cannot assign an SV name to device, only to an expression.

B4 = 5 (entered on button A3)

Cannot assign an expression to another button (A3 = 5 would have been legal).

= sin(STV1) (entered on a secondary step variable)

Cannot assign an expression to a step variable.

## Case Sensitivity

Expression text entries are not case sensitive. For instance, both "SIN" and "sin" can be used in an expression to mean the sine function. If "fred=4" was entered on one button and "= FRED" on another, both would be assigned to 4. The literal expression as typed appears on the button.

## Operators and Functions

The following operators are recognized. The precedence and associativity of these are as expected:

```

```
+, -, *, /, % (integer modular division) \^ (raise LHS to the power of the RHS), (unary) -.

The following functions are supported:

```

```
Name Returns

abs Absolute value of arg. acos 0 .. PI being arc cosin of radian argument. asin -PI/2 .. PI/2 being arc sin of radian argument. atan -PI/2 .. PI/2 being the arc tangent of its radian argument. ceil Smallest integer that is greater than the argument. cos Cosine of radian argument. cosh Hyperbolic cosine of argument. exp Base e raised to power of argument floor Largest integer that is less than or equal to its argument. log Natural log of arg. log10 Base 10 log of arg. sin Sine of radian argument. sinh Hyperbolic sine of radian argument. sqrt Square root of argument. tan Tangent radian argument. tanh Hyperbolic tangent of radian argument.

## Constants

The following predefined constants are currently available. Physical constants and their values will be added as requested.

```

```

Name Comment

## Labeling

Since the expression entered for a SV can include any other variable (step or sampled), there must be some way to uniquely label the SVs. There are three ways in which SVs are labeled; firstly, using their correlation plots variable number (the number that appears on a button when it's an INPT variable), secondly, using its ``spreadsheet" or ``row, column'' name, and lastly, as a ``named variable". The last two are added specifically for this release to allow convenient ways of including SVs in mathematical expressions.

Dealing with these three in more detail:

1. Correlation plots sampled variable number. This is how the SVs have been traditionally defined. In this case, when typed in an expression, the SV number must be preceeded by a "#" sign. For example, the top lefthand SV button on the first acquisition panel is (unintuitively) numbered 16 by convention in correlation plots (see table of SV numbers below). To refer to SV 16, "#16" is then used. The step variables are also labeled this way, with "#0" and "#-1" being the primary and secondary step variables, respectively.

• Spreadsheet name. This labeling is oriented around rows and columns where rows are indexed by number and columns are indexed by letter, as in most spreadsheets. On the eight acquisition panels, the top two SV rows have three columns each and the two rows beneath have seven columns each. This provides for 160 SVs. From one acquisition panel to the next, the letters repeat but the numbers do not. So the allowed SV label defaults are A1-G4 on the first panel, A5-G8 on the second panel, ... and A29-G32 on the last panel (see table of SV spreadsheet names below). Step variables have the labels "STV1" and "STV2", for the primary and secondary step variables, respectively. To get help on the spreadsheet names of buttons, use the "DISPSV axes" button on the Correlation Plots Application panel.

• Named variable. A variable name can be provided on the left-hand-side of the "=". The button is now labeled with the given variable name (ie, ``prod1 = A1*A2*A3"). Once entered, the variable name can be used in expressions entered for other buttons (ie, ``sumOfProd = prod1+prod2"). The variable name persists until either a new variable name is assigned to the button or the button is assigned to something other than an expression.

• ```

TABLE OF SAMPLED VARIABLE SPREADSHEET NAMES AND NUMBERS

0,"STV1"  - Primary step variable.
-1,"STV2" - Secondary step variable.

16,"A1"   18,"B1"   20,"C1"                First screen 1-20
15,"A2"   17,"B2"   19,"C2"
2,"A3"    4,"B3"    6,"C3"    8,"D3"   10,"E3"    12,"F3"   14,"G3"
1,"A4"    3,"B4"    5,"C4"    7,"D4"    9,"E4"    11,"F4"   13,"G4"

36,"A5"   38,"B5"   40,"C5"                Second screen 21-40
35,"A6"   37,"B6"   39,"C6"
22,"A7"   24,"B7"   26,"C7"   28,"D7"   30,"E7"    32,"F7"   34,"G7"
21,"A8"   23,"B8"   25,"C8"   27,"D8"   29,"E8"    31,"F8"   33,"G8"

156,"A29",158,"B29",160,"C29",             Last Screen 141-160
155,"A30",157,"B30",159,"C30",
142,"A31",144,"B31",146,"C31",148,"D31",150,"E31",152,"F31",154,"G31",
141,"A32",143,"B32",145,"C32",147,"D32",149,"E32",151,"F32",153,"G32"
```

## Plot Labels

The axes of plots for SVs defined by an expression are labelled with the expression, including, if present, any variable name that was given on the left-hand-side of the expression.

## Parsing and Evaluation

Parsing for correct syntax is performed at the time the expression is entered. In general, all expressions are evaluated at the end of the data acquisition cycle.

Some additional buttons are provided for controlling evaluations and are described in the next section.

The order of evaluation

Whenever all expressions are evaluated, they are processed in ``spreadsheet order" (that is, top-to-bottom and left-to-right) rather than in increasing order of the correlation plots button number or in some chain using a precedent-consequent scheme. Therefore, it's necessary to assign each SV defined by expression, whose value is used in other expressions, to a lexically lower button than those which use its value. For instance, given ``B2=Fred+3", Fred must have been defined in one of A1, A2, A3, A4 or B1. When an expression is entered, this interdependence is checked and any expression using buttons that would not have been evaluated when it is evaluated is not permitted.

When expressions are evaluated

All expressions are evaluated after a valid AUTO data acquisition cycle has completed. MANUAL STEPPING expressions are not evaluated after each step, but can be evaluated ``by-hand" using the EVAL expr buttons detailed in the next section. When an expression is entered, it can be evaluated immediately using one of the EVAL buttons, or if in ENTER mode, it is evaluated automatically.

If the number of steps is changed for a step variable, Correlation Plots does not think that the number of elements in each data array has changed until a valid data acquisition is performed. So if expressions are re-evaluated after changing the number of steps but without first doing a re-acquisition, the length of the resulting arrays is that of the previous number of steps.

## New Buttons

There are 6 new buttons and all appear on the Correlation Applications Panel:

1. ``EVAL on [CMND|ENTER]" - This is a toggle. In the CMND mode, expressions are evaluated after a valid AUTO data acquisition and whenever one of the EVAL button commands is used. This is the default. In the ENTER mode, an expression is evaluated as soon as it has been entered and, subsequently, in all situations detailed for CMND mode. This mode is useful after a valid acquisition has been made.

• ``EVAL expr for SV" - Until this button is pressed again, the SV expression is evaluated when its button is pressed rather than an initiation of a dialog for a new value. If the SV button is not defined by an expression, pressing it will start a dialog as it always has. This button is useful for evaluating all expressions after a MANUAL acquisition, or if in CMND mode, after entering an expression.

• ``EVAL ALL exprs" - Evaluates all expressions. This button is useful for evaluating all expressions after a MANUAL acquisition, or if in CMND mode, after entering an expression.

• ``DISP expr for SV" - Until this button is pressed again, the SV expression is displayed in the local messages area when its button is pressed rather than an initiation of a dialog for a new value. If the SV button is not defined by an expression, pressing it will start a dialog as it always has.

• ``DISP ALL exprs" - All expressions are displayed on the graphics area.

• ``DISP SV axes" - Until this button is pressed again, all of the data acquisition and display panels show the spreadsheet label names on the left-most and bottom line of the SV buttons.

• ## Limitations and Restrictions

The level of parenthesis nesting is limited to 9.

Program complexity is limited to about 500 mathematical instructions, though in practice expressions are limited to 70 characters because of a SCP limitation in the number of characters that may be input on one line. To use longer expression strings, a button expression can be written on one line in a Correlation Plots button file. Note that the Button File facility has been enhanced to save expressions for SV buttons.

Only the first 32 characters can be printed on a button on an X-COW, and fewer on other kinds of COWs and CALFs. To see all the characters, one of the ``DISP expr'' buttons can be used.

No linear recurrence operations are offered in this release. For instance, expressions such as A1[SAMP] = B1[SAMP-1] are not recognized.

### Using Control-C in BPM Displays

March 22, 1994

 Author: M. Zelazny Subsystem: BPM User Impact: Small Panel Changes: None Documentation: No Help File: Yes

Did you know that the SCP software monitors your keyboard for Control-C?

When the BPM Displays are taking too long to update and you would like your SCP returned to you, please use Control-C.

This feature may be necessary when an SLC micro has difficulty reading the hardware you have specified.

### Fast Feedback Dither Calibration

March 28, 1994

 Author: Stephanie Allison Subsystem: Fast Feedback User Impact: Small Panel Changes: Few Documentation: Yes Help File: Yes

Fast feedback's main goal in life is to stabilize some states (e.g. position, angle, or energy of the beam) by varying some actuators (e.g. correctors or phase shifters). To do this properly, it must know how much each state will change when each actuator is changed by a certain amount. When a feedback loop is first set up, these slopes are calculated using the online model of the accelerator as calculated by DIMAD. Fast feedback calibration allows the user to directly measure these slopes and optionally save them to the database to be used by the feedback loop in place of the values from the model.

In the past, the only fast feedback calibration option available was ``full-range" calibration. Full-range calibration takes each of the selected actuators through a specified range centered around its present setting using a specified number of steps. To provide less perturbation to the system and to filter out system changes during calibration, a new option called ``dither" calibration has been added. Dither calibration moves each of the selected actuators up and down around its present setting a specified number of times.

For both types of calibrations, each time the actuator is stepped, enough time is allowed for the actuator and states to settle to steady values before a snapshot of the states is taken. The data (states and actuator values) are then available for matrix recalculation and correlation plots, and to determine the slope of each state versus the actuator settings. The results must be linear and reproducible in order for the feedback to function correctly. Also, the results from the two different types of calibration should be similar.

Except for specifying the type of calibration when initiating a calibration, the details on how to perform a calibration have not changed. DOC\$FEEDBACK:HOWTO_CALIB.DOC contains the relevant documentation. The help available from the calibration, diagnostic, and actuator panels also provide more detail.

New buttons have been added to the fast feedback actuator panel to control dither calibration. Note that all calibration buttons are NOT available for dither actuators used in minimization loops. They are also not functional for special-purpose actuators which are not calculated directly from the states (e.g. phase shifters in the FB31 energy loops).

The first two buttons,

 Full Calib  Range
and
 # Full Calib  Steps
, are used to specify the range and number of steps used during full calibration. The second two buttons,
 Dither Calib  Amount
and
 # Dith Calib  Steps
, are used to specify the total amount that the actuator is moved from one step to the next and the number of steps used during dither calibration.

### User Defined Timing Variable for BPMs

March 22, 1994

 Author: M. Zelazny Subsystem: SCP User Impact: Small Panel Changes: Few Documentation: No Help File: Yes

You can now assign a Timing Variable to a BPM Definition. Doing this will delay the reading of hardware by the BPM Displays on the SCP by the amount of time supplied by the Timing Variable. This feature was particularly valuable during the last ASSET run when the beam time was altered frequently.

Two new buttons have been added to the More BPM Diagnosticspanel. One button,

 Disply TMVAR  Names
will display a list of available Timing Variables along with their timing offset displayed in both number of ticks and number of nanoseconds. The other new button,
 Select User  TMVAR
will attach the entered Timing Variable to the BPM SCP software. This Timing Variable only affects the BPM SCP software.

For a more detailed description of Timing Variables please see the Index Panel article on Regional Beam Codes.

 March 22, 1994 Index Panel Vol. 8, No. 4

Translated from original PlainTeX by index2html.pl.

Contact (until Aug. 15, 1996): Jeffrey Miller
Owner: Bob Sass