Class TopupWatchdog
java.lang.Object
org.eclipse.scanning.sequencer.watchdog.AbstractWatchdog<TopupWatchdogModel>
org.eclipse.scanning.sequencer.watchdog.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
-
Field Summary
Fields inherited from class org.eclipse.scanning.sequencer.watchdog.AbstractWatchdog
active, controller, model -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcheckPosition(String deviceName, IPosition pos) Checks the position during the scan and at startup.getId()Watchdog idprotected longgetValueMs(double pos, String unit) protected longgetValueMs(IPosition ipos, String name, String unit) booleanReturns whether the watchdog is currently active in a scan and pausing that scan.voidvoidCalled on a thread when the position changes.voidsetCountdownUnit(String countdownUnit) voidvoidstop()Methods inherited from class org.eclipse.scanning.sequencer.watchdog.AbstractWatchdog
activate, deactivate, getController, getModel, getName, getScannable, isActive, isEnabled, scanFinally, scanStarted, setController, setEnabled, setModel, setNameMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.eclipse.scanning.api.IModelProvider
updateModelMethods inherited from interface org.eclipse.scanning.api.scan.event.IPositionListener
levelPerformed, positionMovePerformed, positionPerformed, positionWillPerform
-
Constructor Details
-
TopupWatchdog
public TopupWatchdog() -
TopupWatchdog
-
-
Method Details
-
getId
Description copied from interface:IDeviceWatchdogWatchdog id- Specified by:
getIdin interfaceIDeviceWatchdog<TopupWatchdogModel>- Returns:
- id
-
positionChanged
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:
positionChangedin interfaceIPositionListener- Parameters:
evt-
-
checkPosition
Checks the position during the scan and at startup.- Parameters:
pos-- Throws:
Exception
-
start
- Throws:
Exception
-
pointEnd
-
stop
public void stop() -
getValueMs
-
getValueMs
-
getCountdownUnit
-
setCountdownUnit
-
isPausing
public boolean isPausing()Description copied from interface:IDeviceWatchdogReturns whether the watchdog is currently active in a scan and pausing that scan.- Specified by:
isPausingin interfaceIDeviceWatchdog<TopupWatchdogModel>
-