hitl_tester.modules.bms.thermoplate

Provides controls for the thermocouples.

(c) 2020-2024 TurnAround Factor, Inc.

#

CUI DISTRIBUTION CONTROL

Controlled by: DLA J68 R&D SBIP

CUI Category: Small Business Research and Technology

Distribution/Dissemination Controls: PROTECTED BY SBIR DATA RIGHTS

POC: GOV SBIP Program Manager Denise Price, 571-767-0111

Distribution authorized to U.S. Government Agencies only, to protect information not owned by the

U.S. Government and protected by a contractor’s ‘limited rights’ statement, or received with the understanding that

it is not routinely transmitted outside the U.S. Government (determination made September 14, 2024). Other requests

for this document shall be referred to ACOR DLA Logistics Operations (J-68), 8725 John J. Kingman Rd., Suite 4317,

Fort Belvoir, VA 22060-6221

#

SBIR DATA RIGHTS

Contract No.:SP4701-23-C-0083

Contractor Name: TurnAround Factor, Inc.

Contractor Address: 10365 Wood Park Ct. Suite 313 / Ashland, VA 23005

Expiration of SBIR Data Rights Period: September 24, 2029

The Government's rights to use, modify, reproduce, release, perform, display, or disclose technical data or computer

software marked with this legend are restricted during the period shown as provided in paragraph (b)(4) of the Rights

in Noncommercial Technical Data and Computer Software--Small Business Innovative Research (SBIR) Program clause

contained in the above identified contract. No restrictions apply after the expiration date shown above. Any

reproduction of technical data, computer software, or portions thereof marked with this legend must also reproduce

the markings.

 1"""
 2Provides controls for the thermocouples.
 3
 4# (c) 2020-2024 TurnAround Factor, Inc.
 5#
 6# CUI DISTRIBUTION CONTROL
 7# Controlled by: DLA J68 R&D SBIP
 8# CUI Category: Small Business Research and Technology
 9# Distribution/Dissemination Controls: PROTECTED BY SBIR DATA RIGHTS
10# POC: GOV SBIP Program Manager Denise Price, 571-767-0111
11# Distribution authorized to U.S. Government Agencies only, to protect information not owned by the
12# U.S. Government and protected by a contractor’s ‘limited rights’ statement, or received with the understanding that
13# it is not routinely transmitted outside the U.S. Government (determination made September 14, 2024). Other requests
14# for this document shall be referred to ACOR DLA Logistics Operations (J-68), 8725 John J. Kingman Rd., Suite 4317,
15# Fort Belvoir, VA 22060-6221
16#
17# SBIR DATA RIGHTS
18# Contract No.:SP4701-23-C-0083
19# Contractor Name: TurnAround Factor, Inc.
20# Contractor Address: 10365 Wood Park Ct. Suite 313 / Ashland, VA 23005
21# Expiration of SBIR Data Rights Period: September 24, 2029
22# The Government's rights to use, modify, reproduce, release, perform, display, or disclose technical data or computer
23# software marked with this legend are restricted during the period shown as provided in paragraph (b)(4) of the Rights
24# in Noncommercial Technical Data and Computer Software--Small Business Innovative Research (SBIR) Program clause
25# contained in the above identified contract. No restrictions apply after the expiration date shown above. Any
26# reproduction of technical data, computer software, or portions thereof marked with this legend must also reproduce
27# the markings.
28"""
29
30import pytest
31
32from hitl_tester.modules.bms_types import BMSFlags, SuppressExceptions
33from hitl_tester.modules.file_lock import RFileLock
34from hitl_tester.modules.logger import logger
35
36if hasattr(pytest, "flags") and isinstance(pytest.flags, BMSFlags) and pytest.flags.dry_run:
37    from hitl_tester.modules.bms.pseudo_hardware import THERMO
38else:
39    import piplates.THERMOplate as THERMO  # type: ignore[no-redef]
40
41
42class ThermoCouple:
43    """Thermocouples on the Pi-Plate."""
44
45    def __init__(self, thermocouple_id: int, board: int, channel: int):
46        """Initialize the thermocouples."""
47        self._lock = RFileLock("piplate")
48        self.thermocouple_id = thermocouple_id
49        self.board_id = board
50        self.channel = channel
51
52    @property
53    def temperature(self) -> float:
54        """Returns the temperature from the thermo-couple."""
55        with SuppressExceptions(), self._lock:
56            if THERMO.getADDR(self.board_id) != self.board_id:
57                logger.write_warning_to_report("Thermocouple board not present, no temperature will be measured")
58                return 0.0
59            return float(THERMO.getTEMP(self.board_id, self.channel))
60        logger.write_warning_to_report("Thermocouple gave no response")
61        return 0.0
class ThermoCouple:
43class ThermoCouple:
44    """Thermocouples on the Pi-Plate."""
45
46    def __init__(self, thermocouple_id: int, board: int, channel: int):
47        """Initialize the thermocouples."""
48        self._lock = RFileLock("piplate")
49        self.thermocouple_id = thermocouple_id
50        self.board_id = board
51        self.channel = channel
52
53    @property
54    def temperature(self) -> float:
55        """Returns the temperature from the thermo-couple."""
56        with SuppressExceptions(), self._lock:
57            if THERMO.getADDR(self.board_id) != self.board_id:
58                logger.write_warning_to_report("Thermocouple board not present, no temperature will be measured")
59                return 0.0
60            return float(THERMO.getTEMP(self.board_id, self.channel))
61        logger.write_warning_to_report("Thermocouple gave no response")
62        return 0.0

Thermocouples on the Pi-Plate.

ThermoCouple(thermocouple_id: int, board: int, channel: int)
46    def __init__(self, thermocouple_id: int, board: int, channel: int):
47        """Initialize the thermocouples."""
48        self._lock = RFileLock("piplate")
49        self.thermocouple_id = thermocouple_id
50        self.board_id = board
51        self.channel = channel

Initialize the thermocouples.

thermocouple_id
board_id
channel
temperature: float
53    @property
54    def temperature(self) -> float:
55        """Returns the temperature from the thermo-couple."""
56        with SuppressExceptions(), self._lock:
57            if THERMO.getADDR(self.board_id) != self.board_id:
58                logger.write_warning_to_report("Thermocouple board not present, no temperature will be measured")
59                return 0.0
60            return float(THERMO.getTEMP(self.board_id, self.channel))
61        logger.write_warning_to_report("Thermocouple gave no response")
62        return 0.0

Returns the temperature from the thermo-couple.