spec

Software for Diffraction

setpowder

Configure powder mode scans

DESCRIPTION

The setpowder macro is used to turn powder mode on or off. Powder mode rocks a designated motor back and forth over a fixed distance at each point of scans involving other motors. Usage is:

setpowder [[+|-]uni] [[+|-]slew] motor full_width
turns powder mode on for designated motor and width.
setpowder off
turns powder mode off.
setpowder
turns powder mode on, asks for parameters and settings.

The [+|-]uni option turns unidirectional scanning on or off. The [+|-]slew option turns setting the motor speed from the count time mode on or off.

When powder mode is on, the powder motor will be rocked the full width specified at each point in a scan. Counts will be accumulated while the motor is moving. Powder mode works by redefining the standard scan_move and scan_count macros, used by all the standard scans that move motors. Note, though, the continuous scan (cscan) and fly scan macros should not be used with powder mode on.

The syntax for invoking scans remains unchanged. The count-time parameter is still required. Its value will be used to set the powder-mode motor's speed, if the slew option is selected.

By default, the powder mode moves the rocked motor in opposite directions at successive points to save time. If unidirectional mode is selected, the motor is scanned in the same direction for each point with the direction determined by the sign of the full_width parameter. The motor movements do not include backlash corrections in either case. At the end of the scan, or if the scan is aborted, the rocked motor will be returned to its position at the start of the scan, correcting for backlash.

By default, the motors are rocked at the base rate as configured in the config file. To accommodate a faster rocking speed that requires accelerating from a base rate or a powder speed different from the base rate, the following motor_par() motor parameters are available: "powder_base", "powder_slew" and "powder_acceleration". The values for the first two parameters are set to the motor base rate and the last to the motor acceleration when spec starts up and on every reconfig command (or config macro invocation). If the "powder_slew" value is less than the "powder_base" value both the base and slew rates are set to the "powder_slew" value.

If the slew option is selected, the "powder_slew" speed is replaced with a value equal to the full_width times the motor's steps per unit ("step_size" in the config file) divided by the count time. If counting to monitor counts (a negative count time), the MON_RATE global variable is used to estimate the scan time per point.

(The spec support for certain vintage motor controllers, namely the 18011, CM3000, CM4000, E500, ES_OMS, ES_VPAP, HUB9000, IP28, MC4, MCB, SIX19, SMC and XRGCI_M, does not recognize the "powder_*" parameters. Contact CSS to discuss the feasibility of adding support for the parameters for any of these controllers.)

INTERNAL MACROS

setpowder turns power mode on or off.

powder_cleanup restores the powder motor to its starting position.

powder_setup() assigns _cp0 to the current position of the powder motor, sets up calls to powder_cleanup for the end of the scan, and sets the powder slew speed based on the count time (if that mode is enabled).

_pmove is used as scan_move when powder mode is on.

_pcount is used as scan_count when powder mode is on.

GLOBALS

_pmotflag - Flag that holds powder mode settings bits.

_cp0 - Center position of powder motor at start of scan.

MACROS

setpowder

powder_cleanup

powder_setup()

_pmove

_pcount