spec

Software for Diffraction

set_sim()

set simulate (no hardware) mode

DESCRIPTION

Simulate mode allows a user to exercise the program without accessing any of the hardware interfaces (for the most part, see below) or updating the motor-settings file.

The function set_sim() is used to turn simulate mode on and off.

set_sim(0)
Turns simulate mode off. Returns previous state.
set_sim(arg)
Turns simulate mode on if arg is greater than zero. If bit 4 (0x10) is set in arg, the user-level sleep() function is simulated, that is, spec does not sleep (as of spec release 6.00.06). Returns previous state.
set_sim(-1)

Doesn't change mode, but returns current state. Bit assignments in the return value are as follows:

Bit 0 0x01 Simulate mode by set_sim() command
Bit 1 0x02 Simulate mode on start up (-s flag)
Bit 2 0x04 No write access to settings file
Bit 3 0x08 Hardware locked by another user
Bit 4 0x10 User-level sleep simulated

Both set_sim(0) and set_sim(arg), where arg is greater than zero, wait for moving and counting to finish before changing the mode. Also set_sim(0) always rereads the motor settings file to restore the motor positions.

Access to the user-level socket interface is disabled when in simulate mode, but can be left on by using the command sock_par("ignore_sim", 1). See the sockets help file for details.

Simulate mode is turned on when spec is invoked with the -s flag and can't be turned off without restarting spec. If there is no write access to the spec settings file or if the hardware is locked because another user is running an instance of spec using the same hardware configuration file, simulate mode is also turned on. Prior to spec release 6.03.10, in such cases, simulate mode could not be turned off without restarting spec. With release 6.03.10, the reconfig command will turn off simulate mode if write access is restored or the other user has quit spec and unlocked the hardware.

Users normally use the macros onsim and offsim to turn simulate mode on and off. The macros document the changes in the data file.

The config macro automatically invokes edconf with the -s flag when simulate mode is on. This means the configuration file can't be changed using config when in simulate mode.

SEE ALSO

spec config