{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# QCoDeS Example with R&S HMP4040 Power Supply" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import qcodes as qc\n", "import qcodes_contrib_drivers.drivers.RohdeSchwarz.HMP4040 as hmp4040" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Create the instrument (in this case a HMP4040 connected via USB to the ASRL4::INSTR address)" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Connected to: ROHDE&SCHWARZ HMP4040 (serial:101920, firmware:HW50020003/SW2.62) in 0.12s\n" ] } ], "source": [ "ps = hmp4040.RohdeSchwarzHMP4040('ps_1', 'ASRL4::INSTR')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "You can set voltage and/or current to any channel." ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "ps.ch1.set_voltage.set(0.05)\n", "ps.ch2.set_current.set(0.2)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The set voltage and current can be read out." ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "scrolled": true }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "0.05\n", "0.2\n" ] } ], "source": [ "print(ps.ch1.set_voltage.get())\n", "print(ps.ch2.set_current.get())" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Channel(s) should be turned on, as well as the master on/off" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [], "source": [ "ps.ch1.state('ON')\n", "ps.state('ON')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Voltage, current and power can be measured" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "V1= 0.05\n", "I1= 0.005\n", "P1= 0.00025\n" ] } ], "source": [ "print('V1=', ps.ch1.voltage.get())\n", "print('I1=', ps.ch1.current.get())\n", "print('P1=', ps.ch1.power.get())" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "And finally turned off" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [], "source": [ "ps.ch1.state('OFF')\n", "ps.state('OFF')" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "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.8.12" }, "nbsphinx": { "execute": "never" }, "widgets": { "application/vnd.jupyter.widget-state+json": { "state": {}, "version_major": 2, "version_minor": 0 } } }, "nbformat": 4, "nbformat_minor": 4 }