BM02 is currently controlled by SPEC applications, for which a tutorial can be found on the ESRF intranet web site.

These applications are generally already running when the user arrives. If they are not running, they can be started typing their name in a Konsole window of the linux PC called "d2cc" :

• mono: to control Optics, including mirror1 and mirror2
• slits or slitsaxs: to control the optic slits and the goniometer slits or saxs slits respectively.
• fourc: to control the 7-circle diffractometer.
• saxsint, saxsext, saxsht, gisaxs: to control the Small Angle Scattering Camera
• esrfCCD : to control the small camera used for direct beam alignment. To avoid saturation, adapt the acquisition time with ccdlive time. Once done please exit the session.
• tablegonio : to align the goniometer with respect to the direct beam. Once done please exit the session and switch off the motors, to make sure the goniometer stays in place.

In all those cases, the same program is used. The applications differ only by motor names and specific initializations : the general commands and datafile format are common to all applications.

The following different applications can be triggered from d2cc computer only !!!

From the other computers, they can be runned in simulation mode (-s) only.

Important:

1. pay attention when typing "mv" commands, motor names are checked, but numbers are also recognized as motor num.
ex: mv tth 5 will move tth to 5
mv 1 5  will move motor number 1 to 5
2. The number of intervals in a scan is limited to 4000.
3. Several movement can be triggered simultaneously, but MIND TO AVOID COLLISIONS!!!
4. In not-attended mode a scan controlled by the monitor is more convenient than a scan with time control: it allows to overcome reinjections or beam losts...
5. You can stop each scan by typing ^C. This should be done for example if you start scannning a motor to a unwanted position. dscan will return to the old position after ^C. An error message may occur telling you that the motor didn't reached its final position. In addition, a mismatch between the values of the motor position in SPEC and from the controller may occur. In this case, always answer the question to change the value with no, unless you are sure about what you are doing. In general, all motors have limit switches (hard limit) and/or soft limits controlled by the software, so that it should not be possible to destroy anything.

The users are kindly ask not to change any configuration in the SPEC applications without contacting the beamline personnel.

#### Spec coordinates :

Two systems of coordinates are used in spec : users and dial. They are displayed by the same order wa, but all the commands use only the users coordinates. The dial coordinates can be considered as absolute; they can be used to define limits (see also Bugs).

## Spec basic commands are :

 lsdef display the basic spec commands hi history, print the previous triggered commands (with their number) wa display the positions of all motors using user-coordinates and dial-coordinates. pon send the following commands and the answers to the printer. poff send back the following commands and the answers to the terminal. ct (time) send back the value of the counters integrated over the time to the terminal. (By default time =1s) pct (time) send back the value of the counters integrated over the time to the spec datafile (u)mv motor value (motor2 value2) move a motor to an absolute position given in user-coordinates (and display its current position). It can move simultaneously a 2nd motor. (u)mvr motor value (motor2 value2) move one (or 2) motor(s) of the relative value given in user-coordinates (and display its current position) tw motor value move a motor by steps twct motor value move a motor by steps and every time, send back the values of the counters integrated over 1 second ascan motor begin end steps time perform a scan and display the counts. The position begin and end are given by their absolute values. The interval is divided into steps, when finished the motor remains at the last position. Negative time gives control to the monitor counting : Works only if mon is plugged to vct1_3. Data are automatically added to the file: ($HOME)/dataspec/prg_name.($DATE). dscan motor begin end steps time act like ascan but perform a relative scan and display the counts. The position begin and end are given by their relative values. At the end, it returns to the initial position. afscan motor begin end steps time act like ascan but perform a fast scan (a ramp of time between two "steps" when there is no stop). dfscan motor begin end steps time act like dscan but perform a fast scan (a ramp of time between two "steps" when there is no stop). timescan time sleeping_time infinite scan moving no motors; stop by ctrl C. pplot The displayed spectrum can be plotted on the laser printer. plotselect number1 number2 ... These basic SPEC scans are automatically plotted on the screen. It is possible to switch the displayed counter with this command; numbers are the channel numbers in the counter array. counters allows you to choose which counter is associated with the monitor and which with the detector: MON=1 or 2 and DET=1 or 2. ( ! in the monitoring mode the vtc6_1 should be physically connected to the MON) cen moves to the center between half height points of the last scan. It is equivalent to "mv motor CEN"; CAUTION, use after a scan using only one motor. cenmass moves to the center of mass of the last scan; equivalent to "mv motor COM" pic moves to the postion of the highest detector counting of the last scan; equivalent to "mv motor PEAK" laser prints the display (plot) window, clic with the left side button of the mouse in the display window to be printed. Escan begin end steps time perform a photon_energy scan and display the counts. The position begin and end are given by their absolute values (in keV). getE display the photon energy (in keV). MIND the photon energy is NOT transferred from an application to one another, so, when opening an other application do not forget to type wa and then getE (eventually use resetE energy). setE value set the user angle of the monochromator to match with the chosen value (in keV). BE VERY CAUTIOUS at this STEP!!! Do not forget to do it in all opened applications. resetE value TO be Preferred: ask to verify before the setE command is triggered moveE value moves to the absolute energy in keV (the value is not transferred to the other applications!!!) lm print the user and dial soft limits for all motors of the application. set_lm motor begin end set the soft user limits. flux aper thick dist gives the ratio of flux to the monitor with the scattering of a kapton foil of thickness 'thick' in view of a PM with an aperture 'aper' at a distance "dist" for the energy registered in the application.

You can stop each command or scan by typing ^C.
This should be done for example if you started scannning a motor to a unwanted position will return to the old position.
To quit the SPEC applications, always use ^D or quit. This will store the current definitions.

## Macros (see manual p. 25)

In SPEC it is possible to built higher level commands combining a sequence of basic instructions.

• Use a text editor in a X-window, and input the commands as it would be typed interactively with the terminal.
• You also can write your own macro function. The syntax is similar to the C language. Grammar rules and operators are defined p 52-59 of the manual.

def macroname '
instructions
'

To execute the command file:

 qdo macro_name executes the command file macro_name. Does not echo the commands. do macro_name similar to qdo, except that commands are echoed.

WARNING: If an error occurs at one line (i.e. scan outside software limits), the command file is INTERRUPTED, that is the following lines are not executed.

 prdef macro_name print the definition of the macro. lsdef give the list of all available macros. lsdef *aaa* give the list of macros which name contains the string 'aaa'.

## Bugs

-At spec initialization, it sometimes ask for modifying registers, this is related to spec coordinates. Please answer NO.

- Sometimes, spec does not understand any commands giving wrong diagnostics. In such a case, get out of the application and reopen it using the -f arguments : mono -f, by example, if you whish to play with the monochromator.

- Within some spec implementation, out of range values are displayed by spec, for instance the value of a  motor1. In order to correct this, the following procedure can be use (MIND, verify that HARD LIMITS are ACTIVE!!!):
for exemple

wa
...
lm
... then either type, for exemple
set motor1 20.000
set_dial motor1 2 0.000
or type
set_lm motor1 -200 200
and verify by
wa
...

- if during a movement  with a coder, it appears:
motor to xyz --> move to x'y'z'
The domain of acceptance of the value may be too short (by default generally .001 degree for main rotations). To enlarge it, type:
retry on domain

- If during a scan , it appears
WARNING NO BEAM:

- Cancel the scan by ctrl C
- check that the shutters or slits are opened...
- the program loop until the monitor has reached a certain value defined by VALID_MON= (50 by default);

if you want to overpass this limitation (usefull for automatic scans when there is beam crash or reinjection),type :

VALID_MON=0

### spec implantation

All beamline control at ESRF are done using a networking architecture for which we can assume three levels :

the motor controller, which really moves can be either a VPAP system or an ITL indexor from Micro Controle.

they are driven by a server on a VME crate running OS9

the application program ( spec or others ) send orders to the VME see also BUGS in spec-coord.