iCalculate's Studio.

LakeShore Model 335 Python控制脚本

Word count: 1.4kReading time: 8 min
2023/03/18 Share

Model 335 Cryogenic Temperature Controller

The Model 335 measures and controls cryogenic temperature environments.

More information about the instrument can be found on our website including the manual which has a list of all commands and queries.

Example Scripts

Setting a temperature curve

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import matplotlib.pyplot as plt
from lakeshore import Model224
from lakeshore.model_224 import Model224CurveHeader, Model224CurveFormat, Model224CurveTemperatureCoefficients, \
Model224SoftCalSensorTypes

# Connect to a temperature instrument (the Model 224 in this case) over USB
myinstrument = Model224()

# Configure a curve by first setting its header parameters. First, set the name and serial number of the curve.
# Then, select the units used to set map the sensor units to temperature units. Set a temperature limit, and
# then specify whether the coefficients are positive or negative.
curve_header_25 = Model224CurveHeader("My_Curve", "ABC123", Model224CurveFormat.VOLTS_PER_KELVIN, 300.0,
Model224CurveTemperatureCoefficients.POSITIVE)
myinstrument.set_curve_header(25, curve_header_25)

# Edit individual data points of the curve. In this case, a sensor value of 1.23 is set to equal a Kelvin value of
# 276.0
myinstrument.set_curve_data_point(25, 1, 1.23, 276.0)

# You can create a softcal curve by inputting 1-3 calibration sensor/temperature points. The instrument generates
# a new curve using your entered data points and the selected standard curve
myinstrument.generate_and_apply_soft_cal_curve(Model224SoftCalSensorTypes.DT_400, 30, "SN123", (276, 10),
(300, 5), (310, 2))

# Use the get_curve method to get all the data points for a curve as a list. This can then be used to create a plot
# of the calibration curve.
data_points_list = myinstrument.get_curve(30)
x_list = [item[0] for item in data_points_list]
y_list = [item[1] for item in data_points_list]
plt.plot(x_list, y_list)

# Finally, a curve can be deleted if you would like to reset the data points for that curve. Only user curves
# can be deleted.
myinstrument.delete_curve(25)

Recording data with the Model 335

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from lakeshore.model_335 import *

# Connect to the first available Model 335 temperature controller over USB using a baud rate of 57600
my_model_335 = Model335(57600)

# Create a new instance of the input sensor settings class
sensor_settings = Model335InputSensorSettings(Model335InputSensorType.DIODE, True, False,
Model335InputSensorUnits.KELVIN,
Model335DiodeRange.TWO_POINT_FIVE_VOLTS)

# Apply these settings to input A of the instrument
my_model_335.set_input_sensor("A", sensor_settings)

# Set diode excitation current on channel A to 10uA
my_model_335.set_diode_excitation_current("A", Model335DiodeCurrent.TEN_MICROAMPS)

# Collect instrument data
heater_output_1 = my_model_335.get_heater_output(1)
heater_output_2 = my_model_335.get_heater_output(2)
temperature_reading = my_model_335.get_all_kelvin_reading()

# Open a csv file to write
file = open("335_record_data.csv", "w")

# Write the data to the file
file.write("Data retrieved from the Lake Shore Model 335\n")
file.write("Temperature Reading A: " + str(temperature_reading[0]) + "\n")
file.write("Temperature Reading B: " + str(temperature_reading[1]) + "\n")
file.write("Heater Output 1: " + str(heater_output_1) + "\n")
file.write("Heater Output 2: " + str(heater_output_2) + "\n")
file.close()

Setting up autotune on the Model 335

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
from lakeshore import Model335
from lakeshore.model_335 import Model335DisplaySetup, Model335HeaterResistance, \
Model335HeaterOutputDisplay, Model335HeaterRange, Model335AutoTuneMode, Model335HeaterError
from time import sleep

# Connect to the first available Model 335 temperature controller over USB using a baud rate of 57600
my_model_335 = Model335(57600)

# It is assumed that the instrument is configured properly with a control input sensor curve
# and heater output, capable of closed loop control

# Configure the display mode
my_model_335.set_display_setup(Model335DisplaySetup.TWO_INPUT_A)

# Configure heater output 1 using the HeaterSetup class and set_heater_setup method
my_model_335.set_heater_setup_one(Model335HeaterResistance.HEATER_50_OHM, 1.0, Model335HeaterOutputDisplay.POWER)

# Configure heater output 1 to a setpoint of 310 kelvin (units correspond to the configured output units)
set_point = 325
my_model_335.set_control_setpoint(1, set_point)

# Turn on the heater by setting the range
my_model_335.set_heater_range(1, Model335HeaterRange.HIGH)

# Check to see if there are any heater related errors
heater_error = my_model_335.get_heater_status(1)
if heater_error is not Model335HeaterError.NO_ERROR:
raise Exception(heater_error.name)

# Allow the heater some time to turn on and start maintaining a setpoint
sleep(10)

# Ensure that the temperature is within 5 degrees kelvin of the setpoint
kelvin_reading = my_model_335.get_kelvin_reading(1)
if (kelvin_reading < (set_point - 5)) or (kelvin_reading > (set_point + 5)):
raise Exception("Temperature reading is not within 5k of the setpoint")

# Initiate autotune in PI mode, initial conditions will not be met if the system is not
# maintaining a temperature within 5 K of the setpoint
my_model_335.set_autotune(1, Model335AutoTuneMode.P_I)

# Poll the instrument until the autotune process completes
autotune_status = my_model_335.get_tuning_control_status()
while autotune_status["active_tuning_enable"] and not autotune_status["tuning_error"]:
autotune_status = my_model_335.get_tuning_control_status()
# Print the status to the console every 5 seconds
print("Active tuning: " + str(autotune_status["active_tuning_enable"]))
print("Stage status: " + str(autotune_status["stage_status"]) + "/10")
sleep(5)

if autotune_status["tuning_error"]:
raise Exception("An error occurred while running autotune")

Enumeration objects

This section describes the Enum type objects that have been created to name various settings of the Model 335 series that are represented as an int or single character to the instrument. The purpose of these enum types is to make the settings more descriptive and obvious to the user rather than interpreting the ints taken by the instrument.

  • lakeshore.model_335.``Model335RelayControlMode

    alias of lakeshore.temperature_controllers.RelayControlMode

  • classlakeshore.temperature_controllers.``RelayControlMode

    Relay operating mode enumerationALARMS= 2RELAY_OFF= 0RELAY_ON= 1

  • lakeshore.model_335.``Model335RelayControlAlarm

    alias of lakeshore.temperature_controllers.RelayControlAlarm

  • classlakeshore.temperature_controllers.``RelayControlAlarm

    Enumeration of the setting determining which alarm(s) cause a relay to close in alarm mode.BOTH_ALARMS= 2HIGH_ALARM= 1LOW_ALARM= 0

  • lakeshore.model_335.``Model335InterfaceMode

    alias of lakeshore.temperature_controllers.InterfaceMode

  • classlakeshore.temperature_controllers.``InterfaceMode

    Enumeration for the mode of the remote interfaceLOCAL= 0REMOTE= 1REMOTE_LOCAL_LOCK= 2

  • lakeshore.model_335.``Model335HeaterError

    alias of lakeshore.temperature_controllers.HeaterError

  • classlakeshore.temperature_controllers.``HeaterError

    Enumeration for possible errors flagged by the heaterHEATER_OPEN_LOAD= 1HEATER_SHORT= 2NO_ERROR= 0

  • lakeshore.model_335.``Model335CurveFormat

    alias of lakeshore.temperature_controllers.CurveFormat

  • classlakeshore.temperature_controllers.``CurveFormat

    Enumerations specify formats for temperature sensor curvesLOG_OHMS_PER_KELVIN= 4MILLIVOLT_PER_KELVIN= 1OHMS_PER_KELVIN= 3VOLTS_PER_KELVIN= 2

  • lakeshore.model_335.``Model335CurveTemperatureCoefficient

    alias of lakeshore.temperature_controllers.CurveTemperatureCoefficient

  • classlakeshore.temperature_controllers.``CurveTemperatureCoefficient

    Enumerations specify positive/negative temperature sensor curve coefficientsNEGATIVE= 1POSITIVE= 2

  • lakeshore.model_335.``Model335AutoTuneMode

    alias of lakeshore.temperature_controllers.AutotuneMode

  • classlakeshore.temperature_controllers.``AutotuneMode

    Enumerator used to represent the different autotune control modesP_I= 1P_I_D= 2P_ONLY= 0

  • lakeshore.model_335.``Model335HeaterResistance

    alias of lakeshore.temperature_controllers.HeaterResistance

  • classlakeshore.temperature_controllers.``HeaterResistance

    Enumerator used to represent the different heater resistancesHEATER_25_OHM= 1HEATER_50_OHM= 2

  • lakeshore.model_335.``Model335HeaterOutputUnits

    alias of lakeshore.temperature_controllers.HeaterOutputUnits

  • classlakeshore.temperature_controllers.``HeaterOutputUnits

    Enumerator used to represent heater output unit settingsCURRENT= 1POWER= 2

  • classlakeshore.model_335.``Model335InputSensor

    Enumeration when “NONE” is an option for sensor inputCHANNEL_A= 1CHANNEL_B= 2NONE= 0

  • classlakeshore.model_335.``Model335MonitorOutUnits

    Units associated with a sensor channelCELSIUS= 2KELVIN= 1SENSOR= 3

  • lakeshore.model_335.``Model335Polarity

    alias of lakeshore.temperature_controllers.Polarity

  • classlakeshore.temperature_controllers.``Polarity

    Enumerator for unipolar or bipolar output operationBIPOLAR= 1UNIPOLAR= 0

  • classlakeshore.model_335.``Model335InputSensorType

    Sensor type enumerationDIODE= 1DISABLED= 0NTC_RTD= 3PLATINUM_RTD= 2THERMOCOUPLE= 4

  • lakeshore.model_335.``Model335InputSensorUnits

    alias of lakeshore.temperature_controllers.InputSensorUnits

  • classlakeshore.temperature_controllers.``InputSensorUnits

    Enumerator used to represent temperature sensor unit optionsCELSIUS= 2KELVIN= 1SENSOR= 3

  • classlakeshore.model_335.``Model335DiodeRange

    Diode voltage range enumerationTEN_VOLTS= 1TWO_POINT_FIVE_VOLTS= 0

  • classlakeshore.model_335.``Model335RTDRange

    RTD resistance range enumerationHUNDRED_OHM= 2ONE_HUNDRED_THOUSAND_OHM= 8ONE_THOUSAND_OHM= 4TEN_OHM= 0TEN_THOUSAND_OHM= 6THIRTY_OHM= 1THIRTY_THOUSAND_OHM= 7THREE_HUNDRED_OHM= 3THREE_THOUSAND_OHM= 5

  • classlakeshore.model_335.``Model335ThermocoupleRange

    Thermocouple range enumerationFIFTY_MILLIVOLT= 0

  • lakeshore.model_335.``Model335BrightnessLevel

    alias of lakeshore.temperature_controllers.BrightnessLevel

  • classlakeshore.temperature_controllers.``BrightnessLevel

    Enumerator to specify the brightness level of an instrument displayFULL= 3HALF= 1QUARTER= 0THREE_QUARTERS= 2

  • classlakeshore.model_335.``Model335HeaterOutType

    Heater output 2 enumerationCURRENT= 0VOLTAGE= 1

  • classlakeshore.model_335.``Model335HeaterOutputDisplay

    Heater output display units enumerationCURRENT= 1POWER= 2

  • classlakeshore.model_335.``Model335HeaterOutputMode

    Control loop enumerationCLOSED_LOOP= 1MONITOR_OUT= 4OFF= 0OPEN_LOOP= 3WARMUP_SUPPLY= 5ZONE= 2

  • classlakeshore.model_335.``Model335WarmupControl

    Heater output 2 voltage mode warmup enumerationsAUTO_OFF= 0CONTINUOUS= 1

  • classlakeshore.model_335.``Model335HeaterRange

    Control loop heater range enumerationHIGH= 3LOW= 1MEDIUM= 2OFF= 0

  • lakeshore.model_335.``Model335ControlTypes

    alias of lakeshore.temperature_controllers.ControlTypes

  • classlakeshore.temperature_controllers.``ControlTypes

    Enumerator used to represent the control type settingsAUTO_OFF= 0CONTINUOUS= 1

  • lakeshore.model_335.``Model335DiodeCurrent

    alias of lakeshore.temperature_controllers.DiodeCurrent

  • classlakeshore.temperature_controllers.``DiodeCurrent

    Enumerator used to represent diode current rangesONE_MILLIAMP= 1TEN_MICROAMPS= 0

  • classlakeshore.model_335.``Model335DisplaySetup

    Panel display setup enumerationCUSTOM= 6INPUT_A= 0INPUT_A_MAX_MIN= 1INPUT_B= 3INPUT_B_MAX_MIN= 4TWO_INPUT_A= 2TWO_INPUT_B= 5TWO_LOOP= 7

  • classlakeshore.model_335.``Model335HeaterVoltageRange

    Voltage mode heater enumerationsVOLTAGE_OFF= 0VOLTAGE_ON= 1

  • classlakeshore.model_335.``Model335DisplayInputChannel

    Panel display information enumerationINPUT_A= 1INPUT_B= 2NONE= 0OUTPUT_1= 5OUTPUT_2= 6SETPOINT_1= 3SETPOINT_2= 4

  • classlakeshore.model_335.``Model335DisplayFieldUnits

    Panel display units enumerationCELSIUS= 2KELVIN= 1MAXIMUM_DATA= 5MINIMUM_DATA= 4SENSOR_NAME= 6SENSOR_UNITS= 3

Status register classes

This section describes the register objects. Each bit in the register is represented as a member of the register’s class

  • classlakeshore.model_335.``Model335StatusByteRegister(message_available_summary_bit, event_status_summary_bit, service_request, operation_summary_bit)

    Class object representing the status byte register LSB to MSB

  • classlakeshore.model_335.``Model335ServiceRequestEnable(message_available_summary_bit, event_status_summary_bit, operation_summary_bit)

    Class object representing the service request enable register LSB to MSB

  • lakeshore.model_335.``Model335StandardEventRegister

    alias of lakeshore.temperature_controllers.StandardEventRegister

  • classlakeshore.temperature_controllers.``StandardEventRegister(operation_complete, query_error, execution_error, command_error, power_on)

    Class object representing the standard event register

  • lakeshore.model_335.``Model335OperationEvent

    alias of lakeshore.temperature_controllers.OperationEvent

  • classlakeshore.temperature_controllers.``OperationEvent(alarm, sensor_overload, loop_2_ramp_done, loop_1_ramp_done, new_sensor_reading, autotune_process_completed, calibration_error, processor_communication_error)

    Class object representing the status byte register LSB to MSB

  • classlakeshore.model_335.``Model335InputReadingStatus(invalid_reading, temp_underrange, temp_overrange, sensor_units_zero, sensor_units_overrange)

    Class object representing the input status flag bits

CATALOG
  1. 1. Model 335 Cryogenic Temperature Controller
    1. 1.1. Example Scripts
      1. 1.1.1. Setting a temperature curve
      2. 1.1.2. Recording data with the Model 335
      3. 1.1.3. Setting up autotune on the Model 335
    2. 1.2. Enumeration objects
    3. 1.3. Status register classes