# The Control software¶

The control software is the program in charge of the MASCARA station and which makes it completely robotic. The MASCARA station hosts N+1 computers, where N is the number of cameras. The camera computers are each in charge of one camera. They are responsible for the cooling-down of the cameras, the acquisition of the images at the right time, and the reduction of the images during day-time. However the camera computers depend to the control computer for starting an acquisition sequence: no point exposing if the dome is not open. Thus the control computer, which is the one hosting the control software, is monitoring the various sensors of the station, and the weather stations available.

## Station status control¶

The control of the station’s status is done real-time, by reading every seconds the status of the various sensors used by MASCARA. A detail on the sensors and how to read then can be found in the electronics module. Here we shall concentrate on how the station is self-checking its status and how.

### The moving parts¶

MASCARA has a moving dome, and a door. As a result, it is important to verify the status of those parts every time:

• the dome position should always be either closed, or open. Only for a short period of time is the dome in-between those positions.
• the dome is always closed. If the door is open, it means that the station is in maintenance mode, and the dome should not move (for security reasons).

The door can only be opened manually. But the dome is opened and closed via two rotation motors. The motors don’t know of their positions. Thus the position of the dome while moving is read via the encoder (The encoder). The opened or closed position of the dome is read via the limit switches (limit-switch). One limit-switch for the closed position, and one for the opened-position.

### The electronic parts¶

The control software reads at high cadence the measurements of the following sensors:

• the temperature and humidity sensors
• the limit-switches.

### The status¶

At any time, as a function of the read-out of the sensor, a status code is returned describing the state of the station, and the potential error occuring. The detail of the error codes can be found in errorcodes.

## References/APIs¶

The Station class which serves all the rest:

class mascara_control.Station(**kwargs)[source]

Class representing the MASCARA station (all interface with the hardware is here)

Turn the LEDS on and off during flats

check_power_supplies()[source]
cleanexit(turnOffStation=False)[source]

Cleanexit is a tentative routine to exit the station properly: meaning closing safely all the serial port connections, saving the measurements if some were taken, etc.

close_dome(timeout=25, writelog=True)[source]

Closes the dome Keywords:

timeout: integer (default 25 sec) writelog: boolean (default True)
close_rh()[source]
Short routine to close properly the serial connection with
the RH sensors.

To be updated with the other serial connections?

get_encoder(verbose=True, init=False)[source]
get_pdu_current()[source]

Gets power from the PDUs

get_pdu_power()[source]

Gets power from the PDUs

get_pdu_status(arr=False)[source]

Gets status from the PDUs and transforms them in 2 x 8-bit integers

get_status(verbose=True, writelog=True)[source]

Checks for all possible (known) problems and returns a code representing the status

get_status_messages(verbose=True)[source]
get_weather(verbose=True)[source]

Gets the latest reading from the weather station.

is_dome_closed(updateDomePosition=True)[source]

is_dome_closed checks that the dome is properly closed

is_dome_open(updateDomePosition=True)[source]

is_dome_open checks if the dome is open using the limit switches and the position of the encoder.

is_door_open()[source]

is the door open

log_pdu_power()[source]
log_status()[source]

logs all entries for plotting purposes

log_weather()[source]
onoff_code
open_dome(timeout=25, writelog=True)[source]

Opens the dome Keywords:

timeout: integer (default 25 sec) writelog: boolean (default True)
reboot()[source]
reboot_pdu(outlet)[source]
restart()[source]
restart_cameras()[source]
send_warning(*args, **kwargs)[source]

sends an email to the MASCARA team notifying possible failures of the station.

set_current(*args)[source]
set_peltiers_to_cool()[source]
set_peltiers_to_heat()[source]
set_voltage(*args)[source]
shutdown()[source]
stop_motor()[source]
take_rh_measurements()[source]

Takes measures of the humidity sensors and their status.

text_status()[source]
turn_all_cameras_off()[source]
turn_all_cameras_on()[source]
turn_camera_off(*args)[source]
turn_camera_on(*args)[source]
turn_heater_off()[source]
turn_heater_on()[source]
turn_led_off(*args)[source]
turn_led_on(*args)[source]
turn_pdu_off(outlet)[source]
turn_pdu_on(outlet)[source]
turn_peltiers_off()[source]
turn_peltiers_on()[source]
turn_power_off()[source]
turn_power_on()[source]