{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# QCoDeS example with Rohe&Schwarz SMW200A" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The Rohde&Schwartz SMW200A Vector Source is a high-performance signal generator. The frequency range is from 100kHz up to 40GHz. The signal can be modulated with a wide range of internal or external generated waveforms. All signals can be configured with their specific classes. One usage is generating signals for radar module and receiver tests." ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [], "source": [ "from qcodes_contrib_drivers.drivers.RohdeSchwarz.SMW200A import RohdeSchwarz_SMW200A as smw200a" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Be sure to specify the correct IP address in the constructor. If the driver cannot find the device, a VisaIOError is raised. If the read device id is not correct, a RuntimeError is raised." ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [], "source": [ "dev = smw200a( name='SMW200A', address='TCPIP::134.61.7.60::hislip0::INSTR' )" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "At the startup of the driver it asks the instrument for the device id and the installed options. With this informations the set of parameters is modified. Not all parameters are available with all options." ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "scrolled": true }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "ID: Rohde&Schwarz,SMW200A,1412.0000K02/105578,04.30.005.29 SP2\n", "Options: ['SMW-B13T', 'SMW-B22', 'SMW-B120', 'SMW-K22', 'SMW-K23']\n" ] } ], "source": [ "print( \"ID:\", dev.get_id() )\n", "print( \"Options:\", dev.get_options() )" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "As an example for the usage of the device, the frequency modulation is modified here. First, we will print the current settings." ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " Deviation: 1000.0\n", " Source: LF1\n", "Deviation ration: 100.0\n", " Mode: NORM\n", " State: OFF\n" ] } ], "source": [ "fm = dev.submodules['fm_channels'][0]\n", "print(' Deviation:', fm.deviation())\n", "print(' Source:', fm.source())\n", "print('Deviation ration:', fm.deviation_ratio())\n", "print(' Mode:', fm.mode())\n", "print(' State:', fm.state())" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Then we change some values. The last one sets the state of the frequency modulation to 'ON'. Now the modulation is activated until the state is set to 'OFF'." ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "DBG-Mock: MockVisaHandle write SOUR1:FM1:DEV 20000\n", "DBG-Mock: MockVisaHandle write SOUR1:FM:RAT 50\n", "DBG-Mock: MockVisaHandle write SOUR1:FM:MODE LNO\n", "DBG-Mock: MockVisaHandle write SOUR1:FM1:SOUR INT\n", "DBG-Mock: MockVisaHandle write SOUR1:FM1:STAT 1\n" ] } ], "source": [ "fm.deviation(20000)\n", "fm.deviation_ratio(50)\n", "fm.mode('LNO')\n", "fm.source('INT')\n", "fm.state('ON')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Close the connection after your work is completed." ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [], "source": [ "dev.close()" ] } ], "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.6.7" }, "nbsphinx": { "execute": "never" } }, "nbformat": 4, "nbformat_minor": 2 }