Skip to content

Low-level library for communicating with a Sunpower AVC and Cryocooler controller

Notifications You must be signed in to change notification settings

COO-Utilities/sunpower

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sunpower

A collection of Python interfaces for communicating with HISPEC FEI components.

Features

  • Query device status, error, and firmware version
  • Get and set target temperature
  • Get and set user commanded power
  • Get reject and cold head temperatures
  • Turn cooler on or off
  • Supports both serial and TCP (socket) connections with error handling

Requirements

Installation

pip install .

Usage

Serial Connection

from sunpower_cryocooler import SunpowerCryocooler

controller = SunpowerCryocooler()
controller.connect('/dev/ttyUSB0', 9600, con_type="serial")

print("\n".join(controller.get_status()))
controller.set_target_temp(300.0)
controller.turn_on_cooler()
print("\n".join(controller.get_commanded_power()))
print("\n".join(controller.get_measured_power()))
controller.set_commanded_power(10.0)
print("\n".join(controller.get_reject_temp()))
print("\n".join(controller.get_cold_head_temp()))

TCP Connection

from sunpower_cryocooler import SunpowerCryocooler

controller = SunpowerCryocooler()
controller.connect("192.168.29.100", 10016, con_type="tcp")

print("\n".join(controller.get_status()))
controller.set_target_temp(300.0)
controller.turn_on_cooler()
print("\n".join(controller.get_commanded_power()))
print("\n".join(controller.get_measured_power()))
controller.set_commanded_power(10.0)
print("\n".join(controller.get_reject_temp()))
print("\n".join(controller.get_cold_head_temp()))

🧪 Testing

Unit tests are located in tests/ directory and use pytest with unittest.mock to simulate hardware behavior — no physical sunpower controller is required.

To run all tests from the project root:

pytest

Class Diagram

Below is a class diagram of the added methods and attributes for the sunpower. See the README for the hardware_device_base module for the inherited methods and attributes.

classDiagram
    class SunpowerCryocooler {
        +Str con_type
        +Float read_timeout
        +serial.Serial ser
        +socket sock
        _send_and_read() List[str]
        +get_status() List[str]
        +get_error() Union[str, None]
        +get_version() Union[str, None]
        +get_coldhead_temp() Union[float, None]
        +get_reject_temp() Union[float, None]
        +get_target_temp() Union[float, None]
        +set_target_temp() Union[float, None]
        +get_measured_power() Union[float, None]
        +get_commanded_poer() Union[float, None]
        +get_current_commanded_power() Union[float, None]
        +set_commanded_power() Union[float, None]
        +turn_on_cooler() Union[bool, None]
        +turn_off_cooler() Union[bool, None]
    }
Loading

About

Low-level library for communicating with a Sunpower AVC and Cryocooler controller

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages