io.github.dfieser/thermocouple-its90
thermocouple-its90
用于 Python 的 NIST ITS-90 热电偶转换:电压转温度和温度转电压,支持全部八种字母代号类型(B、E、J、K、N、R、S、T),并带有冷端补偿和塞贝克系数。测试套件在每次运行时都会验证 NIST 参考表中全部 12,026 个列表点的数据。
纯标准库实现,无任何依赖,完整类型标注。本引擎的浏览器版本以免费在线热电偶计算器的形式运行,每次发布时都会从本仓库同步代码。
安装
pip install thermocouple-its90Related MCP server: mcp-units
将热电偶毫伏转换为温度
from thermocouple_its90 import TypeK
TypeK.emf(300.0) # 12.209 (mV at 300 C, 0 C reference: the table value)
TypeK.temperature(12.209) # 300.0 (C, ice-bath reference)
TypeK.seebeck(300.0) # 0.0416 (mV per C)
TypeK.range # (-270.0, 1372.0)冷端补偿
热电偶测量的是其两个结点之间的温差,而参考表假定冷端处于 0 C。如果您的仪表接线端子处于室温,直接查表就会出错:
from thermocouple_its90 import TypeK
# Meter reads 4.096 mV, terminals at 25 C:
TypeK.temperature(4.096) # 100.0 C <- naive lookup, wrong
TypeK.temperature(4.096, reference=25.0) # 124.3 C <- the actual answer全部八种类型的工作方式相同:
from thermocouple_its90 import get, letters
letters() # ['B', 'E', 'J', 'K', 'N', 'R', 'S', 'T']
get("s").emf(1400.0) # 14.373 mV
get("t").temperature(-4.648) # -149.98 C (cryogenic ranges included)精度:经过验证,而非口头宣称
正向参考函数可复现 NIST 参考表中全部 12,026 个逐度数据点,误差在其 0.001 mV 的打印舍入范围内。完整对比在每次推送时都会在 CI 中运行(
tests/test_full_tables.py)。反演以已发布的 ITS-90 逆多项式为初值,并在精确正向函数上通过牛顿迭代进行精化。往返转换的误差可达微度量级,远优于逆多项式 0.02 至 0.06 C 的误差带。
K、E 和 T 型可在其完整低温范围内(低至 -270 C)进行反演,而已发布的逆多项式在该范围以下即失效。
B 型按其物理特性处理:其电动势在室温附近是非单调的,因此当输入低于 0.291 mV(约 250 C)时会拒绝反演并给出解释,而不是返回两个可能答案之一。
面向 AI 智能体的 MCP 服务器
语言模型经常记错热电偶多项式。本包附带一个 Model Context Protocol 服务器,使智能体可以调用经过验证的实现:
pip install "thermocouple-its90[mcp]"
claude mcp add thermocouple -- thermocouple-its90-mcp工具:thermocouple_to_temperature、thermocouple_to_emf、thermocouple_types。
数据来源与许可
系数是从 NIST ITS-90 热电偶数据库(SRD 60,https://its90.nist.gov/)中通过机器解析获得,绝非手工录入。该数据库复现了 NIST Monograph 175(Burns、Scroger、Strouse、Croarkin 和 Guthrie,1993 年),这是美国政府的出版物,不受版权保护。规范数据集位于 data/its90.json 中;_data.py 由它生成,如果两者出现偏差,CI 将失败。代码采用 MIT 许可。
相关资源
在线计算器,本引擎的浏览器版本,附有实例和常见问题解答
同一作者的更多经过验证的工程计算器,包括参比电极、合金成分、扩散和 XRD 工具
lcf-strain-life,采用相同的库加 MCP 模式,用于低周疲劳分析
引用
如果本库在已发表的工作中有用,请通过概念 DOI https://doi.org/10.5281/zenodo.22036393 引用它,该 DOI 始终解析到最新版本(参见 CITATION.cff)。还请引用底层参考文献:Burns, G. W., Scroger, M. G., Strouse, G. F., Croarkin, M. C., & Guthrie, W. F. (1993). Temperature-electromotive force reference functions and tables for the letter-designated thermocouple types based on the ITS-90 (NIST Monograph 175). NIST.
This server cannot be deployed
Maintenance
Related MCP Connectors
MCP server for aerospace calculations: orbital mechanics, ephemeris, DSN operations, ...
Remote MCP server for deterministic educational practice-assessment score conversions.
QuLab MCP remote server (Streamable HTTP) for computational science and lab tools.
Engineering calculation MCP server for oil and gas engineering applications.
Related MCP Servers
- AlicenseAqualityFmaintenanceA universal MCP server that exposes all UTCP-registered tools to MCP clients while providing a web interface for tool management.714 npm205MIT
- AlicenseAqualityDmaintenanceMCP server for converting cooking measurements (volume, weight, temperature) between common units like ml, cup, g, oz, and Celsius/Fahrenheit.31MIT
- AlicenseBqualityBmaintenanceAn MCP server for controlling lab instruments (oscilloscopes, signal generators, etc.) via standardized interfaces like USBTMC, RS-232, and LAN.100MIT
- AlicenseAqualityCmaintenanceThis MCP server enables AI clients to calculate the boiling temperature of water at a given absolute pressure using the IAPWS-IF97 standard, separating natural-language reasoning from authoritative scientific computation.1MIT