Skip to content

Commit

Permalink
Merge pull request #27 from dstr951/add-ldd-1321
Browse files Browse the repository at this point in the history
Add ldd 1321
  • Loading branch information
timhellwig authored Feb 12, 2024
2 parents 7d3af20 + a69fd19 commit f6c005c
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 5 deletions.
56 changes: 56 additions & 0 deletions mecom/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,62 @@
{"id": 52102, "name": "Set Output States", "format": "INT32"},
{"id": 52103, "name": "Read Input States", "format": "INT32"},
]


#only common product parameters and monitor tab.
#full list can be found the ldd-1321 protocol at: https://www.meerstetter.ch/customer-center/downloads/category/35-latest-communication-protocols
LDD_1321_PARAMETERS = [
#Communication Device Address
{"id": 2051, "name": "Device Address", "format": "INT32"},
#Device Identification
{"id": 100, "name": "Device Type", "format": "INT32"},
{"id": 101, "name": "Hardware Version", "format": "INT32"},
{"id": 103, "name": "Firmware Version", "format": "INT32"},
{"id": 104, "name": "Device Status", "format": "INT32"},
{"id": 105, "name": "Error Number", "format": "INT32"},
{"id": 106, "name": "Error Instance", "format": "INT32"},
{"id": 107, "name": "Error Parameter", "format": "INT32"},
#Flash
{"id": 108, "name": "Save Data to Flash", "format": "INT32"},
{"id": 109, "name": "Flash Status", "format": "INT32"},
#LDD Output Monitoring
{"id": 1100, "name": "Actual Output Current", "format": "FLOAT32"},
{"id": 1101, "name": "Actual Output Voltage", "format": "FLOAT32"},
{"id": 1102, "name": "Actual Output Current Raw ADC Value", "format": "FLOAT32"},
{"id": 1104, "name": "Actual Anode Voltage", "format": "FLOAT32"},
{"id": 1105, "name": "Actual Cathode Voltage", "format": "FLOAT32"},
{"id": 1106, "name": "Nominal Anode Voltage", "format": "FLOAT32"},
#LDD Internal Parameters
{"id": 1402, "name": "Nominal Output Current (Ramp)", "format": "FLOAT32"},
{"id": 1404, "name": "Gate Voltage", "format": "FLOAT32"},
{"id": 1103, "name": "Raw DAC Value", "format": "INT32"},
#External Temperature Measurement x
{"id": 1200, "name": "Temperature", "format": "FLOAT32"},
{"id": 1201, "name": "Resistance", "format": "FLOAT32"},
{"id": 1202, "name": "Raw ADC Value", "format": "FLOAT32"},
#Analog Interfaces
{"id": 1502, "name": "Analog Voltage Input Raw ADC Value", "format": "INT32"},
{"id": 1500, "name": "Analog Voltage Input", "format": "FLOAT32"},
{"id": 1501, "name": "Photodiode Input", "format": "FLOAT32"},
#Light Measurement
{"id": 1600, "name": "Laser Power", "format": "FLOAT32"},
#Fan Controller x
{"id": 1210, "name": "Relative Cooling Power", "format": "FLOAT32"},
{"id": 1212, "name": "Actual Fan Speed", "format": "FLOAT32"},
{"id": 1211, "name": "Fan Nominal Speed", "format": "FLOAT32"},
{"id": 1213, "name": "Actual Fan PWM Level", "format": "FLOAT32"},
#Firmware and Hardware Versions
{"id": 1051, "name": "Firmware Build Number", "format": "INT32"},
{"id": 1054, "name": "Min Version for Firmware Downgrade", "format": "INT32"},
#Power Supplies and Temperature
{"id": 1060, "name": "Driver Input Voltage", "format": "FLOAT32"},
{"id": 1061, "name": "8V Internal Supply", "format": "FLOAT32"},
{"id": 1062, "name": "5V Internal Supply", "format": "FLOAT32"},
{"id": 1063, "name": "3.3V Internal Supply", "format": "FLOAT32"},
{"id": 1064, "name": "-3.3V Internal Supply", "format": "FLOAT32"},
{"id": 1065, "name": "Device Temperature", "format": "FLOAT32"},
{"id": 1066, "name": "Powerstage Temperature", "format": "FLOAT32"},
]

ERRORS = [
{"code": 1, "symbol": "EER_CMD_NOT_AVAILABLE", "description": "Command not available"},
Expand Down
13 changes: 8 additions & 5 deletions mecom/mecom.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

# from this package
from .exceptions import ResponseException, WrongResponseSequence, WrongChecksum, ResponseTimeout, UnknownParameter, UnknownMeComType
from .commands import TEC_PARAMETERS, LDD_PARAMETERS, ERRORS
from .commands import TEC_PARAMETERS, LDD_PARAMETERS, LDD_1321_PARAMETERS, ERRORS


class Parameter(object):
Expand Down Expand Up @@ -58,7 +58,7 @@ def as_list(self):
class ParameterList(object):
"""
Contains a list of Parameter() for either TEC (metype = 'TEC')
or LDD (metype = 'TEC') controller.
,LDD (metype = 'LDD') controller or LDD-1321 (metype = 'LDD-1321') controller.
Provides searching via id or name.
:param error_dict: dict
"""
Expand All @@ -74,6 +74,9 @@ def __init__(self,metype='TEC'):
elif metype =='LDD':
for parameter in LDD_PARAMETERS:
self._PARAMETERS.append(Parameter(parameter))
elif metype =='LDD-1321':
for parameter in LDD_1321_PARAMETERS:
self._PARAMETERS.append(Parameter(parameter))
else:
raise UnknownMeComType

Expand Down Expand Up @@ -508,7 +511,7 @@ def __init__(self, metype='TEC'):
Initialize communication with serial port.
:param serialport: str
:param timeout: int
:param metype: str: either 'TEC' or 'LDD'
:param metype: str: either 'TEC', 'LDD' or 'LDD-1321'
"""
self.lock = Lock()

Expand Down Expand Up @@ -796,7 +799,7 @@ def __init__(self, ipaddress, ipport=50000, metype='TEC'):
:param ipaddress: str
: :param ipport: int
:param timeout: int
:param metype: str: either 'TEC' or 'LDD'
:param metype: str: either 'TEC', 'LDD' or 'LDD-1321'
"""
# initialize network connection
self.tcp = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
Expand Down Expand Up @@ -877,7 +880,7 @@ def __init__(self, serialport="/dev/ttyUSB0", timeout=1, baudrate=57600, metype=
Initialize communication with serial port.
:param serialport: str
:param timeout: int
:param metype: str: either 'TEC' or 'LDD'
:param metype: str: either 'TEC', 'LDD' or 'LDD-1321'
"""
# initialize serial connection
self.ser = Serial(port=serialport, timeout=timeout, write_timeout=timeout, baudrate=baudrate)
Expand Down

0 comments on commit f6c005c

Please sign in to comment.