BCDA-APS / apstools

various tools for use with Bluesky at the APS
https://bcda-aps.github.io/apstools/latest/
Other
16 stars 9 forks source link

Revolver insertion device (only 08US, 08DS, 34DS) #979

Closed prjemian closed 3 months ago

prjemian commented 4 months ago

image

prjemian commented 4 months ago

/APSshare/adlsys/screens/adl/iocs/idctl/adl_BL/newIDControl_Revolver.adl

prjemian commented 4 months ago
(base) usaxs@usaxscontrol /APSshare/adlsys $ ll */*/*/*/*/ID_*
-rw-r--r-- 1 aesbc 198702 May 23 12:39 screens/adl/iocs/idctl/adl_Global/ID_Control.adl
-rw-r--r-- 1 aesbc 137012 May 23 12:39 screens/adl/iocs/idctl/adl_Global/ID_Global_Ctl.adl
-rw-r--r-- 1 aesbc 165995 May 23 12:39 screens/adl/iocs/idctl/adl_Global/ID_Global_Ctl.adl_20240417
-rw-r--r-- 1 aesbc  39762 May 23 12:39 screens/adl/iocs/idctl/adl_Global/ID_IOC_Status.adl
-rw-r--r-- 1 aesbc  39706 May 23 12:39 screens/adl/iocs/idctl/adl_Global/ID_IOC_Status.adl_20240417.adl
-rw-r--r-- 1 aesbc  40046 May 23 12:39 screens/adl/iocs/idctl/adl_Global/ID_IOC_Status.adl_20240417.adl.adl
-rw-r--r-- 1 aesbc  63499 May 23 12:39 screens/adl/iocs/idctl/adl_Global/ID_Main.adl
-rw-r--r-- 1 aesbc  63303 May 23 12:39 screens/adl/iocs/idctl/adl_Global/ID_Main_BK2.adl
-rw-r--r-- 1 aesbc 202675 May 23 12:39 screens/adl/iocs/idctl/adl_Global/ID_Status_1.adl
-rw-r--r-- 1 aesbc 209128 May 23 12:39 screens/adl/iocs/idctl/adl_Global/ID_Status_1_BK2.adl
-rw-r--r-- 1 aesbc 182868 May 23 12:39 screens/adl/iocs/idctl/adl_Global/ID_Status_2.adl
-rw-r--r-- 1 aesbc 228243 May 23 12:39 screens/adl/iocs/idctl/adl_Global/ID_Status_2_BK2.adl
-rw-r--r-- 1 aesbc 189302 May 23 12:39 screens/adl/iocs/idctl/adl_Global/ID_SysMgr_Citrix1.adl
-rw-r--r-- 1 aesbc 169890 May 23 12:39 screens/adl/iocs/idctl/adl_Global/ID_SysMgr_Citrix2.adl
-rw-r--r-- 1 aesbc   3175 May 23 12:39 screens/adl/iocs/idctl/adl_Legacy/ID_Identifiers.adl
-rw-r--r-- 1 aesbc   3658 May 23 12:39 screens/adl/iocs/idctl/adl_New/ID_Identifiers.adl
-rw-r--r-- 1 aesbc   1232 May 23 12:39 screens/adl/iocs/idctl/adl_New/ID_Planar_OtherPanelButton.adl
-rw-r--r-- 1 aesbc  16176 May 23 12:39 screens/adl/iocs/idctl/adl_New/ID_Planar_Setup.adl
-rw-r--r-- 1 aesbc  40039 May 23 12:39 screens/adl/iocs/idctl/adl_New/ID_Planar_SysControl.adl
-rw-r--r-- 1 aesbc   1234 May 23 12:39 screens/adl/iocs/idctl/adl_New/ID_Resolver_OtherPanelButton.adl
-rw-r--r-- 1 aesbc  32471 May 23 12:39 screens/adl/iocs/idctl/adl_New/ID_Revolver_Setup.adl
-rw-r--r-- 1 aesbc  47955 May 23 12:39 screens/adl/iocs/idctl/adl_New/ID_Revolver_SysControl.adl
-rw-r--r-- 1 aesbc   1202 May 23 12:39 screens/adl/iocs/idctl/adl_New/ID_STI_OtherPanelButton.adl
-rw-r--r-- 1 aesbc   6485 May 23 12:39 screens/adl/iocs/idctl/adl_New/ID_SwitchesLarge.adl
-rw-r--r-- 1 aesbc  26647 May 23 12:39 screens/adl/iocs/idctl/adl_New/ID_SwitchesLarge_BK.adl
prjemian commented 4 months ago

(base) usaxs@usaxscontrol /APSshare/adlsys $ grep chan= screens/adl/iocs/idctl/adl_BL/newIDControl_Revolver.adl chan="$(P):AccessSecurityC" chan="$(P):AccessSecurityC.VAL" chan="$(P):AtSafeGapM.VAL" chan="$(P):DeadbandGapC" chan="$(P):DeviceLimitM.VAL" chan="$(P):DeviceM" chan="$(P):DeviceMagnetM" chan="$(P):EnergyM.VAL" chan="$(P):EnergySetC.VAL" chan="$(P):GapM.VAL" chan="$(P):GapSetC.VAL" chan="$(P):HarmonicValueC" chan="$(P):HPMUVersionM.VAL" chan="$(P):LocationM" chan="$(P):Message1M.VAL" chan="$(P):Message2M.VAL" chan="$(P):Message3M.VAL" chan="$(P):OptimumTaperM.VAL" chan="$(P):PLCVersionM.VAL" chan="$(P):Position1M" chan="$(P):Position1M.VAL" chan="$(P):Position2M" chan="$(P):Position2M.VAL" chan="$(P):RevolverSelectC.VAL" chan="$(P):StartC.VAL" chan="$(P):StopC.VAL" chan="$(P):TaperEnergyM.VAL" chan="$(P):TaperEnergySetC.VAL" chan="$(P):TaperGapM.VAL" chan="$(P):TaperGapSetC.VAL" chan="$(P):TotalPowerM.VAL"

prjemian commented 4 months ago

Consider energy, energy_taper, gap, gap_taper as positioners

https://github.com/BCDA-APS/apstools/blob/ece96632cb919c34c18bc200645189a5632fa576/apstools/devices/positioner_soft_done.py#L239-L239

or

https://github.com/BCDA-APS/apstools/blob/ece96632cb919c34c18bc200645189a5632fa576/apstools/devices/positioner_soft_done.py#L28

prjemian commented 4 months ago

"$(P):RevolverSelectC.VAL" is the widget in the bottom left corner image

prjemian commented 4 months ago

image

is "$(P):Position1M"

prjemian commented 4 months ago

image

This area has the three messages:

                chan="$(P):Message1M.VAL"
                chan="$(P):Message2M.VAL"
                chan="$(P):Message3M.VAL"
prjemian commented 4 months ago

Boxes with sunken borders are writeable image

prjemian commented 4 months ago

Here's a view of that screen in the MEDM editor image

prjemian commented 4 months ago
positioner setpoint readback
energy $(P)EnergySetC.VAL $(P)EnergyM.VAL
energy_taper $(P)TaperEnergySetC.VAL $(P)TaperEnergyM.VAL
gap $(P)GapSetC.VAL $(P)GapM.VAL
gap_taper $(P)TaperGapSetC.VAL $(P)TaperGapM.VAL
prjemian commented 4 months ago

Some examples

apstools/devices/xia_slit.py:    inb = Component(PVPositionerSoftDone, "", setpoint_pv="l", readback_pv="lRB")
apstools/devices/xia_slit.py:    out = Component(PVPositionerSoftDone, "", setpoint_pv="r", readback_pv="rRB")
apstools/devices/xia_slit.py:    bot = Component(PVPositionerSoftDone, "", setpoint_pv="b", readback_pv="bRB")

Adding WithStop seems to always be done in a subclass, so far:

apstools/devices/eurotherm_2216e.py:class Eurotherm2216e(PVPositionerSoftDoneWithStop):
apstools/devices/lakeshore_controllers.py:class LakeShore336_LoopControl(PVPositionerSoftDoneWithStop):
apstools/devices/lakeshore_controllers.py:class LS340_LoopBase(PVPositionerSoftDoneWithStop):
apstools/devices/linkam_controllers.py:class T96Temperature(PVPositionerSoftDoneWithStop):
apstools/devices/positioner_soft_done.py:class PVPositionerSoftDoneWithStop(PVPositionerSoftDone):
apstools/devices/simulated_controllers.py:class SimulatedSwaitControllerPositioner(PVPositionerSoftDoneWithStop):
apstools/devices/simulated_controllers.py:class SimulatedTransformControllerPositioner(PVPositionerSoftDoneWithStop):
canismarko commented 4 months ago

From mattermost conversation with TomCaswell. The PVPositionerSoftDone may not be necessary. With a PR to Ophyd, we might be fine with using the done, stop signals in a normal Ophyd PVPositioner.

ah, the . access can go down but not up 13:07

we could special case parent to mean "go up" 13:11

hmm 13:11

less sure I know what is going on... Thomas Caswell|NSLS-II 13:17

diff --git a/ophyd/ophydobj.py b/ophyd/ophydobj.py
index 471ffedd..918f33a5 100644
--- a/ophyd/ophydobj.py
+++ b/ophyd/ophydobj.py
@@ -156,8 +156,6 @@ class OphydObject:
             kind = Kind.normal
         self.kind = kind

-        super().__init__()
-
         # base name and ref to parent, these go with properties
         if name is None:
             name = ""
@@ -167,6 +165,9 @@ class OphydObject:
         self._name = name
         self._parent = parent

+        # let Device do its thing
+        super().__init__()
+
         # dictionary of wrapped callbacks
         self._callbacks = {k: {} for k in self.subscriptions}
         # this is to maintain api on clear_sub

This may fix it 13:19

also try setting lazy=True on the components 13:20

I think what is going on is that as part of device creation we try to reach out to get something from the parent before parent is defined 13:21

or before the thing on the parent is defined 13:21

it may also work if you put the start/stop signals before you refer to them

prjemian commented 4 months ago
$ find /APSshare/adlsys/screens/adl -name newIDControl_Revolver.adl
/APSshare/adlsys/screens/adl/iocs/idctl/adl_BL/newIDControl_Revolver.adl
/APSshare/adlsys/screens/adl/iocs/idctl/adl_New/newIDControl_Revolver.adl
prjemian commented 4 months ago

They have the same timestamp, size, and cksum: the same file.

$ grep chan= /APSshare/adlsys/screens/adl/iocs/idctl/adl_BL/newIDControl_Revolver.adl
        chan="$(P):StopC.VAL"
        chan="$(P):DeviceM"
        chan="$(P):Message2M.VAL"
        chan="$(P):Message1M.VAL"
        chan="$(P):EnergyM.VAL"
        chan="$(P):GapSetC.VAL"
        chan="$(P):EnergySetC.VAL"
        chan="$(P):GapM.VAL"
        chan="$(P):LocationM"
        chan="$(P):StartC.VAL"
        chan="$(P):DeviceLimitM.VAL"
        chan="$(P):DeadbandGapC"
        chan="$(P):AccessSecurityC.VAL"
        chan="$(P):TaperGapSetC.VAL"
        chan="$(P):TaperEnergySetC.VAL"
        chan="$(P):TaperEnergyM.VAL"
        chan="$(P):TaperGapM.VAL"
        chan="$(P):HarmonicValueC"
        chan="$(P):PLCVersionM.VAL"
        chan="$(P):TotalPowerM.VAL"
        chan="$(P):AccessSecurityC"
        chan="$(P):OptimumTaperM.VAL"
        chan="$(P):HPMUVersionM.VAL"
        chan="$(P):DeviceMagnetM"
        chan="$(P):Message3M.VAL"
        chan="$(P):RevolverSelectC.VAL"
        chan="$(P):Position1M"
        chan="$(P):Position1M.VAL"
        chan="$(P):Position2M.VAL"
        chan="$(P):Position2M"
        chan="$(P):AtSafeGapM.VAL"
prjemian commented 3 months ago

Connected to 8ID upstream

In [2]: undulator = RevolverInsertionDevice("S08ID:USID:", name="undulator")

In [3]: undulator.connected
Out[3]: True

In [4]: undulator.energy.position
Out[4]: 16.25984001159668

In [5]: from apstools.utils import listdevice

In [6]: listdevice(undulator, show_pv=True)
Out[6]: 
================================== ================================ ===================== ==========================
name                               PV                               value                 timestamp                 
================================== ================================ ===================== ==========================
undulator.gap_deadband             S08ID:USID:DeadbandGapC          0.0                   2024-06-07 11:26:58.041505
undulator.device_limit             S08ID:USID:DeviceLimitM.VAL      50.9                  2024-06-29 15:15:14.324279
undulator.access_mode              S08ID:USID:AccessSecurityC       2                     2024-07-01 14:20:00.698128
undulator.message1                 S08ID:USID:Message1M.VAL         Device At Destination 2024-07-01 08:55:50.589036
undulator.message2                 S08ID:USID:Message2M.VAL                               2024-07-01 08:53:32.359274
undulator.device                   S08ID:USID:DeviceM               APS21R25#10           2024-06-07 11:27:10.426276
undulator.magnet                   S08ID:USID:DeviceMagnetM         APS21#15              2024-06-07 11:27:10.426277
undulator.location                 S08ID:USID:LocationM             S08ID-UpStream        2024-06-07 11:27:10.231091
undulator.version_plc              S08ID:USID:PLCVersionM.VAL       1.0399999618530273    2024-06-26 09:58:43.389749
undulator.version_hpmu             S08ID:USID:HPMUVersionM.VAL      4.06                  1989-12-31 18:00:00       
undulator.start_button             S08ID:USID:StartC.VAL            1                     2024-06-21 17:33:41.199796
undulator.stop_button              S08ID:USID:StopC.VAL             1                     2024-06-20 09:07:59.417066
undulator.busy                     S08ID:USID:BusyM.VAL             0                     1989-12-31 18:00:00       
undulator.done                     S08ID:USID:BusyDeviceM.VAL       1                     1989-12-31 18:00:00       
undulator.motor_drive_status       S08ID:USID:MotorDriveStatusM.VAL 1.0                   1989-12-31 18:00:00       
undulator.energy.setpoint          S08ID:USID:EnergySetC.VAL        16.25986671447754     2024-07-01 08:53:30.478261
undulator.energy.readback          S08ID:USID:EnergyM.VAL           16.25984001159668     2024-06-27 08:38:52.437611
undulator.energy.actuate                                            1                     2024-06-21 17:33:41.199796
undulator.energy.stop_signal                                        1                     2024-06-20 09:07:59.417066
undulator.energy.done                                               1                     1989-12-31 18:00:00       
undulator.energy_taper.setpoint    S08ID:USID:TaperEnergySetC.VAL   0.0                   2024-06-21 17:33:40.000635
undulator.energy_taper.readback    S08ID:USID:TaperEnergyM.VAL      1.1444091796875e-05   2024-06-27 08:38:32.837163
undulator.energy_taper.actuate                                      1                     2024-06-21 17:33:41.199796
undulator.energy_taper.stop_signal                                  1                     2024-06-20 09:07:59.417066
undulator.energy_taper.done                                         1                     1989-12-31 18:00:00       
undulator.gap.setpoint             S08ID:USID:GapSetC.VAL           140.0                 2024-07-01 08:53:30.477769
undulator.gap.readback             S08ID:USID:GapM.VAL              140.00036239624023    2024-07-01 16:51:42.836248
undulator.gap.actuate                                               1                     2024-06-21 17:33:41.199796
undulator.gap.stop_signal                                           1                     2024-06-20 09:07:59.417066
undulator.gap.done                                                  1                     1989-12-31 18:00:00       
undulator.gap_taper.setpoint       S08ID:USID:TaperGapSetC.VAL      0.0                   2024-06-07 11:26:58.041044
undulator.gap_taper.readback       S08ID:USID:TaperGapM.VAL         -0.00110626220703125  2024-07-01 16:51:42.836319
undulator.gap_taper.actuate                                         1                     2024-06-21 17:33:41.199796
undulator.gap_taper.stop_signal                                     1                     2024-06-20 09:07:59.417066
undulator.gap_taper.done                                            1                     1989-12-31 18:00:00       
undulator.harmonic_value           S08ID:USID:HarmonicValueC        1.0                   1989-12-31 18:00:00       
undulator.total_power              S08ID:USID:TotalPowerM.VAL       4.809626268151807e-15 2024-07-01 16:50:53.535928
undulator.revolver_select          S08ID:USID:RevolverSelectC.VAL   0                     2024-06-07 11:27:10.426256
undulator.status_position1         S08ID:USID:Position1M.VAL        1.0                   2024-06-26 09:58:41.535832
undulator.status_position2         S08ID:USID:Position2M.VAL        0.0                   2024-06-26 09:58:41.535832
undulator.status_safe_gap          S08ID:USID:AtSafeGapM.VAL        0.0                   2024-06-26 09:58:41.535846
================================== ================================ ===================== ==========================

In [7]: