Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CryomagneticsModel4G Power Supply Driver #5968

Merged
merged 51 commits into from
May 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
57c1d54
creating cryo 4g driuver based on AMI430
Feb 9, 2024
cc2d9a6
creating cryo 4g driuver based on AMI430
Feb 9, 2024
f7fb54f
Merge branch 'trmorgan/cryo-4g-driver' of https://github.com/trevormo…
Feb 9, 2024
d9bda73
commenting out irrelevant parameters
Feb 15, 2024
7d9fc15
Merge branch 'main' into trmorgan/cryo-4g-driver
Feb 16, 2024
7648190
Merge remote-tracking branch 'origin/main' into trmorgan/cryo-4g-driver
Feb 18, 2024
7ac0451
removing code that will be mostly rewritten
Feb 19, 2024
370d8d6
updateds to have features in AMI
Feb 27, 2024
10fbe21
t [Merge branch 'main' into trmorgan/cryo-4g-driver
Feb 27, 2024
4fa10d6
feature parity with andews driver
Feb 28, 2024
36cfb60
updates
Mar 8, 2024
4937e13
cleaning up
Mar 21, 2024
6058186
cleanup based on precommit hook
Mar 25, 2024
67a4003
Merge branch 'main' into trmorgan/cryo-4g-driver
Mar 25, 2024
149165e
unit tests for cryomagnetics driver
Mar 25, 2024
0d6b739
currently working on hardware
Apr 13, 2024
f139ef2
formating changes
Apr 13, 2024
2886b5a
pre commit run
Apr 13, 2024
55e9fab
updates to tests
Apr 13, 2024
0888b09
ruff from precommit
Apr 13, 2024
16d88a4
Merge branch 'main' into trmorgan/cryo-4g-driver
Apr 15, 2024
6efbdab
formatting from pre-commit
Apr 16, 2024
3d7a4f3
Merge branch 'main' into Trmorgan/cryo-4g-driver
Apr 16, 2024
640eb02
public api exposed in __init__
Apr 17, 2024
429d812
convert to public function
Apr 17, 2024
5d0fbda
adding doc string to magnet_operating_state
Apr 18, 2024
e0faa9d
daker formatting
Apr 18, 2024
999d26a
formatting
Apr 18, 2024
af38537
Merge remote-tracking branch 'upstream/main' into trmorgan/cryo-4g-dr…
Apr 18, 2024
2472902
updates related to module rename
Apr 18, 2024
3de9395
formatting with darker
Apr 18, 2024
3b78090
formatting with darker
Apr 18, 2024
2623b46
ran ruff
Apr 18, 2024
f9af921
removed unused logging
Apr 23, 2024
135ae69
Merge branch 'main' into trmorgan/cryo-4g-driver
trevormorgan Apr 23, 2024
f659a6b
Merge branch 'trmorgan/cryo-4g-driver' of https://github.com/trevormo…
Apr 23, 2024
bbbba0a
Update tests/drivers/test_cryomagnetics_4g.py
trevormorgan Apr 23, 2024
e62412a
adding rst file for cryomagnetics api in docs
Apr 23, 2024
06f7861
Merge branch 'trmorgan/cryo-4g-driver' of https://github.com/trevormo…
Apr 23, 2024
62245da
changes from precommit
Apr 25, 2024
7b45770
fix private module import name
Apr 25, 2024
4f0a958
Merge branch 'microsoft:main' into trmorgan/cryo-4g-driver
trevormorgan Apr 25, 2024
7454904
Merge branch 'trmorgan/cryo-4g-driver' of https://github.com/trevormo…
Apr 25, 2024
45434ad
ruff formatting
Apr 25, 2024
4466104
adding write_raw ask_raw override tto retry if bad communication
May 1, 2024
4eec0b6
adding terminator var
May 1, 2024
4aecfd9
adding new feature highlight for changelogs when releazed
May 1, 2024
6a29828
Merge branch 'microsoft:main' into trmorgan/cryo-4g-driver
trevormorgan May 3, 2024
6b1dc4e
lower case string change
May 3, 2024
cdfa5bb
fix doc string in operating state method
May 3, 2024
b936f82
asterisks around *STB? have been replaced with double backticks
May 3, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions docs/changes/newsfragments/5968.new
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Added a new QCoDeS driver for the Cryomagnetics Model 4G superconducting magnet power supply.

The `CryomagneticsModel4G` driver provides an interface to control and communicate with the Cryomagnetics Model 4G
superconducting magnet power supply using the VISA protocol. It allows setting and reading the magnetic field, ramp rate,
and various other parameters of the instrument.

Key features of the driver include:

* Setting and reading the magnetic field in Tesla, considering the coil constant and current limits.

* Controlling the ramp rate in Tesla per minute.

* Checking the operating state of the magnet and handling quench conditions and power module failures.

* Blocking and non-blocking ramping of the magnetic field.

* Handling communication errors and retrying failed operations.

The driver is located in ``qcodes/instrument_drivers/cryomagnetics/cryomagnetics_4g.py``.

For more details and usage examples, please refer to the driver's documentation:
https://qcodes.github.io/Qcodes/examples/driver_examples/Qcodes_example_with_cryomagnetics4g.html
7 changes: 7 additions & 0 deletions docs/drivers_api/CryoMagnetics.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.. _cryomagnetics_api :

Cryomagnetics Drivers
=====================

.. automodule:: qcodes.instrument_drivers.cryomagnetics
:autosummary:
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Cryomagnetics 4G QCoDeS Driver Example\n",
"\n",
"This notebook showcases how to interfacing with a Cryomagnetics 4G power supply using the QCoDeS. The Cryomagnetics 4G power supply is commonly used in research settings for precise magnetic field control in experiments that include superconductivity studies and material science.\n",
"\n",
"## Setup\n",
"\n",
"First, ensure you have the required drivers and QCoDeS installed. The connection to the instrument is assumed to be via GPIB. Let's establish the connection and set up the initial parameters for the magnetic field control."
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Connected to: None (serial:None, firmware:None) in 0.03s\n"
]
}
],
"source": [
"from qcodes.instrument_drivers.cryomagnetics import CryomagneticsModel4G\n",
"\n",
"max_current_limits = {\n",
" 1: (45.0, 0.01),\n",
" 2: (67.24, 0.0138),\n",
" 3: (85, 0.0001),\n",
" 4: (95, 0.0001),\n",
"}\n",
"coil_constant = 0.13385 # T/A\n",
"\n",
"cryo_instrument = CryomagneticsModel4G(\n",
" name='cryo_4g',\n",
" address='GPIB::1::INSTR',\n",
" max_current_limits=max_current_limits,\n",
" coil_constant=coil_constant,\n",
" pyvisa_sim_file=\"cryo4g.yaml\",\n",
")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Basic Operations\n",
"\n",
"The following sections demonstrate how to perform basic operations with the Cryomagnetics 4G instrument. We will cover setting and measuring the magnetic field, checking the magnet's operational state, and modifying the ramp rate for adjusting the magnetic field."
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Coil constant = 0.13385 T/A\n"
]
}
],
"source": [
"# Checking the coil constant\n",
"coil_constant = cryo_instrument.coil_constant\n",
"print(f'Coil constant = {coil_constant} T/A')"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"import time\n",
"\n",
"import matplotlib.pyplot as plt\n",
"\n",
"\n",
"# Function to plot magnetic field over time\n",
"def plot_field_over_time(cryo_instr, target, duration):\n",
" times = []\n",
" fields = []\n",
" start_time = time.time()\n",
" while (time.time() - start_time) < duration:\n",
" fields.append(cryo_instr.field())\n",
" times.append(time.time() - start_time)\n",
" time.sleep(0.5)\n",
" plt.plot(times, fields, marker='o')\n",
" plt.xlabel('Time (s)')\n",
" plt.ylabel('Magnetic Field (T)')\n",
" plt.title(f'Time vs Magnetic Field towards {target} T')\n",
" plt.show()\n",
"\n",
"# Example usage:\n",
"# plot_field_over_time(cryo_instrument, 1.0, 60) # plot for 60 seconds while setting the field to 1 T"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"\n",
"## Range and Rate Settings\n",
"\n",
"The Cryomagnetics4G.py driver provides functionality to manage the current ranges and ramp rates of the Cryomagnetics 4G superconducting magnet power supply. These settings are crucial for ensuring safe and efficient operation of the magnet within its specified limits.\n",
"\n",
"### Current Ranges\n",
"\n",
"The power supply has multiple current ranges, each with its own upper current limit. The `max_current_limits` parameter in the `CryomagneticsModel4G` class constructor allows you to specify these ranges and their corresponding limits. It is a dictionary where the keys represent the range indices, and the values are tuples containing the upper current limit and maximum rate for that range.\n",
"\n",
"For example:\n",
"```python\n",
"max_current_limits = {\n",
" 1: (45.0, 0.01),\n",
" 2: (67.24, 0.0138),\n",
" 3: (85, 0.0001),\n",
" 4: (95, 0.0001),\n",
"}\n",
"```\n",
"\n",
"In this example, there are four current ranges defined:\n",
"- Range 1: Upper current limit of 45.0 A and a maximum rate of 0.01 A/s.\n",
"- Range 2: Upper current limit of 67.24 A and a maximum rate of 0.0138 A/s.\n",
"- Range 3: Upper current limit of 85 A and a maximum rate of 0.0001 A/s.\n",
"- Range 4: Upper current limit of 95 A and a maximum rate of 0.0001 A/s.\n",
"\n",
"The driver automatically handles the selection of the appropriate range based on the current field value when setting the ramp rate.\n",
"\n",
"### Ramp Rates\n",
"\n",
"The `rate` parameter in the driver represents the ramp rate of the magnetic field in Tesla per minute. When setting the ramp rate, the driver ensures that it does not exceed the maximum rate specified for the corresponding current range.\n",
"\n",
"If an attempt is made to set a ramp rate that is outside the defined rate ranges, a `ValueError` is raised.\n",
"\n",
"### Initializing Range and Rate Settings\n",
"\n",
"During initialization, the driver sets up the current limits and maximum rates for each range on the instrument based on the provided `max_current_limits` parameter. This ensures that the instrument is properly configured with the specified limits.\n",
"\n",
"By carefully defining the current ranges and ramp rates, you can ensure that the magnet operates within its safe limits and optimize its performance based on your specific requirements.\n",
"\n",
"It is important to consult the manufacturer's documentation and specifications when determining the appropriate current limits and ramp rates for your specific magnet and experimental setup.\n",
"\n",
"### Note on Safety\n",
"\n",
"Always ensure the input parameters remain within the safe operating bounds of your instrument. Manual cross-checking and regular maintenance schedules are recommended to avoid equipment damage or accidents.\n",
"\n",
"For further information, consult the official documentation and user manuals provided by the manufacturer. Always prioritize safe operating practices and maintain the instrument according to the recommended guidelines."
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.2"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
57 changes: 57 additions & 0 deletions src/qcodes/instrument/sims/cryo4g.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
spec: "1.0"
devices:
cryomagnetics_4g:
eom:
GPIB INSTR:
q: "\n"
r: "\n"
error: ERROR
dialogues:
- q: "*IDN?"
r: "Cryomagnetics,4G,2239,1.02,208"
- q: "UNITS?"
r: "T"
- q: "UNITS A"
r: ""
- q: "UNITS kG"
r: ""
- q: "UNITS T"
r: ""
- q: "VMAG?"
r: "4.75"
- q: "VOUT?"
r: "12.0"
- q: "IOUT?"
r: "85.0"
- q: "QRESET"
r: ""
- q: "REMOTE"
r: ""
- q: "SWEEP ZERO"
r: ""
- q: "*STB?"
r: "0" # standby mode
- q: "*STB?"
r: "1" # ramping mode
- q: "IMAG?"
r: "85.0 kG"
- q: "RATE?"
r: "5.0"
- q: "LLIM 50"
r: ""
- q: "ULIM 100"
r: ""
- q: "SWEEP UP"
r: ""
- q: "SWEEP DOWN"
r: ""
- q: "RANGE 0 100.0"
r: ""
- q: "RATE 0 1.0"
r: ""
- q: "SWEEP PAUSE"
r: ""

resources:
GPIB::1::INSTR:
device: cryomagnetics_4g
13 changes: 13 additions & 0 deletions src/qcodes/instrument_drivers/cryomagnetics/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from ._cryomagnetics4g import (
Cryomagnetics4GException,
Cryomagnetics4GWarning,
CryomagneticsModel4G,
CryomagneticsOperatingState,
)

__all__ = [
"Cryomagnetics4GException",
"Cryomagnetics4GWarning",
"CryomagneticsModel4G",
"CryomagneticsOperatingState",
]
Loading
Loading