diff --git a/documentation/trajectoryScan.html b/documentation/trajectoryScan.html index 22aa01d4..ed68e532 100644 --- a/documentation/trajectoryScan.html +++ b/documentation/trajectoryScan.html @@ -5,37 +5,60 @@

Trajectory Scanning with the Newport MM4005 and XPS Motor Controllers

Mark Rivers

-

January 20, 2007

+

June 29, 2007

Contents

-

-

Overview

+

 

+

+ Overview

The Newport MM4005 and XPS motor controllers are capable of executing complex -coordinated motions. Trajectories can be defined which move any or all of +coordinated motions. Trajectories can be defined that move any or all of the axes through any set of complex motions. The controller will coordinate these motions, keeping each axis very close to the theoretical position during the entire motion. The controller can output logic pulses during the execution of the trajectory, permitting external equipment to be synchronized to the -motion. These capabilities are ideally suited to “on-the-fly” data +motion. These capabilities are ideally suited to “on-the-fly” data collection.

At the APS one application of the MM4005 and XPS is to drive the large Newport @@ -44,7 +67,8 @@ the mass of the moving elements. However, with this trajectory scanning software one can use SPEC, for example, to compute a set of diffractometer positions for a scan in HKL space, and then download these positions to the controller. The entire scan can be executed without stopping, collecting data in a multi-channel -scaler. This can reduce data collection times dramatically relative to +scaler or other triggered buffering detector. +This can reduce data collection times dramatically relative to traditional step scanning.

This document describes an EPICS interface to the trajectory capabilities of @@ -62,7 +86,7 @@ access client do the following:

  • Define detector triggers to start detectors at the beginning of the trajectory and stop them at the end of the trajectory.
  • Build and verify the trajectory, checking for errors. -
  • Define a total time scaling factor from .01 to 100 which will speed up or +
  • Define a total time scaling factor from .01 to 100 that will speed up or slow down the trajectory execution relative to its original definition (MM4005 only).
  • Execute the trajectory, checking for completion and errors. This can be done repeatedly without rebuilding if the only changes are in the start @@ -73,13 +97,14 @@ access client do the following:

    synchronization pulse was output. -

    -

    Implementation

    +

     

    +

    + Implementation

    The EPICS implementation consists of the following:

    -

    -

    Safety

    +

     

    +

    + Safety

    The MM4005 and XPS are used at the APS to control the large Newport diffractometer. This device is capable of moving large masses at high speeds. The trajectory scanning software does not use the EPICS motor record, and so @@ -101,7 +127,10 @@ important that:

  • The controller be programmed via the front panel (MM4005) or Web interface (XPS) to have safe software limits to prevent collisions whenever possible. The trajectory scanning software does - obey the MM4005 and XPS internal soft limits. + obey the MM4005 internal soft limits. However, the MultipleAxesPVTExecution command + on the XPS does not obey the soft limits! The XPS trajectory scan SNL code + checks that the limits of the trajectory do not exceed the soft limits, and will not + execute the trajectory if they do.
  • Care be taken to avoid trajectory execution whenever personnel could be harmed. The following error thresholds for each axis on the controller should be set tight enough that the motor power will turn off when a significant @@ -111,9 +140,11 @@ important that:

    vulnerable positions on the diffractometer. -

    -

    Notation

    -

    The database is loaded with $(P) (prefix) and $(R) +

     

    +

    + Notation

    +

    +The database is loaded with $(P) (prefix) and $(R) (record base) macros. For example, $(P) might be 13IDC: for the name of the IOC, and $(R) might be Traj1: for the first trajectory in this IOC. The prefix and @@ -123,22 +154,25 @@ aware that, for example, Nelements is really $(P)$(R)Nelements or in this case 13IDC:Traj1:Nelements.

    -

    There are 8 motors in the database, and thus 8 similar records for many +

    +There are 8 motors in the database, and thus 8 similar records for many functions. For example, the records defining the trajectory positions are M1Traj, M2Traj ... M8Traj. These are referred to in this document either as M1Traj ... M8Traj or as MnTraj.

    -

    -

    -

    Defining a Trajectory

    -

    The MM4005 and XPS always define a trajectory in terms of displacements (i.e. +

     

    +

    + Defining a Trajectory

    +

    +The MM4005 and XPS always define a trajectory in terms of displacements (i.e. relative positions) of each motor for each element of the trajectory. Each trajectory element has an execution time associated with it, and hence there is a velocity defined for each motor (displacement/time) for each trajectory element. The MM4005 supports trajectories of up to 2000 elements, while the XPS -supports an essentially unlimited number of elements

    +supports an essentially unlimited number of elements.

    -

    During execution of the trajectory the MM4005/XPS can output a user-definable +

    +During execution of the trajectory the MM4005/XPS can output a user-definable number of logic pulses.  The trajectory elements where these output pulses begin and end can also be selected. On the MM4005 these pulses are evenly spaced in distance along the trajectory, which is a distance in up to 8-dimensional space. On the XPS @@ -149,13 +183,15 @@ no software overhead at each point. At the time that each pulse is output the controller captures the theoretical and actual (encoder) position of each motor. These positions can be read back when the trajectory is complete.

    -

    It is important to remember that the number of data points in a scan is +

    +It is important to remember that the number of data points in a scan is determined by the number of output pulses, not by the number of trajectory elements. For example, a constant velocity theta/2-theta scan over 10 degrees can be defined with a only 1 trajectory element, but could be used to collect 1000 data points at .01 degree steps.

    -

    The following table lists the EPICS Process Variables (PVs) which are used to +

    +The following table lists the EPICS Process Variables (PVs) that are used to define the trajectory. Some of these are explained in more detail below.

    @@ -166,7 +202,8 @@ define the trajectory. Some of these are explained in more detail below.

    - + @@ -233,16 +270,9 @@ define the trajectory. Some of these are explained in more detail below.

    TimeMode=Total, and must be loaded by the user if TimeMode=Per Element. - + - - - -
    NumAxes longoutThe number of motors (axes) which are connected to the MM4005 or XPS.
    The number of motors (axes) to be moved. For the MM4005 this is the total number + of axes connected. For XPS it is the number of axes in this MultipleAxes group.
    Nelements longout
    AccelAccel(MM4005 only) ao The acceleration time for the trajectory. Default=0.5 seconds.
    M1Name ... M8NamestringoutThe name of each motor. These are used for the labels on MEDM screens - and by channel access clients. These names are defined when the database - is loaded. These PVs are not otherwise used and are not required for the - trajectory definition.
    @@ -253,7 +283,7 @@ access client and let the SNL program do the calculations. MoveMode can have the following 3 values:

    +

    Note that when programming TimeTraj in Absolute or Hybrid mode TimeTraj[i] is the time to execute the move from position MnTraj[i] to MnTraj[i+1].

    +

    The MM4005 requires the number of elements in a trajectory to be a multiple of 4. This means that Nelements should be a multiple of 4 in @@ -306,45 +338,74 @@ padding elements will cause the trajectory to execute for up to 0.3 seconds longer than requested, and the motors will move slightly farther than requested. However, there will be no velocity change, and hence no unexpected accelerations during the padding elements.

    -

    The number of trajectory elements, Nelements is limited as + +

    The MM4000 has a concept of accelerating onto the trajectory, so that the time +per trajectory element will actually be longer than the specified times for the +first few and last few trajectory elements, as the motors accelerate and deccelerate. +This is typically normalized out during data processing by having a scaler channel +that measures the time (or integrated incident intensity) during each trajectory element. + +

    +The XPS does not do this acceleration automatically, rather the acceleration must be explicitly +defined in the trajectory file that is downloaded to the XPS. The XPS SNL program adds +one padding element at the beginning of the file and one padding element at the end of +the file. The first padding element is calculated to be the minimum time to accelerate +all of the motors from 0 to the velocity of the first actual trajectory element. +This time is calculated using an acceleration of 90% of the maximum allowed +acceleration for each axis (to avoid roundoff problems). It also calculates how far +each axis moves during this acceleration time. +Similarly the final padding element is calculated to be the minimum time to deccelerate +all of the motors from the velocity of the last actual trajectory element to 0. +These padding elements cause the actual range of motion of each of the motors +to be somewhat larger than the range in the trajectory itself. This means that trajectories +cannot execute right up to the software or hardware limits for an axis, because there +will not be room for the acceleration motion. + +

    +The number of trajectory elements, Nelements is limited as follows.

    + the database is loaded.
  • + +

    The number of output pulses, Npulses is limited as follows.

    + limit, and all arrays are double precision, requiring 8 bytes per element. +
  • There are 16 double precision arrays that are dimensioned + MAX_PULSES in the SNL program, and 16 waveform records + (MnActual and MnError) that are dimensioned + NPULSE in the database. If 2000 points are allowed then the total + memory used in the IOC is 2000*16*8*2 = 512,000 bytes. This is a significant + amount of memory for an IOC. MAX_PULSES is presently defined + to be 2000 in the SNL program. This value can be changed (up to 2000 for the MM4005) or + and the SNL program recompiled. The value of NPULSE + must be set to exactly the value of MAX_PULSES + when the database is loaded.
  • + +

     

    -

     

    -

    Building a Trajectory

    +

    + Building a Trajectory

    After a trajectory has been defined by setting the values of the PVs described in the previous section it must be built before it can be executed. -Building the trajectory consists of downloading it to the MM4005 and checking it +Building the trajectory consists of downloading it to the controller and checking it for errors such as excess velocities or accelerations.

    -

    The following table describes the EPICS PVs used for building a +

    +The following table describes the EPICS PVs used for building a trajectory.

    @@ -395,11 +456,12 @@ trajectory.

    - + - @@ -408,11 +470,11 @@ trajectory.

    - + - @@ -424,7 +486,8 @@ trajectory.

    The trajectory element number where MnMDVA occurs. The acronym is Maximum Delta Velocity Element. Read-Only.
    M1MVA ... M8MVA (MM4005 only)M1MVA ... M8MVA aoThe actual maximum velocity. This value is read from the MM4005 after + The actual maximum velocity. This value is read from the controller after the trajectory is built. MnMVE gives the specific trajectory - element in which this maximum velocity occurred. If MnMVA is + element in which this maximum velocity occurred (MM4005 only). + If MnMVA is greater than the maximum velocity allowed for this motor then the build will fail. The acronym is Maximum Velocity Actual. Read-Only.
    The trajectory element number where MnMVA occurs. The acronym is Maximum Velocity Element. Read-Only.
    M1MAA ... M8MAA (MM4005 only)M1MAA ... M8MAA aoThe actual maximum acceleration. This value is read from the MM4005 + The actual maximum acceleration. This value is read from the controller after the trajectory is built. MnMAE gives the specific - trajectory element in which this maximum acceleration occurred. If + trajectory element in which this maximum acceleration occurred (MM4005 only). If MnMVA is greater than the maximum acceleration allowed for this motor then the build will fail. The acronym is Maximum Acceleration Actual. Read-Only.
    -

    Channel access clients should do the following to build a trajectory:

    +

    +Channel access clients should do the following to build a trajectory:

    -

    If the build fails then it is useful to look at the +

    +If the build fails then it is useful to look at the trajectoryScanDebug.adl MEDM screen to examine the maximum velocity and acceleration values. See if one or more motors is being commanded to move too fast.

    +

     

    -

     

    -

    Executing a Trajectory

    +

    + Executing a Trajectory

    After a trajectory has been successfully built it can be executed. The trajectory execution consists of the following steps:

    @@ -458,11 +523,14 @@ trajectory execution consists of the following steps:

  • When the trajectory is complete:
  • +
  • Command the EPICS motors to move to the final position in the trajectory. This does + not actually move the motors, but syncs the EPICS motor VAL and RBV fields + to the actual motor positions. + -

    The following table describes the EPICS PVs used for executing a +

    +The following table describes the EPICS PVs used for executing a trajectory.

    @@ -543,7 +611,8 @@ trajectory.

    -

    Channel access clients should do the following to execute a trajectory:

    +

    +Channel access clients should do the following to execute a trajectory: