解析AMESim二进制结果文件
This commit is contained in:
1 parent
a598fcd5c3
commit
796433c275
3 files changed
+211
-7
No files matched your search
@@ -12,7 +12,8 @@
|
||||
## 源文件
|
||||
|
||||
- AMESim 源模型:`AmesimModels/test_mql.ame`
|
||||
- 该 `.ame` 文件本质是一个 tar 包,内部包含 `test_mql_.cir`、`test_mql_.param`、`test_mql_.modelinfo`、`test_mql_.sim` 等文件。
|
||||
- 该 `.ame` 文件本质是一个 tar 包,内部包含 `test_mql_.cir`、`test_mql_.param`、`test_mql_.modelinfo`、`test_mql_.sim`、`test_mql_.data`、`test_mql_.results`、`test_mql_.var` 等文件。
|
||||
- `test_mql_.results` 是 AMESim 主时序结果文件;`test_mql_.data` 是配套结果/数据文件。
|
||||
|
||||
## 当前新增文件
|
||||
|
||||
@@ -45,7 +46,14 @@
|
||||
- `PythonModels/components/amesim_pneumatic.py`
|
||||
- 提供 `test_mql` 后续会用到的 AMESim 气动组件原语。
|
||||
- 当前包含氦气 PR 压力闭合的气动容腔、标准可压缩孔口流量、单位换算 helper。
|
||||
- 这层仍是首版近似原语,后续必须通过 AMESim CSV 对齐修正。
|
||||
- 这层仍是首版近似原语,后续必须通过 AMESim 结果对齐修正。
|
||||
|
||||
- `PythonModels/reporting/amesim_results.py`
|
||||
- 直接解析 `.ame` 包内的 AMESim 二进制结果。
|
||||
- 当前已确认 `test_mql_.results` 结构为:2 个 int32 头字段、1116 个保存变量映射、1002 行 `time + 1116变量` 的 double 时序矩阵,以及尾部 `time + 1278变量终值`。
|
||||
|
||||
- `tests/test_amesim_results.py`
|
||||
- 保护 `test_mql_.results` 的时间轴、变量数量、Data_Path 映射和典型样本值。
|
||||
|
||||
## 物性约定
|
||||
|
||||
@@ -86,19 +94,19 @@ AMESim 模型中 `test_mql` 使用氦气,Python 侧当前通过 `HELIUM_PR`
|
||||
1. 组件别名优先沿用 AMESim 原名,例如 `pn_brp2_8`、`pn_c1_8`、`pn_orifice_18`。
|
||||
2. 子模型族优先沿用 AMESim 子模型名,例如 `PNRP17`、`PNCH012`、`PNOR001`、`PNVO001`。
|
||||
3. 输出变量命名要能追溯到 AMESim 的 `Data_Path`,避免 Python 侧改名后无法对比。
|
||||
4. Python 每完成一批物理方程,都应拿 AMESim 导出的 CSV 结果做误差对比。
|
||||
5. 当前 `.ame` 包内的 `test_mql_.results` 是 AMESim 二进制结果文件,暂不作为直接解析基准;建议后续从 AMESim 导出 CSV 结果放到本目录下。
|
||||
6. 在没有 AMESim CSV 基准前,不能把 Python 输出描述为“已经和 AMESim 几乎一致”,只能说明完成了结构、参数或某类组件方程。
|
||||
4. Python 每完成一批物理方程,都应优先使用 `test_mql_.results` 解析出的 AMESim 原始时序做误差对比。
|
||||
5. CSV 仍可作为人工检查或外部交换格式,但不是自动对齐的前置条件。
|
||||
6. 在没有完成逐变量误差对比前,不能把 Python 输出描述为“已经和 AMESim 几乎一致”,只能说明完成了结构、参数、结果读取或某类组件方程。
|
||||
|
||||
## 验证方式
|
||||
|
||||
```bash
|
||||
python3 -m py_compile PythonModels/components/amesim_pneumatic.py PythonModels/core/peng_robinson.py PythonModels/systems/test_mql.py PythonModels/systems/test_mql_config.py PythonModels/scripts/run_test_mql.py
|
||||
python3 -m py_compile PythonModels/components/amesim_pneumatic.py PythonModels/core/peng_robinson.py PythonModels/reporting/amesim_results.py PythonModels/systems/test_mql.py PythonModels/systems/test_mql_config.py PythonModels/scripts/run_test_mql.py
|
||||
python3 -m PythonModels.scripts.run_test_mql
|
||||
python3 -m unittest discover -s tests -t .
|
||||
```
|
||||
|
||||
当前测试覆盖的是结构和配置解析,不代表已经完成 AMESim 物理结果复刻。
|
||||
当前测试覆盖的是结构、配置解析、气动原语和 AMESim 结果读取,不代表已经完成 AMESim 物理结果复刻。
|
||||
|
||||
## 后续方向
|
||||
|
||||
|
||||
Reference in new issue
Block a user