Hi,
I am developing a Soft Channel motor to be a virtual motor that controls two other motors. The virtual motor is essentially a copy of one of the underlying motors and applies ‘adjustment’ moves to the other motor it controls in accordance
with a pre-specified alignment profile (using a simple linear equation determined by calibration).
Most of this is working well. However, when the IOC starts, the virtual motor often fails to retrieve its RBV value from the underling motor. I’ve included the soft channel motor record below.
How do I fix this?
I am using EPICS base version 3.14.12.6. I am currently developing on my VM with Simulated motors. I’m not sure what differences to expect when I deploy this to an actual instrument.
So far I haven’t found a simple solution.
However, I have created horribly complicated solution that seems to work: I created another do-nothing Soft Channel motor and make it part of the virtual motor system, so now the overall virtual motor controls 3 motors, one of them being
the do-nothing motor. Then, if the RBV value was not set properly at launch time, I move this do-nothing motor. This has the effect of sometimes properly setting the RBV of the main virtual motor. If that doesn’t work, I try it again, and again, up to some
maximum number. I call this process ‘kicking’ the RBV.
It's a kludgy and nasty solution. I would very much appreciate knowing how to fix this in some simple way.
Thank you,
Ray Gregory
Oak Ridge National Laboratory
################################################################
#
# Database template to create a Virtual ISD (Incident Slit Distance)
# soft motor record based on three underlying real motors:
#
# 1) Real ISD motor
#
# 2) Motor controlling the center of the incident slits.
# NOTE: This is also a virtual soft motor defined elsewhere.
#
# 3) do-nothing Auxiliary soft motor with the only purpose of
# being used to 'kick' the RBV of the main virtual motor into shape
# (see code and comments below).
#
# Derived from slit.template (Matthew Pearson; Feb 2014).
# Adapted for Virtual ISD (Ray Gregory; Jun 2022).
#
# Macros:
# VM - PV name of Virtual ISD axis
# M1 - The real ISD motor PV
# M2 - The incident slit center motor PV
# DESC - Description used for virtual ISD axis (e.g., 'Virtual ISD')
# PREC (optional) - Display precision for virtual motor
# MRES (optional) - Virtual motor resolution
#
# Notes:
# * Do not set an offset on the virtual motor, otherwise the readback
# will be out of sync with the demand.
# * Errors on the underlying real motors that generate an alarm condition
# should be visible in the virtual motor. However, if the real motor
# doesn't move and doesn't generate an alarm then we will not see this.
# In this case only one real motor will move (and virtual ISD will
# compensate to take it into account). To deal with soft limit
# violations, it will be necessary to set up soft limits on the virtual
# motor to prevent soft limit violations on the real motors (which
# don't generate alarm states).
# * Using an offset on the virtual ISD will not affect any software limits
# on the virtual motor, so these should be manually changed as well. Not sure
# if we want to automate this. Ideally the motor record should be fixed so limits
# work with soft motors.
################################################################
################################################################
# Virtual ISD motor calculation
################################################################
# ///
# /// Virtual ISD soft motor
# ///
record(motor, "$(VM)") {
field(DESC, "$(DESC)")
field(DTYP, "Soft Channel")
field(OUT, "$(VM):Set PP")
field(RDBL, "$(M1).RBV")
field(RRES, "1")
field(URIP, "Yes")
field(TWV, "0.1")
field(DINP, "$(VM):Done.VAL")
field(STOO, "$(VM):Stop PP")
field(RTRY, "0")
field(OFF, "0")
field(FOFF, "Frozen")
field(NTM, "NO")
field(PREC, "$(PREC=4)")
field(MRES, "$(MRES=0.0001)")
field(DLLM, "0")
field(DHLM, "100")
field(EGU, "mm")
info(autosaveFields, "DLLM DHLM TWV DLY ADEL MDEL DISA DISP")
info(archive, "Monitor, 00:00:01, VAL RBV DMOV STAT LVIO HLS LLS")
}
Ray Gregory
IDAC HFIR Software Team
Instrument Data Acquisition and Controls Group
Neutron Technologies Division
Neutron Sciences Directorate
Oak Ridge National Laboratory
Building 7964K Room 19
ph (865) 241-1116
cell (417) 827-6515
email:
gregoryrd at ornl.gov
Oak Ridge National Laboratory
P. O. Box 2008
1 Bethel Valley Road, MS-6430
Oak Ridge, TN 37831