The motor record is intended to support motors of all kinds, but currently supports only the following variety of motor controllers (in addition to Soft Channel support):
Except where specified otherwise, fields associated with the motor position and its derivatives take values in user-specified "engineering units", such as degrees; the engineering unit name is contained in the field EGU. Thus, generally, speeds are expressed in EGU's per second. Accelerations, however, are expressed as the number of seconds taken to accelerate to full speed. However, additional fields are provided so that the motor position can be specified in steps and the speed in revolutions per second, and so that the step size can be set by specifying the number of steps per revolution and the number of EGU's per revolution.
The motor record can read motor position from the controller's readback register or encoder register, or from any other EPICS record, via an EPICS input link. While the motor is moving, the record can trigger an output link periodically, to send readback information to other EPICS records. When a complete motion (possibly including backlash takeout) is finished, the record can trigger a forward link to process other EPICS records.
The motor record can force its drive fields to agree with its readback fields, and it does so in a variety of circumstances (e.g., when the user tells a motor to stop, and when a limit switch is hit). Therefore, if you are driving the motor record's VAL or DVAL field with the output of another record, and you want that record always to contain the same value as the motor record, you must handle this behavior in the database. One way to do this is to forward link the motor record to a soft analog output record, and to cause that AO record to grab the motor record's VAL or DVAL field and poke it into your record.
The motor record is unlike most other EPICS records in that its processing is neither "synchronous" nor "asynchronous", as these terms are used in the EPICS Record Reference Manual. Currently, the PACT field is always FALSE after record processing has completed, even though a motor motion may be in progress. This means the record always responds to channel-access puts, and can be stopped or retargeted at any time. The record's forward link is not executed until the motor has stopped and no motion requests are pending.
Name | Access | Prompt | Data type | Comment | |||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ACCL | R/W | Seconds to Velocity | FLOAT | acceleration time | |||||||||||||||||
ATHM | R | At HOME | SHORT | uses the HOME switch | |||||||||||||||||
BACC | R/W | BL Seconds to Veloc. | FLOAT | backlash acceleration time | |||||||||||||||||
BDST | R/W | BL Distance (EGU) | FLOAT | backlash distance | |||||||||||||||||
BVEL | R/W | BL Velocity (EGU/s) | FLOAT | backlash speed | |||||||||||||||||
CARD | R | Card Number | SHORT | EPICS card # | |||||||||||||||||
CBAK | None | Callback structure | NOACCESS | ||||||||||||||||||
CDIR | R | Command direction | SHORT | ||||||||||||||||||
CNEN | R/W | Enable control | RECCHOICE | (0:"Disable", 1:"Enable") | |||||||||||||||||
DCOF | R/W | Derivative Gain | FLOAT | ||||||||||||||||||
DHLM | R/W* | Dial High Limit | FLOAT | ||||||||||||||||||
DIFF | R | Difference dval-drbv | DOUBLE | ||||||||||||||||||
DINP | R/W | DMOV Input Link | INLINK | ||||||||||||||||||
DIR | R/W* | User Direction | RECCHOICE | (0:"Pos", 1:"Neg") | |||||||||||||||||
DLLM | R/W* | Dial Low Limit | FLOAT | ||||||||||||||||||
DLY | R/W | Readback settle time (s) | FLOAT | ||||||||||||||||||
DMOV | R | Done moving to value | SHORT | The "done" flag | |||||||||||||||||
DOL | R | Desired Output Loc | INLINK | only for closed-loop mode | |||||||||||||||||
DRBV | R | Dial Readback Value | DOUBLE | ||||||||||||||||||
DVAL | R/W* | Dial Desired Value | DOUBLE | ||||||||||||||||||
EGU | R/W | Engineering Units | STRING | ||||||||||||||||||
ERES | R/W* | Encoder Step Size (EGU) | FLOAT | ||||||||||||||||||
FOF | R/W | Freeze Offset | SHORT | ||||||||||||||||||
FOFF | R/W | Offset-Freeze Switch | RECCHOICE | (0:"Variable", 1:"Frozen") | |||||||||||||||||
FRAC | R/W | Move Fraction | FLOAT | ||||||||||||||||||
HHSV | R/W* | Hihi Severity | GBLCHOICE | ||||||||||||||||||
HIGH | R/W* | High Alarm Limit | FLOAT | ||||||||||||||||||
HIHI | R/W* | Hihi Alarm Limit | FLOAT | ||||||||||||||||||
HLM | R/W* | User High Limit | FLOAT | ||||||||||||||||||
HLS | R | At High Limit Switch | SHORT | ||||||||||||||||||
HLSV | R/W* | HW Lim. Violation Svr | GBLCHOICE | ||||||||||||||||||
HOMF | R/W* | Home Forward | SHORT | ||||||||||||||||||
HOMR | R/W* | Home Reverse | SHORT | ||||||||||||||||||
HOPR | R/W | High Operating Range | FLOAT | ||||||||||||||||||
HSV | R/W* | High Severity | GBLCHOICE | ||||||||||||||||||
HVEL | R/W* | Home Velocity | FLOAT | ||||||||||||||||||
ICOF | R/W | Integral Gain | FLOAT | ||||||||||||||||||
INIT | R/W | Startup commands | STRING | ||||||||||||||||||
JAR | R/W | Jog Acceleration (EGU/s^2) | FLOAT | ||||||||||||||||||
JOGF | R/W* | Jog motor Forward | SHORT | careful! | |||||||||||||||||
JOGR | R/W* | Jog motor Reverse | SHORT | careful! | |||||||||||||||||
JVEL | R/W | Jog Velocity | FLOAT | ||||||||||||||||||
LDVL | R | Last Dial Des Val | DOUBLE | ||||||||||||||||||
LLM | R/W* | User Low Limit | FLOAT | ||||||||||||||||||
LLS | R | At Low Limit Switch | SHORT | ||||||||||||||||||
LLSV | R/W* | Lolo Severity | GBLCHOICE | ||||||||||||||||||
LOCK | R/W* | Soft Channel Position Lock | RECCHOICE | (0:"No", 1:"Yes") | |||||||||||||||||
LOLO | R/W* | Lolo Alarm Limit | FLOAT | ||||||||||||||||||
LOPR | R/W | Low Operating Range | FLOAT | ||||||||||||||||||
LOW | R/W* | Low Alarm Limit | FLOAT | ||||||||||||||||||
LRLV | R | Last Rel Value | DOUBLE | ||||||||||||||||||
LRVL | R | Last Raw Des Val | DOUBLE | ||||||||||||||||||
LSPG | R | Last SPMG | RECCHOICE | (See SPMG) | |||||||||||||||||
LSV | R/W* | Low Severity | GBLCHOICE | ||||||||||||||||||
LVAL | R | Last User Des Val | DOUBLE | ||||||||||||||||||
LVIO | R | Limit violation | SHORT | ||||||||||||||||||
MIP | R | Motion In Progress | SHORT | ||||||||||||||||||
MISS | R | Ran out of retries | SHORT | ||||||||||||||||||
MMAP | R | Monitor Mask | ULONG | ||||||||||||||||||
MOVN | R | Motor is moving | SHORT | Don't confuse with DMOV | |||||||||||||||||
MRES | R/W* | Motor Step Size (EGU) | FLOAT | ||||||||||||||||||
MSTA | R | Motor Status | ULONG | ||||||||||||||||||
NMAP | R | Monitor Mask | ULONG | ||||||||||||||||||
NTM | R/W* | New Target Monitor | RECCHOICE | (0:"No", 1:"Yes") | |||||||||||||||||
OFF | R/W | User Offset (EGU) | DOUBLE | ||||||||||||||||||
OMSL | R/W | Output Mode Select | GBLCHOICE | ||||||||||||||||||
OUT | R/W | Output Specification | OUTLINK | ||||||||||||||||||
PCOF | R/W | Proportional Gain | FLOAT | ||||||||||||||||||
PERL | R/W | Periodic Limits | RECCHOICE | (0:"No", 1:"Yes") | |||||||||||||||||
POST | R/W | Post-move commands | STRING | ||||||||||||||||||
PP | R | Post process command | SHORT | ||||||||||||||||||
PREC | R/W | Display Precision | SHORT | ||||||||||||||||||
PREM | R/W | Pre-move commands | STRING | ||||||||||||||||||
RBV | R | User Readback Value | DOUBLE | ||||||||||||||||||
RCNT | R | Retry count | SHORT | ||||||||||||||||||
RDBD | R/W | Retry Deadband (EGU) | FLOAT | ||||||||||||||||||
RDBL | R | Readback Location | INLINK | ||||||||||||||||||
RDIF | R | Difference rval-rrbv | LONG | ||||||||||||||||||
REP | R | Raw Encoder Position | DOUBLE | ||||||||||||||||||
RHLS | R | Raw High Limit Switch | SHORT | ||||||||||||||||||
RINP | R/W | RMP Input Link | INLINK | ||||||||||||||||||
RLLS | R | Raw Low Limit Switch | SHORT | ||||||||||||||||||
RLNK | R | Readback OutLink | OUTLINK | ||||||||||||||||||
RLV | R/W* | Relative Value | DOUBLE | ||||||||||||||||||
RMP | R | Raw Motor Position | DOUBLE | ||||||||||||||||||
RRBV | R | Raw Readback Value | DOUBLE | ||||||||||||||||||
RRES | R/W | Readback Step Size (EGU) | FLOAT | ||||||||||||||||||
RTRY | R/W | Max retry count | SHORT | ||||||||||||||||||
RVAL | R/W* | Raw Desired Value | DOUBLE | ||||||||||||||||||
RVEL | R | Raw Velocity | LONG | ||||||||||||||||||
S | R/W | Speed (RPS) | FLOAT | ||||||||||||||||||
SBAK | R/W | BL Speed (RPS) | FLOAT | ||||||||||||||||||
SBAS | R/W | Base Speed (RPS) | FLOAT | ||||||||||||||||||
SET | R/W | Set/Use Switch | RECCHOICE | (0:"Use", 1:"Set") | |||||||||||||||||
SMAX | R/W | Max Velocity (RPS) | FLOAT | ||||||||||||||||||
SPMG | R/W* | Stop/Pause/Move/Go | RECCHOICE | (0:"Stop", 1:"Pause", 2:"Move", 3:"Go") | |||||||||||||||||
SREV | R/W* | Steps per Revolution | LONG | ||||||||||||||||||
SSET | R/W | Set SET Mode | SHORT | ||||||||||||||||||
STOO | R/W | STOP OutLink | OUTLINK | ||||||||||||||||||
STOP | R/W* | Stop | SHORT | ||||||||||||||||||
SUSE | R/W | Set USE Mode | SHORT | ||||||||||||||||||
TDIR | R | Direction of Travel | SHORT | ||||||||||||||||||
TWF | R/W* | Tweak motor Forward | SHORT | ||||||||||||||||||
TWR | R/W* | Tweak motor Reverse | SHORT | ||||||||||||||||||
TWV | R/W* | Tweak Step Size (EGU) | FLOAT | ||||||||||||||||||
UEIP | R/W* | Use Encoder If Present | RECCHOICE | (0:"No", 1:"Yes") | |||||||||||||||||
UREV | R/W* | EGU's per Revolution | FLOAT | ||||||||||||||||||
URIP | R/W* | Use RDBL Link If Present | RECCHOICE | (0:"No", 1:"Yes") | |||||||||||||||||
VAL | R/W* | User Desired Value | DOUBLE | ||||||||||||||||||
VBAS | R/W | Base Velocity (EGU/s) | FLOAT | ||||||||||||||||||
VELO | R/W | Velocity (EGU/s) | FLOAT | ||||||||||||||||||
VERS | R | Code Version | FLOAT | e.g., "1.95" | |||||||||||||||||
VMAX | R/W | Max Velocity (EGU/s) | FLOAT | ||||||||||||||||||
VOF | R/W | Variable Offset | SHORT | ||||||||||||||||||
|
PID related record fields accept only normalized
values (i.e., 0.0 <= value <= 1.0). Before sending them to the motor
controller, device support scales the record fields to valid motor controller
parameters,. Let the motor controller PID parameters be represented by CKP,
CKI and CKD; then the PID coefficients are converted from motor record fields to
controller parameters as follows:
For the MM4000; CKP = PCOF, CKI = ICOF and CKD = DCOF. Note the following:
|
||||
|
|
|
|
|
CNEN | R/W | Enable control | RECCHOICE | (0:"Disable", 1:"Enable") Enable/Disable closed-loop position control. This field is active only if the GAIN_SUPPORT bit in the MSTA is true. This field is set by both the user and device support. CNEN is set to Disable by device support when it detects a motion controller error; e.g. maximum following error exceeded. |
PCOF | R/W | Proportional Gain | FLOAT | Valid range; 0.0 <= PCOF <= 1.0 |
ICOF | R/W | Integral Gain | FLOAT | Valid range; 0.0 <= ICOF <= 1.0 |
DCOF | R/W | Derivative Gain | FLOAT | Valid range; 0.0 <= DCOF <= 1.0 |
SOURCE CODE files to be placed in <top>/<app>App/src/ |
|
---|---|
motorRecord.dbd | Database Definition file for motor record. |
motorRecord.c | Record support for the motor record |
motor.h | Header included by all .c files |
motordevCom.c | Device support common to all motor Record device drivers. |
motordevCom.h | Device support header file. |
motordrvCom.c | Driver support common to all motor Record device drivers. |
motordrvCom.h | Driver support header file. |
motordrvComCode.h | Local variables common to all motor Record drivers. |
NOTE: All of the above files are required for any and all motor Record device drivers. | |
devOmsCom.c | Device support common to all Oregon Micro Systems device drivers. |
devOmsCom.h | Device support header file common to all Oregon Micro Systems device drivers. |
drvOmsCom.h | Driver support header file common to all Oregon Micro Systems device drivers. |
NOTE: The above files are required for any and all Oregon Micro Systems device drivers. | |
devOms.c | Device support for Oregon Micro Systems VME8 and VME44 series boards |
drvOms.c | Driver for Oregon Micro Systems VME8 and VME44 series boards |
drvOms.h | Header included by devOms.c and drvOms.c |
devOms58.c | Device support for Oregon Micro Systems VME58 series boards |
drvOms58.c | Driver for Oregon Micro Systems VME58 series boards |
drvOms58.h | Header included by devOms58.c and drvOms58.c |
devV544.c | Device support for Highland Technology boards. |
drvV544.c | Driver for Highland Technology boards. |
drvV544.h | Header included by devV544.c and drvV544.c |
drvMMCom.h | Common header included by all Newport Motion Master device drivers. |
NOTE: The above files are required for any and all Newport Motion Master device drivers. | |
devMM3000.c | Device support for Newport MM3000. |
drvMM3000.c | Driver for Newport MM3000. |
devMM4000.c | Device support for Newport MM4000/40005. |
drvMM4000.c | Driver for Newport MM4000/40005. |
devPM500.c | Device support for Newport PM500. |
drvPM500.c | Driver for Newport PM500. |
devESP300.c |
Device support for Newport ESP300. |
drvESP300.c |
Driver for Newport ESP300. |
devSoft.c | Soft Channel device support. |
devSoftAux.c | Soft Channel device support (Note: CA and record access code cannot both reside in the same file; each defines (redefines) the DBR's. Hence, functions are split between this and the above file base on whether they are record oriented (devSoft.c) or CA oriented (devSoftAux.c). |
devSoft.h | Header included by devSoft.c and devSoftAux.c |
gpibIO.h | GPIB communication include file. |
gpibIO.c | GPIB interface via Hideos. |
serialIO.h | Serial communication include file. |
serialIOMPF.cc | Serial communication interface via MPF. |
drvIM483.h | Common header included by all IMS device drivers. |
devIM483PL.c | Device support for IM483 in party line communication mode. |
devIM483SM.c | Device support for IM483 in single mode communication mode. |
drvIM483PL.c | Driver for IM483 in party line communication mode. |
drvIM483SM.c | Driver for IM483 in single mode communication mode. |
MEDM DISPLAY SCREENS files to be placed in <top>/<app>App/op/adl/ |
|
---|---|
motorx.adl | Small motor-control screen |
motorx_tiny.adl | Tiny motor-control screen |
motorx_more.adl | Medium motor-control screen |
motorx_setup.adl | Setup screen for a single motor |
motorx_all.adl | Debug screen for a single motor |
These files build medm screens to access the motor
record. To use one of them from the command line, type, for example
medm -x -macro "P=XXX:,M=m1" motorx.adlwhere XXX:m1 is the name of a motor record in an IOC. These files can also be used as related displays from other medm screens by passing the argument "P=XXX:,M=m1" . |
EPICS STARTUP FILES files to be placed in <top>/ioc/ioc<name>/ |
|||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
st.cmdmv167 | Startup script | ||||||||||||||||||||||
A sample startup script, containing excerpts relevant to motors,
is included in the distribution. Here is an annotated copy:
#######################################################################Load standard EPICS software # the following should be loaded first - BEGINLoad custom EPICS software (including motor support) ld < ../../stdApp/src/O.mv167/stdlib.oMotor-related debug switches recMotordebug = 0Motor-related databases # load this before loading any databasesSpecify motor-controller board address, interrupt vector, etc.
# OMS VME8, VME44, VMEX driver setup parameters:Start EPICS iocInit |
BACKUP/RESTORE (BURT) REQUEST FILES files to be placed in <top>/<app>App/op/burt/ |
|
---|---|
settings.req | sample request file to save settings of all motors. Edit this file, supplying names of the motor records whose settings you want saved. (The sample file also saves the states of other records in the sample database, m16.db, that enable or disable the motor records.) |
yyMotorSettings.req | save settings of a specified motor. This file is #include 'd (once for each motor) by settings.req. |
positions.req | sample request file to save positions of all motors. Edit this file, supplying names of the motor records whose positions you want saved. |
yyMotorPositions.req | save position of a specified motor, This file is #include 'd (once for each motor) by positions.req. |
These files tell the backup/restore tool how to save motor
settings and positions. To use them from the command line, type, for example
burtrb -f settings.req -o myMotorSettings.snapTo restore the motor settings and positions saved by the above commands, type burtwb -f myMotorSettings.snap |
There is no way to ask for a reading of the motor's position register, encoder, or limit switches. These are read only while the motor is moving.
Because of the way limit-switch information is conveyed by the OMS hardware, the motor record cannot know the states of both limit switches at the same time. It only knows the state of the switch toward which the motor is moving.
If a move is requested while the motor already is in motion, the original move will still receive a (useless) backlash correction.
Changing MRES (the motor resolution) should change VELO (the speed in
engineering units per second), and leave S (the speed in revolutions per second)
unchanged. Currently, neither VELO nor S appears to change, but the record
behaves as though S had been changed to agree with VELO. A similar thing happens
with SBAK and SBAS.
The following database implements the system described above. The database consist of four records:
grecord(motor,"$(user):rotary") { field(DTYP,"Soft Channel") field(OUT,"$(user):convertDriveValue.A PP MS") field(RDBL,"$(user):convertReadbackValue.VAL NPP MS") field(URIP,"Yes") field(STOO,"$(user):linear.STOP PP MS") field(DINP,"$(user):linear.DMOV NPP MS") field(MRES,"0.001") field(RRES,"1.000") field(PREC,"3") field(DHLM,"45") field(DLLM,"-45") field(TWV,"5") field(RTRY,"0") field(EGU,"deg.") } |
grecord(motor,"$(user):linear") { field(DTYP,"OMS VME58") field(VBAS,"1.0") field(VELO,"25.0") field(OUT,"#C0 S0 @") field(MRES,"0.001") field(PREC,"3") field(DHLM,"1000") field(DLLM,"-1000") field(RTRY,"0") field(TWV,"1") field(EGU,"mm.") } |
grecord(calcout,"$(user):convertDriveValue") { field(DESC,"Convert rotary to linear") field(CALC,"TAN(A / 57.296) * 1000") field(OUT,"$(user):linear.DVAL PP MS") } |
grecord(calcout,"$(user):convertReadbackValue") { field(DESC,"Convert linear to rotary") field(CALC,"ATAN(A / 1000) * 57.296") field(INPA,"$(user):linear.DRBV CP MS") } |
Background: The MM4000 is a stand-alone controller with it's own front panel, non-volatile memory and power supply. The user can configure the MM4000 entirely from the front panel; including which engineering units will be displayed on the front panel. Once engineering units are selected, these same units will be used by the MM4000 when communicating with a host system (i.e., EPICS). Since a host can query the MM4000 for both the controller's engineering units and it's positioning resolution, it is possible to have the motor record's EGU and MRES fields automatically set based on values stored in the MM4000 controller, but we decided not to do this.
To maximize flexibility, we decided to keep these characteristics separate
between the motor record and the controller. This decision allows the
motor record EGU field (and consequently, MRES) to be set to an application
specific value (e.g., kV) that is not supported by the motor controller.