The Electronic Control¶
Introduction¶
The electronic module regroups all the classes and functions which are related to the reading of electronics components. The electronic components used here are:
- the The Data Acquisition Board, which is connected to
- the The limit switches
- the The On-Off Objects
the RHsensors
the power_supplies
the PDUs (Power Distribution Unit)
the The encoder used to monitor the rotation of the motors
The Data Acquisition Board¶
MASCARA uses the USB 1208FS mccdaq series. The datasheet relative to this device can be found on the website of mmcdaq. Below a quick diagram of the different types of outputs of the DAQ:
The DAQ has its own class to acces the functions embedded in the cbw32 dll. See DAQ.DAQ()
for a description of the APIs.
The limit switches¶
The limit switches provide an analog way to verify the position of the roof of the MASCARA station.
Until the switch is pushed, no current goes through the switch. We use the analog input and digital
output of the DAQ to verify at any time the status of the limit switches.
The limit-switches have their own class mascara_electronics.LimitSwitch()
.
The On-Off Objects¶
- Several electronic components fall under the On-Off appelation:
- the relays
- the heaters
- the LEDs
While each component has its specifics class, they are all subclasses from the mascara_electronics.OnOffObject()
class.
The encoder¶
The encoder serves to verify the dome’s position during the open-close phases. Since the motors themselves do not provide
a reading on their rotation, the encoder fulfills this role. The encoder is directly connected to the rotation axis of
the dome. Thus the reading of the encoder provides a direct measurement of the position of the dome.
The details on how to communicate with the encoder are in the mascara_electronics.Encoder
.
Referece APIs¶
The DAQ class¶
-
class
DAQ.
DAQ
(BoardNum=0, gain=1)[source]¶ mccdaq is a class for connecting with and reading the USB-1208FS+ data acquisition board. The functions defined here are the main functions embedded in the cbw32.dll
-
__init__
(BoardNum=0, gain=1)[source]¶ The DAQ instance regroups all functions to communicate with the Data Acquisition board. The Board is defined by a board number (default 0). The gain is programmable but set to 1 per default.
-
configPorts
(inout='out')[source]¶ ConfigPort configurates the digital ports for Output or input.
- Keyword:
- inout, if dqp.DIGITALOUT, the port delivers a voltage
if dqp.DIGITALIN, the port read the voltage
-
dAllOut
(bitValue)[source]¶ Sets the state of all digital output bits. This function treats all the DI/O ports of a particular type on the board as a single large port. The port should be configured as output beforehand.
- Inputs:
- port, the port considered (‘A’ or ‘B’)
- bitValue, value of the byte (0-1)
-
dBitIn
(channel, port='A')[source]¶ Reads the state of a single digital input bit.
- Inputs:
- channel, the bit to read
- Outputs:
- The value of the bit. If 1, logical high => ~ 5V If 0, logical low, => ~0V
-
dBitOut
(channel, bitValue, port='A')[source]¶ Sets the state of a single digital output bit. This function treats all the DI/O ports of a particular type on the board as a single large port. The port should be configured as output beforehand.
- Inputs:
- port, the port considered (‘A’ or ‘B’)
- channel, the channel considered (0-7)
- bitValue, if 0 logic output low (~0V) if 1 logic input high (~5V)
-
dOut
(byteValue, port='A')[source]¶ Sets the state of all digital output bits of a given port. This function treats all the DI/O ports of a particular type on the board as a single large port. The port should be configured as output beforehand.
- Inputs:
- port, the port considered (‘A’ or ‘B’)
- byteValue, value of the byte (0-255)
-
The OnOff class and its dependencies¶
-
class
mascara_electronics.
OnOffObject
(daq, channel, inversed=False)[source]¶ A class for all the on-off objects: relays, heaters, LEDs. They are activated via relays.
-
class
mascara_electronics.
Relay
(daq, channel, inversed=False)[source]¶ A subclass of the OnOffObject class for the relays:
The Limit Switch class:¶
The Power Supply¶
-
class
mascara_electronics.
PowerSupply
(daq, ID)[source]¶ Class for the power supplies
-
__init__
(daq, ID)[source]¶ Initialize the power supply :param daq: an instance from the DAQ class :param ID: the ID of the power supply (1 or 2)
-
The PDUs¶
-
class
mascara_electronics.
PDU
(ip, username='apc', password='apc', timeout=5)[source]¶ -
__init__
(ip, username='apc', password='apc', timeout=5)[source]¶ Initilization of the PDU. The PDUs are accessed using Telnet protocol, thus they have each a username and password to access the PDU.
Parameters:
-
The Encoder¶
-
class
mascara_electronics.
Encoder
[source]¶ Class for communicating with the #$% encoder using SSI protocol. SSI stands for synchronous Serial Interface. It means that in order to get any signal from the encoder, the computer has to send a continuous pulse of N-bits. The response from the encoder is 20 bits long:
- the first 8 are the multiturn information,
- the last 12 the singleturn information.
The communication are made in BitBang mode, and hex and were a pain to figure out.
-
ReadEncoder
()[source]¶ Reads the response of the encoder. The response is already translated in the information multiand single turns.
Return mturns: the number of full turns Return sturns: the fractional number of turns.
-
__init__
()[source]¶ Initialise the encoder instance. Requires the ftd2xx.dll to be in the working directory. No libusb is required.
-
setBaudrate
(baudrate=460800)[source]¶ Sets the baudrate for the communication. The encoder needs quite a high baudrate to even spit an answer. Default baudrate is 460800. Better not change it.
The Temperature and Humidity sensors¶
-
class
mascara_electronics.
RHSensor
(**kwargs)[source]¶ Class for humidity/temperature sensor
-
__init__
(**kwargs)[source]¶ Initialize and open the connection with the humidity and temperature sensor.
- Keywords:
- port= ‘COM3’
- idVendor = ‘0403
- idProduct = ‘6001’
- serialNumber = ‘FDXXXX’
- timeout = 1
-
getAll
()[source]¶ Reads humidity and temperature from sensor Args:
Return tuple (hum,temp): where
- hum, the humidity as a string
- temp, the temperature as a string
-
getCAll
(dt=0, npts=100, verbose=False, plotData=False)[source]¶ Gets a continuous reading of the humidity and temperature.
Parameters: Return tuple (t,hum,temp): with:
- t: time as a float
- hum: humidity as a float
- temp: temperature as a float
-
getCHumidity
(dt=0, npts=100, verbose=False, plotData=False)[source]¶ Gets a continuous reading of the humidity. :param int dt: time interval to wait in seconds between two measurements (default = 0) :param int npts: total number of points (default = 100)
Returns tuple (t,hum): t, time as a float, and hum, humidity as a float
-
getCTemperature
(dt=0, npts=100, verbose=False, plotData=False)[source]¶ Gets a continuous reading of the temperature. :param int dt: time interval to wait in seconds between two measurements (default = 0) :param int npts: total number of points (default = 100) :return tuple (t,hum): t, time as a float, and temp, temperature as a float
-