Mettler Toledo
MTSICS MT Standard Interface Communication Software
- class instruments.mettler_toledo.MTSICS(filelike, *args, **kwargs)[source]
Instrument class to communicate with Mettler Toledo balances using the MT-SICS Standared Interface Command Set.
Example usage:
>>> import instruments as ik >>> inst = ik.mettler_toledo.MTSICS.open_serial('/dev/ttyUSB0', 9600) >>> inst.weight <Quantity(120.2, 'gram')>
- class WeightMode(*values)[source]
Enum class to select the weight mode.
- immediately = True
- stable = False
- clear_tare()[source]
Clear the tare value.
Example usage:
>>> import instruments as ik >>> inst = ik.mettler_toledo.MTSICS.open_serial('/dev/ttyUSB0', 9600) >>> inst.clear_tare()
- query(cmd, size=-1)[source]
Query the instrument for a response.
Error checking is performed on the response.
- Parameters:
cmd (str) – The command to send to the instrument.
size (int) – Number of bytes to read from the instrument.
- Returns:
The response from the instrument.
- Return type:
str
- Raises:
UserWarning if the balance is in dynamic mode.
- reset()[source]
Reset the balance.
Example usage:
>>> import instruments as ik >>> inst = ik.mettler_toledo.MTSICS.open_serial('/dev/ttyUSB0', 9600) >>> inst.reset()
- tare(immediately=None)[source]
Tare the balance.
The mode is dependent on the weight mode, however, can be overwritten with the keyword
immediately.- Parameters:
immediately (bool) – Tare immediately if True, otherwise wait for stable weight.
Example usage:
>>> import instruments as ik >>> inst = ik.mettler_toledo.MTSICS.open_serial('/dev/ttyUSB0', 9600) >>> inst.tare()
- zero(immediately=None)[source]
Zero the balance after stable weight is obtained.
Terminates processes such as zero, tare, calibration and testing etc. If the device is in standby mode, it is turned on. This function sets the currently read and the tare value to zero.
The mode is dependent on the weight mode, however, can be overwritten with the keyword
immediately.- Parameters:
immediately (bool) – Zero immediately if True, otherwise wait for stable weight.
Example usage:
>>> import instruments as ik >>> inst = ik.mettler_toledo.MTSICS.open_serial('/dev/ttyUSB0', 9600) >>> inst.zero()
- property mt_sics
Get MT-SICS level and MT-SICS versions.
- Returns:
Level, Version Level 0, Version Level 1, Version Level 2, Version Level 3
Example usage:
>>> import instruments as ik >>> inst = ik.mettler_toledo.MTSICS.open_serial('/dev/ttyUSB0', 9600) >>> inst.mt_sics ['1', '1.0', '1.0', '1.0']
- property mt_sics_commands
Get MT-SICS commands.
Please refer to manual for information on the commands. Not all of these commands are currently implemented in this class!
- Returns:
List of all implemented MT-SICS levels and commands
- Return type:
list
Example usage:
>>> import instruments as ik >>> inst = ik.mettler_toledo.MTSICS.open_serial('/dev/ttyUSB0', 9600) >>> in inst.mt_sics_commands [["0", "I0"], ["1", "D"]]
- property name
Get / Set balance name.
A maximum of 20 characters can be entered.
- Raises:
ValueError – If name is longer than 20 characters.
Example usage:
>>> import instruments as ik >>> inst = ik.mettler_toledo.MTSICS.open_serial('/dev/ttyUSB0', 9600) >>> inst.name = "My Balance" >>> inst.name 'My Balance'
- property serial_number
Get the serial number of the balance.
- Returns:
The serial number of the balance.
- Return type:
str
Example usage:
>>> import instruments as ik >>> inst = ik.mettler_toledo.MTSICS.open_serial('/dev/ttyUSB0', 9600) >>> inst.serial_number '123456789'
- property tare_value
Get / set the tare value.
If no unit is given, grams are assumed.
Example usage:
>>> import instruments as ik >>> inst = ik.mettler_toledo.MTSICS.open_serial('/dev/ttyUSB0', 9600) >>> inst.tare_value = 1.0 >>> inst.tare_value <Quantity(1.0, 'gram')>
- property weight
Get the weight.
If you want to get the immediate (maybe unstable) weight, plese set the weight mode accordingly.
- Returns:
Weight
- Return type:
u.Quantity
Example usage:
>>> import instruments as ik >>> inst = ik.mettler_toledo.MTSICS.open_serial('/dev/ttyUSB0', 9600) >>> inst.weight <Quantity(1.0, 'gram')>
- property weight_mode
Get/set the weight mode.
By default, it starts in
MTSICS.WeightMode.stable.- Returns:
Weight mode
- Return type:
- Raises:
TypeError – Weight mode is not of type
MTSICS.WeightMode
Example usage:
>>> import instruments as ik >>> inst = ik.mettler_toledo.MTSICS.open_serial('/dev/ttyUSB0', 9600) >>> inst.weight_mode = inst.WeightMode.immediately >>> inst.weight_mode <Weight.immediately>