Use of the EPID record for feedback at UNICAT (2004-06-23)
An swait (calculation) record was used to simulate a crystal reflection (Lorentzian peak shape) and to calculate the response of the crystal to different parameters using EPICS records. The various ananlog output (ao) records are used (by name) as inputs to the swait record. A state notation (SNL) program was written to generate Gaussian-probability (zero mean, unit standard deviation) random numbers to simulate experimental noise. The ideal position of the reflection is also adjusted by the SNL program to simulate drift in the ideal tuning position for the crystal element. An additional Gaussian random number was used to provide a small amplitude of jitter to the ideal position.
hnl:userCalc10 value for epid_test:response function
A | hnl:epid:positioner.VAL |
B | hnl:epid:resp:ideal |
C | hnl:epid:resp:sigma |
D | hnl:epid:resp:scale |
E | hnl:epid:resp:base |
F | hnl:epid:resp:noise |
G | 1.00002 |
CALC | G*(D/(1+((A-B)/C)^2)^2+E) |
An epid record provides the means to drive the pseudo-positioner in a closed feedback loop. The epid record can be operated in either a hold constant (PID control) mode or a maximize (or minimize) mode. In the latter mode, negative input signals will be minimized while positive signals are maximized. Consider that the software will only maximize the absolute value of the input signal. The next table shows a working configuration for maximizing the signal generated by the previously-shown calculation.
epid_test: working configuration | SCAN | 0.2 seconds | | input | hnl:userCalc10.VAL NPP NMS | | KP | 0.004 | | MODE | Max/Min | | low limit | -2 | | high limit | 9 |
One limitation of the epid record is that the output link must be a database link. Therefore, it must be defined in the database at boot time, although the string is changeable at run time. (Why is this?) Circumventing this presumed limitation, an swait record (next table) has been configured to picl up the calculation value from the epid record and pass it to the chosen positioner, provided that the epid record feedback mode has been turned on.
hnl:userCalc9 epid_test: position calculation
SCAN | I/O Intr |
A | hnl:epid:epid.OVAL |
B | hnl:epid:epid.FBON |
C | hnl:userCalc9.VAL |
CALC | B?A:C |
Comments
Some packaging remains to be completed in order to use the epid record for routine software feedback and replace the existing software feedback. Features of that packaging might include :
- Automatic on/off mode when input signal is out of range
- User selection of input signal(s)
- User selection of positioner
- Preservation of separate tuning parameters for PID and Max/Min modes
- When in Max/Min mode, automatic update of set point to maximum (minimum)
- Scan of positioner through user-specified range to locate peak (?using sscan record?)
- EGU, PREC, DRVH, DRVL fields come from positioner
- Support HOPR and LOPR on GUI screens