HWP PMX Agent

usage: python3 agent.py [-h] [--ip IP] [--port PORT]
                        [--sampling-frequency SAMPLING_FREQUENCY]
                        [--supervisor-id SUPERVISOR_ID]
                        [--no-data-timeout NO_DATA_TIMEOUT]

Agent Options

--ip

ip address for kikusui PMX

--port

port for kikusui PMX

--sampling-frequency

Sampling frequency for data acquisition

Default: 2.0

--supervisor-id

Instance ID for HWP Supervisor agent

--no-data-timeout

Time (sec) after which a ‘no_data’ action should trigger a shutdown

Default: 900

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': 'HWPPMXAgent',
 'instance-id': 'hwp-pmx',
 'arguments': [['--ip', '10.10.10.100'],
               ['--port', '5025'],
               ['--sampling-frequency', 1],
               ['--supervisor-id', 'hwp-supervisor']]},

Docker Compose

An example docker-compose configuration:

ocs-hwp-pmx:
  image: simonsobs/socs:latest
  hostname: ocs-docker
  network_mode: "host"
  environment:
    - INSTANCE_ID=hwp-pmx
    - SITE_HUB=ws://127.0.0.1:8001/ws
    - SITE_HTTP=http://127.0.0.1:8001/call
  volumes:
    - ${OCS_CONFIG_DIR}:/config:ro

Note

Since the Agent container needs network_mode: "host", it must be configured to connect to the crossbar server as if it was on the host system. In this example the crossbar server is running on localhost, 127.0.0.1, but on your network this may be different.

Description

The HWP PMX Agent interfaces with the PMX Kikusui power supply and allows control of the current and voltage that drives the CHWP rotation. The PMX provides several connection options for communicating remotely with the hardware. For the HWP PMX Agent we have written the interface for communication via Ethernet cable.

Protection Mode

The PMX enters protection mode and stops outputting when something harmful occurs. The HWP PMX Agent monitors the state of the protection mode and outputs a protection code and message to prot_code and prot_msg for each data acquisition. There are several possible situations that can cause entering the protection mode. Below is a table showing the protection codes and corresponding situations.

prot_code

Description

0

not in protection mode

1

overcurrent protection

2

overvoltage protection

3

AC power failure or power interuption

5

over temperature protection

7

IOC communication error

When the PMX enters the protection mode, the cause must be removed and the protection mode must be deactivated in order to resume output. After removing the cause of the protection, output can be resumed by executing the following API tasks via the HWP PMX Agent:

pmx.clear_alarm()
pmx.set_on()

Agent API

class socs.agents.hwp_pmx.agent.HWPPMXAgent(agent, ip, port, f_sample=1, supervisor_id=None, no_data_timeout=900)[source]

Agent for interfacing with a PMX Kikusui power supply to control the current and voltage that drive the rotation of the CHWP.

Parameters:
  • ip (str) – IP address for the PMX Kikusui power supply

  • port (str) – Port for the PMX Kikusui power supply

  • f_sample (float) – sampling frequency (Hz)

  • supervisor_id (str) – Instance id of HWP supervisor

  • no_data_timeout (float) – Time (in seconds) to wait between receiving ‘no_data’ actions from the supervisor and triggering a shutdown

set_on()[source]

Task - Turn on the PMX Kikusui.

set_off()[source]

Task - Turn off the PMX Kikusui.

clear_alarm()[source]

Task - Clear alarm and exit protection mode.

use_ext()[source]

Task - Set the PMX Kikusui to use an external voltage control. Doing so enables PID control.

ign_ext()[source]

Task - Set the PMX Kiksui to ignore external voltage control. Doing so disables the PID and switches to direct control.

set_i(curr=0)[source]

Task - Set the current.

Parameters:

curr (float) – set current

set_v(volt=0)[source]

Task - Set the voltage.

Parameters:

volt (float) – set voltage

set_i_lim(curr=1)[source]

Task - Set the drive current limit.

Parameters:

curr (float) – limit current

set_v_lim(volt=32)[source]

Task - Set the drive voltage limit.

Parameters:

volt (float) – limit voltage

initiate_shutdown()[source]

Task - Initiate the shutdown of the agent.

cancel_shutdown()[source]

Task - Cancels shutdown mode, allowing other tasks to update the power supply

main()[source]

Process - Start data acquisition.

Notes

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

>>> response.session['data']
{'curr': 0,
 'volt': 0,
 'prot': 0,
 'last_updated': 1649085992.719602}
monitor_supervisor()[source]

Process - This is a process that is constantly running to monitor the HWP supervisor and the recommended course of action course of action recommended by the HWP supervisor. If certain conditions are met, this will trigger a shutdown and force the power supply to power off.