Skip to content

Commit

Permalink
Merge pull request #86 from simonzihlmann/master
Browse files Browse the repository at this point in the history
feat: add driver for Lakeshore Model 625
  • Loading branch information
jenshnielsen authored Feb 4, 2021
2 parents b01ce47 + 9987c09 commit 97e05f8
Show file tree
Hide file tree
Showing 2 changed files with 890 additions and 0 deletions.
367 changes: 367 additions & 0 deletions docs/examples/Lakeshore_625.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,367 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Example with Lakeshore Model 625 Superconducting Magnet power supply"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import qcodes as qc"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"from qcodes_contrib_drivers.drivers.Lakeshore.Model_625 import Lakeshore625"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Connected to: LSCI 625 (serial:6251287, firmware:1.3/1.1) in 0.77s\n"
]
}
],
"source": [
"# Initialize a single power supply for a superconducting magnet using GPIB\n",
"# specify coil constant of the magnet in units of T/A\n",
"# specifz field ramp rate in units of T/min\n",
"magnet = Lakeshore625(name = 'magnet', address = 'GPIB0::4::INSTR', coil_constant = 0.0166614, field_ramp_rate = 0.15)"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'vendor': 'LSCI', 'model': '625', 'serial': '6251287', 'firmware': '1.3/1.1'}"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"magnet.IDN()"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"magnet:\n",
"\tparameter value\n",
"--------------------------------------------------------------------------------\n",
"IDN :\t{'vendor': 'LSCI', 'model': '625', 'serial': '625...\n",
"coil_constant :\t0.01666 (magnet_coil_constant_unit)\n",
"coil_constant_unit :\tT/A \n",
"current :\t0.0014 (A)\n",
"current_limit :\t55 (A)\n",
"current_ramp_rate :\t0.15 (A/s)\n",
"current_rate_limit :\t0.3 (A/s)\n",
"field :\t2.4e-05 (T)\n",
"field_ramp_rate :\t0.14994 (T/min)\n",
"oer_quench :\tno quench detected \n",
"operational_error_status :\t000000000 \n",
"persistent_switch_heater :\tdisabled \n",
"quench_current_step_limit :\t0.4 (A/s)\n",
"quench_detection :\tenabled \n",
"ramp_segments :\tdisabled \n",
"ramping_state :\tnot ramping \n",
"timeout :\t10 (s)\n",
"voltage :\t0.0048 (V)\n",
"voltage_limit :\t1 (V)\n"
]
}
],
"source": [
"# Let's look at all parameters\n",
"magnet.print_readable_snapshot(update=True)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Check current to field conversion"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"coil constant = 0.01666 T/A\n",
"current limit = 55.0 A\n",
"current ramp rate limit = 0.3 A/s\n"
]
}
],
"source": [
"# Since the set method of the driver only excepts fields in Tesla and we want to check if the correct \n",
"# currents are applied, we need to convert target currents to target fields. For this reason we need \n",
"# the coil constant. \n",
"coil_const = magnet.coil_constant()\n",
"current_limit = magnet.current_limit()\n",
"current_rate_limit = magnet.current_rate_limit()\n",
"print(\"coil constant = {} T/A\".format(coil_const))\n",
"print(\"current limit = {} A\".format(current_limit))\n",
"print(\"current ramp rate limit = {} A/s\".format(current_rate_limit))"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Target field is 0.0016660000000000002 T\n",
"Measured field is 0.001678 T\n",
"Measured current is = 0.1007202881152461 A\n"
]
}
],
"source": [
"# Let see if we can set and get the field in Tesla \n",
"target_current = 0.1 # [A] The current we want to set \n",
"target_field = coil_const * target_current # [T]\n",
"print(\"Target field is {} T\".format(target_field))\n",
"magnet.field(target_field)\n",
"\n",
"field = magnet.field() # This gives us the measured field\n",
"print(\"Measured field is {} T\".format(field))\n",
"# The current should be \n",
"current = field / coil_const\n",
"print(\"Measured current is = {} A\".format(current))\n",
"# We have verified with manual inspection that the current has indeed ben reached"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Let's have a look at other parameters"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Field"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.001678"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Let's read the field\n",
"magnet.field()"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [],
"source": [
"# Let's set a field (blocking mode)\n",
"magnet.field(0.005)"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [],
"source": [
"# Let's set a field (non-blocking mode)\n",
"magnet.set_field(0.01, block=False)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Ramp rate"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Field ramp rate: 0.09996000000000001 T/min.\n",
"Current ramp rate: 0.1 A/s.\n",
"Field ramp rate: 0.19992000000000001 T/min.\n",
"Current ramp rate: 0.2 A/s.\n"
]
}
],
"source": [
"# The field ramp rate can easily be changed (this will update the current ramp rate as well since the power supply only works in current)\n",
"magnet.field_ramp_rate(0.1)\n",
"print('Field ramp rate: {} {}.'.format(magnet.field_ramp_rate(), magnet.field_ramp_rate.unit))\n",
"print('Current ramp rate: {} {}.'.format(magnet.current_ramp_rate(), magnet.current_ramp_rate.unit))\n",
"\n",
"magnet.field_ramp_rate(0.2)\n",
"print('Field ramp rate: {} {}.'.format(magnet.field_ramp_rate(), magnet.field_ramp_rate.unit))\n",
"print('Current ramp rate: {} {}.'.format(magnet.current_ramp_rate(), magnet.current_ramp_rate.unit))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Quench detection"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Quench detection is enabled.\n",
"Current rate limit for quench detection:0.4 A/s\n",
"There was no no quench detected.\n"
]
}
],
"source": [
"# Quenches detection can be enabled, which it is by default\n",
"print('Quench detection is {}.'.format(magnet.quench_detection()))\n",
"\n",
"# A quench is detected if the current rate is above the follwoing limit\n",
"print('Current rate limit for quench detection:{} {}'.format(magnet.quench_current_step_limit(), magnet.quench_current_step_limit.unit))\n",
"\n",
"# Let's check if there was a quench detected\n",
"print('There was no {}.'.format(magnet.oer_quench()))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"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.7.7"
},
"nbsphinx": {
"execute": "never"
},
"toc": {
"base_numbering": 1,
"nav_menu": {},
"number_sections": true,
"sideBar": true,
"skip_h1_title": false,
"title_cell": "Table of Contents",
"title_sidebar": "Contents",
"toc_cell": false,
"toc_position": {},
"toc_section_display": true,
"toc_window_display": false
},
"varInspector": {
"cols": {
"lenName": 16,
"lenType": 16,
"lenVar": 40
},
"kernels_config": {
"python": {
"delete_cmd_postfix": "",
"delete_cmd_prefix": "del ",
"library": "var_list.py",
"varRefreshCmd": "print(var_dic_list())"
},
"r": {
"delete_cmd_postfix": ") ",
"delete_cmd_prefix": "rm(",
"library": "var_list.r",
"varRefreshCmd": "cat(var_dic_list()) "
}
},
"types_to_exclude": [
"module",
"function",
"builtin_function_or_method",
"instance",
"_Feature"
],
"window_display": false
}
},
"nbformat": 4,
"nbformat_minor": 4
}
Loading

0 comments on commit 97e05f8

Please sign in to comment.