Skip to content

OL 16A, 65A, 83A¤

OLxxA (MultiMessageBased) ¤

OLxxA(equipment: Equipment)

              flowchart LR
              msl.equipment_resources.optronic_labs.olxxa.OLxxA[OLxxA]
              msl.equipment_resources.multi_message_based.MultiMessageBased[MultiMessageBased]
              msl.equipment.interfaces.message_based.MessageBased[MessageBased]
              msl.equipment.schema.Interface[Interface]

                              msl.equipment_resources.multi_message_based.MultiMessageBased --> msl.equipment_resources.optronic_labs.olxxa.OLxxA
                                msl.equipment.interfaces.message_based.MessageBased --> msl.equipment_resources.multi_message_based.MultiMessageBased
                                msl.equipment.schema.Interface --> msl.equipment.interfaces.message_based.MessageBased
                




              click msl.equipment_resources.optronic_labs.olxxa.OLxxA href "" "msl.equipment_resources.optronic_labs.olxxa.OLxxA"
              click msl.equipment_resources.multi_message_based.MultiMessageBased href "" "msl.equipment_resources.multi_message_based.MultiMessageBased"
              click msl.equipment.interfaces.message_based.MessageBased href "" "msl.equipment.interfaces.message_based.MessageBased"
              click msl.equipment.schema.Interface href "" "msl.equipment.schema.Interface"
            

Communicate with a DC current source from Optronic Laboratories.

Regular-expression patterns that are used to select this Resource when connect() is called.

manufacturer=r"Optronic"
model=r"(OL)?\s*(16|65|83)A"
flags=IGNORECASE

Warning

The connection interface must be selected (using the buttons on the front panel) to be either RS-232 or IEEE-488 after the Current Source is initially powered on. Even if this is the default power-on interface, it must be manually re-selected before communication will work.

Parameters:

Name Type Description Default
equipment Equipment

An Equipment instance.

required

A Connection instance supports the following properties for an Optronic Current Source, as well as the properties for Serial if using RS-232 as the interface or GPIB if using IEEE-488 as the interface.

Connection Properties:

Name Type Description
address int

Internal address of the device (RS-232 only). Default: 1

delay float

Number of seconds to wait between a write-read transaction (RS-232 only). Default: 0.1

use_ack_nak bool

Whether to force ACK/NAK for checksum verification. The default value depends on the type of interface that is used. It is True if the interface is detected as serial and False otherwise.

Source code in packages/resources/src/msl/equipment_resources/optronic_labs/olxxa.py
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
def __init__(self, equipment: Equipment) -> None:
    r"""Communicate with a DC current source from Optronic Laboratories.

    Regular-expression patterns that are used to select this Resource when
    [connect()][msl.equipment.schema.Equipment.connect] is called.
    ```python
    manufacturer=r"Optronic"
    model=r"(OL)?\s*(16|65|83)A"
    flags=IGNORECASE
    ```

    !!! warning
        The connection interface must be selected (using the buttons on the
        front panel) to be either RS-232 or IEEE-488 after the Current Source
        is initially powered on. Even if this is the default power-on interface,
        it must be manually re-selected before communication will work.

    Args:
        equipment: An [Equipment][] instance.

    A [Connection][msl.equipment.schema.Connection] instance supports the following
    _properties_ for an Optronic Current Source, as well as the _properties_ for
    [Serial][msl.equipment.interfaces.serial.Serial] if using RS-232 as the interface
    or [GPIB][msl.equipment.interfaces.gpib.GPIB] if using IEEE-488 as the interface.

    Attributes: Connection Properties:
        address (int): Internal address of the device (RS-232 only). _Default: `1`_
        delay (float): Number of seconds to wait between a write-read transaction (RS-232 only). _Default: `0.1`_
        use_ack_nak (bool): Whether to force ACK/NAK for checksum verification. The default value
            depends on the type of interface that is used. It is `True` if the interface is
            detected as serial and `False` otherwise.
    """
    super().__init__(equipment)

    self._system_status_byte: int = 0
    self._options: tuple[int, ...] = (40, 50, 60, 70, 80, 90, 95)
    self._str_options: tuple[int, ...] = (60, 90, 95)

    assert equipment.connection is not None  # noqa: S101
    p = equipment.connection.properties
    self._address: int = int(p.get("address", 1))
    self._delay: float = float(p.get("delay", 0.1))
    self._use_ack_nak: bool = p.get("use_ack_nak", hasattr(self._interface, "serial"))

    if self._use_ack_nak:
        self.read_termination = struct.pack("B", ETX)  # pyright: ignore[reportUnannotatedClassAttribute]
        self.write_termination = None  # pyright: ignore[reportUnannotatedClassAttribute]

system_status_byte property ¤

system_status_byte: int

The system status byte that is returned in every reply.

It is constructed as follows:

  • bit 7: Busy flag (the device is performing a function)
  • bit 6: Reserved
  • bit 5: Reserved
  • bit 4: Lamp status (0=off, 1=on)
  • bit 3: Reserved
  • bit 2: Reserved
  • bit 1: Seeking current (1=current is ramping)
  • bit 0: Reserved

get_current ¤

get_current() -> float

Get the output current.

Source code in packages/resources/src/msl/equipment_resources/optronic_labs/olxxa.py
188
189
190
191
192
def get_current(self) -> float:
    """Get the output current."""
    self._send(b"c")
    reply = self._receive(b"c")
    return float(reply[0])

get_option ¤

get_option(lamp: int, option: Literal[40, 50, 70, 80]) -> float
get_option(lamp: int, option: Literal[60, 90, 95]) -> str
get_option(
    lamp: int, option: Literal[40, 50, 60, 70, 80, 90, 95]
) -> str | float

Get the value of a lamp configuration option.

Parameters:

Name Type Description Default
lamp int

The lamp number (between 0 and 9, inclusive).

required
option Literal[40, 50, 60, 70, 80, 90, 95]

The option type to read. Must be one of the following values

  • 40: Lamp Hours
  • 50: Recalibration interval (hours)
  • 60: Target units → "A", "V" or "W"
  • 70: Target value
  • 80: Current limit
  • 90: Lamp description text
  • 95: Wattage → "L" or "H"
required

Returns:

Type Description
str | float

The value of the option that was requested. The return type depends on the option value.

Source code in packages/resources/src/msl/equipment_resources/optronic_labs/olxxa.py
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
def get_option(self, lamp: int, option: Literal[40, 50, 60, 70, 80, 90, 95]) -> str | float:
    """Get the value of a lamp configuration option.

    Args:
        lamp: The lamp number (between 0 and 9, inclusive).
        option: The option type to read. Must be one of the following values

            * `40`: Lamp Hours
            * `50`: Recalibration interval (hours)
            * `60`: Target units → `"A"`, `"V"` or `"W"`
            * `70`: Target value
            * `80`: Current limit
            * `90`: Lamp description text
            * `95`: Wattage → `"L"` or `"H"`

    Returns:
        The value of the `option` that was requested. The return type depends on the `option` value.
    """
    self._check_lamp_number(lamp)

    if option not in self._options:
        msg = f"Invalid option value {option}"
        raise ValueError(msg)

    msg = f"Y {lamp:.0f} {option:.0f}"
    self._send(msg.encode("ascii"))
    reply = self._receive(b"Y")

    if len(reply) == 3:  # noqa: PLR2004
        num, dt, dv = reply
    else:
        num, dt = reply[:2]
        dv = b"".join(reply[2:])

    n = int(num)
    if n != lamp:
        msg = f"Lamp number mismatch, {n} != {lamp}"
        raise MSLConnectionError(self, msg)

    t = int(dt)
    if t != option:
        msg = f"Data type mismatch, {t} != {option}"
        raise MSLConnectionError(self, msg)

    if t in self._str_options:
        return dv.decode("ascii").strip("|")
    return float(dv)

get_voltage ¤

get_voltage() -> float

Get the output voltage.

Source code in packages/resources/src/msl/equipment_resources/optronic_labs/olxxa.py
248
249
250
251
252
def get_voltage(self) -> float:
    """Get the output voltage."""
    self._send(b"v")
    reply = self._receive(b"v")
    return float(reply[0])

get_wattage ¤

get_wattage() -> float

Get the output wattage.

Source code in packages/resources/src/msl/equipment_resources/optronic_labs/olxxa.py
254
255
256
257
258
def get_wattage(self) -> float:
    """Get the output wattage."""
    self._send(b"w")
    reply = self._receive(b"w")
    return float(reply[0])

reset ¤

reset() -> None

Reset the communication buffers.

Source code in packages/resources/src/msl/equipment_resources/optronic_labs/olxxa.py
260
261
262
263
def reset(self) -> None:
    """Reset the communication buffers."""
    self._send(b"Z")
    _ = self._receive(b"Z")

select_lamp ¤

select_lamp(lamp: int) -> None

Select a lamp.

Parameters:

Name Type Description Default
lamp int

The lamp number (between 0 and 9, inclusive).

required
Source code in packages/resources/src/msl/equipment_resources/optronic_labs/olxxa.py
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
def select_lamp(self, lamp: int) -> None:
    """Select a lamp.

    Args:
        lamp: The lamp number (between 0 and 9, inclusive).
    """
    self._check_lamp_number(lamp)
    msg = f"S {lamp:.0f}".encode("ascii")

    # selecting a lamp is buggy, so try to do it twice
    try:
        self._send(msg)
        _ = self._receive(b"S")
    except MSLConnectionError:
        self._send(msg)
        _ = self._receive(b"S")

set_current ¤

set_current(amps: float) -> float

Set the target output current.

Parameters:

Name Type Description Default
amps float

The target current, in Amps. If the value is above the target current limit for the presently selected lamp setup or if the value is less than the minimum supported current, the target current will not change.

required

Returns:

Type Description
float

The actual value of the output current after it was set.

Source code in packages/resources/src/msl/equipment_resources/optronic_labs/olxxa.py
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
def set_current(self, amps: float) -> float:
    """Set the target output current.

    Args:
        amps: The target current, in Amps. If the value is above the target current limit for
            the presently selected lamp setup or if the value is less than the minimum
            supported current, the target current will not change.

    Returns:
        The actual value of the output current after it was set.
    """
    msg = f"C {amps:.5f}"
    self._send(msg.encode("ascii"))
    reply = self._receive(b"C")
    return float(reply[0])

set_option ¤

set_option(lamp: int, option: int, value: str | float) -> None

Set a value for one of the lamp configuration options.

Parameters:

Name Type Description Default
lamp int

The lamp number (between 0 and 9, inclusive).

required
option int

The option type to update. Must be one of the following values.

  • 40: Lamp Hours
  • 50: Recalibration interval (hours)
  • 60: Target units, value must be "A", "V" or "W"
  • 70: Target value
  • 80: Current limit
  • 90: Lamp description text
  • 95: Wattage, value must be "L" or "H"
required
value str | float

The value to write for option.

required
Source code in packages/resources/src/msl/equipment_resources/optronic_labs/olxxa.py
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
def set_option(self, lamp: int, option: int, value: str | float) -> None:
    """Set a value for one of the lamp configuration options.

    Args:
        lamp: The lamp number (between 0 and 9, inclusive).
        option: The option type to update. Must be one of the following values.

            * `40`: Lamp Hours
            * `50`: Recalibration interval (hours)
            * `60`: Target units, `value` must be `"A"`, `"V"` or `"W"`
            * `70`: Target value
            * `80`: Current limit
            * `90`: Lamp description text
            * `95`: Wattage, `value` must be `"L"` or `"H"`

        value: The value to write for `option`.
    """
    self._check_lamp_number(lamp)
    if option not in self._options:
        msg = f"Invalid option value {option}"
        raise ValueError(msg)

    msg = f"X {lamp:.0f} {option:.0f} {value}"
    self._send(msg.encode("ascii"))
    _ = self._receive(b"X")

set_voltage ¤

set_voltage(volts: float) -> float

Set the target output voltage.

Parameters:

Name Type Description Default
volts float

The target voltage, in Volts. If the value is above the target voltage limit for the presently selected lamp setup or if the value is less than the minimum supported voltage, the target voltage will not change.

required

Returns:

Type Description
float

The actual value of the output voltage after it was set.

Source code in packages/resources/src/msl/equipment_resources/optronic_labs/olxxa.py
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
def set_voltage(self, volts: float) -> float:
    """Set the target output voltage.

    Args:
        volts: The target voltage, in Volts. If the value is above the
            target voltage limit for the presently selected lamp setup or if
            the value is less than the minimum supported voltage, the target
            voltage will not change.

    Returns:
        The actual value of the output voltage after it was set.
    """
    msg = f"V {volts:.5f}"
    self._send(msg.encode("ascii"))
    reply = self._receive(b"V")
    return float(reply[0])

set_wattage ¤

set_wattage(watts: float) -> float

Set the target output wattage.

Parameters:

Name Type Description Default
watts float

The target wattage, in Watts. If the value is above the target wattage limit for the presently selected lamp setup or if the value is less than the minimum supported wattage, the target wattage will not change.

required

Returns:

Type Description
float

The actual value of the output wattage after it was set.

Source code in packages/resources/src/msl/equipment_resources/optronic_labs/olxxa.py
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
def set_wattage(self, watts: float) -> float:
    """Set the target output wattage.

    Args:
        watts: The target wattage, in Watts. If the value is above the
            target wattage limit for the presently selected lamp setup or if
            the value is less than the minimum supported wattage, the target
            wattage will not change.

    Returns:
        The actual value of the output wattage after it was set.
    """
    msg = f"W {watts:.5f}"
    self._send(msg.encode("ascii"))
    reply = self._receive(b"W")
    return float(reply[0])

state ¤

state() -> bool

Returns whether the output is on or off.

Source code in packages/resources/src/msl/equipment_resources/optronic_labs/olxxa.py
358
359
360
361
362
def state(self) -> bool:
    """Returns whether the output is on or off."""
    self._send(b"b")
    reply = self._receive(b"b")
    return reply[0] == b"1"

target_info ¤

target_info() -> LampInfo

Get the target information of the currently-selected lamp.

Returns:

Type Description
LampInfo

The target information.

Source code in packages/resources/src/msl/equipment_resources/optronic_labs/olxxa.py
382
383
384
385
386
387
388
389
390
def target_info(self) -> LampInfo:
    """Get the target information of the currently-selected lamp.

    Returns:
        The target information.
    """
    self._send(b"t")
    number, value, unit = self._receive(b"t")
    return LampInfo(number=int(number), value=float(value), unit=unit.decode("ascii"))

turn_off ¤

turn_off() -> None

Turn the output off.

Source code in packages/resources/src/msl/equipment_resources/optronic_labs/olxxa.py
392
393
394
395
def turn_off(self) -> None:
    """Turn the output off."""
    self._send(b"B 0")
    _ = self._receive(b"B")

turn_on ¤

turn_on() -> None

Turn the output on.

Source code in packages/resources/src/msl/equipment_resources/optronic_labs/olxxa.py
397
398
399
400
def turn_on(self) -> None:
    """Turn the output on."""
    self._send(b"B 1")
    _ = self._receive(b"B")

zero_voltage_monitor ¤

zero_voltage_monitor() -> None

Zero the voltage monitor.

Source code in packages/resources/src/msl/equipment_resources/optronic_labs/olxxa.py
402
403
404
405
def zero_voltage_monitor(self) -> None:
    """Zero the voltage monitor."""
    self._send(b"D")
    _ = self._receive(b"D")

Communicate with a DC current source from Optronic Laboratories.

Compatible models are OL 16A, 65A and 83A.

LampInfo dataclass ¤

LampInfo(number: int, value: float, unit: str)

Information about the currently-selected lamp.

Parameters:

Name Type Description Default
number int

The lamp number (between 0 and 9, inclusive).

required
value float

The target value.

required
unit str

The unit of value.

required