Download presentation
Presentation is loading. Please wait.
Published byKatrina Palmer Modified over 6 years ago
1
Diamond Motion Control Emma Shepherd & Matthew Pearson May 2011
High level look at motor control software EPICS Motor record EPICS Motor driver organisation PMAC Co-ordinate systems (synchronized motion) PMAC PLC programs Python motor control software Plans
2
The EPICS Motor Record Generic user interface to most kinds of motor:
Move, Stop, Home User offset Change sign of motion Motion retries in case of failed move Handles backlash Software limits Axis status Set velocity, acceleration, etc Call-back when motion complete >100 fields in the record
3
Diamond User Interface (EDM)
4
Axis Status Motion Parameters
5
Soft Limits and Calibration
User adjustable direction and offset
6
High level look at motor control software
IOC Motor Record Axis 2 Motor Record Axis 1 User interface Driver abstraction layer Motor Controller Device Support Device Support User Program Controller Tasks (servo loop, etc) Device Driver VME Bus, Ethernet, Etc Record/Device Support/Device Driver is generally how EPICS software is organised.
7
PMAC Co-ordinate System Driver
Can define virtual axes that look (almost) the same as standard motors. We use a customised PMAC driver to operate/readback the co-ordinate systems. Example: Table with 3 jacks Y1 Y2 Y3 Pitch Angle - X Height - Y Advantages: True synchronized motion Pushes complexity down into controller Disadvantages: Requires EPICS PMAC driver changes More to maintain #1 J=100 X(0.5)Y(100)
8
Example: Hexapods Complex kinematics
Suppliers adhere to Diamond PMAC programming conventions so that we can use the motor record co-ordinate system driver to control it: Q71..Q79: Axis demand positions – written down from the motor record Q81..Q89: Axis readback positions – constantly calculated in a PLC from the real motor (leg) positions
9
‘Soft’ Motor Driver Calc Define output and readback links to other PVs
An alternative to PMAC co-ordinate systems Commonly used to control piezo motors via simple analogue interface X+ Blade Calc X- Blade X Centre
10
Motor Record Closed Loop Control
Define output to the motion controller axis Setup readback link to a PV Turn ‘Use Readback If Present’ ON Setup maximum retries and retry deadband
11
Example Control Screen (a PGM)
Different motor record parameters for fast vs high precision moves Encoder averaging done in EPICS
12
PMAC Status
13
PMAC PLC Programs Run in the background PLC 0 can be used for more
Monitor digital inputs / set outputs Setup motion related parameters Provide safety checks (encoder loss and motion stop) Reset controller state Power on/off amplifiers between moves Axis homing Run in the background PLC 0 can be used for more critical tasks. PLC 1 is run first at power-on / reset CLOSE DELETE GATHER OPEN PLC 2 CLEAR {PLC statements here} ENABLE PLC 2
14
Diamond Standard PLCs Try to standardise PLCs run on all PMACs and Geobricks: PLC1 – PMAC/UMAC initialization PLC2 – Monitors the motion stop input PLC3 – Auto-energises motors PLC4 – Encoder loss detection PLC5 – CPU load monitoring PLC6 – Geobrick internal amplifier setup PLC7 – Powers down motors after a move
15
Homing PLC programs We use PLCs to:
Widen soft limits when homing Search for home flag on encoder Drive quickly (in right direction) to home position Move back to old position after home Provides feedback (success, fail, following error, etc.) 1 PLC to handle a ‘device’ – pair of slits, mirror jacks, etc. Provides a 1-click ‘home’ button for a device. Python script is used to generate the PLC at IOC build time.
16
Nanomotor Duty Cycle PLC 0 used to enforce the duty cycle
Motor is killed after maximum move time Enforced rest time is 3*actual move time EPICS interrogates PMAC variables to display status
17
Python motor applications
Expert control Configuration upload/backup
18
Similar software for XPS controller
19
Build framework for scanning / data gathering
Future/Ongoing work Build framework for scanning / data gathering Currently have software for XPS, but no equivalent for PMAC. Need to build abstract interface for this. Re-implement driver layers in C++ There is a new Epics motor driver framework, developed by Mark Rivers (Chicago/APS). Will make it easier to implement and maintain drivers in future. Make our PMAC python motor software and utilities more widely available. Attempt to standardise use of PMAC advanced functions (PLCs, co-ordinate systems, etc) across EPICS sites, which will lead to common EPICS software. Bug fixes, etc…..
20
Questions?
21
Backup Slides
22
Driver Layers XPS drvMotorAsyn.c drvXPSAsyn.c pmacAsynMotor.c TCP
Socket XPS_C8_Drivers.c Asyn Interpose pmacAsynIPPort.c pmacDriver.c pmacVme.c XPS drvAsynIPPort.c VME PMAC Ethernet PMAC
23
EPICS motor control software summary
Motor Record 1 ai Motor Record 2 DTYPE=asynFloat64 devMotorAsyn devAsynFloat64 devMotorAsyn Asyn Port Asyn Port drvMotorAsyn drvMotorAsyn pmacAsynMotor drvXPSAsyn Asyn Octet Socket pmacAsynIPPort (interpose - optional) XPS VME or Socket or Serial Port interface PMAC
24
EPICS IOC startup (XPS example from I16 diffractometer)
#XPSSetup(number of controllers) XPSSetup(3) #XPSConfig(card,IP,PORT,number of axes,active poll period (ms), #idle poll period (ms)) XPSConfig(0, " ", 5001, 7, 50, 500) #Configure ASYN motor controller. #(asyn port, driver name, controller index, max number of axes). drvAsynMotorConfigure("XPS1", "motorXPS", 0, 7) #XPSConfigAxis(card, axis, group.positioner, #number of steps per user unit) XPSConfigAxis(0,0,"Z1_Z2_Z3.Z1_BASE", 10000) XPSConfigAxis(0,1,"Z1_Z2_Z3.Z2_BASE", 10000) XPSConfigAxis(0,2,"Z1_Z2_Z3.Z3_BASE", 10000) XPSConfigAxis(0,3,"GROUP4.Y_BASE", 1000) XPSConfigAxis(0,4,"GROUP6.X_sample", ) XPSConfigAxis(0,5,"GROUP7.Y_sample", ) XPSConfigAxis(0,6,"GROUP8.Z_sample", ) Allocate memory for driver data structures for each XPS Configure driver for each XPS. Open sockets, etc. Set up Asyn driver. Pass in type of driver and name of XPS port. Set up controller axis names in driver.
25
Example Coordinate system (slit gap and centre)
; Change to coordinate system 2 and set relevant ; axes to use kinematics &2 #1->I ; +ve blade (B+) #2->I ; -ve blade (B-) OPEN FORWARD ; Calculate Gap and Centre ; X = Q7 = centre in mm = ({B+}+{B-})/2 ; Y = Q8 = gap in mm = {B+}-{B-} CLEAR Q7=(P1+P2)/2 Q8=P1-P2 CLOSE + similar for inverse + actual position readback PLC program + motion program to execute move Q-variables are local to coordinate systems Python script is used to generate the coordinate system and PLC at IOC build time.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.