deviceControl Record Reference Manual

William Rambold , Jennifer Dunn, Angelic Ebbers

deviceControl/01

This document describes the deviceControl record created by the Herzberg Institute of Astrophysics.

Introduction

Purpose

This document describes the deviceControl record created by the Herzberg Institute of Astrophysics team for integrated control of direct current (DC) and Stepper Motor positioned devices.

Scope

This document defines the interface to the deviceControl record only. For a list of EPICS records created by and for the GEMINI project see the Gemini Record Reference Manual [3]. For a complete list of the standard EPICS records, and a description of the field summary tables, refer to the EPICS Input Output Controller Record Reference Manual [1].

References
  1. EPICS Input Output Controller Record Reference Manual, Janet B. Anderson and Martin R. Kraimer, Argonne National Laboratory, Dec 1, 1994.
  2. ICD 1b The Baseline Attribute/Value Interface (gscg.grp.024/04), Kim Gillies, Steve Wampler, Bret Goodrich.
  3. Gemini Record Reference Manual (spe-c-g0070/02), Bret Goodrich and Andy Foster
Revisions
Version 01, 21 November, 1998. Document Created.
Version 1.1, April, 1999.

Overview

This section will provide an overview of the record functions, then a field summary for the record. The next section is a configuration section on how to configure this record, followed by a section detailing the operation of the record. Finally there is a section on details for the support modules that make up this record.

Record Overview

This record has been designed to provide a higher level of moving device control than the standard Motor or Steppermotor records. As well as controlling device position it also incorporates the functionality of the Gemini CAD and CAR records [3] to allow checking of input arguments before they are applied and monitoring the motion command status.

The deviceControl record communicates directly with the selected motor drive interface electronics via integrated device support. Current device support is limited to Oregon Micro Systems OMS 8 and OMS 44 VME boards.

General features of the deviceControl record include:

  • Independent control of device position, velocity and acceleration.
  • Single motion and position tracking modes.
  • Optional control of external brake and motor power.
  • Encoder support.
  • Named position translation.
  • Automatic home sequencing.
  • Full error and exception handling and reporting.
  • Built-in simulation modes.
  • Built in debugging modes.

New motion parameters (position, velocity etc.) are loaded into the record and the appropriate operating mode selected. The GO directive is then issued to begin the following motion sequence:

  • Power is applied to the motor (optional).
  • The brake or other locking device is removed (optional).
  • Drive electronics motion parameters are updated as required
  • Motion begins.
  • Motion is monitored until the target position is reached.
  • The brake or other locking mechanism is re-applied (optional).
  • The power is turned off (optional).

Any errors detected in the above will generate a diagnostic message explaining what happened as well as causing the motion to abort.

See Device Control Record - Primary operating fields shows the primary deviceControl record fields which are available from a configuration tool (e.g. CAPFAST).

Device Control Record - Primary operating fields

 

 

 

 

Figure 2 shows the permitted state transitions for the deviceControl record. This provides a general synopsis of the standard operational control flow.

deviceControl Record - State Transitions
Field Summary

See Field Summary is a summary of fields for a record instance. All of these fields, plus additional standard fields (see See Additional Standard Record Fields) defines the record structure that is accessed via the module code. Column 3 (DCT) indicates if the field will appear in a configuration tool, column 5 (Access) indicates if the field can be read, column 6 (Modify) indicates if a field can be written to, column 7 (Rec Proc Monitor) indicates if the field can raise a monitor, and column 8 (PP) indicates that changes to the field causes the record to be processed if set to Yes.

The field, brief description and type for the fields are listed in See Field Descriptions. Some more detailed field descriptions can be found in See Configuration See Configuration.

 

Field Summary

Field

Type

DCT

Initial

Access

Modify

Rec Proc Monitor

PP

ACCL

FLOAT

Yes

0

Yes

Yes

Yes

No

ACK

LONG

No

0

Yes

Yes

Yes

No

ADEL

FLOAT

No

0

No

Yes

No

No

ALST

DOUBLE

No

0

No

No

No

No

BRK

LONG

No

0

Yes

Yes

Yes

No

BRKL

OUTLINK

Yes

0

Yes

No

No

No

BSTA

LONG

No

0

Yes

Yes

Yes

Yes

BSYL

OUTLINK

Yes

0

Yes

No

No

No

BTMO

SHORT

Yes

0

Yes

Yes

No

No

BUSY

RECCHOICE

No

0

Yes

Yes

Yes

No

DBGL

INLINK

Yes

0

Yes

No

No

No

DBUG

RECCHOICE

Yes

0

Yes

Yes

Yes

No

DIR

RECCHOICE

No

0

Yes

Yes

Yes

Yes

DOL

INLINK

Yes

0

Yes

No

No

No

EDBD

LONG

Yes

0

Yes

Yes

No

o

EGU

STRING

Yes

0

Yes

Yes

No

No

ERES

FLOAT

Yes

0

Yes

Yes

No

No

FLT

LONG

No

0

Yes

Yes

Yes

Yes

HHSV

GBLCHOICE

No

0

No

No

Yes

No

HIGH

FLOAT

No

0

No

No

Yes

No

HIHI

FLOAT

No

0

No

No

Yes

No

HLSV

GBLCHOICE

No

0

No

No

Yes

No

HPVL

SHORT

No

0

Yes

Yes

Yes

No

HSV

GBLCHOICE

No

0

No

No

Yes

No

IALG

LONG

Yes

0

Yes

Yes

Yes

No

LLSV

GBLCHOICE

No

0

No

No

Yes

No

LMAP

ULONG

No

0

Yes

Yes

No

No

LOLO

FLOAT

No

0

No

No

Yes

No

LOW

FLOAT

No

0

No

No

Yes

No

LSV

GBLCHOICE

No

0

No

No

Yes

No

LSWA

SHORT

No

0

Yes

Yes

Yes

No

LTHP

NOACCESS

No

0

Yes

No

No

No

LVIO

SHORT

Yes

0

Yes

Yes

Yes

No

MDBD

FLOAT

Yes

0

Yes

Yes

Yes

No

MDEL

FLOAT

No

0

No

Yes

No

No

MESS

STRING

No

-

Yes

Yes

Yes

No

MIP

RECCHOICE

No

0

Yes

Yes

Yes

No

MMAP

ULONG

No

0

Yes

Yes

No

No

MODE

RECCHOICE

Yes

0

Yes

Yes

Yes

No

MLST

DOUBLE

No

0

No

No

No

No

MPOS

DOUBLE

No

0

Yes

Yes

Yes

No

MRES

FLOAT

Yes

0

Yes

Yes

No

No

MSGL

OUTLINK

Yes

0

Yes

No

No

No

MSTA

LONG

No

0

Yes

Yes

Yes

No

OMSL

GLBCHOICE

Yes

0

Yes

Yes

No

No

OSTA

SHORT

No

0

Yes

Yes

No

No

OUT

OUTLINK

Yes

0

Yes

No

No

No

PHLM

FLOAT

Yes

0

Yes

Yes

No

No

PLLM

FLOAT

Yes

0

Yes

Yes

No

No

PP

SHORT

No

0

Yes

Yes

No

No

PREC

SHORT

Yes

0

Yes

Yes

No

No

PSTA

LONG

No

0

Yes

Yes

Yes

Yes

PTMO

SHORT

Yes

0

Yes

Yes

No

No

PWR

LONG

No

0

Yes

Yes

Yes

No

PWRL

OUTLINK

Yes

0

Yes

No

No

No

RENC

LONG

No

0

Yes

Yes

Yes

No

RPOS

LONG

No

0

Yes

Yes

Yes

No

RRBV

LONG

No

0

Yes

Yes

Yes

No

RVEL

LONG

No

0

Yes

Yes

Yes

No

SIML

INLINK

Yes

0

Yes

No

No

No

SIMM

RECCHOICE

Yes

0

Yes

Yes

Yes

No

TDIR

STRING

Yes

-

Yes

Yes

No

No

TFIL

STRING

Yes

-

Yes

Yes

No

No

UAPB

RECCHOICE

Yes

0

Yes

Yes

No

No

UBSB

RECCHOICE

Yes

0

Yes

Yes

No

No

UEIP

RECCHOICE

Yes

0

Yes

Yes

No

No

UPSB

RECCHOICE

Yes

0

Yes

Yes

No

No

VAL

DOUBLE

No

0

Yes

Yes

Yes

No

VALS

STRING

No

-

Yes

Yes

No

No

VBAS

FLOAT

Yes

0

Yes

Yes

No

No

VELO

FLOAT

Yes

0

Yes

Yes

Yes

No

VERS

FLOAT

Yes

0

Yes

Yes

No

No

VHLM

FLOAT

Yes

0

Yes

Yes

No

No

VLLM

FLOAT

Yes

0

Yes

Yes

No

No

 

Additional Standard Record Fields

Field

Type

Description

General Record Fields

name

char[]

Name of record instance

desc

char[]

Descriptor

asg

char[]

Access Security Group

scan

ushort

Scan Mechanism

pini

ushart

Process at oicInit

phas

short

Scan phase

evnt

short

Event Number

tse

short

Time Stamp Event

tsel

struct link

Time Stamp Link

dtyp

ushort

Device Type

disv

short

Disable Value

disa

short

Disabled

sdis

struct link

Scanning Disable

mlok

FAST_LOCK

Monitor fastlock

mlis

ELLLIST

Monitor List

disp

uchar

Disabled putField

proc

uchar

Force Processing

stat

ushort

Alarm Status

sevr

ushort

Alarm Severity

nsta

ushort

New Alarm Status

nsev

ushort

New Alarm Severity

acks

ushort

Alarm Ack Severity

ackt

ushort

Alarm Ack Transient

diss

ushort

Disable Alarm Severity

lset

short

Lock Set

lcnt

uchar

Lock Count

pact

uchar

Record active

putf

uchar

dbPutField process

rpro

uchar

Reprocess

asp

void*

Access Security Pvt

ppn

void *

addr of PUTNOTIFY

ppnn

void *

next record PUTNOTIFY

spvt

void *

Scan Private

rset

void

Address of RSET

dset

struct deset *

DSET address

dpvt

void *

Device Private

prio

ushort

Scheduling Priority

tprio

uchar

Trace Processing

bkpt

char

Break Point

udf

uchar

Undefined

time

TS_STAMP

Time

flnk

struct link

Forward Processing Line

 

 

Field Descriptions

Name

Summary

Description

ACCL

Acceleration

Desired acceleration / deceleration rate in EGU / Sec2.

ACK

Command Acknowledge

A non-zero value on this field indicates that the last command directive was rejected and not acted upon.

ADEL

Archive Deadband

Motor position hysteresis factor triggering archiver (internal use only).

ALST

Last Value Archived

Last user position value archived (internal use only).

BRK

Brake Control

The desired motion locking device state.

BRKL

Brake Control Link

If a link is specified then changes to the BRK field will be written here.

BSTA

Brake State

Input for the current locking device state.

BSYL

Command Action Link

If a link is specified then changes to the BUSY field will be written here.

BTMO

Brake Timeout

The time (in 0.1 Sec units) that the record will wait for the brake to activate / deactivate before continuing the motion sequence. A value of zero will disable brake control.

BUSY

Command Busy

Command Action State, possible options (0..2) are:

IDLE | BUSY | ERR

DBGL

Debug Mode Link

If a link is specified then the current debug level will be read from here.

DBUG

Debug Mode

Debug output complexity level. Possible options (0..3) are:

NONE | MIN | FULL | MAX.

DIR

Command Directive

Command Control word - options (0..2) are:

STOP | CHECK | GO

DOL

Desired Output Location

If OMSL is configured for closed-loop operation the target position is read from this field.

EDBD

Encoder Deadband

Encoder update hysteresis factor. Encoder must change by +/- this ammount from the value at the end of the last move before triggering updates.

EGU

Engineering Units

Engineering unit string to be displayed on engineering screens.

ERES

Encoder Resolution

Number of encoder counts per engineering unit.

FLT

Fault

Emergency stop handle.

HIHI

Hihi Alarm Limit

High high alarm limit. (internal use only).

HIGH

High Alarm Limit

High alarm limit. (internal use only).

HHSV

HiHi Severity

High high severity. (internal use only).

HPVL

Home Position Valid

This field is non-zero when the index or home position is valid and the record is firm control of the motor.

HLSV

HW Limit Violation Svr

Hardware limit violation severity. (internal use only).

HSV

High Severity

High severity. (internal use only).

IALG

Index Algorithm

Indexing method for this device.

LMAP

Link Bitmap

Bitmap for links to be triggered. (internal use only)

LSWA

Limit Switch Active

This field goes non-zero when a soft limit has been detected by the motor drive electronics.

LOLO

Lolo Alarm Limit

Low low alarm limit. (internal use only).

LOW

Low Alarm Limit

Low alarm limit. (internal use only).

LLSV

Lolo Severity

Low low severity. (internal use only).

LSV

Low Severity

Low severity. (internal use only).

LTHP

Lookup Table Head Pointer

The address of the head of the translation table linked list.

(internal use only)

LVIO

Limit Violation

This field is set to non-zero if the given target position or the current motor position exceed the PHLM / PLLM range.

MDBD

Motion Deadband.

The motion deadband region around the current motor position.

MDEL

Monitor Deadband

Change in monitored value deadband.

MESS

Error Message

The current error message string is written to this field.

MIP

Motion in Process

The current state of the motion cycle, possible values are:

STOPPED | BEGINNING | MOVING | HOLDING | ENDING | ERROR

MLST

Last value monitored

Last monitored user position value. (internal use only).

MMAP

Monitor Bitmap

Bitmap for fields to have monitors raised. (internal use only)

MODE

Operating Mode

The prevailing motion type - options (0..5) are:

INIT | MOVE | TRACK | INDEX | PARK | TEST

MPOS

Motor Position

Current position in engineering units.

MRES

Motor Resolution

Number of motor steps per engineering unit.

MSGL

Error Message Link

If a link is specified then changes to the MSG field will be written here.

MSTA

Motor Status

Motor status word returned by device support.

OMSL

Output Mode Select

Set the output mode: open_loop or supervisory. (not yet implemented)

OSTA

Operating State

Current state machine operating state. (internal use only)

OUT

Output Specification

Motor address specification string.

PHLM

Position High Limit

Maximum valid target position in engineering units.

PLLM

Position Low Limit

Minimum valid target position in engineering units.

PP

Post Process Flag

Asynchronous processing requests command completion.

(internal use only)

PREC

Precision

Display precision for VAL and MPOS fields.

PSTA

Power State

The input for the current power state.

PTMO

Power Timeout

The time (in 0.1 Second units) that the record will wait for the motor to energize / de-energize before continuing with the motion sequence. A value of zero will disable motor power control.

PWR

Power Control

The desired device power state.

PWRL

Power Control Link

If a link is specified then changes to the PWR field will be written here.

RENC

Raw Encoder Value

Raw encoder value returned by device support.

RPOS

Raw Position

Raw target position written to device support.

RRBV

Raw Readback Value

Raw device position returned by device support.

RVEL

Raw Velocity

Raw motion velocity written to device support.

SIML

Simulation Mode Link

If a link is specified then the current simulation mode will be read from here

SIMM

Simulation Mode

Motion Simulation mode. Possible values are: NONE | VSM | FAST | FULL. (0..3)

TDIR

Translation File Directory

Directory name for translation file

TFIL

Translation File Name

File name for named position translation file.

UAPB

Use Auxiliary Power Bit

If this field is non-zero then the motor drive electronics will be used to control motor power

UBSB

Use Brake Status Bit

If this field is non-zero the motion will be aborted if the brake status field does not follow the brake request field (BTMO).

UEIP

Use Encoder if Present

If this field is non-zero and an encoder is present then the encoder will be used for all position information.

UPSB

Use Power Status Bit.

If this field is non-zero the motion will be aborted if the power status field does not follow the power request field.

VAL

Target Position

The desired target position in engineering units.

VBAS

Base Velocity

The minimum operating velocity of the motor in engineering units / sec.

VALS

Named Position

Optional Target position name string.

VELO

Velocity

Desired slew velocity of the motor in engineering units / sec.

VERS

Version

Current record software revision number

VHLM

Velocity High Limit

Maximum velocity in engineering units.

VLLM

Velocity Low Limit

Minimum velocity in engineering units

Configuration

This record does not require any record or device support code changes to make it function. It currently will work with both the OMS8 and OMS44 board. PLEASE NOTE: that this record works similar to the EPICS motor record and assumes control of the boards attached to it. As a result, this record and the motor record will not be able to run on the same IOC. See Configuration Field Descriptions gives a list of all configurable record fields. These fields can be accessed via the CAPFAST symbol. See Status Field Descriptions contains a list of status record fields and a detailed list of the results they represent.

 

Configuration Field Descriptions

Name

Summary

Description

ACCL

Acceleration (EGU/Sec) (DBF_FLOAT)

Set the acceleration/deceleration rate for all motions in Engineering Units/Sec2. Motor velocity is ramped linearly from VBAS to VELO Engineering Units/sec at the beginning of a motion and from VELO to VBAS at the end of a motion. If the distance to be moved is less than that covered by the two ramps, the ramps are automatically adjusted by the motor driver hardware.

BTMO

Brake Timeout (DBF_SHORT)

Set the brake control timeout. If this value is non-zero the record will execute the brake control sequence(). A BTMO value of zero causes the record to proceed directly from the powering-up to starting state.

DBUG

Debug Mode

Debug output complexity level. Possible options (0..3) are:

NONE | MIN | FULL | MAX.

DTYP

DeviceType (USHORT)

Name of device support to use. Default and only valid value is:

"DEV CTL OMS 8/44"

EDBD

Encoder Deadband (DBF_LONG)

Set the encoder deadband. If encoder feedback is enabled (see UEIP), all encoder value changes less than +/- EDBD around the value at the end of the last motion will be ignored by the record. Once this threshold has been crossed all encoder changes will be recognized by the read.

EGU

Engineering Units (DBF_STRING)

Set the string to be displayed by a dm engineering screen units request.

ERES

Encoder Resolution

Set the encoder resolution. The value should be the number of encoder counts per engineering units. i.e., if the device moves 2mm for every shaft rotation and there are 2.00 encoder counts per revolution the ERES field should be set to 2000/2 or 1,000 for engineering units of millimeters. (not yet implemented)

IALG

Indexing Algorithm

Set the indexing algorithm. When executing a mode of INDEX, the algorithm used will depend on the value of the IALG field as follows:

0 = Index is none (this acts like a move and works well during debugging. It will move to the VAL field value )

1 = Index to Lower home switch or in reverse.

2 = Index to Upper home switch or forward.

3 = Index to center. This will move forward until it hits a lower limit switch and then move up till it hits a home switch.

4 = Index to lower limit switch.

5 = Index to upper limit switch.

See the INDEX section for details of these indexing algorithms.

MDBD

Motion Deadband (EGU) (DBF_FLOAT )

Set the motion deadband. Motion requests to positions +/- the MDBD value of the current position will be acknowledged as completed but no actual device motion will take place and the position feedback fields will continue to show the current position.

MRES

Motor Resolution

Set the motor resolution. The value is given as the number of motor steps per engineering units. i.e. if the device moves 2mm for every rotation of the shaft and there are 200 steps/revoluation then the MRES field should be set to 200 steps/2mm or 100 for engineering units of mm.

OUT

Output Specification (SPC_NOMOD,DBF_OUTLINK)

Select the motor to be controlled. This is a VMEIO link with the following format "#Cx Sy" where x is the OMS interface card number (0-7) and y is the channel on the card that the motor is connected to.

PHLM

Position High Limit (DBF_FLOAT)

Set the maximum position for the device in engineering units. Motion request to positions (VAL) greater than this value will be rejected.

PLLM

Position Low Limit (DBF_FLOAT)

Set the minimum position for the device in engineering units. Motion request to positions (VAL) less than this value will be rejected.

PTMO

Power Timeout (DBF_SHORT)

Set the power control timeout. If the value is non-zero the record will enable the power control sequence (See Power Control). A PTMO value of zero causes the record to stop the power control sequence.

PWR

Power Control Bit (LONG)

This turns the power on and off. A PWR value of zero causes the record to proceed directly from the powering-up to unlocking state.

SIMM

Simulation mode

Value values are :

0 = None

1 = VSM

2 = FAST

3 = FULL

TDIR

Translation Directory (DBF_STRING)

Set the source directory for the translation file. If this field is left blank then no named positions translation is performed.

TFIL

Translation File (DBF_STRING)

Set the name of the translation file. If the field is left blank then no named position translation is performed. The format of the file is:

# Lines beginning with a "#" sign is a comment

#

# Named Position target(VAL) OR index type

position1 5.70 0

position2 6.10 0

position3 7.10 0

indexCenter 0 3

indexLowerSwitch 0 4

You can either give a named position a target - which will cause the mode to be "MOVE", and set the VAL to the target, or you can make the named position mean a mode of "INDEX" where the index algorithm is specified in the last column.

UAPB

Use Motor Driver Auxiliary Bit

Only uses this if PTMO is set. A nonzero value will enable the control of motor power via the motor drive electronics auxiliary power bit.

UBSB

Use Brake Feedback Checking Mode

Set the brake feedback checking mode. If this field is non-zero then the brake status bit (BSTA) will be checked whenver the external brake state is changed (see BTMO) to confirm that the action has taken place. Failure of the status bit to reflect the desired state will cause the motion to be aborted.

UEIP

Use Encoder

Set the encoder feedback mode. A non-zero value will cause the encoder value to be read (if the interface hardware supports encoders for this motor) and used for stall and motor-creep detection.

UPSB

Use Power Status Bit. (DDR_DEVCONTROL_YN)

Set the power feedback checking state. If the field is non-zero then the power status bit (PSTA) will be checked whenever the power status is changed (see PTMO) to confirm that the action has taken place. Failure of power during motion or failure of the status bit to reflect the desired power state will cause the motion to be aborted.

VBAS

Base Velocity (DBF_FLOAT)

Set the base velocity in engineering units/second.. This is the minimum velocity that the device will move at. Acceleration/deceleration profile will start/end at this velocity. Target velocities less than this value will actually be performed at the VBAS velocity.

VELO

Motion Velocity (DBF_FLOAT)

Set the target velocity. All device motions will be performed at this velocity, specified in Engineering Units per second.

VHLM

Maximum Velocity (DBF_FLOAT)

Set the maximum velocity. Any motion requests with the VELO field set greater than this value will be rejected.

VLLM

Minimum Velocity (DBF_FLOAT)

Set the minimum velocity. Any motion requests with the VELO field set less than this value will be rejected.

Status Field Descriptions

Name

Summary

Description

BUSY

Command Execution State

This field will be IDLE until a "GO" directive is received. At this point the field will be set to BUSY to indicate that a command is being processed. Once the device has reached the commanded position and/or other processing has completed the field will be set to IDLE again to indicate successful completion of the command. Any faults or errors deteced during processing will cause the command to abort and the field to be set to ERR.

HPVL

Home Position Valid

This field will contain a non-zero value as long as the device can trust its index or reference position. Any faults that may cause uncontrolled motion and hence a loss of reference will cause the field to be set to zero. The fields will be set to non-zero again upon successful completion of a re-indexing sequence (see MODE and IALG field descriptions). This means that if an error occurs while processing any move commands, the HPVL will be lost and at that point you can use the INDEX mode but not the MOVE mode.

LSWA

Limit Switch Active

This field will be set to non-zero if the stepper control hardware detects a soft limit switch during a motion. Note that due to hardware interface limitations this will only be reported during motion. The field will remain non-zero until the device is moved off of the limit switch. Since the interface hardware does not reliably report which switch (high or low soft-limit) was encountered, no attempt is made to return this information.

MESS

Error Message

Whenever a fault condition is encountered during processing a diagnostic string is written to this field to indicate the source of error. This value is written before the BUSY field is set to ERR (see BUSY field description) to ensure that it is available for the commanding process in time.

MIP

Motion in Progress

This field provides information on the current motion state as follows:

STOPPED: Motor is idle with power off and locking device on.

BEGINNING: A new command has been received and the device is being prepared for motion (power on, locking device off, motion parameters loaded, etc.).

MOVING: Device is currently moving to the commanded position.

HOLDING: Device has reached the commanded position in TRACK mode and is holding this position (power on, brake off), pending a new motion request.

ENDING: Device has reached the commanded psotion in all but

TRACK mode and is executing the shutdown sequence (locking device on, power off, etc.).

ERROR: Device has detected an un-recoverable fault during the last motion and has aborted the command. Power is off, locking device is on.

MPOS

Current Motor Position

The current motor position in engineering units. This position is updated at the scan task rate whenever the device is in motion.

MSTA

Motor Status Word

The motor status word returned by the device support drives. This value is device dependant, refer to the appropriate device support documentation for these values. (not yet implemented)

RENC

Raw Encoder Value

Raw Encoder Value (in Encoder counts) returned by the device support code.

RPOS

Raw Motor Target Position

Raw motor target position (in steps) passed to the device support code.

RRBV

Raw Current Motor Position

Raw current motor position (in steps) returned by the device support code.

VERS

Current software version number

This value is coded into the record support code.

Device Record Operations

deviceControl record operation is controlled by the DIR, MODE and Primary motion control fields (VAL, VALS, MODE and VELO). In normal operation, motion parameters are written to the appropriate control fields and the GO directive is issued to begin execution of the command. If a motion sequence involving more than one device is being prepared it will be possible to check the validity of the control information via the CHECK directive for all devices prior to starting the motions.

The DIR field

Commands to re-position a device are sent via the DIR field. While a command is being processed the BUSY field is set to BUSY. When a command has completed the BUSY field is set either to IDLE (if all went well) or ERR (if something went wrong). In some cases, a command in progress can be updated with new information as described below. A directive that requires no asynchronous processing (such as a STOP when the device is already idle) will be acknowledged by setting the BUSY field to BUSY for a short period of time then returning it to IDLE.

The possible directives are:

STOP

This directive terminates a command in progress. Any moving devices will be stopped in a controlled manner prior to setting the record to IDLE. The STOP directive will simply be acknowledged if the record is idle.

CHECK

This directive validates all of the input fields prior to starting or updating a command. The ACK field is set to zero if all arguments are within limits and it is safe to start or update a command. If the command is rejected (ACK set to nonzero) a diagnostic message appears in the MESS field to explain why. The CHECK directive does not affect the state of the record BUSY field.

GO

This directive either starts a new command action or updates the control parameters for a command in progress. All input fields are validated prior to executing the command (see CHECK). If it is safe to proceed the record is set to BUSY and the control information is processed according to the current state of the record. The record will remain BUSY until either the command has completed or an error is encountered.

The MODE field

When a device motion command has been received the operating mode field is consulted to determine how to process the command.

Possible MODE field values are:

INIT

Initialize the device. The initialization process consists of:

  • Ensuring that the device is stopped and powered down
  • Indicating that the home reference is not valid
  • Re-loading the translation table information.

The INIT command will be rejected if the device is in motion.

MOVE

This is the normal operating mode for the record. It calls for the device to be powered up and unlocked, moved to a new target and shut down again ready for the next motion command. If the given target position is within the motion deadband of the current motor position the command will simply be acknowledged without moving the motor. New motion parameters (such as velocity and target updates) can be issued while the device is still in motion and they will be acted upon immediately if the GO directive is re-issued.

TRACK

In TRACK mode the device is powered up and unlocked (if not already active) however the device will be left unlocked and powered on after the motion is completed. This mode is useful when the device must follow a series of target positions with the minimum delay. New motion parameters (such as velocity and target updates) can be issued while the device is still in motion and they will be acted upon immediately.

INDEX

In INDEX mode the target position is ignored and the device is sent to find its home or reference point. How this is accomplished depends on the current setting of the Index Algorithm (IALG) field as follows:

  • INDEX_NONE - No home searching is done. Simply move to the given position and indicate that the reference point is now valid.
  • INDEX_REV - The device is moved in the reverse direction at the current velocity until the home switch is activated, then brought forward very slowly until the switch opens again. The internal position counters are set to zero at this point.
  • INDEX_FWD - The device is moved in the forward direction at the current velocity until the home switch is activated, then brought backwards very slowly until the switch opens again. The internal position counters are set to zero at this point.
  • INDEX_CENTER - Handles a home switch that is not located at either end of travel by performing an INDEX_REV_LIM followed immediately by an INDEX_FWD.
  • INDEX_REV_LIM - The device is moved in the reverse direction at the current velocity until the lower soft limit switch is activated. The drive electronics stop the motor immediately. The internal position counters are set to zero at this point.
  • INDEX_FWD_LIM - The device is moved in the forward direction until the upper soft limit switch is activated. The drive electronics stop the motor immediately. The internal position counters are set to zero at this point.

If the homing sequence was successful, the Home Position Valid (HPVL) field will be set to non-zero to indicate that the reference point is valid.

VAL and VALS fields
Named position translation

The deviceControl record supports the concept of named positions. This is a useful feature for fixed position devices (such as filter wheels or in/out devices) where the target position can be given in terms of the fixed position name rather than the actual position in engineering units.

Named position support is implemented via the VALS field. An ascii string written to this field will trigger a search of the associated lookup table. If a named position corresponding to the string is found in the table the associated target position in engineering units is written into the VAL field and will be acted upon when the GO command is issued. If the string can not be translated the command will be rejected when the GO command is issued.

This feature allows the device to be positioned to its valid positions only and relieves the controlling process from having to know how these positions are implemented.

Lookup table support

The lookup table is contained in an ASCII file (see the TDIR and TFIL field descriptions). This file is loaded into an internal lookup table whenever the record is initialized. The file can be changed and re-loaded at any time via the INIT command.

The file format is as follows

  • One or more comment lines starting with a #
  • One or more data lines containing three fields separated by white spaces:
  • First field is the named position string.
  • The second field is the translated position in engineering units.
  • The third field is the index algorithm to be used for the motion (see the IALG field description). If this field is zero a normal motion will take place to the translated target position. If the field is non-zero the target position field is ignored and the motion is executed as if the mode had been set to INDEX and the IALG field set to the given value. Neither field is actually changed in the process.
Power and Locking Mechanism Control

Integral to the deviceControl record is the optional control of motor power and locking mechanisms. When a motion command is received the power control sequence is executed followed by the brake control sequence prior to starting the motion. In TRACK mode the power is left on and brake off following a move. In all other modes the brake control sequence is executed followed by the power control sequence when the move is completed. Disabling one or both features will simply skip that part of the sequence with no other effect on record operation.

Power Control

Power to the motor can be controlled in one of two ways: internal (using device support) and external (using other EPICS records). If external power feedback is available it can be checked to insure that the power has responded before moving on to the brake control phase. The general sequence is as follows:

  • If the power control delay (PTMO) field contains non-zero value then power control is enabled and the following sequence is executed for each move. A zero value disables power control and the record skips this sequence entirely.
  • Prior to starting the motor the PWR field is set to non-zero and this value is written to the record specified in the PWRL link field (optional). If the UAPB field is non-zero a call is made to the device support power control function to enable the power via the control hardware as well.
  • The record then pauses for the length of time specified in the PTMO field (in 0.1 second units) to allow the power to stabilize.
  • If power feedback is enabled (UPSB field set to a non-zero value) the record will check the power status field (PSTA) to confirm that the device has been energized successfully. If the device has not been energized after this delay the motion will be aborted at this point and an error message returned.
  • If power feedback is enabled then the PSTA field will be monitored while the device is moving to detect power failures during motion.
  • The same sequence is executed at the end of a motion once the brake sequence is completed, only the power is turned off and the status field monitored to insure that the device has been depowered successfully.
Brake Control

External locking devices are controlled via external EPICS records triggered by the BRKL field. If locking device feedback is available it can be checked to insure that the device has responded before actually starting the motion. The general sequence is as follows:

  • If the brake control delay (BTMO) field contains non-zero value then brake control is enabled and the following sequence is executed for each move. A zero value disables brake control and the record skips this sequence entirely.
  • Prior to starting the motor the BRK field is set to zero and this value is written to the record specified in the BRKL link field (optional).
  • The record then pauses for the length of time specified in the BTMO field (in 0.1 second units) to allow the brake to energize.
  • If brake feedback is enabled (UBSB field set to a non-zero value) the record will check the brake status field (PSTA) to confirm that the locking device has been released successfully. If the device has not been released after this delay the motion will be aborted at this point and an error message returned.
  • The same sequence is executed at the end of a motion only the brake field is set to one and the status field monitored to insure that the locking device has been applied successfully.
Encoded field definitions

All definitions for encoded fields are device support independent. Currently these are given, along with appropriate mnemonics, in the module header file recDeviceControl.h.

Output Specification

The motor address selection is done via the OUT field of the deviceControl record. This field must contain a string having the following format:

<# Cx Sx>

Where Cx is the drive card and Sx is the motor number on that card.

An example OUT specification would be:

#<C2 S3>

To select the fourth motor on the third card in the system.

Support Entry Tables

The following section will define the support routines for both the record and device support modules.

Record Support (RSET) Entries

The record support routine, as defined by deviceControlRSET, is the same for every record of this type. The associated functions are:

initRecord

This routine is called twice at iocInit. On the first call it returns immediately. On the second call, it does the following:

  • Create the device support communications structure
  • Initialize device support.
  • Initialize the record output and status fields.
process

This routine implements the following algorithm:

  • Set PACT to TRUE.
  • If the processing was caused by an external command:
  • Process all input links.
  • Process the command directive DIR field (see section x.x).
  • Process the MODE field (see section x.x.).
  • If not a CHECK directive set the BUSY field to BUSY.
  • If the processing was caused by an internal callback or status field change:
  • Process the current internal state machine state.
  • If device support command has completed then update the BUSY field to IDLE if successful or ERR if an error was detected.
  • In all cases:
  • Write selected output links
  • Trigger selected monitors
  • Raise alarms.
  • If command is finished save processing time, trigger forward link and clear the PACT field.
getValue

Fills in the values of struct valueDes so that they reflect the VAL field.

getUnits

Returns the engineering units string for display purposes.It returns the value in the EGU field.

getPrecision

Sets the display precision to the value of PREC for the VAL and MPOS fields.

special

Status buttons (FLT) are treated like callbacks and so set the internal callback processing flag to prevent processing of other external fields.

getGraphicsDouble

The graphic display range limits are set to the values of the PHLM/PLLM fields for the VAL and MPOS fields.

getControlDouble

The control operating range limits are set to the values of the PHLM/PLLM fields for the VAL and MPOS fields.

getAlarmDouble

The alarm double structure values are updated with the current settings of the HIHI/HI/LO/LOLO fields for the VAL and MPOS fields.

Device Support (DSET) Entries

The deviceControl record has been written to be as device-independent as possible. It requests only basic motion functions from the drive support code.

The device support routine, as defined by deviceControlDSET, is the same for every record of this type. The associated functions are

devInit

This function is called twice during initialization of the IOC. On the first pass (before records are initialized) the scan task is started and the linked list of subscribing records is initialized. The second pass (after records are initialized) is ignored.

devInitRec

This function is called once for each deviceControl in the system. It creates and initializes a private motion control structure for the record's device support and adds it to the list of control structures to be scanned by the scan task. The control structure is saved in the calling record's device private structure to allow scan task callbacks to re-process the record.

configureDrive

This function transfers the motion control variables from the communications structure to the private control structure and writes them to the hardware as appropriate.

controlMotion

This function starts, stops or aborts device motion as directed by the mode word supplied. How this is done is entirely up to the device support.

controlPower

This function enables or disables the motor power according to the power word supplied using the motor control electronics. How this is done is entirely up to the device support.

setDelay

This function requests that the calling record be re-processed the time specified in the delay word has elapsed (delay has 0.1 second resolution). How this is done is entirely up to the device support.

setPosition

Load the given value into the drive electronics position register.

setLimts

Determine current high and low limits from the card.

Communications structure definition

All command and status information is passed via the record's device private structure. This communications structure is defined in the header file recDeviceControl.h as follows:

typedef struct

{

SEM_ID mutexSem; /* mutual exclusion semaphore */

void pPrivate; /* device support private structure pointer */

long callback; /* (status) set to TRUE for callback processing */

long timeout; /* (status) set to TRUE for delay callback */

long target; /* (command) desired target position (steps) */

long velocity; /* (command) desired motion velocity (steps/sec) */

long acceleration; /* (command) desired acceleration time (steps/sec2)*/

long index; /* (command) index algorithm */

long position; /* (status) current device position (steps) */

long encoder; /* (status) current encoder value (encoder units) */

long moving; /* (status) current motion state */

long limit; /* (status) current limit switch state */

long status; /* (status) current device support status */

long simulation; /* (command) desired simulation mode */

long debug; /* (command) desired debugging level */

}DAO_DEVICE_PRIVATE;