Skip to main content

sun_tracking

module core.modules.sun_tracking


class SunTracking

SunTracking manages the software CamTracker. CamTracker controls moveable mirrors attached to the FTIR spectrometer EM27. These mirrors are sync with the current sun position to ensure direct sun light to be directed into the instrument. SunTracking will initialize CamTracker according to the current value of StateInterface: measurements_should_be_running.

These mirrors are initialized at startup of CamTracker if it is called with the additional parameter -autostart. CamTracker can be gracefully shut down with creating a stop.txt file in its directory. CamTracker creates multiple logfiles at run time that give information on its current status of tracking the sun. Most importantly motor offsets tells the differencebetween current sun angle and calculated sun positions. It happens from time to time that SunTracker fails to track the sun and is unable to reinitialize the tracking. If a certain motor offset threshold is reached the only way to fix the offset is to restart CamTracker.

method __init__

__init__(initial_config: Config)

property stop_file_path

Returns the path to the stop.txt file in CamTracker directory.


method camtracker_is_running

camtracker_is_running()bool

Checks if CamTracker 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 check_camtracker_motor_position

check_camtracker_motor_position() → Literal['logs too old', 'valid', 'invalid']

Checks whether CamTracker is running and is pointing in the right direction.

Reads in the LEARN_Az_Elev.dat logfile, if the last line is older than 5 minutes, the function returns "logs too old".

If the last logline is younger than 5 minutes, the function returns "valid" if the motor offsets are within the defined threshold and "invalid" if the motor offsets are outside the threshold.


method check_tum_plc_cover_position

check_tum_plc_cover_position() → Literal['angle not reported', 'valid', 'invalid']

Checks whether the TUM PLC cover is open or closed. Returns "angle not reported" if the cover position has not beenreported by the PLC yet.


method remove_stop_file

remove_stop_file()None

This function removes the stop.txt file to allow CamTracker to restart.


method run

run(new_config: Config)None

Called in every cycle of the main loop. Start and stops CamTracker based on StateInterface.measurements_should_be_running.


method start_sun_tracking_automation

start_sun_tracking_automation()None

Uses os.startfile() to start up the CamTracker executable with additional parameter "-automation". The paramter - automation will instruct CamTracker to automatically move the mirrors to the expected sun position during startup.

Removes stop.txt file in CamTracker directory if present. This file is the current way of gracefully shutting down CamTracker and move the mirrors back to parking position.


method stop_sun_tracking_automation

stop_sun_tracking_automation()None

Tells the CamTracker application to end program and move mirrors to parking position.

CamTracker has an internal check for a stop.txt file in its directory. After detection it will move it's mirrors to parking position and end itself.


method test_setup

test_setup()None

Function to test the functonality of this module. Starts up CamTracker to initialize the tracking mirrors. Then moves mirrors back to parking position and shuts dosn CamTracker.