Previous: CAD4 General Operator Rules
Next: CAD4 Control commands
NONIUS CAD4/MACH3 
User manual
21 December 2000
    Starting and Stopping the CAD4 Programs

Introduction
Preparation for bringing up the CAD4
Initiating the CAD4 system
Running the CAD4 system
Terminating CAD4 operations
Changing file assignments
Obtaining and terminating a CAD4-dialogue session
Explanation of the GCONST and CASPAR parameters

Introduction

The CAD4 software system will be described in detail in the forthcoming chapters. At this point only a very broad outline is given for familiarization purposes. The host system is capable of controlling upto 8 CAD4 diffractometers (numbered 0,1,2,3,4,5,6,7) at the same time. In further explanations CAD4 number 0 is assumed. Starting the CAD4 program (see Initiating the CAD4 program) will result in starting three processes:

1) cad4 0
2) cad4_run 0 and
3) canoper 0
cad4 is a program that starts to check if the CAD4 is already in use (i.e. if cad4_run 0 is still running). If so, it only starts the canoper process. Otherwise both processes, cad4_run and canoper, are started.
cad4_run does all computations involved in the diffractometer experiment; it is HOST resident.
canoper is the CAD4 operator program which services all terminal input and/or output requests (on any system terminal) of the current CAD4 programs; it is HOST resident.
For CAD4 systems with LSI11/02, FALCON or FALCON+ processors: Each of these components may contain other units which are not shown here in order not to obscure the essential structure.

The CAD4 programs terminal I/O can be serviced from either any system terminal or optionally from the target terminal. The last one is a terminal which can be connected (through port "CT") to the CAD4 (FR546) interface (target). This  terminal is therefore referred to as the target terminal.
The communication with the CAD4 programs can be redirected to the CAD4 terminal using the CONSW command.

Three versions of CAD4H, CAD4M and CAD4T exist now; e.g. for the LSI11/02, FALCON or FALCON+, named CAD4H, CAD4HC and CAD4HE, respectively.

CAD4 directories and files:
cad4_root/system Work directory for CAD4 programs. In this directory linked to cad4_system.
cad4/data0 Default directory for data files and indirect command files (Chapter V, section F). In work directory linked  to ca0_data.
cad4/data0/config Directory for configuration files for this CAD4 (Chapter III). In work directory linked to ca'n'_config.
cad4/data0/master Directory for files used by ARGUS      (Chapter XV). In work directory linked to ca0_master.
gonca0.par File in directory ca0_data with diffractometer specific parameters. In work directory linked to ca0_para.
dummy0.cry Crystal data file in ca0_data containing 28 records of 512 byte
dummy0.dat  Data collection file in ca0_data containing 2 records of 64 bytes/reflection without profile or 10 records of 64 bytes/reflection with profile.
dummy0.hkl File with records of 16 byte in ca0_data containing hkl's to be measured during data collection in file mode.
dummy0.log File in ca0_data containing all terminal output.

Note that the name gonca0.par is required by the software for the goniometer constants file. The names and extensions of the other three data files listed may be changed at wish.

Preparation for bringing up the CAD4

Initiating the CAD4 System

In the example given below the user was logged in as cad4 user. As usual the user input is in fixed font. % is assumed to be the unix prompt after the login and 0 is the cad4 number.

Go to the work directory cad4_system by:

% cd ~/system

To start the CAD4 program enter:

% cad4 or cad4 0

If the cad4 number is not given the program will ask for it.

The CAD4 interface power should be switched on. If all of the above preparations have been taken care of and all of the system components do function correctly you will see a message:

"Connection to cad4 number 0 with process-id 00015"

and there is a pause, which will be about 10-40 seconds for some systems and up to 4 minutes for slower communication links.

The file ca0_para (ca0_data/gonca0.par), which contain the goniometer constants and the names of the used crystal, data and hkl file, is then made available for examination. The default wavelength and scan parameters are displayed and the CAD4 prompt CD0> is output indicating the systems readiness to
accept commands. To illustrate this procedure the output from a CAD4 initiation in a running system is given below.

Nonius CAD4 unix version, January 1998
unit 1 = ca0_data/dummy0.cry
file has   28 records of 512 bytes.
unit 2 = ca0_data/dummy0.dat
file has 1 records of  64 bytes.
unit 3 = ca0_data/dummy0.hkl
file has 0 records of  16 bytes
Lam1=  .70930 Lam2=  .71359 Filf= 15.000
Swoma Swomb Diafra Diafrb Scanr Qfact Pfact
   2.00   .35   4.00   1.05 6.  1.00  1.00
CD0>

Note:
It is also possible to run the cad4 program directly such that the cad4 process is all the time connected to your  terminal channel. In that case it is not possible to give input to and observe output from the cad4 process on another terminal then you started the program (see Running the CAD4 system).

To start the direct version type: "cad4_direct 0"  instead of "cad4 0.

Possible problems encountered in bringing up the CAD4 programs.

Prompt "CD0>" does not appear at the host terminal.

  Possible remedies:
  a. Turn interface off for a few seconds
  b. Turn generator and interface on

Note:
After a power failure the last data records may be lost. In addition data in the crystal file (unit 1) may be obsolete. It is advised to verify which is the last correctly stored reflection in the data file and to print and verify all of the DATCIN-parameters against the values used at data collection startup. Only running hkl's might have changed; reset the running hkl's to remeasure any lost reflection.

Running the CAD4 system.

As explained in the previous chapter canoper is the process which handles all terminal input and/or output requests. With this program the user has full control of the CAD4 system from any system terminal. The input and output of the cad4_run process is piped to the canoper process and you can switch to another terminal channel by giving "quit", while the program is running. Then there is no output to the terminal window anymore, but the cad4_run process is still running in the background (and all relevant output is written to a log-file, see below).

In this situation it is possible to get the control over the CAD4 from any HOST terminal including telephone modems by entering again: cad4 0, resuming the canoper process.

The output from the CAD4 is stored in a log-file (in the example above ca0_data/dummy0.log) and thus a data collection can be run 'unattended', and the output can be examined afterwards on a video terminal. The command LOG enables the  user to close the current log file and to open a new one.

CD0> LOG<CR>
Log-file [ ca0_data/dummy0.log]: delft<CR>
% -I- Open Log-File  ca0_data/delft.log
%CA0-Logging stopped at: 30-MAR-97 15:47:13

The newly created log-file delft.log starts with the message:
% CA0-logging started at: 30-MAR-97 15:47:14
% From previous-log-file: ca0_data/dummy0.log

The old log-file dummy0.log ends with the message:
% -I- Open Log-File ca0_data/delft.log
% CA0-logging stopped at: 30-MAR-97 15:47:13

Some informative commands can be given on the CD0> prompt.
 
TIME: This gives the date and time.
VERSION: This gives the version of the program.
SHOWSW and SETSW see CAD4 General Operator Rules Optional terminal output
! With ! a comment can be given. This has no effect on the  program, but the comment will appear in the log file.
CAPRT With this command the user can disable or enable printing on the CAD4-terminal

Terminating CAD4 operations

To exit the CAD4 system the user must first ensure that the  operating program is idle and waiting for input i.e. the CAD4 prompt CD0> is displayed. This will usually be the case when wishing to exit. IF not it may be achieved by:

CD0> EXITXX<CR>
If, by some reason no command can be given, all processes for cad4 number 0 can still be finished by abort_cad4 0. In fact one should always do this if the cad4 process is not finished  by EXITXX to be sure that no (hidden) processes are runnning in the background and that configuration files are treated in the right way.


Changing file assignments

As explained in section B of this Chapter there are 3 I/O files used by the CAD4-programs. During the operation the operator has full control on the file assignments to the programs logical units 1 upto and inclusive 3. Access to this procedure is obtained by typing GONCON in response to the CAD4-prompt
CD0>. The program returns five keywords which pertain to the different files.

CASPAR, GCONST, FCRYST, FILDAT, FILHKL?
 
 
CASPAR gives access to the file containing the CAD4 system electronic and communication parameters (see GCONST parameters)
GCONST gives access to the file containing the mechanical goniometer parameters (see GCONST parameters)
FCRYST software selector for file linked to logical unit # 1
FILDAT software selector for file linked to logical unit # 2
FILHKL software selector for file linked to logical unit # 3

The file ca0_para contains the names of the files currently linked to the CAD4 program's logical unit numbers (LUN's), together with all information accessible through GCONST and CASPAR. It is a binary file, so printing of or external access to ca0_para is impossible.

When the CAD4 program is started and there is no crystal file available, a new CRY-file will be created with the Nonius default Datcin parameters for an average medium sized organometallic crystal with Mo-radiation. The Filterfactor (FF) is set to 15.0, the orientation matrix (RO) is zero and the list of reflections is empty. When a new crystal-file is created with GONCON, FCRYST command and there is an old crystal-file available the contents of this file will be copied to the new file.

Examples to assign new file names with the GONCON command:
CD0>GONCON
CASPAR, GCONST, FCRYST, FILDAT, FILHKL? FCRYST
unit 1 = ca0_para/test02.cry
file has   28 records of 512 bytes.
Do you want to assign an other file? N<CR>
CASPAR, GCONST, FCRYST, FILDAT, FILHKL? FILDAT
unit 2 = ca0_para/example.dat
file not found! Do you want it to be created? N<CR>
specify file 2: test02<CR>
file has 2383 records of 64 bytes.
Do you want to assign another file? N<CR>
CASPAR, GCONST, FCRYST, FILDAT, FILHKL? FILHKL
unit 3 = ca0_data/testdem.hkl
file has 1 records of  64 bytes
Do you want to assign an other file? Y<CR>
specify file 3: test02<CR>
file not found! Do you want it to be created? Y<CR>

Note:
It is good practise to keep filenames the same for a given crystal, i.e. unit 1, 2 and 3 have file name specifications like:

ca0_data/sugar.cry
ca0_data/sugar.dat and
ca0_data/sugar.hkl
Other commands to assign new names to the files

Because the procedure to assign new filenames with GONCON is rather time consuming, the following commands can also be used.
 
NEWCRY file_name connection to new .cry file
NEWDAT file_name connection to new .dat file
NEWHKL file_name connection to new .hkl file
OLDCRY file_name connection to old .cry file
OLDDAT file_name connection to old .dat file
OLDHKL file_name connection to old .hkl file

If an old filename is assigned with NEWCRY, NEWDAT or NEWHKL an error message is given:

"0121F Newfile: Not creating ca0_data/yyyxxx.cry, it already exist."

This is also the case if with OLDCRY, OLDDAT or OLDHKL the given file does not exist:

"0120F Oldfile:ca0_data/xxxyyy.dat does not exist."

In connection with all this the following command is convenient:
 
 FILES overview of used files

With the command

NEWCMP xxxxxx

all files will get the same name  xxxxxx, i.e. xxxxxx.cry, xxxxxx.dat and xxxxxx.hkl. For xxxxxx  6 numerical or alphabetic are demanded. This command will be  used at the start of the measurements for a new crystal. Also the name of the log file is changed to xxxxxx.log

With the command

DISTRB xxxxxx

all files will get the name  dummy0 and all files starting with xxxxxx will be saved in a  subdirectory of ca0_data. This command will be used at the end of the measurements on a crystal.

Note:
The following names should not be used:
config, master, gonca0, dummy0 (for cad4 number 1 gonca1 and dummy1 etc.). Other subdirectory names of ca0_data are also no good crystal identification code for NEWCMP and DISTRB.

Obtaining and terminating a CAD4-dialogue session

It has been mentioned before that from any HOST-terminal it is possible to obtain the CAD4-dialogue on your terminal (section D).

When leaving the programs in this way the HOST resident programs will remain active. If the operator program is activated while another operator uses the CAD4 the program returns for instance the message:

"Device ttyd2 already in use by cad4 nr. 1 with process id 25404"

This means that the same port (defined by the file rs232_port.xxxxx in ca'n'_config) is used by different cad4 numbers.

Explanation of the GCONST and CASPAR parameters

The GCONST parameters have the following functions.
 
CON1 defined in Chapter II, section B
CON2  defined in Chapter II, section B
CON3 defined in Chapter II, section B
THPOS maximum allowable Theta-value in degrees
THNEG minimum allowable Theta-value in degrees
PDIST distance in mm from the center of the goniometert to the position of the fluorescent screen (Polaroid camera)
RADIUS distance in mm from the center of the goniometer to the aperture disk
SLIT vertical height in mm of the manually insertable slit in front of the detector
APMAX maximum horizontal size in mm of the continuously variable slit
APMIN  minimal horizontal size in mm of the continuously variable slit
MAXVAR encoder position referring to APMAX position of the aperture disc
MINVAR encoder position referring to APMIN position of the aperture disc
UPPERH   encoder position referring to upper half-aperture position of the aperture disc
LOWERH encoder position referring to lower half-aperture position of the aperture disc
NEGSL encoder position referring to negatively slanted slit position of the aperture disc
POSSL  encoder position referring to positively slanted slit position of the aperture disc
VSLIT encoder position referring to vertical slit position of the aperture disc
HSLIT encoder position referring to horizontal slit position of the aperture disc
 HOLE encoder position referring to 9 mm aperture position of the aperture disc

Examples:
CD0>GONCON
CASPAR, GCONST, FCRYST, FILDAT, FILHKL? GCONST
Gconst;I,M,O,S: O<CR>
CON1  = 0.5870635
CON2  = 0.6426014
CON3  = 0.0001788
THPOS =  78.00
THNEG = -49.00
PDIST =  78.50
RADIUS= 173.
SLIT  = 6.0
APMAX = 5.9
APMIN = 1.3
MAXVAR= 2434
MINVAR=  254
UPPERH= 3723
LOWERH= 3476
NEGSL = 2777
POSSL = 3135
VSLIT = 3315
HSLIT =   66
HOLE  = 2560
Gconst;I,M,O,S: M<CR>
'SLIT<CR>
SLIT  = 6.0
4.0<CR>
Q<CR>
Gconst;I,M,O,S: S<CR>

Entries in CASPAR are:
HV detector high voltage setting in volts
LL lower level setting in units
WD window setting units
DT dead-time in micro seconds (for LSI/FALCON interfaces)
GA gain (for MACH3 interface)
BR baudrate setting of interface terminal(for LSI/FALCON)
ID motor stop id (for MACH3)
PA positioning accuracy (do not change)
MT motor gain for THETA motor
MP motor gain for PHI motor
MO motor gain for omega motor
MK motor gain for KAPPA motor
MD motor gain for DIAL motor
FL flagword with entry for options:
phi-limit switch
special collision area
kappa-limit switch for the Helium cryostat
"turbo-CAD4" special motors with increased scan speeds
rotating anode generator
EM emission level setting

Of course, the LL+WD sum cannot be greater than the allowed range, i.e. the sum of LL+WD as input cannot be greater than 1275. The program will adjust WD if necessary to ensure the range is not exceeded. A procedure is given in Chapter XIII for chosing HV, LL and WD. Their default values are 627 V for HV, 120 units for LL and 720 units for WD.

The dead-time constant occupies two contiguous words in the data block. The permitted range of the dead-time is 0 - 5 microsec. A procedure is given in Chapter XIII for determining the dead-time. A normal value for DT is 1.00 microsec.

Note that the baudrate BR is for controlling the  transmission speed between the 546 interface and the CAD4 terminal (Target terminal). This transmission speed is independent of that for the link between the host computer and the 546 interface.

The positioning accuracy and motor-gain entries are usually set only by NONIUS engineers. Their values should be permanently recorded. Guidance from NONIUS should be obtained before any of these values are modified. This is also valid for the motor values and the encoder absolute zero positions in the MACH3 interface. If they are not yet  determined the program will prompt during startup:

WARNING : One or more absolute zero positions are not initialized.
To skip the zeroing procedure (normally only the first time during installation to supply the caspar parameters) a file  named ca0_config/skip.zero has to be present (can be created in the workdirectory by:

touch ca0_config/skip.zero

Then the program will prompt during the startup:

  ****************************************
  * Caution : zeroing procedure skipped. *
  ****************************************

If the right values are filled in, the file ca0_config/skip.zero has to be removed again. The FL word carries five entries which indicate if the phi limit switch is installed, the special hardware collar is installed, the kappa unit limit switch is installed (for the liquid helium cryostat), the turbo CAD4 or a rotating anode generator is used. The operator is prompted for Yes/No answers to questions concerning these devices. More than one entry can be effective simultaneously.

Examples:

CD0>GONCON
CASPAR, GCONST, FCRYST, FILDAT, FILHKL? CASPAR
Caspar;I,M,O,S: O<CR>
photomultiplier High Voltage is 672. volts.
Lower Level discriminator value is 60.
discriminator WinDow value is 580.
Dead-Time for correction is 1.0000 mmsec.
cad4 terminal BaudRate is 9600.
axes Positioning Accuracy limit is 2. steps.
Motorgain for Theta is 24.
Motorgain for Phi is 26.Motorgain for Omega is 24.
Motorgain for Kappa is 24.
Motorgain for Dial is 24.
you are assumed to have a Turbo Goniometer
your generator is supposed to be a Rotating Anode Generator
Emission level setting is 60.0 mA.
Caspar;I,M,O,S: M<CR>
Object: HELP<CR>
possible objects are: HV LL WD DT BR PA MT MP MO MK MD FL EM
Object: HV<CR>
photomultiplier High Voltage is 672. volts. Enter HV:
580<CR>
Object: WD<CR>
discriminator Window value is 1000. Enter WD:
450<CR>
Object: DT<CR>
Dead-Time for correction is 1.0000 mmsec. Enter DT: 1.1<CR>
Object: Q<CR>
Caspar;I,M,O,S: S<CR>
CD0>

CD0> goncon<CR>
Caspar, Gconst, Fcryst, Fildat, Filhkl? caspar<CR>
Caspar;I,M,O,S,P: o<CR>
photomultiplier High Voltage is  125. volts.
Lower Level discriminator value is   40.
discriminator Window value is  130.
Gain is :  200.
Motor stop ID is 3.
axes Positioning Accuracy limit is  30. steps.
Motorgain for Theta is   100.
Motorgain for Phi is   150.
Motorgain for Omega is   100.
Motorgain for Kappa is   150.
Motorgain for Dial is   125.
view position 0 and 1 used on pocket terminal
Pulse shift correction is turned on
your generator is supposed to be a 591 Generator
Caspar;I,M,O,S,P: p<CR>
Select motor TH,PH,OM,KA,DL or ENcoders : th<CR>
Motor :TH
Maximum acceleration is  0.05000
Maximum velocity is 33.00000
Integral feedback factor is   100.
Differential feedback factor is   156.
Integration limit factor is   500.
Derivative sample interval is 20.
Select PID feature AC,VE,IF,DF,IL,DS: q<CR>
Select motor TH,PH,OM,KA,DL or ENcoders : ph<CR>
Motor :PH
Maximum acceleration is  0.05000
Maximum velocity is 45.00000
Integral feedback factor is   150.
Differential feedback factor is   150.
Integration limit factor is  1000.
Derivative sample interval is 10.
Select PID feature AC,VE,IF,DF,IL,DS: q<CR>
Select motor TH,PH,OM,KA,DL or ENcoders : om<CR>
Motor :OM
Maximum acceleration is  0.05000
Maximum velocity is 33.00000
Integral feedback factor is   100.
Differential feedback factor is   110.
Integration limit factor is  1000.
Derivative sample interval is 12.
Select PID feature AC,VE,IF,DF,IL,DS: q<CR>
Select motor TH,PH,OM,KA,DL or ENcoders : ka<CR>
Motor :KA
Maximum acceleration is  0.80096
Maximum velocity is 33.00000
Integral feedback factor is 75.
Differential feedback factor is   250.
Integration limit factor is  1000.
Derivative sample interval is 10.
Select PID feature AC,VE,IF,DF,IL,DS: q<CR>
Select motor TH,PH,OM,KA,DL or ENcoders : dl<CR>
Motor :DL
Maximum acceleration is  0.05000
Maximum velocity is  5.00000
Integral feedback factor is 75.
Differential feedback factor is   250.
Integration limit factor is  1000.
Derivative sample interval is 10.
Select PID feature AC,VE,IF,DF,IL,DS: q<CR>
Select motor TH,PH,OM,KA,DL or ENcoders : en<CR>
For Theta : Abs. zero - index =  3553
For Phi   : Abs. zero - index = -2746
For Omega : Abs. zero - index = -3897
For Kappa : Abs. zero - index =   126
For Theta : Zero switch - index =  3058
For Phi   : Zero switch - index =  3496
For Omega : Zero switch - index =  2681
For Kappa : Zero switch - index = -1675
For Dail  : present position =  0
Select zero feature TA,PA,OA,KA,TZ,PZ,OZ,KZ : q<CR>
Select motor TH,PH,OM,KA,DL or ENcoders : q<CR>
Caspar;I,M,O,S,P: q<CR>
Caspar, Gconst, Fcryst, Fildat, Filhkl? q<CR>
CD0>



Previous: CAD4 General Operator Rules
Next: CAD4 Control commands

(C) Nonius BV, 1999, 2000. Last change 21 December 2000