乙二醇水溶液属性查询程序 Ethylene Glycol Aqueous Solution Properties Program
Project description
乙二醇水溶液物性参数查询程序 | egasp (Ethylene Glycol Aqueous Solution Properties)
安装
官方版本 egasp 发布在 PyPI 上,并且可以通过 pip 包管理器从 PyPI 镜像轻松安装。
请注意,您必须使用 Python 3 版本 pip:
pip3 install egasp
命令行使用
基本用法
1. 单温度查询
# 查询体积浓度 50%,温度 25°C 时的物性参数
egasp 25
# 指定浓度查询
egasp -qt mass -qv 0.5 25
2. 多温度查询(新增)
# 一次性查询多个温度值
egasp -qt volume -qv 0.5 20 30 40 50
3. 参数说明
| 参数 | 说明 | 默认值 |
|---|---|---|
-qt, --query_type |
浓度类型,支持 volume(体积) 或 mass(质量) |
volume |
-qv, --query_value |
浓度值,范围 0.1-0.9 | 0.5 |
query_temp |
查询温度(°C),范围 -35~125,支持多个温度值 | - |
4. 交互式模式
不带参数直接运行可进入交互式输入模式:
egasp
5. 查看帮助
egasp -h
6. 查看版本
egasp --version
多平台支持
EGASP 现在使用现代的 Excel Web Add-in,支持以下平台:
Windows 平台
- 使用 Excel Web Add-in
- 支持 Excel 2016 及以上版本
- 无需 VBA 宏支持
Web 平台
- 使用 Office.js 构建的 Web Add-in
- 支持 Excel for Web
- 无需安装,直接加载
安装说明
安装 Excel Web Add-in
-
构建应用
python -m tools.app_builder
-
运行配置脚本
- 运行
dist/egasp-v*/configure_egasp_env.bat配置环境变量
- 运行
-
加载 Web Add-in
- 在 Excel 中打开'插入'选项卡
- 点击'我的加载项' -> '管理我的加载项'
- 点击'上传我的加载项',选择
dist/egasp-v*/manifest.xml文件 - 加载项将出现在 Excel 功能区中
开发环境设置
-
安装依赖
cd web_addin npm install
-
构建 Web Add-in
cd web_addin npm run build
-
启动开发服务器
cd web_addin npm run dev-server
跨平台测试
EGASP 提供了跨平台测试脚本,用于验证插件在不同平台上的功能:
# 运行跨平台测试
python tools/test_cross_platform.py
# 运行Windows平台测试
python tools/test_windows_addin.py
# 运行Mac平台测试
python tools/test_mac_addin.py
# 运行Web平台测试
python tools/test_web_addin.py
升级
pip3 install --upgrade egasp
Excel Web Add-in 使用说明
使用方法
1. 使用功能区按钮
在 Excel 功能区中找到 EGASP 选项卡,包含以下功能:
- 初始化 EGASP:配置 EGASP 环境
- 物性参数查询:打开任务窗格进行参数计算
- 清除缓存:清除计算缓存
- 缓存状态:查看缓存使用情况
2. 使用自定义函数
在 Excel 单元格中直接输入函数,例如:
=EG_RHO("volume", 0.5, 25) // 获取体积浓度 50%、温度 25°C 时的密度
=EG_MU("mass", 0.3, 10) // 获取质量浓度 30%、温度 10°C 时的粘度
=EG_CP("volume", 0.6, 30) // 获取体积浓度 60%、温度 30°C 时的比热容
=EG_K("volume", 0.4, 50) // 获取体积浓度 40%、温度 50°C 时的导热系数
=EG_TF("mass", 0.7) // 获取质量浓度 70% 时的冰点
=EG_TB("volume", 0.3) // 获取体积浓度 30% 时的沸点
3. 使用任务窗格
- 点击功能区中的 'EGASP' 按钮打开任务窗格
- 在任务窗格中输入以下参数:
- 浓度类型:体积浓度或质量浓度
- 浓度值:0.1-0.9
- 温度:-35~125°C
- 物性参数:密度、粘度、比热容、导热系数、冰点、沸点
- 点击 '计算' 按钮查看结果
4. 高级使用场景
场景1:温度变化对物性的影响
// A列:温度值从-30到100,步长10
// B列:体积浓度50%时的密度变化
=EG_RHO("volume", 0.5, A2)
// C列:体积浓度50%时的粘度变化
=EG_MU("volume", 0.5, A2)
场景2:浓度变化对冰点的影响
// A列:体积浓度从0.1到0.9,步长0.1
// B列:对应的冰点
=EG_TF("volume", A2)
场景3:质量浓度与体积浓度转换
// A列:质量浓度
// B列:转换为体积浓度
=EG_VOL("mass", A2, 25)
// C列:转换回质量浓度(验证)
=EG_MASS("volume", B2, 25)
场景4:综合热物性分析
// A列:温度
// B列:密度
=EG_RHO("volume", 0.5, A2)
// C列:比热容
=EG_CP("volume", 0.5, A2)
// D列:导热系数
=EG_K("volume", 0.5, A2)
// E列:粘度
=EG_MU("volume", 0.5, A2)
支持的函数
| 函数名 | 描述 | 参数 |
|---|---|---|
EG_INITIALIZE |
初始化 EGASP | 无 |
EG_PROPERTY |
通用属性查询 | type, value, temp, prop |
EG_RHO |
获取密度 | type, value, temp |
EG_MU |
获取粘度 | type, value, temp |
EG_CP |
获取比热容 | type, value, temp |
EG_K |
获取导热系数 | type, value, temp |
EG_TF |
获取冰点 | type, value |
EG_TB |
获取沸点 | type, value |
EG_MASS |
计算质量浓度 | type, value, temp |
EG_VOL |
计算体积浓度 | type, value, temp |
EG_CLEAR_CACHE |
清除缓存 | 无 |
EG_TOGGLE_CACHE |
切换缓存状态 | enabled |
EG_CACHE_STATUS |
获取缓存状态 | 无 |
参数说明
- type:浓度类型,支持
volume(体积浓度)或mass(质量浓度) - value:浓度值,范围 0.1-0.9
- temp:温度值,单位 °C,范围 -35~125
- prop:物性参数名称,支持:
rho或density:密度mu或viscosity:粘度cp或specific_heat:比热容k或thermal_conductivity:导热系数freezing或freezing_point:冰点boiling或boiling_point:沸点mass或mass_concentration:质量浓度volume或volume_concentration:体积浓度
错误提示说明
#ERROR: 未找到EGASP可执行文件路径:请先运行 EG_INITIALIZE 函数#ERROR: 无效的浓度类型:浓度类型必须是 volume 或 mass#ERROR: 浓度值超出范围:浓度值必须在 0.1-0.9 之间#ERROR: 温度超出范围:温度必须在 -35°C 到 125°C 之间#ERROR: 无效的物性参数:请检查物性参数名称是否正确
构建指南
构建完整应用
-
安装依赖
uv install -
生成可执行文件
make pack -
构建完整应用包
python -m tools.app_builder
构建 Excel Web Add-in
-
安装 Web Add-in 依赖
cd web_addin npm install
-
构建 Web Add-in
cd web_addin npm run build
-
构建完整插件包
python -m tools.build_addin
-
输出产物
dist/egasp-vX.X.X/:完整应用包dist/excel_addin/:Excel Web Add-in 构建结果
性能优化
缓存机制
插件内置了高效的缓存系统,显著提高重复计算的性能:
- 缓存大小:默认 1000 条记录
- 缓存命中:相同参数的查询会直接返回缓存结果
- 缓存淘汰:使用 FIFO 策略自动淘汰旧记录
性能统计
通过功能区中的 性能统计 按钮可以查看缓存状态和使用情况。
常见问题
1. EGASP 功能区不显示
- 检查宏是否启用
- 重启 Excel/WPS
- 重新导入
EGASP_Integration.bas文件
2. 函数返回 #NO_EXE_FOUND
- 运行
设置按钮配置 EGASP 可执行文件路径 - 确保
egasp.exe已正确安装
3. 函数返回 #EXEC_ERROR
- 检查输入参数是否正确
- 确保浓度和温度在有效范围内
4. Excel/WPS 崩溃或无响应
- 尝试清除缓存
- 检查 EGASP 可执行文件是否为最新版本
- 减少批量处理的数据量
未来计划
- 打包成独立可执行程序
- 支持 Excel/WPS 调用
- 改进 Excel 加载项的计算速度(已通过缓存机制实现)
- 添加单位转换工具
- 支持更多物性参数
来源
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file egasp-0.2.1.tar.gz.
File metadata
- Download URL: egasp-0.2.1.tar.gz
- Upload date:
- Size: 42.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a8c0d456cfad5797de050a85d8e2263c4fe2f0da2ce63a609531ba79e0bda6a2
|
|
| MD5 |
b0f65c6a15af422cac416ccc315aa509
|
|
| BLAKE2b-256 |
c2161d0790cc460037e9f5f96d71d306a877ec703b920ad66c0282e03acb3420
|
Provenance
The following attestation bundles were made for egasp-0.2.1.tar.gz:
Publisher:
Publish.yml on YanMing-lxb/egasp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
egasp-0.2.1.tar.gz -
Subject digest:
a8c0d456cfad5797de050a85d8e2263c4fe2f0da2ce63a609531ba79e0bda6a2 - Sigstore transparency entry: 1566823043
- Sigstore integration time:
-
Permalink:
YanMing-lxb/egasp@97011ea3ff7f0963b281f1cb7655c8ca43e17189 -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/YanMing-lxb
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
Publish.yml@97011ea3ff7f0963b281f1cb7655c8ca43e17189 -
Trigger Event:
push
-
Statement type:
File details
Details for the file egasp-0.2.1-py3-none-any.whl.
File metadata
- Download URL: egasp-0.2.1-py3-none-any.whl
- Upload date:
- Size: 41.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
17de813c690415422920e8405920d0abc5dd012c241ea432db833e0e0a41db45
|
|
| MD5 |
065fa7590f59c5d76deaafe27bfc391f
|
|
| BLAKE2b-256 |
d7fb4358c651b37638d1bea353bb7ffdf5873d7e90a53915e2062a3bd7b3b716
|
Provenance
The following attestation bundles were made for egasp-0.2.1-py3-none-any.whl:
Publisher:
Publish.yml on YanMing-lxb/egasp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
egasp-0.2.1-py3-none-any.whl -
Subject digest:
17de813c690415422920e8405920d0abc5dd012c241ea432db833e0e0a41db45 - Sigstore transparency entry: 1566823047
- Sigstore integration time:
-
Permalink:
YanMing-lxb/egasp@97011ea3ff7f0963b281f1cb7655c8ca43e17189 -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/YanMing-lxb
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
Publish.yml@97011ea3ff7f0963b281f1cb7655c8ca43e17189 -
Trigger Event:
push
-
Statement type: