reflow-profile-compliance-toolkit
Deterministic handbook-grounded retrieval + thermocouple computations for reflow profile compliance outputs (ramp, TAL, peak, feasibility, best-run selection) with stable sensor-selection rules.
- License 许可
- Apache-2.0
- 最近更新
- 2026-11-14
- Stars
- ★ 0
- Forks
- 1
01 前言 Front Matter
- name
- reflow-profile-compliance-toolkit
- description
- Deterministic handbook-grounded retrieval + thermocouple computations for reflow profile compliance outputs (ramp, TAL, peak, feasibility, best-run selection) with stable sensor-selection rules.
03 SKILL.md 正文
Steps
-
From the task questions, list the required handbook items to extract (definitions, regions/windows, numeric limits, and thermocouple “representative/cold-spot” selection guidance).
-
Search handbook.pdf for these sections/tables and extract a compact
cfgused by all computations:- Thermal profile overview: “preheat”, “soak”, “reflow”, “cooling”
- Ramp/slope guidance: “°C/s”
- Liquidus & TAL/wetting time: “liquidus”, “time above liquidus”, “TAL”, “wetting”
- Peak guidance: “minimum peak”, “margin above liquidus”
- Conveyor/dwell feasibility: “conveyor speed”, “dwell time”, “heated length”, “time-in-oven”
- Thermocouple placement: “cold spot”, “representative sensor”
cfg = { "preheat_region": {...}, # temp_band / zone_band / time_band "ramp_limit_c_per_s": ..., "tal_threshold_c_source": "solder_liquidus_c", "tal_min_s": ..., "tal_max_s": ..., "peak_margin_c": ..., "conveyor_rule": {...}, } -
Load
/app/data/mes_log.csvand/app/data/thermocouples.csv(and/app/data/test_defects.csvwhen ranking runs for Q05). Coercerun_id/tc_idto strings, and sort deterministically (stablemergesort). Always sort TC samples bytime_sbefore any calculation and ignore segments wheredt <= 0. If using MESsolder_liquidus_cas the TAL threshold, check for missing values and handle explicitly (fallback to handbook liquidus ornull). -
Compute thermocouple metrics using deterministic recipes:
- Max ramp in the handbook-defined preheat region: finite-difference slope on consecutive samples, filtered to the region.
- TAL: time at-or-above the liquidus threshold using linear interpolation at crossings (do not “count samples”).
- Peak per TC:
max(temp_c). Use reference implementations (same logic for all runs/TCs):
def max_slope_in_temp_band(df_tc, tmin, tmax): g = df_tc.sort_values("time_s") t = g["time_s"].to_numpy(dtype=float) y = g["temp_c"].to_numpy(dtype=float) best = None for i in range(1, len(g)): dt = t[i] - t[i-1] if dt <= 0: continue if (tmin <= y[i-1] <= tmax) and (tmin <= y[i] <= tmax): s = (y[i] - y[i-1]) / dt best = s if best is None else max(best, s) return bestdef time_above_threshold_s(df_tc, thr): g = df_tc.sort_values("time_s") t = g["time_s"].to_numpy(dtype=float) y = g["temp_c"].to_numpy(dtype=float) total = 0.0 for i in range(1, len(g)): t0, t1 = t[i-1], t[i] y0, y1 = y[i-1], y[i] if t1 <= t0: continue a0 = (y0 >= thr) a1 = (y1 >= thr) if a0 and a1: total += (t1 - t0) elif (a0 != a1) and (y1 != y0): frac = (thr - y0) / (y1 - y0) tcross = t0 + frac * (t1 - t0) total += (tcross - t0) if a0 else (t1 - tcross) return total -
Apply fixed, handbook-driven representative thermocouple selection (deterministic; define the rule up front and apply it uniformly):
- Q01 ramp: select the TC with maximum preheat ramp; tie-break by smallest
tc_id. - Q02 TAL: compute
tal_sfor each TC in the run, then select the TC that is worst vs the handbook TAL window. Use a single “window margin” score per TC:
margin = min(tal_s - tal_min_s, tal_max_s - tal_s)(negative means violation).
Pick the TC with the smallestmargin; tie-break by smallesttc_id. Report that TC’stal_s. Set runstatusto "compliant" iff the smallest margin is >= 0 (i.e., no TC violates the window). - Q03 peak: select the TC with minimum peak temperature; tie-break by smallest
tc_id.
- Q01 ramp: select the TC with maximum preheat ramp; tie-break by smallest
-
Build outputs with strict completeness and determinism:
- Emit outputs exactly to
/app/output/q01.json…/app/output/q05.json. - Q02 deliverable rule: emit one record per
run_idin MES; if a run has no usable TAL computation, settc_id: null,tal_s: null, andstatus: non-compliant. - Sort arrays lexicographically by
run_id(and other keys as specified). - Round floats to 2 decimals; replace missing/invalid/NaN/Inf with
null.
def r2(x): if x is None: return None if isinstance(x, float) and (math.isnan(x) or math.isinf(x)): return None return float(round(float(x), 2)) - Emit outputs exactly to
-
Treat the task as complete only after writing the required JSON outputs under
/app/outputand verifying:/app/output/q01.json…/app/output/q05.jsonexist andjson.load()parses them- Q02 row count matches the number of MES runs (coverage check)
- no NaN/Inf values remain after rounding/nulling
- sensor-selection tie-breaks are stable and documented in code comments
Expected Result
A reproducible, handbook-auditable pipeline that (1) extracts limits/windows from the handbook, (2) computes ramp/TAL/peak using deterministic segment math and interpolation, (3) for Q02 selects the worst-window-margin thermocouple based on TAL itself (not a peak-temperature proxy), and (4) writes complete, correctly-sorted JSON outputs for every run.
04 同仓库更多 Skills
video-frame-extraction
Extract frames from video files and save them as images using OpenCV
openai-vision
Analyze images and multi-frame sequences using OpenAI GPT vision models
image-ocr
Extract text content from images using Tesseract OCR via Python, including structured field extraction from receipts and forms
video-frame-extraction
Extract frames from video files and save them as images using OpenCV
openai-vision
Analyze images and multi-frame sequences using OpenAI GPT vision models
image-ocr
Extract text content from images using Tesseract OCR via Python, including structured field extraction from receipts and forms