C# Class SympatheticHardwareControl.Controller

This is the interface to the sympathetic specific hardware. Flow chart (under normal conditions): UI -> controller -> hardware. Basically, that's it. Exceptions: -controller can set values displayed on UI (only meant for special cases, like startup or re-loading a saved parameter set) -Some public functions allow the HC to be controlled remotely (see below). HardwareState: There are 3 states which the controller can be in: OFF, LOCAL and REMOTE. OFF just means the HC is idle. The state is set to LOCAL when this program is actively upating the state of the hardware. It does this by reading off what's on the UI, finding any discrepancies between the current state of the hardware and the values on the UI and by updating the hardware accordingly. After finishing with the update, it resets the state to OFF. When the state is set to REMOTE, the UI is disactivated. The hardware controller saves all the parameter values upon switching from LOCAL to REMOTE, then does nothing. When switching back, it reinstates the hardware state to what it was before it switched to REMOTE. Use this when you want to control the hardware from somewhere else (e.g. MOTMaster). Remoting functions (SetValue): Having said that, you'll notice that there are also public functions for modifying parameter values without putting the HC in REMOTE. I wrote it like this because you want to be able to do two different things: -Have the hardware controller take a back seat and let something else control the hardware for a while (e.g. MOTMaster) This is when you should use the REMOTE state. -You still want the HC to keep track of the hardware (hence remaining in LOCAL), but you want to send commands to it remotely (say from a console) instead of from the UI. This is when you would use the SetValue functions. The Hardware Report: The Hardware report is a way of passing a dictionary (gauges, temperature measurements, error signals) to another program (MotMaster, say). MOTMaster can then save the dictionary along with the data. I hope this will help towards answering questions like: "what was the source chamber pressure when we took this data?". At the moment, the hardware state is also included in the report.
Inheritance: System.MarshalByRefObject, CameraControllable, ExperimentReportable, TranslationStageControllable
Show file Open project: ColdMatter/EDMSuite Class Usage Examples

Public Properties

Property Type Description
HCState SHCUIControlState
ImageController IMAQ.CameraController
LaserLockErrorThreshold double
c1pStopLock object
c2pStopLock object
leStopLock object

Public Methods

Method Description
ApplyRecordedStateToHardware ( ) : void
CameraSnapshot ( ) : void
CameraStream ( ) : void
ControllerStopping ( ) : void
FinishRemoteCameraControl ( ) : void
GetExperimentReport ( ) : Object>.Dictionary
GrabMultipleImages ( string cameraAttributesPath, int numberOfShots ) : ].byte[][
GrabSingleImage ( string cameraAttributesPath ) : ].byte[
InitializeLifetimeService ( ) : Object
IsReadyForAcquisition ( ) : bool
LoadParametersWithDialog ( ) : void
OpenNewHardwareMonitorWindow ( ) : void
PrepareRemoteCameraControl ( ) : void
ReadAnalogInput ( string channel ) : double
ReadAnalogInput ( string channelName, bool useCalibration ) : double
ReadAnalogInput ( string channel, double sampleRate, int numOfSamples, bool useCalibration ) : double
ReadChannel1Pressure ( ) : double
ReadChannel2Pressure ( ) : double
ReadLaserErrorSignal ( ) : double
SaveImage ( string path ) : void
SaveImageWithDialog ( ) : void
SaveParametersWithDialog ( ) : void
SetAnalogOutput ( string channel, double voltage ) : void
SetAnalogOutput ( string channelName, double voltage, bool useCalibration ) : void
SetDigitalLine ( string name, bool value ) : void
SetValue ( string channel, bool value ) : void
SetValue ( string channel, double value ) : void

These SetValue functions are for giving commands to the hc from another program, while keeping the hc in control of hardware. Use this if you want the HC to keep control, but you want to control the HC from some other program

SetValue ( string channel, double value, bool useCalibration ) : void
Start ( ) : void
StartCameraControl ( ) : void
StartChamber1PressureMonitor ( ) : void
StartChamber2PressureMonitor ( ) : void
StartMonitoringLaserErrorSignal ( ) : void
StartRemoteControl ( ) : void

This is used when you want another program to take control of some/all of the hardware. The hc then just saves the last hardware state, then prevents you from making any changes to the UI. Use this if your other program wants direct control of hardware.

StopCameraStream ( ) : void
StopChamber1PressureMonitor ( ) : void
StopChamber2PressureMonitor ( ) : void
StopMonitoringLaserErrorSignal ( ) : void
StopRemoteControl ( ) : void
TSAutoTriggerDisable ( ) : void
TSAutoTriggerEnable ( ) : void
TSCheckStatus ( ) : void
TSClear ( ) : void
TSConnect ( ) : void
TSDisconnect ( ) : void
TSGo ( ) : void
TSHome ( ) : void
TSInitialize ( double acceleration, double deceleration, double distance, double velocity ) : void
TSListAll ( ) : void
TSOff ( ) : void
TSOn ( ) : void
TSRead ( ) : void
TSRestart ( ) : void
TSReturn ( ) : void
UpdateHardware ( ) : void

Private Methods

Method Description
ControllerLoaded ( ) : void
CreateAnalogInputTask ( string channel ) : void
CreateAnalogInputTask ( string channel, double lowRange, double highRange ) : void
CreateAnalogOutputTask ( string channel ) : void
CreateDigitalTask ( String name ) : void
StoreParameters ( String dataStoreFilePath ) : void
applyAnalogs ( hardwareState state ) : void
applyDigitals ( hardwareState state ) : void
applyToHardware ( hardwareState state ) : void
chamber1PressureMonitorLoop ( ) : void
chamber2PressureMonitorLoop ( ) : void
getDiscrepancies ( hardwareState oldState, hardwareState newState ) : hardwareState
getLaserThresholdFromUI ( ) : double
isLaserLocked ( double threshold, double error ) : bool
leMonitorLoop ( ) : void
loadParameters ( String dataStoreFilePath ) : hardwareState
readUIAnalogs ( double>.Dictionary keys ) : double>.Dictionary
readUIDigitals ( bool>.Dictionary keys ) : bool>.Dictionary
readValuesOnUI ( ) : hardwareState
setUIAnalogs ( hardwareState state ) : void
setUIDigitals ( hardwareState state ) : void
setValuesDisplayedOnUI ( hardwareState state ) : void
updateStateRecord ( hardwareState changes ) : void

Method Details

ApplyRecordedStateToHardware() public method

public ApplyRecordedStateToHardware ( ) : void
return void

CameraSnapshot() public method

public CameraSnapshot ( ) : void
return void

CameraStream() public method

public CameraStream ( ) : void
return void

ControllerStopping() public method

public ControllerStopping ( ) : void
return void

FinishRemoteCameraControl() public method

public FinishRemoteCameraControl ( ) : void
return void

GetExperimentReport() public method

public GetExperimentReport ( ) : Object>.Dictionary
return Object>.Dictionary

GrabMultipleImages() public method

public GrabMultipleImages ( string cameraAttributesPath, int numberOfShots ) : ].byte[][
cameraAttributesPath string
numberOfShots int
return ].byte[][

GrabSingleImage() public method

public GrabSingleImage ( string cameraAttributesPath ) : ].byte[
cameraAttributesPath string
return ].byte[

InitializeLifetimeService() public method

public InitializeLifetimeService ( ) : Object
return Object

IsReadyForAcquisition() public method

public IsReadyForAcquisition ( ) : bool
return bool

LoadParametersWithDialog() public method

public LoadParametersWithDialog ( ) : void
return void

OpenNewHardwareMonitorWindow() public method

public OpenNewHardwareMonitorWindow ( ) : void
return void

PrepareRemoteCameraControl() public method

public PrepareRemoteCameraControl ( ) : void
return void

ReadAnalogInput() public method

public ReadAnalogInput ( string channel ) : double
channel string
return double

ReadAnalogInput() public method

public ReadAnalogInput ( string channelName, bool useCalibration ) : double
channelName string
useCalibration bool
return double

ReadAnalogInput() public method

public ReadAnalogInput ( string channel, double sampleRate, int numOfSamples, bool useCalibration ) : double
channel string
sampleRate double
numOfSamples int
useCalibration bool
return double

ReadChannel1Pressure() public method

public ReadChannel1Pressure ( ) : double
return double

ReadChannel2Pressure() public method

public ReadChannel2Pressure ( ) : double
return double

ReadLaserErrorSignal() public method

public ReadLaserErrorSignal ( ) : double
return double

SaveImage() public method

public SaveImage ( string path ) : void
path string
return void

SaveImageWithDialog() public method

public SaveImageWithDialog ( ) : void
return void

SaveParametersWithDialog() public method

public SaveParametersWithDialog ( ) : void
return void

SetAnalogOutput() public method

public SetAnalogOutput ( string channel, double voltage ) : void
channel string
voltage double
return void

SetAnalogOutput() public method

public SetAnalogOutput ( string channelName, double voltage, bool useCalibration ) : void
channelName string
voltage double
useCalibration bool
return void

SetDigitalLine() public method

public SetDigitalLine ( string name, bool value ) : void
name string
value bool
return void

SetValue() public method

public SetValue ( string channel, bool value ) : void
channel string
value bool
return void

SetValue() public method

These SetValue functions are for giving commands to the hc from another program, while keeping the hc in control of hardware. Use this if you want the HC to keep control, but you want to control the HC from some other program
public SetValue ( string channel, double value ) : void
channel string
value double
return void

SetValue() public method

public SetValue ( string channel, double value, bool useCalibration ) : void
channel string
value double
useCalibration bool
return void

Start() public method

public Start ( ) : void
return void

StartCameraControl() public method

public StartCameraControl ( ) : void
return void

StartChamber1PressureMonitor() public method

public StartChamber1PressureMonitor ( ) : void
return void

StartChamber2PressureMonitor() public method

public StartChamber2PressureMonitor ( ) : void
return void

StartMonitoringLaserErrorSignal() public method

public StartMonitoringLaserErrorSignal ( ) : void
return void

StartRemoteControl() public method

This is used when you want another program to take control of some/all of the hardware. The hc then just saves the last hardware state, then prevents you from making any changes to the UI. Use this if your other program wants direct control of hardware.
public StartRemoteControl ( ) : void
return void

StopCameraStream() public method

public StopCameraStream ( ) : void
return void

StopChamber1PressureMonitor() public method

public StopChamber1PressureMonitor ( ) : void
return void

StopChamber2PressureMonitor() public method

public StopChamber2PressureMonitor ( ) : void
return void

StopMonitoringLaserErrorSignal() public method

public StopMonitoringLaserErrorSignal ( ) : void
return void

StopRemoteControl() public method

public StopRemoteControl ( ) : void
return void

TSAutoTriggerDisable() public method

public TSAutoTriggerDisable ( ) : void
return void

TSAutoTriggerEnable() public method

public TSAutoTriggerEnable ( ) : void
return void

TSCheckStatus() public method

public TSCheckStatus ( ) : void
return void

TSClear() public method

public TSClear ( ) : void
return void

TSConnect() public method

public TSConnect ( ) : void
return void

TSDisconnect() public method

public TSDisconnect ( ) : void
return void

TSGo() public method

public TSGo ( ) : void
return void

TSHome() public method

public TSHome ( ) : void
return void

TSInitialize() public method

public TSInitialize ( double acceleration, double deceleration, double distance, double velocity ) : void
acceleration double
deceleration double
distance double
velocity double
return void

TSListAll() public method

public TSListAll ( ) : void
return void

TSOff() public method

public TSOff ( ) : void
return void

TSOn() public method

public TSOn ( ) : void
return void

TSRead() public method

public TSRead ( ) : void
return void

TSRestart() public method

public TSRestart ( ) : void
return void

TSReturn() public method

public TSReturn ( ) : void
return void

UpdateHardware() public method

public UpdateHardware ( ) : void
return void

Property Details

HCState public property

public SHCUIControlState HCState
return SHCUIControlState

ImageController public property

public CameraController,IMAQ ImageController
return IMAQ.CameraController

LaserLockErrorThreshold public property

public double LaserLockErrorThreshold
return double

c1pStopLock public property

public object c1pStopLock
return object

c2pStopLock public property

public object c2pStopLock
return object

leStopLock public property

public object leStopLock
return object