Source code for cmd_la_gen8_90

#!/usr/bin/env python2
# -*- coding: utf-8 -*-
# 
# Copyright 2012-2017 Frédéric Magniette, Miguel Rubio-Roy
# This file is part of Pyrame.
# 
# Pyrame is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# 
# Pyrame is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Lesser General Public License for more details.
# 
# You should have received a copy of the GNU Lesser General Public License
# along with Pyrame.  If not, see <http://www.gnu.org/licenses/>

import scpi

# CLASS ##########################################################

class la_gen8_90_class(scpi.scpi):
    # Available channels
    channels=["1"] # one channel

    def __init__(self):
        super(la_gen8_90_class,self).__init__("la_gen8_90")

    def config(self,la_gen8_90_id):
        command="SYST:ERR:ENAB"
        return super(la_gen8_90_class,self).config(la_gen8_90_id,command)

    def set_voltage(self,la_gen8_90_id,voltage):
        command= r"SOUR:CURR {current:.4f}\n"
        command+=r"SOUR:VOLT {voltage:.4f}"
        return super(la_gen8_90_class,self).set_voltage(la_gen8_90_id,voltage,command)

    def set_current(self,la_gen8_90_id,current):
        command= r"SOUR:VOLT {voltage:.4f}\n"
        command+=r"SOUR:CURR {current:.4f}"
        return super(la_gen8_90_class,self).set_current(la_gen8_90_id,current,command)

    def set_voltage_limit(self,la_gen8_90_id,voltage_limit):
        command= r"SOUR:VOLT:PROT:LEV {ovp:.4f}\n".format(ovp=voltage_limit*1.05)
        command+=r"SOUR:VOLT {voltage_limit:.4f}"
        return super(la_gen8_90_class,self).set_voltage_limit(la_gen8_90_id,voltage_limit,command)

    def set_current_limit(self,la_gen8_90_id,current_limit):
        command=r"SOUR:CURR {current_limit:.4f}"
        return super(la_gen8_90_class,self).set_current_limit(la_gen8_90_id,current_limit,command)

    def get_voltage(self,la_gen8_90_id):
        query=r"MEAS:VOLT?"
        return self.simple_query(la_gen8_90_id,query)

    def get_current(self,la_gen8_90_id):
        query=r"MEAS:CURR?"
        return self.simple_query(la_gen8_90_id,query)

    def power_on(self,la_gen8_90_id):
        command="OUTP:STAT ON"
        return self.simple_command(la_gen8_90_id,command)

    def power_off(self,la_gen8_90_id):
        command="OUTP:STAT OFF"
        return self.simple_command(la_gen8_90_id,command)

# CREATE POOL ####################################################

me=la_gen8_90_class()

# COMMANDS #######################################################

[docs]def init_la_gen8_90(la_gen8_90_id,conf_string): """Initialize la_gen8_90 power supply identified by *la_gen8_90_id* *conf_string* must include the parameter: - bus: conf_string of the underlying link module (GPIB, TCP, ...) - channel: channel on which the id will act""" return me.init(la_gen8_90_id,conf_string)
[docs]def deinit_la_gen8_90(la_gen8_90_id): "Deinitialize an la_gen8_90" return me.deinit(la_gen8_90_id)
[docs]def config_la_gen8_90(la_gen8_90_id): "Configure an la_gen8_90" return me.config(la_gen8_90_id)
[docs]def inval_la_gen8_90(la_gen8_90_id): "Invalidate an la_gen8_90" return me.inval(la_gen8_90_id)
[docs]def reset_la_gen8_90(la_gen8_90_id): "Send RST signal to PS" return me.reset(la_gen8_90_id)
[docs]def set_voltage_la_gen8_90(la_gen8_90_id,voltage): "Set voltage in Volts." return me.set_voltage(la_gen8_90_id,voltage)
[docs]def set_current_la_gen8_90(la_gen8_90_id,current): "Set current in Ampers." return me.set_current(la_gen8_90_id,current)
[docs]def set_voltage_limit_la_gen8_90(la_gen8_90_id,voltage_limit): "Set voltage limit in Volts. The Over Voltage Protection will be set to 105% of the supplied value." return me.set_voltage_limit(la_gen8_90_id,voltage_limit)
[docs]def set_current_limit_la_gen8_90(la_gen8_90_id,current_limit): "Set current limit in Ampers." return me.set_current_limit(la_gen8_90_id,current_limit)
[docs]def get_voltage_la_gen8_90(la_gen8_90_id): "Get voltage in Volts." return me.get_voltage(la_gen8_90_id)
[docs]def get_current_la_gen8_90(la_gen8_90_id): "Get current in Ampers." return me.get_current(la_gen8_90_id)
[docs]def power_on_la_gen8_90(la_gen8_90_id): "Turn on." return me.power_on(la_gen8_90_id)
[docs]def power_off_la_gen8_90(la_gen8_90_id): "Turn off." return me.power_off(la_gen8_90_id)
[docs]def free_command_la_gen8_90(la_gen8_90_id,command): "Send a raw command to the PS" return me.free_command(la_gen8_90_id,command)
[docs]def get_error_queue_la_gen8_90(la_gen8_90_id): "Read error queue until the end (code 0)" return me.get_error_queue(la_gen8_90_id)