Beamline Instrument Software Support |
|
SPEC Macro documentation:
[ Macro Index |
BCU Home ]
|
LAKESHORE.MAC | ||||||
[ source code | installed at | configured at ] | ||||||
See other macros in category: Temperature | ||||||
Description:
| ||||||
Documentation:
This macroset contains macros to control and read the temperature from the Lakeshore 340 controller. The macroset has three 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. Finally, macros are provided to enable auto configuration from a datafile for standard parameters which are specific to the type of cryostat in use. This will be discussed further below. A list of commands and syntaxes is provided below for all functions. Getting Started To start logging the temperature from within Spec the command 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 offtemp will stop the logging of the temperature. The command lsspec_setup should be run (usually from the setup macro of spec) for temperature counters and lsspec_setup_resistance for sensor units measurements to pair the lakeshore sensor to a spec counter mnemonics. Please note that lsspec_setup also sets various global parameters so should be run at startup. To switch on and off the temperature control (enable or disable the heater) the command onreg and offreg are used. This causes the conrollers control loop to be enabled or disabled. To show all relevant parameters for the controller the command lsshow can can be used, while showtemp displays all configured sensor temperature and resistance or voltage readings. Setpoint ramping is enabled through the command onramp and disabled with offramp. The rate of ramping can be changed through the command lsramp. Configuration from File BR% Using this macroset it is possible to send a standard configuration to the Lakeshore from a datafile. This is done through two separate macros which call the same internal function to load the config into the controller. The macro lssendconfig causes the Lakeshore to be configured by the datafile passed to it as the first argument. Each call to this macro causes the controller to be placed in its default state with the control loop disabled. This can therefore cause a disturbance to data collection if this is put into a startup script. For this reason the second macro lsconfig exists. This macro takes the same first argument of a datafile to process, but on opening the file and reading the two first lines (see the section on the datafile below) their values are compared with the two global variables LS_CONFIG_NAME and LS_CONFIG_REVISION. If a match is obtained then the config process is aborted. However, if a match is not obtained then the config process is run for the datafile specified. This enables a line to be placed in the setup script for the configuration in use. If no parameter is passed to the lssendconfig macro then a forced reconfig will start using the previous file. This datafile has a minimal amount of input checking so please follow the format fairly strictly. Any line in which the first character is a # is skipped and treated as a comment. The first two non comment lines of the datafile are used for identification of the config file. The first is intended as an identification string for the cryostat, displex etc. and needs to be unique among your setup. The second is intended as version string which is also checked at setup. This could for instance be the $Revision: 2.17 $ string if the files are placed under a revision control system. The sensor input configuration follows as a block. Each line is a different input of the controller. For each line the parameters are separated by commas and should contain no spaces. The string consists of the following parameters. The heater resistance (in ohms) is indicated on the next line by itself. The setpoint high and low limits follow on the next line with the lower temperature limit first, separated by a comma. The next line consists of the control channel (A, B, C etc.) and setpoint unit setting (1 = Kelvin, 2 = Celsius, 3 = sensor) separated by a comma. The zone table follows as the last item with each line indicating a separate zone entry. A maximum of 10 lines are permitted (this is governed by the 340). The list of entries is ended by the string END_ZONE on the next line. If less than 10 entries are included then the remaining entries of the controller are set to zero in the setup procedure. The format of the entries separated by commas is given below: The file is then ended by the string END. An example of the file is given below # # Zone PID File for ARS Cryofurnace #$Id: lakeshore340.mac,v 2.17 2017/01/31 15:05:19 domingue Exp $#$State: Exp $ # # Name ARS_Cryofurnace # Revision $Revision: 2.17 $ # Sensors # Syntax : channel,type,curve,serial,filter,numfilters,percentageband # End with END_SENS A,21,3,P6626,0,20,5 C,22,12,CAL,1,20,5 D,23,12,CAL,1,20,5 END_SENS # # Resistance of Heater # Syntax : resistance # 50 # # Temperature Limits # lower,upper # 10,300 # # Control Parameters # Syntax : sensor,units # units (1 = Kelvin, 2=Celsius, 3=Sensor) C,1 # # Zonetable # Syntax : top,p,i,d,mout,range # end with END_ZONE 100,1000,20,15,0,4 END_ZONE # # End with END. # END INTERNALS Currently in this implementation GPIB is used to communicate with the instrument. However, all comms are done through two functions _ls_send and _ls_read and is is possible, therefore, to overload these to allow communication with a non-gpib interface, eg. a device server. %QUOTE% global LS_VERSION LS_MODEL332 global TEMP_SP global LS_TUNETEXT,LS_ONOFF,LS_UNITS global LS_SENSOR_COUNTER, LS_SENSOR_CHANNEL, LS_SENSOR_VALUE global LS_SENSOR_COUNTER_RESISTANCE, LS_SENSOR_CHANNEL_RESISTANCE global LS_SENSOR_RESISTANCE global LS_NUM_SENSORS, LS_NUM_SENSORS_RESISTANCE global LS_NUM_SENSORS_POWER LS_COUNTER_POWER LS_CHANNEL_POWER LS_SENSOR_VALUE_POWER global LS_LOOP global LS_GPIB_ADDR,LS_SOCKET_ADDR,LS_COMM_MODE global LS_CONFIG_FILENAME, LS_CONFIG_NAME, LS_CONFIG_REVISION global LS_SETP_LIMITS global LS_SILENT LS_VERSION = "$Id: lakeshore340.mac,v 2.17 2017/01/31 15:05:19 domingue Exp $" DEPENDENCIES STANDARD.MAC BUGS Yes, I am sure there are bugs. Please report them! | ||||||
Macros:
Usage: lsgpib_setup Syntax : lsgpib_setup <GPIB unit> <GPIB number>. Set the global LS_ADDR which is used for all gpib access lssocket_setup Usage: lssocket_setup Syntax : lssocket_setup <host> <port>. Set the global LS_ADDR which is used for all socket access lsontemp Usage: lsontemp Syntax : lsontemp Switch temperature logging on. Spec will read the temperature at each count and load temperature values into the pseudo counters defined by lsspec_setup the temperature setpoints are also set from the global variable LS_SETP_LIMITS %QUOTE% lsofftemp Usage: lsofftemp Syntax : lsofftemp Switch temperature logging off. See ontemp %QUOTE% lsonreg Usage: lsonreg Syntax : lsonreg Switch temperature regulation on for the loop defined by the global variable LS_LOOP %QUOTE% lsoffreg Usage: lsoffreg Syntax : lsoffreg Switch temperature regulation off for the loop defined by the global variable LS_LOOP. See onreg %QUOTE% lsconfig Usage: lsconfig Syntax : lsconfig [<filename>] Configure temperature controller from datafile. For datafile format see documentation and example file. This macro checks the global variable LS_CONFIG_NAME and if there is a match then the a reconfigure is NOT undertaken. This variable is loaded from the config files "name" field so care should be taken to ensure this is unique. This macro can therefore be called from the setup of spec. To force a config use the macro lssendconfig . If no parameter is passed the the current config is displayed from the global variables. %QUOTE% lssendconfig Usage: lssendconfig Syntax : lssendconfig [<filename>] Configure temperature controller from datafile. For datafile format see documentation and example file. WARNING This config action will cause a reconfigure of the sensor inputs. This will disturb your temperature control and WILL switch off the control loop. You should run lsconfig if you just want to check config in the setup script of spec. Use this macro to force a reconfig. If no parameter is passed then a reconfig will commence from the pervious file. %QUOTE% lsshow Usage: lsshow Syntax : lsshow Display all main parameters and values for the temperature controller lsident Usage: lsident Syntax : lsident Display the device indentification string of the lakeshore. showtemp Usage: showtemp Syntax : showtemp Read and display all sensors defined by the ls_spec_setup macro and the setpoint temperature this macro also shows the current setpoint ramprate if ramping is active %QUOTE% lsramp Usage: lsramp Syntax : lsramp [<rate>] Set the value of the setpoint ramp rate in (K/mn). If no parameter is passed the current setpoint ramp rate is displayed. %QUOTE% lsonramp Usage: lsonramp Syntax : lsonramp Switch on temperature ramping. The rate must be set using the lsramp macro. %QUOTE% lsofframp Usage: lsofframp Syntax : lsofframp Switch off temperature ramping %QUOTE% lsheater Usage: lsheater Syntax : lsheater [<range>] Shows/allows to change the heater (0 to 5). If no parameter is given the current range is displayed heater 0 means heater off %QUOTE% lspid Usage: lspid Syntax : lspid [<p>] [<i>] [<d>] Macro to alter the PID values in the lakeshore. If no pid values are given then the current values are displayed. %QUOTE% lsmode Usage: lsmode Syntax : lsmode [<mode>] Shows/allows to change the temperature control mode. If no parameter is passed then the current control mode is displayed The available modes are: lsspec_setup Usage: lsspec_setup Syntax : lsspec_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. See lsspec_setup_resistance to setup pseudo counters for measurement in sensor units. %QUOTE% lsspec_setup_resistance Usage: lsspec_setup_resistance Syntax : lsspec_setup_resistance <numsensors> [<spec counter> <lakeshore sensor> ...] Setup spec for counting with sensor units (resistance / voltage etc.). This macro takes the same syntax as lsspec_setup but does not do any other actions than setup the pseudo counters. You MUST run lsspec_setup before running this macro. %QUOTE% lsspec_setup_power Usage: lsspec_setup_power Syntax : lsspec_setup_power <numloop> [<spec counter> <lakeshore loop power> ...] Setup spec for counting with loop power This macro takes the same syntax as lsspec_setup but does not do any other actions than setup the pseudo counters. You MUST run lsspec_setup before running this macro. %QUOTE% lscontrol Usage: lscontrol Syntax : lscontrol [<sensor>] [<units>] [<on/off>] Change the sensor from which the lakeshore will control from, the units used for the setpoints and enable or disable the control loop. The loop to configure is taken from the global variable LS_LOOP. If no parameter is passed then the current control sensor is displayed. The options for <units> are given below. lscurve Usage: lscurve Syntax : lscurve [<sensor>] [<sensor type>] [<curve number>] Changes the number of the calibration curve for a given sensor. If only a sensor is passed then the calibration curve is displayed for that sensor. If no parameter is given then the calibration curve numbers and serial number is displayed for all sensors configured with lsspec_setup. The values for the sensor type are shown below. BR% lsfilter Usage: lsfilter Syntax : lsfilter [<sensor>] [<on/off>] [<n readings>] [<band>] Set the input filter for sensor channel <sensor>. Example : lsfilter A on 20 5 %QUOTE% lscontrast Usage: lscontrast Syntax : lscontrast [<value>] Set display contrast. A value of zero switches off the backlight while if no parameters are passed then the current value is displayed. %QUOTE% lshelp Usage: lshelp Syntax : lshelp Display Functions and their syntax %QUOTE% lslistallcurves Usage: lslistallcurves Syntax : lslistallcurves List out all the curves used in the controller. There are 60 possible curves (1 - 60). %QUOTE% lswritecurve Usage: lswritecurve Syntax : lswritecurve [filename] [curvenumber] Reads one sensor calibration curve from harddisk and writes it into the lakeshore 340 model. Only curves 21 to 60 can be written by the user. EXAMPLE: Sensor Model: CX-1030-CU-1.4L Serial Number: X12379 Data Format: 4 (Log Ohms/Kelvin) SetPoint Limit: 325. (Kelvin) Temperature coefficient: 1 (Negative) Number of Breakpoints: 144 .....%QUOTE% lsloop2on Usage: lsloop2on activate loop 2 %QUOTE% lsloop2off Usage: lsloop2off de-activate loop 2 %QUOTE% | ||||||
Internal Macros: | ||||||
Usage: _ls_send_config(filename,oldname,oldrevision,loop) Syntax : _ls_send_config(filename,oldname,newname,loop) See lssendconfig and lsconfig _ls_send Usage: _ls_send(command) Syntax : _ls_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. %QUOTE% _ls_read Usage: _ls_read(command) Syntax : _ls_read(command) Internal function to send a command string to the lakeshore and get the reply. _ls_get_ident Usage: _ls_get_ident() Syntax : _ls_get_ident() Internal function which gets the lakeshore identification string from the instrument and returns it. %QUOTE% _lsreadtemp Usage: _lsreadtemp() Syntax : _lsreadtemp() Internal function which reads all temperature and sensor values defined by ls_spec_setup and stores them in the internal global variables. This macro is chained through the use of the ontemp command to the std macro measuretemp. %QUOTE% _ls_set_cnt Usage: _ls_set_cnt Syntax : _ls_set_cnt() Read temperature and set the corresponding pseudo counters. This macro calls the measuretemp macro to load the current values into the global variables %QUOTE% _ls_setp Usage: _ls_setp(newval) Syntax _ls_setp() Change setpoint value. Function called by the std macro settemp when ontemp is run %QUOTE% _ls_set_curve Usage: _ls_set_curve(channel,type,curv_num) Syntax : _ls_set_curve(channel,type,curvenumber) This function sets both the sensor type and the calibration curve number. It returns LSOK if sucsessful or LSREADERROR if not. The curve number can be in the range 0 - 60. Curve 0 means no calibration curve. The sensor is also enabled after config. %QUOTE% _ls_isbusy Usage: _ls_isbusy() Syntax _ls_isbusy() Function to poll the busy status of the controller. Returns 0 if the instrument is not busy and 1 otherwise. %QUOTE% _ls_read_curve Usage: _ls_read_curve(channel) Syntax : _ls_read_curve(channel) Function to read the calibration curve parameters. Returns the parameters in an array with elements _ls_set_pid Usage: _ls_set_pid(loop,pid) Syntax : _ls_set_pid(loop,pid) Set pid parameters, returns the controller read pid's as an array. %QUOTE% _ls_read_pid Usage: _ls_read_pid(loop,pid) Syntax : _ls_read_pid(loop,pid) Read controller PID values, returns values as an array. %QUOTE% _ls_set_ramprate Usage: _ls_set_ramprate(loop,ramp) Syntax : _ls_set_ramprate(loop,ramp) Sets controllers ramprate, returns controllers ramprate. %QUOTE% _ls_read_ramprate Usage: _ls_read_ramprate(loop) Syntax : _ls_read_ramprate(loop) Reads and returns controllers ramprate. %QUOTE% _ls_set_ramp Usage: _ls_set_ramp(loop,state) Syntax : _ls_set_ramp(loop,state) Switches on or off temperature ramping (off = 0, on = 1) %QUOTE% _ls_read_ramp Usage: _ls_read_ramp(loop) Syntax : _ls_read_ramp(loop) Reads and returns controllers ramp setting (off = 0, on = 1) %QUOTE% _ls_ramp_state Usage: _ls_ramp_state(loop) Syntax : _ls_ramp_state(loop) Reads and returns status of setpoint ramping (ramping = 1, not ramping = 0) %QUOTE% _ls_readsensor_k Usage: _ls_readsensor_k(sensor) Syntax : _ls_readsensor_k(sensor) Reads and returns sensor reading in kelvin. Returns -2 if there is an error condition on the sensor. %QUOTE% _ls_readsensor_o Usage: _ls_readsensor_o(sensor) Syntax : _ls_readsensor_o(sensor) Reads and returns sensor reading in sensor units (ohms or voltage). returns -2 if there is an error with the sensor. %QUOTE% _ls_set_control_state Usage: _ls_set_control_state(loop,state) Syntax : _ls_set_control_state(loop,state) Switch on or off temperature control loop (1 = on, 0 = off). %QUOTE% _ls_set_control Usage: _ls_set_control(loop,ctrlcnl,units,onoff) Syntax : _ls_set_control(loop,controlchannel,units,onoff) Sets control loop parameters units (1 = Kelvin, 2 = Celsius, 3 = sensor units)%BR onoff (1 = on, 0 = off) %QUOTE% _ls_read_control Usage: _ls_read_control(loop) Syntax : _ls_read_control(loop) Read and return control loop parameters as an array %QUOTE% _ls_set_mode Usage: _ls_set_mode(loop,cmode) Syntax : _ls_set_mode(loop,controlmode) Set and return controller control mode
_ls_read_mode Usage: _ls_read_mode(loop) Syntax : _ls_read_mode(loop) Read and return current control mode. %QUOTE% _ls_read_contrast Usage: _ls_read_contrast() Syntax : _ls_read_contrast() Read and return display contrast. %QUOTE% _ls_set_contrast Usage: _ls_set_contrast(contrast) Syntax : _ls_set_contrast(contrast) Set and return display contrast. A contrast of zero switches off the display backlight. Returns value of _ls_read_constrast() %QUOTE% _ls_set_heater Usage: _ls_set_heater(range) Syntax : _ls_set_heater(range) Set and return heater range (0 to 5, 0 = heater off). %QUOTE% _ls_read_heater Usage: _ls_read_heater() Syntax : _ls_read_heater Read and return heater range (0 to 5, 0 = heater off). %QUOTE% _ls_set_infilter Usage: _ls_set_infilter(sensor,onoff,points,window) Syntax : _ls_set_infilter(sensor,onoff,points,window) Set and return input filtering parameters. %QUOTE% _ls_read_infilter Usage: _ls_read_infilter(sensor) Syntax : _ls_read_infilter(sensor) Read and return input filtering parameters. %QUOTE% _ls_set_zone Usage: _ls_set_zone(loop,zonenum,zoneparams) Syntax : _ls_set_setpoint(loop,sp) Set and read setpoint for given control loop. %QUOTE% _ls_read_setpoint Usage: _ls_read_setpoint(loop) Syntax : _ls_read_setpoint(loop) Set and read setpoint for given control loop. %QUOTE% _ls_set_setpoint Usage: _ls_set_setpoint(loop,sp) Syntax : _ls_set_setpoint(loop,sp) Set and read setpoint for given control loop. %QUOTE% _ls_read_zone Usage: _ls_read_zone(loop,zonenum) Syntax : _ls_read_zone(loop,zonenumber) Read and return zone table entry for number zoneentry. %QUOTE% _ls_load Usage: _ls_load(filename,oldname,oldrevision,loop) Syntax : _ls_load(filename,oldsetupname,oldrevision,loop) Configure controller from datafile filename. If config is the same as in oldsetupname and oldrevision then NO config is done. To force a config pass these variables as blank strings. See lsconfig for datafile format. %QUOTE% _ls_set_resistance Usage: _ls_set_resistance(loop,resistance) Syntax : _ls_set_resistance(loop,resistance) Set the resistance value for the heater in the control loop passed to the function. If sucsessful then "LSOK" is returned else "LSREADERROR" is returned. %QUOTE% _ls_sensorstatus Usage: _ls_sensorstatus(sensor) Syntax : _ls_sensorstatus(sensor) Read status of sensor _ls_istuning Usage: _ls_istuning() Syntax : _ls_istuning() Functions returns 1 if the controller is tuning the PID parameters ans 0 if not. %QUOTE% _ls_issettled Usage: _ls_issettled() Syntax : _ls_issettled() Function returns 1 if the controller is in settle condition, 0 otherwise. %QUOTE% _ls_isalarm Usage: _ls_isalarm() Syntax : _ls_isalarm() Returns 1 if the controller is in alarm condition, 0 otherwise. | ||||||
|