half-sample 0.1.17__tar.gz → 0.1.19__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {half_sample-0.1.17 → half_sample-0.1.19}/PKG-INFO +1 -1
- half_sample-0.1.19/README.md +416 -0
- half_sample-0.1.19/cpp_build/sample.exe +0 -0
- {half_sample-0.1.17 → half_sample-0.1.19}/half_sample.egg-info/PKG-INFO +1 -1
- {half_sample-0.1.17 → half_sample-0.1.19}/sample/result.py +8 -0
- {half_sample-0.1.17 → half_sample-0.1.19}/sample/sample.py +15 -5
- {half_sample-0.1.17 → half_sample-0.1.19}/setup.py +1 -1
- half_sample-0.1.17/README.md +0 -20
- half_sample-0.1.17/cpp_build/sample.exe +0 -0
- {half_sample-0.1.17 → half_sample-0.1.19}/half_sample.egg-info/SOURCES.txt +0 -0
- {half_sample-0.1.17 → half_sample-0.1.19}/half_sample.egg-info/dependency_links.txt +0 -0
- {half_sample-0.1.17 → half_sample-0.1.19}/half_sample.egg-info/top_level.txt +0 -0
- {half_sample-0.1.17 → half_sample-0.1.19}/sample/__init__.py +0 -0
- {half_sample-0.1.17 → half_sample-0.1.19}/sample/process.py +0 -0
- {half_sample-0.1.17 → half_sample-0.1.19}/setup.cfg +0 -0
|
@@ -0,0 +1,416 @@
|
|
|
1
|
+
# Half.Sample
|
|
2
|
+
|
|
3
|
+
[](https://ci.appveyor.com/project/Wingsgo/half-sample)
|
|
4
|
+
|
|
5
|
+
Half.Sample 是 Half 应用中的 C++ 采样程序和 Python 模块。本仓库同时提供独立的 PCI-1714U DAQ 能力验证程序;验证程序不改变原有 `sample.exe` 的行为。
|
|
6
|
+
|
|
7
|
+
## 构建环境
|
|
8
|
+
|
|
9
|
+
需要 Windows、支持 C++14 的 MSVC、Python 和 SCons。在仓库根目录执行:
|
|
10
|
+
|
|
11
|
+
```powershell
|
|
12
|
+
scons -Q cpp_build/sample.exe
|
|
13
|
+
scons -Q cpp_build/daq_capability_test_mock.exe
|
|
14
|
+
scons -Q cpp_build/daq_capability_test_legacy.exe
|
|
15
|
+
scons -Q cpp_build/daq_capability_test_xnavi.exe
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
三个验证 target 分别是无硬件 mock、旧版 BDaq/Legacy 驱动和新版 DAQNavi/XNavi 驱动。Legacy 与 XNavi 使用平级且隔离的头文件目录,不能混用。编译验证程序只需要对应版本的头文件,不需要导入库;程序在运行时动态加载已安装驱动的 `biodaq.dll`。仓库不复制、提交或分发 DLL。现场机必须安装与目标程序架构匹配的对应驱动,不能把另一版本 DLL 放到程序目录“凑版本”。
|
|
19
|
+
|
|
20
|
+
帮助命令不加载设备,退出码应为 `0`:
|
|
21
|
+
|
|
22
|
+
```powershell
|
|
23
|
+
cpp_build\daq_capability_test_legacy.exe --help
|
|
24
|
+
cpp_build\daq_capability_test_xnavi.exe --help
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## sample.exe自动选择Instant AI
|
|
28
|
+
|
|
29
|
+
Python测量接口支持通过外部发射频率阈值选择采集方式:
|
|
30
|
+
|
|
31
|
+
```python
|
|
32
|
+
sampler.measure(
|
|
33
|
+
number_of_waveforms=3,
|
|
34
|
+
emitting_frequency=0.1,
|
|
35
|
+
instant_ai_frequency_threshold=0.5,
|
|
36
|
+
)
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
阈值默认为0,此时所有旧调用继续使用Buffered AI。阈值大于0时,发射频率小于等于阈值
|
|
40
|
+
选择legacy Instant AI;高于阈值选择原有Buffered AI。Buffered AI内部原有规则保持不变:
|
|
41
|
+
发射频率低于10Hz使用1MHz,否则使用20MHz。
|
|
42
|
+
|
|
43
|
+
Instant AI默认将每个等效完整波形重建为100点,平均次数来自
|
|
44
|
+
`number_of_waveforms`。在0.1Hz、3次平均时主体采集时间约30秒。可显式调整目标点数:
|
|
45
|
+
|
|
46
|
+
```python
|
|
47
|
+
sampler.measure(
|
|
48
|
+
number_of_waveforms=5,
|
|
49
|
+
emitting_frequency=0.1,
|
|
50
|
+
instant_ai_frequency_threshold=0.5,
|
|
51
|
+
instant_ai_target_points_per_waveform=500,
|
|
52
|
+
)
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
更低的发射频率不可能快于波形自身周期。Instant AI读取、相位覆盖或重建失败时直接返回
|
|
56
|
+
错误,不会自动回退到Buffered AI。本功能只支持legacy驱动。
|
|
57
|
+
|
|
58
|
+
## Legacy Instant AI 轮询验证
|
|
59
|
+
|
|
60
|
+
`instant-ai-polling` 只在 Legacy 版本中实现。它连续调用
|
|
61
|
+
`InstantAiCtrl::ReadAny()`,记录每次读取完成时间、驱动调用耗时、相邻读取间隔和通道值。
|
|
62
|
+
默认轮询 30 秒:
|
|
63
|
+
|
|
64
|
+
```powershell
|
|
65
|
+
scons -Q cpp_build/daq_capability_test_legacy.exe
|
|
66
|
+
cpp_build\daq_capability_test_legacy.exe instant-ai-polling --device "PCI-1714,BID#0" --channels 0 --range "-5V~5V" --duration 30 --output-dir daq_capability_results\legacy_instant
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
不指定 `--poll-rate` 时程序无等待地连续调用 `ReadAny()`。要匹配官方界面的
|
|
70
|
+
`sampling rate per-channel = 10 Hz`,使用软件定时轮询:
|
|
71
|
+
|
|
72
|
+
```powershell
|
|
73
|
+
cpp_build\daq_capability_test_legacy.exe instant-ai-polling --device "PCI-1714,BID#0" --channels 0 --range "-5V~5V" --poll-rate 10 --duration 30 --output-dir daq_capability_results\legacy_instant_10hz
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
`--poll-rate 10` 使用单调时钟和绝对 deadline,每 100 ms 调用一次 `ReadAny()`;它是每通道的软件
|
|
77
|
+
轮询频率,不是 Buffered AI 硬件采样时钟。多通道在同一次 `ReadAny()` 中读取,因此每个通道均为
|
|
78
|
+
10 点/秒。
|
|
79
|
+
|
|
80
|
+
成功时 exit `0`,末行 JSON 为 `PASS / INSTANT_AI_POLLING_STABLE`。证据包括成功/失败
|
|
81
|
+
读取次数、平均读取率、平均/P95/P99/最大读取间隔,以及每个通道的最小值、最大值和跨度。
|
|
82
|
+
原始数据位于:
|
|
83
|
+
|
|
84
|
+
```text
|
|
85
|
+
<evidence.run_directory>\raw\instant_ai_polling.tsv
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
第一次硬件测试不要设置间隔阈值,先记录实际分布。明确业务门槛后可增加
|
|
89
|
+
`--max-gap-ms <毫秒>`;任一相邻读取完成间隔超过阈值时返回 exit `2` 和
|
|
90
|
+
`INSTANT_AI_GAP_EXCEEDED`。
|
|
91
|
+
|
|
92
|
+
该 PASS 只证明本次 Windows/驱动环境下软件轮询持续成功,不证明硬件时钟等间隔采样,
|
|
93
|
+
也不能证明两次 `ReadAny()` 之间没有遗漏输入变化。
|
|
94
|
+
|
|
95
|
+
安装 Python 绘图依赖并生成采样点图:
|
|
96
|
+
|
|
97
|
+
```powershell
|
|
98
|
+
python -m pip install -r requirements.txt
|
|
99
|
+
python scripts\plot_instant_ai_samples.py "daq_capability_results\legacy_instant\<timestamp>\raw\instant_ai_polling.tsv"
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
默认在 TSV 旁生成 `instant_ai_polling.png`。X 轴为读取完成时间,Y 轴为电压,每个通道
|
|
103
|
+
独立着色。TSV 始终保留全部数据;图中默认在完整时间范围内均匀抽取最多 100,000 个
|
|
104
|
+
共用索引,并保留首尾点。可选参数:
|
|
105
|
+
|
|
106
|
+
```powershell
|
|
107
|
+
python scripts\plot_instant_ai_samples.py "daq_capability_results\legacy_instant\<timestamp>\raw\instant_ai_polling.tsv" --output instant.png
|
|
108
|
+
python scripts\plot_instant_ai_samples.py "daq_capability_results\legacy_instant\<timestamp>\raw\instant_ai_polling.tsv" --max-points 50000
|
|
109
|
+
python scripts\plot_instant_ai_samples.py "daq_capability_results\legacy_instant\<timestamp>\raw\instant_ai_polling.tsv" --max-points 0 --show
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
`--max-points 0` 绘制全部点;`--show` 在保存 PNG 后显示窗口。
|
|
113
|
+
|
|
114
|
+
## CLion 与代码格式
|
|
115
|
+
|
|
116
|
+
`src\CMakeLists.txt` 声明 `daq_capability_test_mock`、`daq_capability_test_legacy` 和
|
|
117
|
+
`daq_capability_test_xnavi`,供 CLion 正确索引验证程序的源文件、符号和 include
|
|
118
|
+
路径。正式构建和验收仍使用本 README 中的 SCons 命令。
|
|
119
|
+
|
|
120
|
+
仓库根目录 `.clang-format` 用于项目自有 C++。批量格式化时排除
|
|
121
|
+
`src\3rdparty\` 和厂商文件 `src\daq_headers\**\bdaqctrl.h`。
|
|
122
|
+
|
|
123
|
+
## 自动判定契约
|
|
124
|
+
|
|
125
|
+
执行命令的 stdout 最后一行是单行 JSON,正式结论由进程退出码和该 JSON 共同给出,不要求人工看波形或 TSV。日志写 stderr;失败原因在末行 JSON 的 `message`、`evidence`,suite 还在 `failed_cases` 中保留每个失败 case 的 `code` 和证据。
|
|
126
|
+
|
|
127
|
+
| 退出码 | 含义 |
|
|
128
|
+
| --- | --- |
|
|
129
|
+
| `0` | 验证通过 |
|
|
130
|
+
| `2` | 能力或数据验证失败 |
|
|
131
|
+
| `3` | 当前硬件或驱动不支持,JSON `result=SKIP` |
|
|
132
|
+
| `4` | 命令参数或配置无效 |
|
|
133
|
+
| `5` | 运行环境缺失或不匹配 |
|
|
134
|
+
| `6` | 驱动、运行库、设备调用或采集超时 |
|
|
135
|
+
| `7` | 结果或输出文件写入失败 |
|
|
136
|
+
|
|
137
|
+
首选方式是直接执行统一验证脚本。脚本根据 `-Variant` 自动选择构建目录中的 Mock、Legacy 或 XNavi 程序,构造 `suite` 命令,并自动断言 exit `0`、`result=PASS`、`code=SUITE_PASSED` 以及 suite 顶层结果字段:
|
|
138
|
+
|
|
139
|
+
```powershell
|
|
140
|
+
# 无硬件完整验证
|
|
141
|
+
.\scripts\daq_validation.ps1 -Variant mock -Config src\daq_capability_test\mock_success.tsv -OutputDir daq_capability_results\mock -All
|
|
142
|
+
|
|
143
|
+
# Legacy/XNavi 现场完整验证
|
|
144
|
+
.\scripts\daq_validation.ps1 -Variant legacy -Config src\daq_capability_test\field_test_matrix.tsv -OutputDir daq_capability_results\legacy -All
|
|
145
|
+
.\scripts\daq_validation.ps1 -Variant xnavi -Config src\daq_capability_test\field_test_matrix.tsv -OutputDir daq_capability_results\xnavi -All
|
|
146
|
+
|
|
147
|
+
# 单项验证、从断点继续、静默自动化
|
|
148
|
+
.\scripts\daq_validation.ps1 -Variant xnavi -Config src\daq_capability_test\field_test_matrix.tsv -Case phase_stitch
|
|
149
|
+
.\scripts\daq_validation.ps1 -Variant xnavi -Config src\daq_capability_test\field_test_matrix.tsv -From dual_channel_reference
|
|
150
|
+
.\scripts\daq_validation.ps1 -Variant mock -Config src\daq_capability_test\mock_success.tsv -All -Quiet
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
`-All`、`-Case`、`-From` 必须恰好指定一个。无参数执行脚本会显示中文帮助和示例并返回 `0`;未知参数、缺少配置/程序或 scope 冲突会显示明确错误并返回非零。正常执行依次显示 `[RUN]`、`[EXIT]` 和 `[PASS]`;验证不一致时显示 `[FAIL]` 及每条 `[ASSERT]`,异常包含 exit、code、message、evidence 和具体断言原因。`-Quiet` 关闭过程提示,但 stdout 最后一行仍是完整 JSON。
|
|
154
|
+
|
|
155
|
+
`-OutputDir` 可以是尚不存在的相对或绝对多层目录,验证程序会逐层创建目录;任何中间路径无法创建时以 exit `7` 返回,并在 `evidence.stage=create_root`、`evidence.path` 和 `evidence.os_error` 中给出失败位置和原因。程序不会覆盖或删除已有文件。
|
|
156
|
+
|
|
157
|
+
高级用法需要自定义预期失败、case code 或 evidence 断言时,可 dot-source 脚本后调用底层函数。dot-source 只注册函数,不启动验证:
|
|
158
|
+
|
|
159
|
+
```powershell
|
|
160
|
+
. .\scripts\daq_validation.ps1
|
|
161
|
+
Invoke-DaqValidation -Executable 'cpp_build\daq_capability_test_mock.exe' -Arguments @('suite','--config','src\daq_capability_test\mock_non_stationary.tsv','--all') -ExpectedExit 2 -ExpectedResult FAIL -ExpectedCode SUITE_FAILED
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
函数只捕获 stdout,不把 stderr 合并进 JSON;进程结束后立即保存退出码并解析最后一个非空 stdout 行。过程使用 `Write-Host`,所以赋值接收函数返回值时 pipeline 中仍只有 payload。
|
|
165
|
+
|
|
166
|
+
后续所有验证命令都通过该函数逐个门控。不要连续裸跑可执行程序,也不要只搜索 stdout 中是否出现 `PASS`。`RequiredTopLevelFields` 和 `RequiredEvidenceProperties` 只要求属性存在,允许合法的空数组/空字符串;`RequiredNonEmptyEvidenceFields` 要求属性存在且不是 null、空白字符串或空集合,布尔值 `false` 和数值 `0` 都是有效值。策略可选择至少包含或精确匹配。验证预期失败场景时显式传入预期 exit/result/code 和 failed case/code。
|
|
167
|
+
|
|
168
|
+
## 接线与安全
|
|
169
|
+
|
|
170
|
+
脉冲发生器输出必须在样品前分路:一路经过样品和测量链路接 PCI-1714U `AI0`,另一路作为未经样品的同步参考,经合适的分压、限流、保护、缓冲或隔离接 `AI1`。这样 `AI1` 的方波边沿给出同一次采集中 `AI0` 样品响应的周期位置;它不是从样品后“恢复”原始信号。两路必须共享可靠时间基准,并按设备接线要求共地或隔离。
|
|
171
|
+
|
|
172
|
+
上电前用万用表/示波器确认两路峰值、偏置和地电位差都在配置量程内。默认 `-10V~10V` 只是示例,不是安全承诺。外部触发验证还需把同步输出安全连接到板卡外部触发端。未完成某种接线时,把相应 case 的 `enabled` 设为 `false`,不能悬空运行。先关闭脉冲输出完成接线,再从小幅度开始;程序不会控制脉冲发生器,也不能代替硬件保护。
|
|
173
|
+
|
|
174
|
+
## 配置示例
|
|
175
|
+
|
|
176
|
+
`default_test_matrix.tsv` 是可修改示例,文件开头的注释逐项解释 30 个参数,数据行给出默认值或 `REQUIRED`。复制后只修改现场文件:
|
|
177
|
+
|
|
178
|
+
```powershell
|
|
179
|
+
Copy-Item src\daq_capability_test\default_test_matrix.tsv src\daq_capability_test\field_test_matrix.tsv
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
保持制表符分隔和表头不变;空值表示“不适用”,不能用 `0` 代替。把所有启用行中的 `REQUIRED` 替换为现场确认值,尤其是设备名、AI0/AI1、量程、采样率/点数、信号频率、目标周期数 N、幅值、边沿抖动、占空比误差、phase bin、重叠/漂移/边界阈值、最大尝试次数、触发源和 delay。外部触发默认禁用,确认接线后才启用。每次运行会把实际配置快照写入结果目录。
|
|
183
|
+
|
|
184
|
+
## 现场验证 Check-list
|
|
185
|
+
|
|
186
|
+
所有命令从仓库根目录执行。每一步都以退出码和末行 JSON 自动判定;下列 FAIL code 均为代表性业务原因,驱动异常、写盘失败等仍按统一退出码返回明确原因。
|
|
187
|
+
|
|
188
|
+
### [ ] 步骤 0:现场参数能否自动判定
|
|
189
|
+
|
|
190
|
+
**问题与方案关系:** 将业务阈值、硬件参数固定到可审计配置;它是三个候选方案的共同前置,避免人工看波形下结论。
|
|
191
|
+
|
|
192
|
+
**前置:** 已复制并填写 `field_test_matrix.tsv`,无法接线的 case 已禁用。
|
|
193
|
+
|
|
194
|
+
```powershell
|
|
195
|
+
Invoke-DaqValidation -Executable 'cpp_build\daq_capability_test_legacy.exe' -Arguments @('suite','--config','src\daq_capability_test\field_test_matrix.tsv','--case','preflight') -ExpectedCode 'SUITE_PASSED' -ExpectedCase 'preflight' -ExpectedCaseCode 'PREFLIGHT_OK'
|
|
196
|
+
Invoke-DaqValidation -Executable 'cpp_build\daq_capability_test_xnavi.exe' -Arguments @('suite','--config','src\daq_capability_test\field_test_matrix.tsv','--case','preflight') -ExpectedCode 'SUITE_PASSED' -ExpectedCase 'preflight' -ExpectedCaseCode 'PREFLIGHT_OK'
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
**PASS:** exit `0`,末行 JSON `result=PASS`,且 `cases.preflight.code=PREFLIGHT_OK`。**FAIL:** exit `4`;打不开文件为 `CONFIG_OPEN_FAILED`,格式错误为 `MISSING_HEADER`、`MISSING_COLUMN`、`UNKNOWN_COLUMN`、`DUPLICATE_COLUMN`、`COLUMN_COUNT_MISMATCH`、`MISSING_VALUE`、`INVALID_BOOLEAN`、`INVALID_INTEGER`、`INVALID_NUMBER`、`INVALID_LIST` 或 `INVALID_VALUE`,规则错误为 `REQUIRED_THRESHOLD_MISSING`、`MISSING_REQUIRED_FIELD`、`INVALID_FIELD`、`UNKNOWN_CASE`、`DUPLICATE_CASE_NAME` 或 `CASE_MODE_MISMATCH`。`message/evidence` 给出行号、case 和字段。修正后重跑,不得跳过。
|
|
200
|
+
|
|
201
|
+
**方案含义与下一步:** 通过只证明参数完整且满足静态安全规则,不证明硬件可用;继续步骤 1。失败则按 `message/evidence` 修正具体字段并重复本步。
|
|
202
|
+
|
|
203
|
+
**现场记录:** 执行版本:____;执行时间:____;进程退出码:____;最终 result/code:____;输出目录:____;现场备注:____。
|
|
204
|
+
|
|
205
|
+
### [ ] 步骤 1:设备和对应驱动是否可用
|
|
206
|
+
|
|
207
|
+
**问题与方案关系:** 验证对应 `biodaq.dll` 可加载、设备可找到、能力可读取;失败时所有方案都不能继续。
|
|
208
|
+
|
|
209
|
+
**前置:** PCI-1714U 和所选版本驱动已安装,设备管理器无错误;脉冲输出可保持关闭。
|
|
210
|
+
|
|
211
|
+
```powershell
|
|
212
|
+
Invoke-DaqValidation -Executable 'cpp_build\daq_capability_test_legacy.exe' -Arguments @('capability','--device','PCI-1714,BID#0','--output-dir','daq_capability_results\legacy_capability') -ExpectedCode 'DEVICE_CAPABILITY_CONFIRMED' -RequiredEvidenceProperties @('trigger_sources','trigger_actions') -RequiredNonEmptyEvidenceFields @('device_description','runtime_path','runtime_version','channel_count','buffer_capacity','trigger_supported')
|
|
213
|
+
Invoke-DaqValidation -Executable 'cpp_build\daq_capability_test_xnavi.exe' -Arguments @('capability','--device','PCI-1714,BID#0','--output-dir','daq_capability_results\xnavi_capability') -ExpectedCode 'DEVICE_CAPABILITY_CONFIRMED' -RequiredEvidenceProperties @('trigger_sources','trigger_actions') -RequiredNonEmptyEvidenceFields @('device_description','runtime_path','runtime_version','channel_count','buffer_capacity','trigger_supported')
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
**PASS:** exit `0`,末行 JSON 为 `PASS / DEVICE_CAPABILITY_CONFIRMED`;`evidence` 必须含 `runtime_path`、`runtime_version`、`channel_count`、`buffer_capacity`、`trigger_supported`、`trigger_sources` 和 `trigger_actions`。**FAIL:** exit `5` 表示环境缺失;当前适配器报告的 `RUNTIME_NOT_FOUND`、`ENTRY_POINT_MISSING`、`HEADER_RUNTIME_INCOMPATIBLE`、`DEVICE_NOT_FOUND`、`FEATURE_QUERY_FAILED` 等驱动/运行库调用错误为 exit `6`;明确不支持时为 exit `3 / SKIP`。先按 JSON 的 `code/message` 修复环境。
|
|
217
|
+
|
|
218
|
+
**方案含义与下一步:** 通过建立所有候选方案的设备前置,继续步骤 2;失败则停止全部上机采集,依据机器原因修复 DLL、驱动或设备。
|
|
219
|
+
|
|
220
|
+
**现场记录:** 执行版本:____;执行时间:____;进程退出码:____;最终 result/code:____;输出目录:____;现场备注:____。
|
|
221
|
+
|
|
222
|
+
### [ ] 步骤 2:现有单通道边界是否稳定
|
|
223
|
+
|
|
224
|
+
**问题与方案关系:** 连续三次验证 1 MHz、1600 万点单通道基准,证明测试程序没有破坏既有采集能力;基准失败时不能评价新方案。
|
|
225
|
+
|
|
226
|
+
**前置:** 步骤 1 通过,AI0 接安全范围内的代表性样品信号,内存和磁盘空间充足。
|
|
227
|
+
|
|
228
|
+
```powershell
|
|
229
|
+
Invoke-DaqValidation -Executable 'cpp_build\daq_capability_test_legacy.exe' -Arguments @('suite','--config','src\daq_capability_test\field_test_matrix.tsv','--case','single_channel_boundary') -ExpectedCode 'SUITE_PASSED' -ExpectedCase 'single_channel_boundary' -ExpectedCaseCode 'SINGLE_CHANNEL_BOUNDARY_PASSED'
|
|
230
|
+
Invoke-DaqValidation -Executable 'cpp_build\daq_capability_test_xnavi.exe' -Arguments @('suite','--config','src\daq_capability_test\field_test_matrix.tsv','--case','single_channel_boundary') -ExpectedCode 'SUITE_PASSED' -ExpectedCase 'single_channel_boundary' -ExpectedCaseCode 'SINGLE_CHANNEL_BOUNDARY_PASSED'
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
**PASS:** exit `0`,`cases.single_channel_boundary` 为 `PASS / SINGLE_CHANNEL_BOUNDARY_PASSED`,3/3 点数正确、时长误差达标且无溢出。**FAIL:** exit `2`(`POINT_COUNT_MISMATCH`、`DURATION_OUT_OF_TOLERANCE` 等数据验证失败),exit `6`(`OVERRUN`、`CACHE_OVERFLOW`、`TIMEOUT` 或其他驱动调用错误),exit `3 / SKIP` 表示不支持;原因和重复序号在 JSON 证据中。
|
|
234
|
+
|
|
235
|
+
**方案含义与下一步:** 通过说明既有基准成立,继续步骤 3;失败先解决基础采集稳定性,不能用后续结果评价新方案。
|
|
236
|
+
|
|
237
|
+
**现场记录:** 执行版本:____;执行时间:____;进程退出码:____;最终 result/code:____;输出目录:____;现场备注:____。
|
|
238
|
+
|
|
239
|
+
### [ ] 步骤 3:降低采样率能否覆盖完整低频周期
|
|
240
|
+
|
|
241
|
+
**问题与方案关系:** 检查 500/200/100 kHz 在固定点数内是否覆盖要求周期且信号幅值有效;成功的采样率才支持 `LOW_SAMPLE_RATE` 方案。
|
|
242
|
+
|
|
243
|
+
**前置:** 步骤 2 通过,脉冲发生器经正式样品路径稳定输出,配置频率与实际一致。
|
|
244
|
+
|
|
245
|
+
```powershell
|
|
246
|
+
Invoke-DaqValidation -Executable 'cpp_build\daq_capability_test_legacy.exe' -Arguments @('suite','--config','src\daq_capability_test\field_test_matrix.tsv','--case','low_sample_rate') -ExpectedCode 'SUITE_PASSED' -ExpectedCase 'low_sample_rate' -ExpectedCaseCode 'LOW_SAMPLE_RATE_PASSED'
|
|
247
|
+
Invoke-DaqValidation -Executable 'cpp_build\daq_capability_test_xnavi.exe' -Arguments @('suite','--config','src\daq_capability_test\field_test_matrix.tsv','--case','low_sample_rate') -ExpectedCode 'SUITE_PASSED' -ExpectedCase 'low_sample_rate' -ExpectedCaseCode 'LOW_SAMPLE_RATE_PASSED'
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
**PASS:** exit `0`,`cases.low_sample_rate` 为 `PASS / LOW_SAMPLE_RATE_PASSED`,`evidence.passed_sample_rates_hz` 列出通过采样率;至少一个配置采样率通过即接受该方案。**FAIL:** exit `2`,如 `WINDOW_TOO_SHORT`、`SIGNAL_SPAN_TOO_LOW`、`POINT_COUNT_MISMATCH`;全部失败则拒绝 `LOW_SAMPLE_RATE`,部分失败记录在 `evidence.failed_sample_rates_hz`。
|
|
251
|
+
|
|
252
|
+
**方案含义与下一步:** 仅采用 `passed_sample_rates_hz` 中的档位;无通过档位则排除降采样率方案。无论结论如何,继续步骤 4 验证独立的相位拼接路径。
|
|
253
|
+
|
|
254
|
+
**现场记录:** 执行版本:____;执行时间:____;进程退出码:____;最终 result/code:____;输出目录:____;现场备注:____。
|
|
255
|
+
|
|
256
|
+
### [ ] 步骤 4:双通道原始参考是否有效
|
|
257
|
+
|
|
258
|
+
**问题与方案关系:** 确认 AI0 样品响应和 AI1 样品前分路参考同步、等点数、同时间轴;这是软件相位定位和拼接的硬件前提。
|
|
259
|
+
|
|
260
|
+
**前置:** 按“接线与安全”完成 AI0/AI1 分路,AI1 幅值、偏置、接地/隔离均安全。
|
|
261
|
+
|
|
262
|
+
```powershell
|
|
263
|
+
Invoke-DaqValidation -Executable 'cpp_build\daq_capability_test_legacy.exe' -Arguments @('suite','--config','src\daq_capability_test\field_test_matrix.tsv','--case','dual_channel_reference') -ExpectedCode 'SUITE_PASSED' -ExpectedCase 'dual_channel_reference' -ExpectedCaseCode 'REFERENCE_SIGNAL_VALID'
|
|
264
|
+
Invoke-DaqValidation -Executable 'cpp_build\daq_capability_test_xnavi.exe' -Arguments @('suite','--config','src\daq_capability_test\field_test_matrix.tsv','--case','dual_channel_reference') -ExpectedCode 'SUITE_PASSED' -ExpectedCase 'dual_channel_reference' -ExpectedCaseCode 'REFERENCE_SIGNAL_VALID'
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
**PASS:** exit `0`,`cases.dual_channel_reference` 为 `PASS / REFERENCE_SIGNAL_VALID`,两通道点数相等、参考幅值有效且重复稳定。**FAIL:** exit `2`(如 `SIGNAL_SPAN_TOO_LOW`、`CHANNEL_POINT_COUNT_MISMATCH`),exit `3 / SKIP`(如 `CHANNEL_COUNT_UNSUPPORTED`、`CHANNEL_INDEX_UNSUPPORTED`),或 exit `6` 的驱动错误。失败即停止步骤 5/6。
|
|
268
|
+
|
|
269
|
+
**方案含义与下一步:** 通过证明相位参考硬件路径成立,继续步骤 5;失败则排除软件相位拼接,先修复分路、量程或通道能力。
|
|
270
|
+
|
|
271
|
+
**现场记录:** 执行版本:____;执行时间:____;进程退出码:____;最终 result/code:____;输出目录:____;现场备注:____。
|
|
272
|
+
|
|
273
|
+
### [ ] 步骤 5:每个短片段能否定位相位
|
|
274
|
+
|
|
275
|
+
**问题与方案关系:** 用 AI1 方波边沿标定 AI0 样本在激励周期中的位置;拒绝无边沿且起点未知的片段,防止错误拼接。
|
|
276
|
+
|
|
277
|
+
**前置:** 步骤 4 通过,频率、参考占空比、占空比误差和最大边沿抖动已填写。
|
|
278
|
+
|
|
279
|
+
```powershell
|
|
280
|
+
Invoke-DaqValidation -Executable 'cpp_build\daq_capability_test_legacy.exe' -Arguments @('suite','--config','src\daq_capability_test\field_test_matrix.tsv','--case','segment_phase') -ExpectedCode 'SUITE_PASSED' -ExpectedCase 'segment_phase' -ExpectedCaseCode 'SEGMENT_PHASE_RESOLVED'
|
|
281
|
+
Invoke-DaqValidation -Executable 'cpp_build\daq_capability_test_xnavi.exe' -Arguments @('suite','--config','src\daq_capability_test\field_test_matrix.tsv','--case','segment_phase') -ExpectedCode 'SUITE_PASSED' -ExpectedCase 'segment_phase' -ExpectedCaseCode 'SEGMENT_PHASE_RESOLVED'
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
**PASS:** exit `0`,`PASS / SEGMENT_PHASE_RESOLVED`,证据含边沿数、实测周期/占空比及抖动。**FAIL:** exit `2`,如 `EDGE_NOT_FOUND`、`SEGMENT_PHASE_UNKNOWN`、`REFERENCE_FREQUENCY_MISMATCH`、`REFERENCE_DUTY_CYCLE_MISMATCH`、`EDGE_JITTER_EXCEEDED`。程序不得猜测相位。
|
|
285
|
+
|
|
286
|
+
**方案含义与下一步:** 通过说明短片段可放入统一相位坐标,继续步骤 6;失败则排除当前参数下的拼接,调整参考质量或采集窗口后重测。
|
|
287
|
+
|
|
288
|
+
**现场记录:** 执行版本:____;执行时间:____;进程退出码:____;最终 result/code:____;输出目录:____;现场备注:____。
|
|
289
|
+
|
|
290
|
+
### [ ] 步骤 6:能否重建 N 个独立完整周期
|
|
291
|
+
|
|
292
|
+
**问题与方案关系:** 多次分段采样只有在相位覆盖完整、片段重叠一致、样品稳定、周期边界连续,并且每个重建周期使用互不复用的片段时,才支持 `PHASE_STITCHING`。
|
|
293
|
+
|
|
294
|
+
**前置:** 步骤 4/5 通过;N、phase bin、每 bin 最少样本、重叠/漂移/边界阈值和最大尝试次数已确认。
|
|
295
|
+
|
|
296
|
+
```powershell
|
|
297
|
+
# Legacy:在线采集通过后,自动使用机器返回的实际目录离线复核。
|
|
298
|
+
$capture = Invoke-DaqValidation -Executable 'cpp_build\daq_capability_test_legacy.exe' -Arguments @('phase-stitch','capture','--config','src\daq_capability_test\field_test_matrix.tsv','--output-dir','daq_capability_results\legacy_phase') -ExpectedCode 'N_INDEPENDENT_WAVEFORMS_RECONSTRUCTED' -RequiredNonEmptyEvidenceFields @('run_directory','requested_waveforms','reconstructed_waveforms')
|
|
299
|
+
$runDirectory = $capture.evidence.run_directory
|
|
300
|
+
if (-not $runDirectory) { throw 'exit=0 code=RUN_DIRECTORY_MISSING message=capture PASS 但未返回 evidence.run_directory evidence={}' }
|
|
301
|
+
$reconstruct = Invoke-DaqValidation -Executable 'cpp_build\daq_capability_test_legacy.exe' -Arguments @('phase-stitch','reconstruct','--input-dir',$runDirectory,'--config','src\daq_capability_test\field_test_matrix.tsv','--output-dir','daq_capability_results\legacy_reconstruct') -ExpectedCode 'N_INDEPENDENT_WAVEFORMS_RECONSTRUCTED' -RequiredNonEmptyEvidenceFields @('run_directory','requested_waveforms','reconstructed_waveforms')
|
|
302
|
+
"PASS code=$($reconstruct.code) input=$runDirectory output=$($reconstruct.evidence.run_directory)"
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
```powershell
|
|
306
|
+
# XNavi:在线采集通过后,自动使用机器返回的实际目录离线复核。
|
|
307
|
+
$capture = Invoke-DaqValidation -Executable 'cpp_build\daq_capability_test_xnavi.exe' -Arguments @('phase-stitch','capture','--config','src\daq_capability_test\field_test_matrix.tsv','--output-dir','daq_capability_results\xnavi_phase') -ExpectedCode 'N_INDEPENDENT_WAVEFORMS_RECONSTRUCTED' -RequiredNonEmptyEvidenceFields @('run_directory','requested_waveforms','reconstructed_waveforms')
|
|
308
|
+
$runDirectory = $capture.evidence.run_directory
|
|
309
|
+
if (-not $runDirectory) { throw 'exit=0 code=RUN_DIRECTORY_MISSING message=capture PASS 但未返回 evidence.run_directory evidence={}' }
|
|
310
|
+
$reconstruct = Invoke-DaqValidation -Executable 'cpp_build\daq_capability_test_xnavi.exe' -Arguments @('phase-stitch','reconstruct','--input-dir',$runDirectory,'--config','src\daq_capability_test\field_test_matrix.tsv','--output-dir','daq_capability_results\xnavi_reconstruct') -ExpectedCode 'N_INDEPENDENT_WAVEFORMS_RECONSTRUCTED' -RequiredNonEmptyEvidenceFields @('run_directory','requested_waveforms','reconstructed_waveforms')
|
|
311
|
+
"PASS code=$($reconstruct.code) input=$runDirectory output=$($reconstruct.evidence.run_directory)"
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
**PASS:** exit `0`,`PASS / N_INDEPENDENT_WAVEFORMS_RECONSTRUCTED`;证据给出请求/实际 N、每周期互不复用的片段 ID、覆盖率、空 bin、重叠误差、响应漂移和边界跳变。**FAIL:** exit `2`,如 `INSUFFICIENT_PHASE_COVERAGE`、`EMPTY_PHASE_BINS`、`INSUFFICIENT_SEGMENT_OVERLAP`、`OVERLAP_MISMATCH`、`NON_STATIONARY_RESPONSE`、`WAVEFORM_BOUNDARY_DISCONTINUITY`、`INSUFFICIENT_COMPLETE_WAVEFORMS`、`MAX_ATTEMPTS_EXCEEDED`;失败结果不会带有效完成标记。
|
|
315
|
+
|
|
316
|
+
**方案含义与下一步:** 只有该 PASS 才接受 `PHASE_STITCHING`,且只接受证据声明的 N;失败按专用 code 定位覆盖、重叠、漂移或边界问题。随后可继续步骤 7 验证独立的硬件触发方案。
|
|
317
|
+
|
|
318
|
+
**现场记录:** 执行版本:____;执行时间:____;进程退出码:____;最终 result/code:____;输出目录:____;现场备注:____。
|
|
319
|
+
|
|
320
|
+
### [ ] 步骤 7:外部触发能否统一起点
|
|
321
|
+
|
|
322
|
+
**问题与方案关系:** 验证脉冲边沿能否稳定启动采集;失败只否定硬件触发统一起点,不自动否定 AI1 软件相位拼接。
|
|
323
|
+
|
|
324
|
+
**前置:** 同步输出已安全接外部触发端,触发源/边沿已填写,并把 `external_trigger` 设为 `true`。
|
|
325
|
+
|
|
326
|
+
```powershell
|
|
327
|
+
Invoke-DaqValidation -Executable 'cpp_build\daq_capability_test_legacy.exe' -Arguments @('suite','--config','src\daq_capability_test\field_test_matrix.tsv','--case','external_trigger') -ExpectedCode 'SUITE_PASSED' -ExpectedCase 'external_trigger' -ExpectedCaseCode 'EXTERNAL_TRIGGER_STABLE'
|
|
328
|
+
Invoke-DaqValidation -Executable 'cpp_build\daq_capability_test_xnavi.exe' -Arguments @('suite','--config','src\daq_capability_test\field_test_matrix.tsv','--case','external_trigger') -ExpectedCode 'SUITE_PASSED' -ExpectedCase 'external_trigger' -ExpectedCaseCode 'EXTERNAL_TRIGGER_STABLE'
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
**PASS:** exit `0`,`PASS / EXTERNAL_TRIGGER_STABLE`,三次触发且起点抖动达标。**FAIL:** exit `3 / SKIP`(`TRIGGER_UNSUPPORTED`),exit `6`(`TRIGGER_TIMEOUT` 或 `TRIGGER_CONFIG_FAILED`),或 exit `2`(`TRIGGER_START_JITTER_EXCEEDED`)。
|
|
332
|
+
|
|
333
|
+
**方案含义与下一步:** 通过后继续步骤 8;失败则不能使用硬件触发统一起点或延迟方案,但步骤 6 已通过的 AI1 软件拼接结论不受影响。
|
|
334
|
+
|
|
335
|
+
**现场记录:** 执行版本:____;执行时间:____;进程退出码:____;最终 result/code:____;输出目录:____;现场备注:____。
|
|
336
|
+
|
|
337
|
+
### [ ] 步骤 8:触发延迟能否覆盖不同周期位置
|
|
338
|
+
|
|
339
|
+
**问题与方案关系:** 验证多个 delay count 的实测位置和整体覆盖;仅步骤 7/8 都通过才支持 `TRIGGER_DELAY`。
|
|
340
|
+
|
|
341
|
+
**前置:** 步骤 7 通过,delay count 和最大位置误差已填写,`delay_trigger` 已启用。
|
|
342
|
+
|
|
343
|
+
```powershell
|
|
344
|
+
Invoke-DaqValidation -Executable 'cpp_build\daq_capability_test_legacy.exe' -Arguments @('suite','--config','src\daq_capability_test\field_test_matrix.tsv','--case','delay_trigger') -ExpectedCode 'SUITE_PASSED' -ExpectedCase 'delay_trigger' -ExpectedCaseCode 'DELAY_TRIGGER_WINDOW_COVERED'
|
|
345
|
+
Invoke-DaqValidation -Executable 'cpp_build\daq_capability_test_xnavi.exe' -Arguments @('suite','--config','src\daq_capability_test\field_test_matrix.tsv','--case','delay_trigger') -ExpectedCode 'SUITE_PASSED' -ExpectedCase 'delay_trigger' -ExpectedCaseCode 'DELAY_TRIGGER_WINDOW_COVERED'
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
**PASS:** exit `0`,`PASS / DELAY_TRIGGER_WINDOW_COVERED`。程序先用普通触发校准参考周期和占空比,再针对每个 `trigger_delay_counts` 的每次 repeat 成对执行同一 delay 的长窗口 phase probe 和短窗口采集;probe 实测起始相位必须匹配等长的 `trigger_delay_target_phase_percent`,probe 周期必须匹配校准周期和配置频率,短窗口完整参考波形必须匹配 probe 相位。所有短窗口按精确圆周区间合并后必须无缝覆盖 100% 相位。preflight 强制每个短窗口不足一周期且至少配置两个 delay,完整覆盖必须来自多个 delay;程序不使用 `count / sample_rate` 推断 delay 时间。calibration、probe、short 分别写入唯一 raw 文件和 summary 记录。**FAIL:** exit `3 / SKIP` 表示驱动不支持触发延迟;exit `2` 为 `DELAY_POSITION_MISMATCH`、`DELAY_SHORT_PHASE_INCONSISTENT`、`TRIGGER_REFERENCE_PERIOD_DRIFT`、`TRIGGER_REFERENCE_FREQUENCY_MISMATCH`、`TRIGGER_REFERENCE_PERIOD_MISSING` 或 `DELAY_WINDOW_INCOMPLETE`;exit `6` 为驱动调用/超时错误,均拒绝 `TRIGGER_DELAY`。
|
|
349
|
+
|
|
350
|
+
`measured_duration_seconds` 只表示返回采样点构成的采样窗口,`trigger_wait_seconds` 表示触发等待,墙钟总耗时单独记录;相位覆盖只使用“实际返回点数 / 实际采样率”,触发等待再长也不会扩大覆盖区间。
|
|
351
|
+
|
|
352
|
+
单独检查一个 delay 时可运行 `trigger ... --action delay_to_start --delay <count> --target-phase-percent <0..100> --delay-tolerance <us>`。未提供 `--target-phase-percent` 时命令只报告参考边沿和抖动,不宣称 delay 位置已验证;`--delay-tolerance` 仅在提供独立目标相位后参与判定。
|
|
353
|
+
|
|
354
|
+
**方案含义与下一步:** 步骤 7/8 都通过才接受 `TRIGGER_DELAY`;否则按机器原因修改 delay 或排除方案。继续步骤 9 生成统一结论。
|
|
355
|
+
|
|
356
|
+
**现场记录:** 执行版本:____;执行时间:____;进程退出码:____;最终 result/code:____;输出目录:____;现场备注:____。
|
|
357
|
+
|
|
358
|
+
### [ ] 步骤 9:全部启用问题能否一次通过
|
|
359
|
+
|
|
360
|
+
**问题与方案关系:** 按依赖顺序汇总所有启用检查,机器给出可采用和被排除的方案;单项失败仍继续收集其他独立问题。
|
|
361
|
+
|
|
362
|
+
**前置:** 步骤 0 通过,所有已启用 case 的接线已完成。
|
|
363
|
+
|
|
364
|
+
```powershell
|
|
365
|
+
Invoke-DaqValidation -Executable 'cpp_build\daq_capability_test_legacy.exe' -Arguments @('suite','--config','src\daq_capability_test\field_test_matrix.tsv','--all') -ExpectedCode 'SUITE_PASSED' -RequiredTopLevelFields @('supported_strategies','rejected_strategies','skipped_cases','cases','failed_cases')
|
|
366
|
+
Invoke-DaqValidation -Executable 'cpp_build\daq_capability_test_xnavi.exe' -Arguments @('suite','--config','src\daq_capability_test\field_test_matrix.tsv','--all') -ExpectedCode 'SUITE_PASSED' -RequiredTopLevelFields @('supported_strategies','rejected_strategies','skipped_cases','cases','failed_cases')
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
**PASS:** exit `0`,末行 JSON `result=PASS`,并列出 `supported_strategies`、`rejected_strategies`、`skipped_cases` 和证据。**FAIL:** 任一 FAIL 导致非零退出;`failed_cases` 列出所有错误 code/原因/证据,依赖不足为 `SKIP / PREREQUISITE_FAILED`。结论必须按 JSON,不得用“有些 case 通过”替代总失败。
|
|
370
|
+
|
|
371
|
+
**方案含义与下一步:** 以 `supported_strategies` 作为可采用方案清单,以 `rejected_strategies` 和 `failed_cases` 安排整改;整改后用 `--case` 或 `--from` 重跑,最终保存完整输出目录作为验收记录。
|
|
372
|
+
|
|
373
|
+
**现场记录:** 执行版本:____;执行时间:____;进程退出码:____;最终 result/code:____;输出目录:____;现场备注:____。
|
|
374
|
+
|
|
375
|
+
## 一键、单项与断点执行
|
|
376
|
+
|
|
377
|
+
一键执行使用 `--all`;单独定位一个问题使用 `--case`;修正现场问题后从指定 case 到末尾使用 `--from`。三者互斥。Legacy 和 XNavi 均支持:
|
|
378
|
+
|
|
379
|
+
```powershell
|
|
380
|
+
Invoke-DaqValidation -Executable 'cpp_build\daq_capability_test_legacy.exe' -Arguments @('suite','--config','src\daq_capability_test\field_test_matrix.tsv','--all') -ExpectedCode 'SUITE_PASSED' -RequiredTopLevelFields @('supported_strategies','rejected_strategies','skipped_cases','cases','failed_cases')
|
|
381
|
+
Invoke-DaqValidation -Executable 'cpp_build\daq_capability_test_legacy.exe' -Arguments @('suite','--config','src\daq_capability_test\field_test_matrix.tsv','--case','phase_stitch') -ExpectedCode 'SUITE_PASSED' -ExpectedCase 'phase_stitch' -ExpectedCaseCode 'N_INDEPENDENT_WAVEFORMS_RECONSTRUCTED' -RequiredTopLevelFields @('supported_strategies','rejected_strategies','skipped_cases','cases','failed_cases')
|
|
382
|
+
Invoke-DaqValidation -Executable 'cpp_build\daq_capability_test_legacy.exe' -Arguments @('suite','--config','src\daq_capability_test\field_test_matrix.tsv','--from','dual_channel_reference') -ExpectedCode 'SUITE_PASSED' -RequiredTopLevelFields @('supported_strategies','rejected_strategies','skipped_cases','cases','failed_cases')
|
|
383
|
+
Invoke-DaqValidation -Executable 'cpp_build\daq_capability_test_xnavi.exe' -Arguments @('suite','--config','src\daq_capability_test\field_test_matrix.tsv','--all') -ExpectedCode 'SUITE_PASSED' -RequiredTopLevelFields @('supported_strategies','rejected_strategies','skipped_cases','cases','failed_cases')
|
|
384
|
+
Invoke-DaqValidation -Executable 'cpp_build\daq_capability_test_xnavi.exe' -Arguments @('suite','--config','src\daq_capability_test\field_test_matrix.tsv','--case','phase_stitch') -ExpectedCode 'SUITE_PASSED' -ExpectedCase 'phase_stitch' -ExpectedCaseCode 'N_INDEPENDENT_WAVEFORMS_RECONSTRUCTED' -RequiredTopLevelFields @('supported_strategies','rejected_strategies','skipped_cases','cases','failed_cases')
|
|
385
|
+
Invoke-DaqValidation -Executable 'cpp_build\daq_capability_test_xnavi.exe' -Arguments @('suite','--config','src\daq_capability_test\field_test_matrix.tsv','--from','dual_channel_reference') -ExpectedCode 'SUITE_PASSED' -RequiredTopLevelFields @('supported_strategies','rejected_strategies','skipped_cases','cases','failed_cases')
|
|
386
|
+
```
|
|
387
|
+
|
|
388
|
+
`--case` 仍会自动检查该 case 的依赖,不能绕过安全前置;`--from` 是重新采集,不会把上次结果当成本次通过证据。
|
|
389
|
+
|
|
390
|
+
## 上机前本地 Mock
|
|
391
|
+
|
|
392
|
+
Mock 使用与现场程序相同的 CLI、矩阵解析、采集调度、相位重建、自动判定和结果写入,但不加载厂商头文件、DLL 或设备。先执行:
|
|
393
|
+
|
|
394
|
+
```powershell
|
|
395
|
+
scons -Q cpp_build/daq_capability_test_mock.exe
|
|
396
|
+
Invoke-DaqValidation -Executable 'cpp_build\daq_capability_test_mock.exe' -Arguments @('suite','--config','src\daq_capability_test\mock_success.tsv','--all') -ExpectedCode 'SUITE_PASSED' -ExpectedSupportedStrategies @('LOW_SAMPLE_RATE','PHASE_STITCHING','TRIGGER_DELAY') -StrategyMatch Exact -RequiredTopLevelFields @('supported_strategies','rejected_strategies','skipped_cases','cases','failed_cases')
|
|
397
|
+
Invoke-DaqValidation -Executable 'cpp_build\daq_capability_test_mock.exe' -Arguments @('suite','--config','src\daq_capability_test\mock_non_stationary.tsv','--all') -ExpectedExit 2 -ExpectedResult 'FAIL' -ExpectedCode 'SUITE_FAILED' -ExpectedFailedCase 'phase_stitch' -ExpectedFailedCode 'NON_STATIONARY_RESPONSE'
|
|
398
|
+
python -m unittest tests.daq_capability_test.test_mock_cli -v
|
|
399
|
+
```
|
|
400
|
+
|
|
401
|
+
第一条 suite 应 exit `0` 并支持 `LOW_SAMPLE_RATE`、`PHASE_STITCHING`、`TRIGGER_DELAY`;non-stationary 场景应故意 exit `2` 并报告 `NON_STATIONARY_RESPONSE`;Python 测试还逐项确认短读、超时、溢出、参考缺失、边沿缺失/抖动、覆盖不足、重叠不一致、边界跳变和触发延迟错误都保留专用 code。
|
|
402
|
+
|
|
403
|
+
Mock 能在上机前发现配置解析、依赖顺序、返回码、JSON、错误传播、N 个周期的片段独立性、写盘和失败兜底问题。它不能证明 PCI-1714U、实际 DLL/API、量程、接线、电气安全、真实吞吐、触发或样品稳定性;这些必须按步骤 0-9 在目标机实测。
|
|
404
|
+
|
|
405
|
+
结果写入 `daq_capability_results/<时间戳>/`(或命令指定的输出根目录)。产物按命令和执行结果生成,不能假定每个目录都有全部文件:
|
|
406
|
+
|
|
407
|
+
| 条件 | 应有产物 |
|
|
408
|
+
| --- | --- |
|
|
409
|
+
| 所有已开始的运行 | `environment.tsv`、`summary.tsv`、`test_log.txt` |
|
|
410
|
+
| `suite` | 上述文件及本次实际配置快照 `matrix.tsv` |
|
|
411
|
+
| 采集 case、phase capture | 上述适用文件及 `raw/*.tsv` |
|
|
412
|
+
| `capability` | 上述通用文件及 `capability.tsv` |
|
|
413
|
+
| 整个命令成功 | `capture.complete` |
|
|
414
|
+
| 命令失败、SKIP 或输出未完整落盘 | 不得存在 `capture.complete` |
|
|
415
|
+
|
|
416
|
+
正式验收保存整个结果目录。`capture.complete` 只证明该命令要求的数据已经完整写入且命令判定成功;其余文件是否存在必须按上表和实际命令判断。
|
|
Binary file
|
|
@@ -16,6 +16,11 @@ class Result:
|
|
|
16
16
|
"voltage_not_enough": "电压不足",
|
|
17
17
|
"wave_not_found": "未找到波形",
|
|
18
18
|
"appropriate_wave_not_found": "未找到合适波形",
|
|
19
|
+
"invalid_instant_ai_config": "Instant AI配置无效",
|
|
20
|
+
"instant_ai_coverage_insufficient": "Instant AI相位覆盖不足",
|
|
21
|
+
"instant_ai_schedule_timeout": "Instant AI采集超时",
|
|
22
|
+
"instant_ai_alignment_failed": "Instant AI波形对齐失败",
|
|
23
|
+
"instant_ai_waveform_count_insufficient": "Instant AI完整波形数量不足",
|
|
19
24
|
|
|
20
25
|
# 警告类错误
|
|
21
26
|
"warning_intr_not_available": "中断资源不可用",
|
|
@@ -78,6 +83,9 @@ class Result:
|
|
|
78
83
|
self.waveform_length = 0 # 一个完整波形的点数(包括上升沿和下降沿)
|
|
79
84
|
self.valid_length = 0 # 有效的波形点数(仅包含上升沿部分)
|
|
80
85
|
self.number_of_waveforms = 0 # 波形平均次数
|
|
86
|
+
self.acquisition_mode = ""
|
|
87
|
+
self.instant_ai_late_reads = 0
|
|
88
|
+
self.instant_ai_interpolated_bins = 0
|
|
81
89
|
self.wave = []
|
|
82
90
|
self.time_line = []
|
|
83
91
|
self.estimate = []
|
|
@@ -60,13 +60,23 @@ class Sampler:
|
|
|
60
60
|
def is_measuring(self) -> bool:
|
|
61
61
|
return self.communicate('is_measuring').measuring
|
|
62
62
|
|
|
63
|
-
def measure(self, number_of_waveforms: int, emitting_frequency: float, auto_mode: bool = False
|
|
64
|
-
|
|
63
|
+
def measure(self, number_of_waveforms: int, emitting_frequency: float, auto_mode: bool = False,
|
|
64
|
+
instant_ai_frequency_threshold: float = 0.0,
|
|
65
|
+
instant_ai_target_points_per_waveform: int = 100) -> Result:
|
|
66
|
+
command = "to_measure {} {:.12g} {}".format(number_of_waveforms, emitting_frequency, auto_mode)
|
|
67
|
+
if instant_ai_frequency_threshold != 0.0 or instant_ai_target_points_per_waveform != 100:
|
|
68
|
+
command += " {:.12g} {}".format(
|
|
69
|
+
instant_ai_frequency_threshold, instant_ai_target_points_per_waveform)
|
|
70
|
+
return self.communicate(command)
|
|
65
71
|
|
|
66
72
|
def dump(self, filename: str, number_of_waveforms: int, emitting_frequency: float,
|
|
67
|
-
auto_mode: bool = False
|
|
68
|
-
|
|
69
|
-
|
|
73
|
+
auto_mode: bool = False, instant_ai_frequency_threshold: float = 0.0,
|
|
74
|
+
instant_ai_target_points_per_waveform: int = 100) -> Result:
|
|
75
|
+
command = "to_dump {} {} {:.12g} {}".format(filename, number_of_waveforms, emitting_frequency, auto_mode)
|
|
76
|
+
if instant_ai_frequency_threshold != 0.0 or instant_ai_target_points_per_waveform != 100:
|
|
77
|
+
command += " {:.12g} {}".format(
|
|
78
|
+
instant_ai_frequency_threshold, instant_ai_target_points_per_waveform)
|
|
79
|
+
return self.communicate(command)
|
|
70
80
|
|
|
71
81
|
def process(self, filename: str) -> Result:
|
|
72
82
|
return self.communicate("to_process {}".format(filename))
|
half_sample-0.1.17/README.md
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
# Half.Sample
|
|
2
|
-
|
|
3
|
-
[](https://ci.appveyor.com/project/Wingsgo/half-sample)
|
|
4
|
-
|
|
5
|
-
Sample, C++ Program in Half Application with Python Module
|
|
6
|
-
|
|
7
|
-
## Requirements
|
|
8
|
-
|
|
9
|
-
Python Requirements:
|
|
10
|
-
|
|
11
|
-
1. st
|
|
12
|
-
2. typing
|
|
13
|
-
|
|
14
|
-
Others:
|
|
15
|
-
|
|
16
|
-
1. C++11 environment
|
|
17
|
-
2. scons
|
|
18
|
-
|
|
19
|
-
You can also refer to the Travis-CI config file: `.travis.yml`, or Appveyor config file: `appveyor.yml`.
|
|
20
|
-
|
|
Binary file
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|