Model 240 Input Modules¶
The 240 Series Input Modules employ distributed PLC control for large scale cryogenic temperature monitoring.
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¶
Below are a few example scripts for the Model 335 that use the Lake Shore Python driver.
Model 240 Input Channel Setup Example¶
from lakeshore import Model240
from lakeshore.model_240 import Model240InputParameter, Model240SensorTypes, Model240Units, Model240InputRange
from time import sleep
# Connect to the first available Model 240 over USB
my_model_240 = Model240()
# Define the channel configuration for a sensor with a negative temperature coefficient, autorange disabled
# current reversal disabled, the channel enabled, and set to the 100 kOhm range
rtd_config = Model240InputParameter(Model240SensorTypes.NTC_RTD, False, False, Model240Units.SENSOR, True,
Model240InputRange.RANGE_NTCRTD_100_KIL_OHMS)
# Apply the configuration to all channels
for channel in range(1, 9):
my_model_240.set_input_parameter(channel, rtd_config)
sleep(1)
print("Reading from channel 5: {} ohms".format(my_model_240.get_sensor_reading(5)))
Model 240 Profibus Configuration Example¶
from lakeshore import Model240, Model240Units, Model240ProfiSlot
# Connect to the first available Model 240 over USB
my_model_240 = Model240()
# Print the instrument's current PROFIBUS connection status to the console
print("Profibus connection status: " + my_model_240.get_profibus_connection_status())
# Configure the number of PROFIBUS slots for the instrument to present to the bus as a modular station
# Setting the number of PROFIBUS slots to 2
my_model_240.set_profibus_slot_count(2)
# Create the ProfiSlot class object by specifying which input to associate the
# slot with and what temperature units the data will be presented in
# Setting the input channel as 2 and temperature units to Celsius
my_profibus_slot = Model240ProfiSlot(2, Model240Units.CELSIUS)
# Configure what data to be presented on the given PROFIBUS slot
# Profibus slot 1 will be associated with channel 2
my_model_240.set_profibus_slot_configuration(1, my_profibus_slot)
# Print the PROFIBUS address
# An address of 126 indicates that it is not configured and it can then be set by a PROFIBUS master
print("Profibus adress: " + my_model_240.get_profibus_address())
# Set the desired address as 123
my_model_240.set_profibus_address("123")
# Acquiring settings that were configured above
print(my_model_240.get_profibus_slot_count())
slot_1_config = my_model_240.get_profibus_slot_configuration(1)
print(slot_1_config.slot_channel)
print(slot_1_config.slot_units)
Classes and methods¶
Instrument methods¶
-
class
lakeshore.model_240.
Model240
(serial_number=None, com_port=None, timeout=2.0, **kwargs)¶ A class object representing the Lake Shore Model 240 channel modules
-
get_identification
()¶ Returns instrument’s identification parameters.
- Returns:
- id (list):
- List defining instrument’s manufacturer, model, instrument serial, firmware version
-
set_brightness
(brightness_level)¶ Sets the brightness for the front panel display
- Args:
- brightness_level (Model240BrightnessLevel):
- Display brightness in percent
-
get_brightness
()¶ Returns the brightness level of front panel display
- Return:
- brightness_level (Model240BrightnessLevel):
- Display brightness in percent
-
get_celsius_reading
(channel)¶ Returns the temperature value in Celsius of channel selected.
- Args:
- channel (int):
- Specifies channel (1-8)
-
set_factory_defaults
()¶ Sets all configuration values to factory defaults and resets the instrument
-
get_kelvin_reading
(channel)¶ Returns the temperature value in Kelvin of channel selected.
- Args:
- channel (int):
- Specifies channel (1-8)
-
get_fahrenheit_reading
(channel)¶ Returns the temperature value in Farenheit of channel selected
- Args:
- channel (int):
- Specifies channel (1-8)
-
get_sensor_reading
(input_channel)¶ Returns the sensor reading in the sensor’s units.
- Returns:
- reading (float):
- The raw sensor reading in the units of the connected sensor
-
delete_curve
(curve)¶ Deletes the user curve
- Args:
- curve (int):
- Specifies a user curve to delete
-
set_curve_header
(input_channel, curve_header)¶ Configures the user curve header
- Args:
- input_channel (int):
- Specifies which input_channel curve to configure
- 1 - 8
- curve_header (CurveHeader):
- A CurveHeader class object containing the desired curve information
-
get_curve_header
(curve)¶ Returns parameters set on a particular user curve header
- Args:
- curve:
- Specifies a curve to retrieve
- Returns:
- header (CurveHeader):
- A CurveHeader class object containing the desired curve information
-
set_curve_data_point
(channel, index, units, temp)¶ Configures a user curve point
- Args:
- channel (int):
- Specifies which channel curve to configure (1-8)
- index (int):
- Specifies the points index in the curve (1-200)
- units (float):
- Specifies sensor units for this point to 6 digits
- temp (float):
- Specifies the corresponding temperature in Kelvin for this point to 6 digits
-
get_curve_data_point
(channel, index)¶ Returns a standard or user curve data point
- Args:
- channel (int):
- Specifies channel (1-8)
- index (int):
- Specifies the points index in the curve (1–200)
-
set_filter
(channel, length)¶ Sets the channel filter parameter
- Args:
- channel (int):
- Specifies which channel to configure (1-8)
- length (int):
- Specifies the number of 1 ms points to average for each update (1-100)
-
get_filter
(channel)¶ Returns the filter parameter
- Args:
- channel (int):
- Specifies channel (1-8)
-
set_sensor_name
(channel, name)¶ Names the sensor channel in specified channel.
- Args:
- channel (int):
- Specifies which channel to configure (1-8)
- name (str):
- Specifies the name to associate with the sensor channel
-
get_sensor_name
(channel)¶ Returns the sensor channel’s name.
- Args:
- channel (int):
- Specifies channel (1-8)
-
set_input_parameter
(channel, input_parameter)¶ Sets channel type parameters.
- Args:
- channel (int):
- Specifies which channel to configure (1-8)
- input_parameter (InputParameter):
- See InputParameter class
-
get_input_parameter
(channel)¶ Returns channel type parameter details
- Args:
- channel (int):
- Specifies channel (1-8)
-
set_modname
(name)¶ Names module.
- Args:
- name (str):
- Specifies the name or description to help identify the module
-
get_modname
()¶ Returns module name
- Returns:
- modname (str):
- Specifies name of module
-
set_profibus_slot_count
(count)¶ Configures the number of PROFIBUS slots for the instrument to present to the bus as a modular station
- Args:
- count (int):
- Specifies the number of PROFIBUS slots (1-8)
-
get_profibus_slot_count
()¶ Returns the number of PROFIBUS slots for the instrument present to the bus as a modular station
- Returns:
- slot_count (str):
- Specifies PROFIBUS slot count
-
set_profibus_address
(address)¶ Configures the PROFIBUS address for the module. An address of 126 indicates that it is not configured and it then can be set by a PROFIBUS master.
- Args:
- address (str):
- Specifies the PROFIBUS address (1-126)
-
get_profibus_address
()¶ Returns the PROFIBUS address for the module.
- Returns:
- address (str):
- Specifies PROFIBUS address of module
-
set_profibus_slot_configuration
(slot, profislot_config)¶ Configures what data to present on the given PROFIBUS slot. Note that the correct number of slots must be configured with the PROFINUM command, or the slot may be ignored.
- Args:
- slot (int):
- Specifies the slot to be configured
- profislot_config (Model240ProfiSlot):
- A Model240ProfiSlot class object containing the desired PROFIBUS slot configuration information
-
get_profibus_slot_configuration
(slot_num)¶ Returns the slot configuration of the slot number.
- Returns:
- slot_config (Model240ProfiSlot):
- See Model240ProfiSlot class
-
get_profibus_connection_status
()¶ Returns the connection status of PROFIBUS.
- Returns:
- status (str):
- Specifies connection status of PROFIBUS
-
get_channel_reading_status
(channel)¶ The integer returned represents the sum of the bit weighting of the channel status flag bits. A “000” response indicates a valid reading is present.
- Args:
- channel (int):
- Specifies which channel to query (1-8)
- Returns:
- bit_status (dict):
- Dictionary containing the current status indicator
-
get_sensor_units_channel_reading
(channel)¶ Returns the sensor units value of channel being queried
- Args:
- channel (int):
- Specifies which channel to query (1-8)
-
command
(command_string)¶ Send a command to the instrument
- Args:
- command_string (str):
- A serial command
-
connect_tcp
(ip_address, tcp_port, timeout)¶ Establishes a TCP connection with the instrument on the specified IP address
-
connect_usb
(serial_number=None, com_port=None, baud_rate=None, data_bits=None, stop_bits=None, parity=None, timeout=None, handshaking=None, flow_control=None)¶ Establish a serial USB connection
-
disconnect_tcp
()¶ Disconnect the TCP connection
-
disconnect_usb
()¶ Disconnect the USB connection
-
query
(query_string)¶ Send a query to the instrument and return the response
- Args:
- query_string (str):
- A serial query ending in a question mark
- Returns:
- The instrument query response as a string.
-
Instrument classes¶
This page describes the classes used throughout the 240 methods that interact with instrument settings and other methods that use objects and classes.
-
class
lakeshore.model_240.
Model240CurveHeader
(curve_name, serial_number, curve_data_format, temperature_limit, coefficient)¶ A class that configures the user curve header and corresponding parameters
-
__init__
(curve_name, serial_number, curve_data_format, temperature_limit, coefficient)¶ Constructor for CurveHeader class
- Args:
- curve_name (str):
- Specifies curve name (limit of 15 characters)
- serial_number (str):
- Specifies curve serial number (limit of 10 characters)
- curve_data_format (Model240CurveFormat):
- Specifies the curve data format
- temperature_limit (float):
- Specifies the curve temperature limit in Kelvin
- coefficient (Model240TemperatureCoefficient):
- Specifies the curve temperature coefficient
-
-
class
lakeshore.model_240.
Model240InputParameter
(sensor, auto_range_enable, current_reversal_enable, units, input_enable, input_range=None)¶ Class used to retrieve and set an input channel’s parameters and initial settings.
-
__init__
(sensor, auto_range_enable, current_reversal_enable, units, input_enable, input_range=None)¶ The constructor for InputParameter class.
Args:
- sensor (Model240SensorTypes):
- Specifies the type of sensor configured at the input
- Member of the Model240SensorTypes IntEnum class
- auto_range_enable (bool):
- Specifies if autoranging is enabled
- current_reversal_enable (bool):
- Specifies channel current reversal
- Current reversal is used to remove thermal EMF errors on resistive sensors.
- Always False if channel is a diode
- False = OFF, True = ON
- units (Model240Units):
- Member of the Model240Units IntEnum class
- Specifies the preferred units parameter.
- input_enable (bool):
- Specifies whether the channel is disabled or enabled
- input_range (Model240InputRange):
- Specifies channel range when autorange is off
-
-
class
lakeshore.model_240.
Model240ProfiSlot
(channel, temp_unit)¶ Class used to configure and retrieve data for given PROFIBUS slot.
-
__init__
(channel, temp_unit)¶ The constructor for Model240ProfiSlot class.
- Args:
- channel (int):
- Specifies which slot to configure (1-8)
- temp_unit (Model240Units):
- Member of Model240Units IntEnum class
- Specifies the units to use for the data in this slot
-
Enum classes¶
This page describes the Enum type objects that have been created to represent various settings of the Model 240 series that are inputted 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.
-
class
lakeshore.model_240.
Model240Units
¶ Enumerations that specify temperature units
-
CELSIUS
= 2¶
-
FAHRENHEIT
= 4¶
-
KELVIN
= 1¶
-
SENSOR
= 3¶
-
-
class
lakeshore.model_240.
Model240CurveFormat
¶ Enumerations that specify temperature sensor curve format units
-
LOG_OHMS_PER_KELVIN
= 4¶
-
OHMS_PER_KELVIN
= 3¶
-
VOLTS_PER_KELVIN
= 2¶
-
-
class
lakeshore.model_240.
Model240Coefficients
¶ Enumerations that specify a positive or negative coefficient
-
NEGATIVE
= 1¶
-
POSITIVE
= 2¶
-
-
class
lakeshore.model_240.
Model240SensorTypes
¶ Enumerations specify types of temperature sensors
-
DIODE
= 1¶
-
NTC_RTD
= 3¶
-
PLATINUM_RTD
= 2¶
-
-
class
lakeshore.model_240.
Model240BrightnessLevel
¶ Enumerations for the screen brightness levels
-
HIGH
= 100¶
-
LOW
= 25¶
-
MED_HIGH
= 75¶
-
MED_LOW
= 50¶
-
OFF
= 0¶
-
-
class
lakeshore.model_240.
Model240TemperatureCoefficient
¶ Enumerations specify positive/negative temperature sensor curve coefficients
-
NEGATIVE
= 1¶
-
POSITIVE
= 2¶
-
-
class
lakeshore.model_240.
Model240InputRange
¶ Enumerations to specify the input range when autorange is off
-
RANGE_DIODE
= 0¶
-
RANGE_NTCRTD_100_KIL_OHMS
= 8¶
-
RANGE_NTCRTD_100_OHMS
= 2¶
-
RANGE_NTCRTD_10_KIL_OHMS
= 6¶
-
RANGE_NTCRTD_10_OHMS
= 0¶
-
RANGE_NTCRTD_1_KIL_OHMS
= 4¶
-
RANGE_NTCRTD_30_KIL_OHMS
= 7¶
-
RANGE_NTCRTD_30_OHMS
= 1¶
-
RANGE_NTCRTD_3_KIL_OHMS
= 5¶
-
RANGE_PTRTD_1_KIL_OHMS
= 0¶
-