Class TopupWatchdog

All Implemented Interfaces:
EventListener, IDeviceWatchdog<TopupWatchdogModel>, IModelProvider<TopupWatchdogModel>, INameable, IPositionListener

public class TopupWatchdog extends AbstractWatchdog<TopupWatchdogModel> implements IPositionListener
 This watchdog may be started to run with a scan.

 It will attempt to pause a scan when topup is about
 to happen and restart it after topup has finished.

 Once made a watch dog is active if the activate method
 is called. The deactivate method may be called to stop
 a given watchdog watching scans.

 https://en.wikipedia.org/wiki/Watchdog_timer

 NOTE This class will usually be created in spring

 Note there are 3 PVs to describe the topup state. This implementation assumes
 that the scannable referred to by the countdown property of the model
 wraps the PV SR-CS-FILL-01:COUNTDOWN.

 A typical top-up event takes around 20s and in low-alpha mode this can be longer, maybe around a minute.
 Will Rogers and Nick Battam are the ones who know and maintain this page.
 If you are missing information on this page, please ask them to explain and possibly add information to the page.
 The gruesome details of the top-up application are here: http://confluence.diamond.ac.uk/x/QpRTAQ

SR-CS-FILL-01:COUNTDOWN: this is a float-valued counter that runs to zero
at the start of TopUp and remains there until the fill is complete when
it resets to time before next TopUp fill,

Example XML configuration

        <!--  Watchdog Example -->
        <bean id="topupModel" class="org.eclipse.scanning.api.device.models.TopupWatchdogModel">
            <property name="countdownName" value="topup" />
            <property name="cooloff" value="4000" />
            <property name="warmup" value="5000" />

            <!-- Optional, recommended but not compulsory a scannable linked to SR-CS-FILL-01:TOPUPMODE, checks the mode is right -->
            <property name="modeName" value="mode" />

            <!-- Optional, do not usually need to set -->
            <property name="period" value="600000"/>
            <property name="topupTime" value="15000"/>
            <!-- End optional, do not usually need to set -->
        </bean>

        <bean id="topupWatchdog" class="org.eclipse.scanning.sequencer.watchdog.TopupWatchdog" init-method="activate">
            <property name="model" ref="topupModel"/>
        </bean>

Calculation of scannable parts of topup


        |invalid input: '<'-w->|
        |.
        |  .
        |    .
        |      .
        |        .
        |          .
        |            .
        |              .|invalid input: '<'-   c  ->|
        |                .
        |                  .
        |                    .
        |                      .
        |                        . |invalid input: '<'-Tf->|
        |                          ........    t
        |
        |__________________________________(time)

        |invalid input: '<'-              p              ->|

        w  - warmup
        c  - cooloff
        t  - time until next topup next occurs
        Tf - Topup fill time (variable but max 15s in normal mode)
        p  - Period of cycle, usually 10mins or so.

        In order for scanning to run, all of the following conditions must be satisfied:

        1. Mode is normal (8)
        2. t > c
        3. t invalid input: '<' (p-Tf)-w

        

Topup Mode

The "Topup Mode" PV is SR-CS-FILL-01:TOPUPMODE. This is an enum PV that has three possible values
  • Normal,
  • Low Alpha,
  • Low Alpha THz
The Topup watchdog should only be used when we are in 'Normal' mode.
  • Constructor Details

    • TopupWatchdog

      public TopupWatchdog()
    • TopupWatchdog

      public TopupWatchdog(TopupWatchdogModel model)
  • Method Details

    • getId

      public String getId()
      Description copied from interface: IDeviceWatchdog
      Watchdog id
      Specified by:
      getId in interface IDeviceWatchdog<TopupWatchdogModel>
      Returns:
      id
    • positionChanged

      public void positionChanged(PositionEvent evt)
      Called on a thread when the position changes. The countdown is likely to report at 10Hz. TODO Check if this is ok during a scan and does not use too much CPU.
      Specified by:
      positionChanged in interface IPositionListener
      Parameters:
      evt -
    • checkPosition

      protected void checkPosition(String deviceName, IPosition pos) throws Exception
      Checks the position during the scan and at startup.
      Parameters:
      pos -
      Throws:
      Exception
    • start

      public void start(ScanBean bean) throws Exception
      Throws:
      Exception
    • pointEnd

      public void pointEnd(IPosition done)
    • stop

      public void stop()
    • getValueMs

      protected long getValueMs(IPosition ipos, String name, String unit)
    • getValueMs

      protected long getValueMs(double pos, String unit)
    • getCountdownUnit

      public String getCountdownUnit()
    • setCountdownUnit

      public void setCountdownUnit(String countdownUnit)
    • isPausing

      public boolean isPausing()
      Description copied from interface: IDeviceWatchdog
      Returns whether the watchdog is currently active in a scan and pausing that scan.
      Specified by:
      isPausing in interface IDeviceWatchdog<TopupWatchdogModel>