esrf

Beamline Instrument Software Support
SPEC Macro documentation: [ Macro Index | BCU Home ]

LAKESHORE.MAC
See other macros in category: Temperature
Description:
    Temperature control macros for the LakeShore model 336 (ID12)
Documentation:
    DESCRIPTION
    This macroset contains macros to control and read the temperature from the Lakeshore 336 controller. The macroset has two main functions. Firstly, the macroset chains onto the counting chain of Spec to allow the temperature or sensor resistance to be measured at each counting event. Secondly, macros are avaliable to control the main parameters of the controller such as heater range, control sensor etc. Macros, present in lakeshore340.mac, provided to enable auto configuration from a datafile for standard parameters which are specific to the type of cryostat in use, are not present here beacause ID12 do not need them and this functionnality is slightly different in the model 336 than in the model 340 and need to be entirely redone

    Getting Started

    To start logging the temperature from within Spec the command ls336_ontemp should be issued. This starts the logging of the temperature at each count command, and will record the temperature in the datafile during a scan. The sister command ls336_offtemp will stop the logging of the temperature. The cpmmand ls336_setup should be called at a first stage as it defined global parameters for the lakeshore 336 The command ls336_spec_setup should be run (usually from the setup macro of spec) for temperature counters to pair the lakeshore sensor to a spec counter mnemonics. Please note that ls336_spec_setup also sets various global parameters so should be run at startup.

    To show all relevant parameters for the controller the command ls336_show can can be used, while ls336_showtemp displays all configured sensor temperature. Setpoint ramping is enabled through the command ls336_onramp and disabled with ls336_offramp. The rate of ramping can be changed through the command ls336_ramp.



    INTERNALS
    Currently in this implementation GPIB is used to communicate with the instrument. However, all comms are done through two functions _ls336_send and _ls336_read and is is possible, therefore, to overload these to allow communication with a non-gpib interface, eg. a device server.

    ################################################################################################# Yes, I am sure there are bugs. Please report them! ################################################################################################# 2014-06-14 - Anthony Mauro lls336range did not display the right setting values. It is fixed. 2014-06-24 - Anthony Mauro sommetimes ls336setpoint do not displayed the last set value but the one before Solution: Add *OPC at the end of the command for _ls336_send. 2016/04/05 - rh included the nr of heaters in the setup fixed the loop (from 1 in the equipment and from 0 in the macro) included the preferred unit to correct the temp print included the celsius reading ################################################################################################# global TEMP_SP global LS_TUNETEXT,LS_UNITS global LS_LOOP global LS_CONFIG_FILENAME, LS_CONFIG_NAME, LS_CONFIG_REVISION global LS_SETP_LIMITS ################################################################################################# ################################################################################################# ######### ########## ######### Setup Lakeshore 336 macros ########## ######### ########## ################################################################################################# #################################################################################################

    DEPENDENCIES


    BUGS
    Yes, I am sure there are bugs. Please report them! 2014-06-14: lls336range did not display the right setting values. It is fixed. Anthony Mauro. 2014-06-24: sommetimes ls336setpoint do not displayed the last set value but the one before Solution: Add *OPC at the end of the command for _ls336_send. Anthony Mauro.

Macros:
    ls336_setup
    Usage: ls336_setup
    Syntax : ls336_setup.
    Set the global variables for Lakeshore336

    ls336_gpib_setup
    Usage: ls336_gpib_setup
    Syntax : ls336_gpib_setup <GPIB unit> <GPIB number>.
    Set the global variables used for all gpib access: LS336_PAR["comm_mode"] and LS336_PAR["addr"]

    ls336_socket_setup
    Usage: ls336_socket_setup
    Syntax : ls336_socket_setup <host> <port>.
    Set the global variables used for all socket access: LS336_PAR["comm_mode"] and LS336_PAR["addr"]

    ls336_spec_setup
    Usage: ls336_spec_setup
    Syntax : ls336_spec_setup <numsensors> [<spec counter> <lakeshore sensor> ...]
    Setup spec for the use of the lakeshore. This macro sets the internal global variables used by the whole macroset and configures the pseudo counters for measuring the temperature in KELVIN.

    ls336_ident
    Usage: ls336_ident
    Syntax : ls336_ident
    Display the device indentification string of the lakeshore.

    ls336on
    Usage: ls336on
    Syntax : ls336on
    Switch temperature logging on. Spec will read the temperature at each count and load sensor values into the pseudo counters defined by lsspec_setup the temperature setpoints are also set from the global variable LS_SETP_LIMITS

    ls336off
    Usage: ls336off
    Syntax : ls336off
    Switch temperature logging off. See ontemp

    ls336show
    Usage: ls336show
    Syntax : ls336show
    Display all main parameters and values for the temperature controller

    ls336_showtemp
    Usage: ls336_showtemp
    Syntax : ls336_showtemp
    Read and display all sensors defined by the ls336_spec_setup macro and the setpoint temperature this macro also shows the current setpoint ramprate if ramping is active

    ls336ramprate
    Usage: ls336ramprate
    Syntax : ls336ramprate [<heater 1-4> <rate 0.1-10>] [<heater 1-4> <rate 0.1-10>] ...
    Set the value of the setpoint ramp rate in (K/mn) for heater <heater>. If no parameter is passed all heater setpoint ramp rate are displayed.

    ls336onramp
    Usage: ls336onramp
    Syntax : ls336onramp <heater> [<heater> heater> ...]
    Switch on temperature ramping. The rate must be set using the ls336_ramprate macro.

    ls336offramp
    Usage: ls336offramp
    Syntax : ls336offramp <heater> [<heater> heater> ...]
    Switch off temperature ramping

    ls336range
    Usage: ls336range
    Syntax : ls336range [<heater 1-4> <range 0-3>] [<heater 1-4> <range 0-3>] ...
    Shows/allows to change the range 0=off 1=low 2=medium 3=high. If no parameter is given the current range is displayed range 0 means heater off

    ls336pid
    Usage: ls336pid
    Syntax : ls336pid [<heater> <p> <i> <d>] [<heater> <p> <i> <d>] ...
    Macro to alter the PID values in the lakeshore. If no pid values are given then the current values are displayed.


Internal Macros:
    _ls336_get_ident
    Usage: _ls336_get_ident()
    Syntax : _ls336_get_ident()
    Internal function which gets the lakeshore identification string from the instrument and returns it.

    _ls336_send
    Usage: _ls336_send(command)
    Syntax : _ls336_send(command)
    Internal function to send a command string to the lakeshore. This imp. uses gpib at an address defined my the global variable LS_ADDR. Returns LSREADERROR if the command could not be sent, otherwise LSOK is returned.

    _ls336_read
    Usage: _ls336_read(command)
    Syntax : _ls336_read(command)
    Internal function to send a command string to the lakeshore and get the reply.

    _ls336_set_cnt
    Usage: _ls336_set_cnt
    Syntax : _ls336_set_cnt()
    Read temperature and set the corresponding pseudo counters.

    _ls336_readtemp
    Usage: _ls336_readtemp()
    Syntax : _ls336_readtemp()
    Internal function which reads all temperature and sensor values defined by ls336_spec_setup and stores them in the internal global variables.

    _ls336_readsensor_k
    Usage: _ls336_readsensor_k(sensor)
    Syntax : _ls336_readsensor_k(sensor)
    Reads and returns sensor reading in kelvin. Returns -2 if there is an error condition on the sensor.

    _ls336_readsensor_c
    Usage: _ls336_readsensor_c(sensor)


    _ls336_readsensor_o
    Usage: _ls336_readsensor_o(sensor)
    Syntax : _ls336_readsensor_o(sensor)
    Reads and returns sensor reading in sensor units (ohms or voltage). returns -2 if there is an error with the sensor.

    _ls336_sensorstatus
    Usage: _ls336_sensorstatus(sensor)
    Syntax : _ls336_sensorstatus(sensor)
    Read status of sensor
    BIT Parameter
    0 Invalid Reading
    1 Old Reading
    4 Underrange
    5 Overrange
    6 Units Zero
    7 Units Overrange


    ls336setpoint
    Usage: ls336setpoint
    Syntax ls336setpoint [<heater 1-4> <newval>] [<heater 1-4> <newval> .... ]
    Change setpoint value.

    _ls336_read_setpoint
    Usage: _ls336_read_setpoint(loop)
    Syntax : _ls336_read_setpoint(loop)
    Set and read setpoint for given control loop.

    _ls336_read_preferred_unit_loop
    Usage: _ls336_read_preferred_unit_loop(_loop)


    _ls336_read_preferred_unit
    Usage: _ls336_read_preferred_unit(_sensor)


    _ls336_set_setpoint
    Usage: _ls336_set_setpoint(loop,sp)
    Syntax : _ls336_set_setpoint(loop,sp)
    Set and read setpoint for given control loop.

    _ls336_set_ramprate
    Usage: _ls336_set_ramprate(heater, ramprate)
    Syntax : _ls336_set_ramprate(heater, ramprate)
    Sets controllers ramprate, returns controllers ramprate.

    _ls336_read_ramprate
    Usage: _ls336_read_ramprate(heater)
    Syntax : _ls336_read_ramprate(lsoutput)
    Reads and returns controllers ramprate.

    _ls336_set_ramp
    Usage: _ls336_set_ramp(heater, state)
    Syntax : _ls336_set_ramp(heater,state)
    Switches on or off temperature ramping (off = 0, on = 1)

    _ls336_read_ramp
    Usage: _ls336_read_ramp(heater)
    Syntax : _ls336_read_ramp(heater)
    Reads and returns controllers ramp setting (off = 0, on = 1)

    _ls336_ramp_state
    Usage: _ls336_ramp_state(heater)
    Syntax : _ls336_ramp_state(heater)
    Reads and returns status of setpoint ramping (ramping = 1, not ramping = 0)

    _ls336_set_range
    Usage: _ls336_set_range(heater, range)
    Syntax : _ls336_set_range(heater, range)
    Set and return heater range (0 to 3, 0 = heater off).

    _ls336_read_range
    Usage: _ls336_read_range(heater)
    Syntax : _ls336_read_range
    Read and return heater range (0 to 3, 0 = heater off).

    _ls336_set_pid
    Usage: _ls336_set_pid(heater,pid)
    Syntax : _ls336_set_pid(heater, pid)
    Set pid parameters, returns the controller read pid's as an array.

    _ls336_read_pid
    Usage: _ls336_read_pid(heater, pid)
    Syntax : _ls336_read_pid(heater, pid)
    Read controller PID values, returns values as an array.

Filename: lakeshore336.mac
Author: G. Berruyer, BCU

$Date: 2016/04/05 14:22:52 $
$Revision: 1.4 $
$State: Exp $
Last mod.: 05/04/2016 16:23 by homsrego