STEP 1582 — QCoDeS Instrument primitive v0.1
目的: QCoDeS (Microsoft、 量子計測 lab framework、 十年以上運用) の Instrument + Parameter + Station composition semantics を Rei stack 内 primitive として抽出。 STEP 1569 design-import register の 6 ecosystem 中 5 番目 (EPICS 続き、 STEP 1581 → 本 STEP → 1583 arc)。
QCoDeS core 3 abstraction
| QCoDeS 概念 | 役割 | Rei stack analog |
| Instrument | 実験装置抽象 base class + parameters 集 | {name, parameters: Map} |
| Parameter | 装置の値、 get/set + validator + cache | {name, unit, get, set, validators, cache: {value, timestamp, stale}, maxCacheAge?} |
| Station | Instrument 集合体 (composition) | {name, instruments: Map} |
| Snapshot | 全装置状態 永続記録 (実験再現性の根幹) | snapshotStation() → JSON-safe StationSnapshot |
D-FUMT₈ verdict
| 状況 | verdict |
| validators pass + get success + fresh cache | TRUE |
| cache stale (age > maxCacheAge) — 要更新 | NEITHER (STEP 1571 pattern) |
| never got value (cache.value === null) | ZERO (STEP 1571 sensor no-data) |
| Station 内 duplicate parameter name — 冗長 | BOTH (STEP 1577 継承) |
API
createParameter<T>(name, {unit, get, set, validators, maxCacheAge})
getParameter(param) → Promise<T> // callback 実行 + cache 更新
setParameter(param, value) // validators 検証 + callback + cache 更新
isCacheStale(param, now?) → boolean // maxCacheAge 経過判定
parameterVerdict(param, now?) → D8Verdict
createInstrument(name) / addParameter(inst, param)
createStation(name) / addInstrument(station, inst)
snapshotStation(station, now?) → StationSnapshot // JSON-safe dump
verifyStation(station, now?) → StationVerdict // 集約 verdict
emptyParameterToNoData(param) → SensorNoDataResult | null // STEP 1571 bridge
test 結果 (28/28 PASS)
| section | test |
| 1. Parameter lifecycle | create + get + set + validator fail |
| 2. cache staleness | fresh vs expired (maxCacheAge = 100ms) |
| 3. Instrument composition | DMM w/ voltage + current parameters |
| 4. Station snapshot | 2 instruments + snapshot JSON dump |
| 5. Station verify | 1 empty ZERO / 全 fresh TRUE |
| 6. duplicate name → BOTH | 2 instruments 共有 param name 'shared' |
| 7. STEP 1571 bridge | empty param → SensorNoDataResult / fresh → null |
Honest scope
- QCoDeS の 「実 hardware VISA/SCPI 通信」 は 非実装 (get/set は user-supplied callback)
- QCoDeS の 「dataset + database (SQLite based)」 layer は 非実装
- 「measurement context (async loop + parameter sweep)」 は 非実装 (別 STEP)
- 「Instrument + Parameter + Station 3 abstraction の core semantics 借用」 に絞る、 「QCoDeS 実装」 主張なし
- Rei stack 差異点: D-FUMT₈ verdict integration + STEP 1571 no-data 統一 + STEP 1577 duplicate BOTH pattern 継承
Prior art
- QCoDeS — microsoft/Qcodes、 docs
- STEP 1569 design-import register / STEP 1581 EPICS Channel Access primitive (本 STEP の 直系前段)