RRM 3-14 Stepper Motor

From EPICSWIKI

EPICS Record Reference Manual


steppermotor - Stepper Motor

The stepper motor record controls and monitors stepper motors. The stepper motor can be controlled in either position mode or velocity mode. Position mode moves a device to a position. Velocity mode causes the motor to revolve continuously.

The record is set up assuming that the same stepper motor will not be used in both velocity and position mode. The fields for the stepper motor record fall into the following categories:

  • scan parameters
  • setup parameters
  • desired output parameters
  • output and readback parameters
  • operator display parameters
  • alarm parameters
  • monitor parameters

run-time parameters.

Scan Parameters

The stepper motor record has the standard fields for specifying under what circumstances the record will be processed. A motor record that is scanned periodically or on event will compare its actual position to the desired position and will attempt to achieve its position. It will only make a certain number of attempts; the number of attempts is specified in the retry (RTRY) field. A passive motor will not go through the retry logic.

These fields are listed in Scan Fields. In addition, Scanning Specification explains how these fields are used. Note that I/O event scanning is only supported for those card types that interrupt.

Setup Parameters

The set-up parameters determine how the stepper motor is initialized and how it operates at run-time.

The MODE field has two choices: Velocity or Position.

The VELO field determines the velocity that the stepper motor will run at when in the velocity mode. In position mode, it determines the pulses per second to move when it moves to a new position.

The ACCL field determines the acceleration of the motor by specifying a number of seconds. In velocity mode, the stepper motor will accelerate at the rate needed to reach the operating velocity in the number of seconds specified in ACCL. In positional mode, ACCL determines the seconds the stepper motor will take to reach the specified velocity, and the number of seconds it will take to come to a stop at the new position.

The MRES field specifies the number of pulses per revolution for the stepper motor, while ERES specifies the encoder pulses per revolution.

The DIST field's value determines the distance which the stepper motor moves for each pulse in engineering units.

The RTRY field specifies the number of attempts the record will make to reach the desired position each time it's processed, and the RDBD field specifies a deadband for this processing. Thus, when the motor is moving in a positive direction, no retries will be attempted unless the readback value is greater than VAL added to the value in the RDBD field. If the motor is moving in the negative direction, no retries will be attempted unless the readback value is less than VAL added to the value in the RDBD field:

if direction positive and RBV > (VAL + RDBD)
attempt to correct position RTRY times
if direction negative and RBV < (VAL + RDBD)
attempt to correct position RTRY times

The initialization algorithm (IALG) field has three algorithms to choose from: No Initialization, Move to the Positive Limit, and Move to the Negative Limit. The IVAL field determines the value of VAL at initialization; i.e., VAL is initialized to the value in IVAL when IALG is either Move to Positive or Move to Negative.


FieldSummaryTypeDCTInitialAccessModifyRec Proc MonitorPP
ACCL Seconds to Reach VelocityFLOATYes0YesYesNoNo
VELO Velocity in Pulses per SecondFLOATYes0YesYesNoNo
DIST Distance in Engineering Units of 1 PulseFLOATYes0YesYesNoNo
IVAL Initial ValueFLOATYes0YesYesNoNo
MODE Mode--Position/VelocityRECCHOICEYes0YesYesNoNo
IALGInitialization AlgorithmRECCHOICEYes0YesYesNoNo
RTRYNumber Of Retries Before FailureSHORTYes0YesYesNoNo
RDBDRetry DeadbandFLOATYes0YesYesNoNo
MRESMotor Pulses per RevolutionUSHORTYes0YesYesNoNo
ERESEncoder Pulses per RevolutionUSHORTYes0YesYesNoNo


Desired Output Parameters

The stepper motor record specifies where the desired output originates in the DOL field. The desired output needs to be in engineering units. If the output is controlled by the operator or a sequence program, nothing should be entered in the DOL field.

The desired output link (DOL) and operation mode select (OMSL) fields work as they do for output records. If OMSL is closed_loop, the desired output (VAL) is fetched from the DOL link, which can be a database or channel access link. If supervisory, VAL can be changed via dbPuts. DOL can be a constant, in which case VAL is initialized to the constant. If DOL is a constant, OMSL cannot specify closed_loop. See Address Specification for information on specifying links.

VAL indicates the position of the stepper motor in position mode; in velocity mode, it indicates the current velocity. When the desired output is retrieved and placed in VAL, it is forced to be within the drive limits configured in the DRVH and DRVL fields. The DRVH and DRVL fields must be given values by the user. Note: If nothing is entered in the DRVH and DRVL fields, the motor will not move. The get_control_double() record support routine returns the values in these fields when it is called.


FieldSummaryTypeDCTInitialAccessModifyRec Proc MonitorPP
VALValue FLOATNo0YesYesYesYes
DOLDesired Output Location (Input Link)INLINKYes0NoNoN/ANo
OMSLOutput Mode Select GBLCHOICEYes0YesYesNoNo


Output and Readback Parameters

In the OUT output link field, the user must enter the address of the I/O card of the device, and in the DTYP field, the user must enter the name of the appropriate stepper motor device support module. Be aware that the address format differs according to the I/O bus used. See Address Specification for information on hardware addresses. The user can see a list of the device support modules currently supported at the user's local site by using the dbst utility in R3.13.

The RDBL field can contain the address of an encoder or an external device, such as an LDVT, or it can specify the motor position field (MPOS) or the encoder position field (EPOS) in the same record. In the case of an external readback, the value would be read through an analog input record and linked to this record through this field. The value retrieved from this field is placed into the RBV field.


FieldSummaryTypeDCTInitialAccessModifyRec Proc MonitorPP
OUTOutput LinkOUTLINKYes0NoNoN/ANo
DTYPDevice TypeDEVCHOICEYes0YesNoNo 
RDBLRead Back Location (an input link)INLINKYes0NoNoN/ANo
RBVRead Back Value FLOATNo0YesYesYesNo


Operator Display Parameters

These parameters are used to present meaningful data to the operator. These fields are used to display the value and other parameters of the stepper motor either textually or graphically.

EGU is a string of up to 16 characters describing the engineering units of VAL. It is retrieved by the get_units record support routine.

The HOPR and LOPR fields set the upper and lower display limits for the VAL, HIHI, HIGH, LOW, LOLO, MPOS, EPOS, RBV, and LVAL fields. Only the get_graphic_double record support routine retrieves these fields. If these values are defined, they must be in the range: DRVL<=LOPR<=HOPR<=DRVH.

The PREC field determines the floating point precision with which to display the VAL and LVAL fields. It is used whenever the get_precision record support routine is called.

See Fields Common to All Record Types for more on the record name (NAME) and description (DESC) fields.


FieldSummaryTypeDCTInitialAccessModifyRec Proc MonitorPP
EGUEngineering UnitsSTRING [16]YesnullYesYesNoNo
HOPRHigh Operating RangeFLOATYes0YesYesNoNo
LOPRLow Operating RangeFLOATYes0YesYesNoNo
PRECDisplay PrecisionSHORTYes0YesYesNoNo
NAMERecord NameSTRING [29]Yes0YesNoNo 
DESCDescriptionSTRING [29]YesNullYesYesNoNo


Alarm Parameters

The possible alarm conditions for stepper motor records are the SCAN, READ, and limit alarms. The SCAN and READ alarms are called by the record or device support routines and are always of MAJOR severity.

The limit alarms are configured by the user in the HIHI, LOLO, HIGH, and LOW fields using numerical values. The conditions apply to the VAL and RBV fields of the stepper motor record. For each of these fields, there is a corresponding severity field which can specify either NO ALARM, MINOR, or MAJOR. The user can specify a deadband around these limits in the HYST or hysteresis field. See Alarm Specification for a complete explanation of analog alarms and these fields. Alarm Fields lists other fields related to a alarms that are common to all record types.


FieldSummaryTypeDCTInitialAccessModifyRec Proc MonitorPP
HIHIHihi Alarm LimitFLOATYes0YesYesNoYes
HIGHHigh Alarm LimitFLOATYes0YesYesNoYes
LOWLow Alarm LimitFLOATYes0YesYesNoYes
LOLOLolo Alarm LimitFLOATYes0YesYesNoYes
HHSVHihi Alarm SeverityGBLCHOICEYes0YesYesNoYes
HSVHigh Alarm SeverityGBLCHOICEYes0YesYesNoYes
LSVLow Alarm SeverityGBLCHOICEYes0YesYesNoYes
LLSVLolo Alarm SeverityGBLCHOICEYes0YesYesNoYes
HYSTAlarm DeadbandDOUBLEYes0YesYesNoNo


Monitor Parameters

These parameters are used to determine when to send monitors placed on the VAL field. The monitors are sent when the value field exceeds the last monitored field by the appropriate delta. If these fields have a value of zero, everytime the value changes, a monitor will be triggered; if they have a value of -1, everytime the record is processed, monitors are triggered. The ADEL field is used by archive monitors and the MDEL field for all other types of monitors. See Monitor Specification for a complete explanation of monitors.


FieldSummaryTypeDCTInitialAccessModifyRec Proc MonitorPP
ADELArchive DeadbandDOUBLEYes0YesYesNoNo
MDELMonitor, i.e. value change, DeadbandDOUBLEYes0YesYesNoNo


Run-time Parameters

These fields are not configurable by the user before run-time, but most of them can be modified after initialization.

The STHM field will set the current position of the motor to its home or zero position when this field is set to 1 via a dbPut. Its value is automatically reset to 0 after the command is accepted.

Setting the STOP field to 1 will cause the motor to stop moving. Its value is also reset to 0 after the command is accepted.

The DMOV field is a flag which indicates if the motor is done moving and all retries are complete. It is significant only while the record is in POSITION mode. It will be 1 if TRUE and 0 if FALSE.

The RVAL field contains the value which is actually written to output after it is forced in the drive limits.

The RBV and RRBV fields contain the value retrieved from the readback location link (RDBL).

The MOVN field indicates whether the motor is currently moving. It will contain a 1 if moving or a 0 if not moving. The DIR field indicates which direction the record is moving--a 0 means clockwise and a 1 means counter clockwise.

The CW and CCW fields contain the values for the clockwise and counterclockwise limit switches, respectively. The MCW and MCCW fields will be 1 if the limit has been reached or 0 if not.

The CVEL field indicates whether the motor is at constant velocity. If so, the value of this field is 1.

The RCNT field will indicate the current number of retries that have been attempted.

The POSM field will contain a 1 if the motor is moving in a positive direction and a 0 if otherwise.

The MISS field holds the error after the first attempt has been made to change the stepper motor's position, the error being the difference between VAL and RBV, the readback value. If monitors are present, the value is posted.

The EPOS field holds the value obtained from encoder readback. The MPOS holds the readback value of the motor positions.

The MLST and ALST fields are used to implement monitors on the VAL field. If the difference between one of these fields and the VAL field exceeds the appropriate deadband (MDEL, for instance) monitors are triggered.

The LVEL, LACC, and LVAL fields contain the last values set for the VELO, ACCL, and VAL fields respectively. They are used to determine when the velocity and acceleration should be recalculated.

The CMOD or current mode fields indicates which mode, position or velocity, the record is using.


FieldSummaryTypeDCTInitialAccessModifyRec Proc MonitorPP
STHMSet HomeSHORTNo0YesYesNoYes
STOPStopSHORTNo0YesYesNoYes
DMOVDone Moving to ValueSHORTNo0YesYesNoNo
RVAL Raw Data Value LONGNo0YesYesYesYes
RRBVRaw Read Back ValueLONGNo0YesYesYesNo
INITInitializeSHORTNo0YesYesNoYes
MOVN Moving StatusSHORTNo0YesYesNoNo
DIRCurrent DirectionSHORTNo0YesYesNoYes
MCWMotor Clockwise Limit Switch ValueSHORTNo0YesYesNoYes
MCCWMotor Counter Clockwise Limit Switch ValueSHORTNo0YesYesNoYes
CW Clockwise LimitSHORTNo0YesYesNoYes
CCWCounter Clockwise LimitSHORTNo0YesYesNoYes
CVELConstant VelocitySHORTNo0YesYesNoNo
RCNTCurrent Retry CountSHORTNo0YesYesYesNo
POSM Positive MotionFLOATNo0YesNoYesNo
MISSFirst Attempt Error FLOATNo0YesYesYesNo
EPOS Encoder Read Back Position FLOATNo0YesYesNoNo
MPOS Motor Position FLOATNo0YesYesNoNo
ALSTArchive Last Value FLOATNo0YesNoNoNo
MLSTMonitor Last ValueFLOATNo0YesNoNoNo
LVELLast Velocity SetFLOATNo0YesYesNoNo
LACCLast Acceleration SetFLOATNo0YesYesNoNo
LVAL Last Value SHORTNo0YesYesNoNo
CMODCurrent Mode RECCHOICEYes0YesYesNoNo


Record Support

Record Support Routines

init_record

This routine checks to see that device support is available. The routine next checks to see if the device support sm_command routine is defined. If either device support or the device support write routine does not exist, an error message is issued and processing is terminated.

If device support includes init_record, it is called.

If DOL is a constant, then VAL is initialized with its value and UDF is set to FALSE. If DOL is a PV_LINK then a channel access link is created.

init_sm is then called.

init_sm

The init_sm routine initializes the stepper motor according to its configuration.

process

See next section.

get_value

Fills in the values of struct valueDes so that they refer to VAL.

get_units

Retrieves EGU.

get_precision

Retrieves PREC.

get_graphic_double

Sets the upper display and lower display limits for a field. If the field is VAL, LVAL, MPOS, RBV, EPOS, HIHI, HIGH, LOW, or LOLO, the limits are set to HOPR and LOPR, else if the field has upper and lower limits defined they will be used, else the upper and lower maximum values for the field type will be used.

get_control_double

Sets the upper control and the lower control limits for a field. If the field is VAL, LVAL, MPOS, RBV, EPOS, HIHI, HIGH, LOW, or LOLO, the limits are set to DRVH and DRVL. Else if the field has upper and lower limits defined they will be used; else the upper and lower maximum values for the field type will be used.

get_alarm_double

Sets the following values:

upper_alarm_limit = HIHI
upper_warning_limit = HIGH
lower_warning_limit = LOW
lower_alarm_limit = LOLO


Record Processing

Description not available.


Device Support

At the present time, device support is intimately connected to record support. The compumotor 1830 and the OMS 6 axis controllers are supported.




EPICS Record Reference Manual - 19 MAY 1998