phantomhv package

Module contents

Control and monitoring tools for the Phantom HV supply developed for SWGO at MPIK.

Use the command-line tools phantomhv-ctl or phantomhv-webui, or the I/O classes PhantomHVIO or PhantomHVStateBuffer to communicate with the hardware.

class phantomhv.PhantomHVIO[source]

Bases: IOStack

PHANTOM_HV_MASTER_CMD_SPI_IO_REQUEST = 0[source]
PHANTOM_HV_MASTER_SUBSYSTEM = 17[source]
__init__(ip, port=512, timeout=0.3, max_retries=3, verbosity=0, max_packet_size=300, interface_ip=None)[source]

Connects to the SPI I/O subsystem at the given address.

Parameters:
  • ip (string) – Destination address.

  • port (int, optional) – Destination port (default: 512).

  • timeout (float, optional) – Response timeout in seconds (default: 200 ms).

  • verbosity (int, optional) – Verbosity level (default: 0, silent)

  • max_packet_size (int, optional) – Expected maximum size of replies (default: 256 Bytes).

  • interface_ip (str, optional) – IP address of local interface (default: let OS choose).

boot_app(slot)[source]
Parameters:

slot (int)

flash_app(data, slot, sleep_interval=0.1)[source]
Parameters:
  • data (str)

  • slot (int)

read_slave_dynamic_cfg(slot)[source]
read_slave_state(slot)[source]
read_slave_static_cfg(slot)[source]
reset(slot)[source]

Requests a SW reset of the device.

Parameters:

slot (int)

write_slave_dynamic_cfg(slot, cfg)[source]
class phantomhv.PhantomHVStateBuffer[source]

Bases: object

Caches all registers of a Phantom HV crate for quick repeated access via the slots member (which contains num_slots PhantomHVSlotStateBuffer objects). Call update() after initialisation to populate the cache.

__init__(ip, port=512, num_slots=1)[source]
update(full=False)[source]

Reads all slave registers and then atomically updates the internal states. Any exceptions such as iostack.TimeoutError or OSError are passed through.

By default (full equals False), the static configurations will only be read once.