opus_measurement
module core.modules.opus_measurement
class OpusMeasurement
OPUS Measurements manages the FTIR spectrometer measurement software OPUS. It allows to remotely communicate with OPUS via a DDE connection and trigger different commands.
OPUS needs an experiment file and can perform continious measurements with parameters passed by a macro file. These files can be loaded via commands over the active DDE connection.
During the day it makes sure that OPUS up and running and reloads the latest experiment if it was changed by the operator. During night OPUS is shut down to reset after a full day of measurements. Day and night is defined by the set sun angle in the config.
OPUSMeasurement will start and stop Macros according to the current value of StateInterface: measurements_should_be_running.
method __init__
__init__(initial_config: Config)
method automated_process_handling
automated_process_handling() → None
Start OPUS.exe if not running and sun angle conditions satisfied. Shuts down OPUS.exe if running and sun angle conditions not satisfied.
method check_for_experiment_change
check_for_experiment_change() → None
Compares the experiment in the config with the current active experiment. To reload an experiment during an active macro the macro needs to be stopped first.
method close_opus
close_opus() → None
Closes OPUS via DDE call.
method force_kill_opus
force_kill_opus() → None
Terminate any "opus.exe" or "OpusCore.exe" processes using psutil.
method load_experiment
load_experiment() → None
Loads a new experiment in OPUS over DDE connection.
method opus_is_running
opus_is_running() → bool
Checks if OPUS is already running by searching for processes with the executable opus.exe
or OpusCore.exe
Returns: True
if Application is currently running and False
if not.
method run
run(new_config: Config) → None
Called in every cycle of the main loop. Starts and stops OPUS.exe based on the present sun angle. Reads StateInterface: measurements_should_be_running and starts and stops the OPUS macro.
method start_macro
start_macro() → None
Starts a new macro in OPUS over DDE connection.
method start_opus
start_opus() → None
Starts the OPUS.exe with os.startfile(). This simulates a user click on the executable.
method stop_macro
stop_macro() → None
Stops the currently running macro in OPUS over DDE connection.
method sun_angle_is_too_low
sun_angle_is_too_low() → bool
Checks defined sun angle in config. Closes OPUS at the end of the day to start up fresh the next day.
method test_setup
test_setup() → None
Function to test the functonality of this module. Starts up OPUS, loads an experiment, starts a macro and stops it after 10s.
method wait_for_opus_startup
wait_for_opus_startup() → None
Checks for OPUS to be running. Breaks out of the loop after a defined time.