CutOrMap

Here are the rules that apply, if a cut or a mapping point has been set for a motor:

 It is possible to set a cutting point which cannot be passed through by a motor movement.

 If a cut has been set, the position of the motor varies in the range [cut, cut + 360[. If a position is outside this range, it will be re-calibrated. Target positions are automatically mapped into that range.

 It is possible to set at mapping point which limits the range of a motor position, [map, map + 360[.

 If a mapping point hast been set, motor positions are automatically re-calibrated after a movement.

 If a mapping point hast been set, Online choses the shortest way for movements.

 Cutting point and mapping point are mutually exclusive.

 It is possible that a motor has neither a cut nor a mapping point.

 Motor limits can be set to any value and they are respected.

 Cuts and mapping points are respected no matter whether a motor is moved by the diffractometer software or not.

Examples:

 
1. Cut_position: -180, limits: -180, 180  
   current position: 175, target: -175, move: 350 units 

2. Cut_position:    0, limits: 0, 360
   current postion:   5, target:  355, move: 350 units

3. Map_position = 0, limits: -500, 500
   current position:  5, target 355, move: 10 units to -5, 
   then calibration to 355. limits stay: -500, 500

4. Map_position = -180, limits: -500, 500
   current position:  175, target -175, move: 10 units to 185, 
   then calibration to -175, limits stay: -500, 500

5. Map_position = -180, limits: -500, 500
   current position:  175,  target: -175, moving 10 units to 185, 
   then calibrate to -175, limits stay: -500, 500

Implementation:

set_motor_flag_cutormap(mot1) = 0  ! CutOrMap is ignored  
set_motor_flag_cutormap(mot1) = 1  ! CutOrMap is a cut
set_motor_flag_cutormap(mot1) = 2  ! CutOrMap is a mapping point

set_motor_cutormap(mot1) = someValue

* = get_motor_flag_cutormap(mot1)
* = get_motor_cutormap(mot1)

Getting started:

! file exp_ini.exp

USE_CUT_OR_MAP = 1

Before this feature is used for the first time at a beamline the flag USE_CUT_OR_MAP should be set to 0 and the following script should be executed. This brings all motors into a save position in the sense that CutOrMap is ignored. In the following CutOrMap can be enabled for selected motors.

 
#!/bin/env perl

use Spectra;

foreach my $mot (Spectra::get_motors())
{
  Spectra::set_motor_flag_cutormap( $mot, 0);
}