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. When the handbook provides both “typical/normal” values and separate “allowable/acceptance/spec” limits, use the allowable/acceptance/spec limits. When extracting/searching via the shell tool, run one command per tool call (or a single chained command with&&) and keep the tool command content to just the command string:- 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": {...}, } - Confirm the required inputs exist under
/app/data(e.g.,ls -l /app/data), then 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: select the handbook’s representative TC for TAL/wetting; if the handbook indicates the “cold spot / slowest-to-reflow” point is representative, operationalize deterministically as the TC with the minimum computed
tal_sin the run; tie-break by smallesttc_id. Computetal_sfor that TC and judge"compliant"ifftal_min_s <= tal_s <= tal_max_s. - 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:
- Ensure
/app/outputexists and emit outputs exactly to/app/output/q01.json…/app/output/q05.json. - Coverage (don’t drop runs): emit results for every
run_idin MES for Q01–Q04 (usingnullwhere needed) and for everyboard_familyin MES for Q05.- Q01:
max_ramp_by_runmust contain eachrun_id; if no usable ramp, settc_id: null,max_preheat_ramp_c_per_s: null(and don’t omit the run). - 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"(still populate required min/max fromcfg). - Q03:
min_peak_by_runmust contain eachrun_id; if a run has no thermocouple data, it is failing (task requirement) and should havetc_id: null,peak_temp_c: null. - Q04: emit one record per
run_id; if required/actual speed can’t be computed, set numeric fieldsnullandmeets: false.
- Q01:
- Sort arrays lexicographically by
run_id(and other keys as specified). For Q05, also sort each record’srunner_up_run_idsascending byrun_id. - 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)) - Ensure
- 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- Q01/Q03 maps cover all MES
run_ids; Q02/Q04 array lengths match the number of MES runs; Q05 length matches the number of MES board families - 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 uses the handbook’s representative/cold-spot thermocouple selection (operationalized as minimum TAL when the handbook indicates cold-spot evaluation), 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