Wiregrid Tilt Sensor Agent

The Wiregrid Tilt Sensor Agent records the wire-grid tilt sensor outputs related to the tilt angle of the wire-grid plane along the gravitaional direction. There is two types of tilt sensors, DWL and sherborne. The tilt sensor data is sent via serial-to-ethernet converter. The converter is linked to the tilt sensor via RS-422(DWL) or RS-485(sherborne), D-sub 9-pin cable. The agent communicates with the converter via Ethernet.

usage: python3 agent.py [-h] [--ip-address IP] [--port PORT]
                        [--sensor-type SENSOR_TYPE]

Agent Options

--ip-address

The ip adress of the serial-to-ethernet converter

--port

The assigned port of the serial-to-ethernet converter for the tilt sensor

--sensor-type

The type of tilt sensor running wiregrid tilt sensor DAQ

Configuration File Examples

Below are configuration examples for the ocs config file and for running the Agent in a docker container.

OCS Site Config

An example site-config-file block:

{'agent-class': 'WiregridTiltSensorAgent',
 'instance-id': 'wg-tilt-sensor',
 'arguments': ['--ip-address', '192.168.11.27',
               '--port', '32',
               '--sensor-type', 'DWL']},
  • ip-address is an IP address of the serial-to-ethernet converter.

  • port is an asigned port for the tilt sensor. (The converter has four D-sub ports, 23, 26, 29, 32, to control multiple devices connected via serial communication. Communicating device is determined by the ethernet port number of the converter.)

  • sensor_type represents the type of tilt sensor to communicate with. We have the two types of tilt sensor, DWL and sherborne. Available values of this argument are only ‘DWL’ or ‘sherborne’, and depend on SATp.

Docker Compose

An example docker compose configuration:

ocs-wg-tilt-sensor-agent:
  image: simonsobs/socs:latest
  hostname: ocs-docker
  network_mode: "host"
  command:
    - INSTANCE_ID=wg-tilt-sensor
  volumes:
    - ${OCS_CONFIG_DIR}:/config:ro
  • Since the agent within the container needs to communicate with hardware on the host network you must use network_mode: "host" in your compose file.

Agent API

class socs.agents.wiregrid_tiltsensor.agent.WiregridTiltSensorAgent(agent, ip, port, sensor_type=None)[source]

Agent to record the wiregrid tilt sensor data. The tilt sensor data is sent via serial-to-ethernet converter.

Parameters:
  • ip (str) – IP address of the serial-to-ethernet converter

  • port (int or str) – Asigned port for the tilt sensor The converter has four D-sub ports to control multiple devices is determined by the ethernet port number of converter.

  • sensor_type (str) – Type of tilt sensor There are twp types of tilt sensor, and this argument is used for specifying to communicate with whichtilt sensor. This argument should be ‘DWL’ or ‘sherborne’.

acq()[source]

Process - Run data acquisition.

Notes

The most recent data collected is stored in session.data in the structure:

>>> response.session['data']
{'tiltsensor_data': {
    'angleX': the angle in X-axis of tilt sensor,
    'angleY': the angle in Y-axis of tilt sensor,
    'temperatureX': the temperature in X-axis of tilt sensor
                    this is available for only sherborne,
    'temperatureY': the temperature in Y-axis of tilt sensor
                    this is available for only sherborne
    },
'timestamp': timestamp when it updates tilt sensor data
}
reset()[source]

Task - Reset the tiltsensor if the type of tiltsensor is sherborne.

Notes

The most recent data collected is stored in session.data in the structure:

>>> response.session['data']
{'reset': bool whether the reset successful or not
 'timestamp': timestamp when this command is performed
}