← Commit history

Merge PR #666: 0.2.143: adopt adom-fields 0.10.20 (fields-0.10.20-0.2.143 -> main) merge

Colby Knox ·b5d76407a5 · ·parents 73225f6, b21324c

Showing changes introduced by the merge (against its first parent).

10 files changed +81−19
Cargo.lock+11−11
@@ -4,7 +4,7 @@ version = 4  [[package]] name = "adom-aiflow"-version = "0.2.142"+version = "0.2.143" dependencies = [  "aiflow-analyze",  "aiflow-board",@@ -28,7 +28,7 @@ dependencies = [  [[package]] name = "aiflow-analyze"-version = "0.2.142"+version = "0.2.143" dependencies = [  "aiflow-board",  "aiflow-sys",@@ -39,7 +39,7 @@ dependencies = [  [[package]] name = "aiflow-board"-version = "0.2.142"+version = "0.2.143" dependencies = [  "aiflow-sys",  "roxmltree",@@ -49,7 +49,7 @@ dependencies = [  [[package]] name = "aiflow-bridge"-version = "0.2.142"+version = "0.2.143" dependencies = [  "aiflow-board",  "aiflow-sys",@@ -59,7 +59,7 @@ dependencies = [  [[package]] name = "aiflow-copper"-version = "0.2.142"+version = "0.2.143" dependencies = [  "aiflow-board",  "aiflow-grid",@@ -70,7 +70,7 @@ dependencies = [  [[package]] name = "aiflow-grid"-version = "0.2.142"+version = "0.2.143" dependencies = [  "aiflow-board",  "serde",@@ -79,7 +79,7 @@ dependencies = [  [[package]] name = "aiflow-place"-version = "0.2.142"+version = "0.2.143" dependencies = [  "aiflow-board",  "aiflow-sys",@@ -89,7 +89,7 @@ dependencies = [  [[package]] name = "aiflow-pours"-version = "0.2.142"+version = "0.2.143" dependencies = [  "aiflow-board",  "aiflow-copper",@@ -100,7 +100,7 @@ dependencies = [  [[package]] name = "aiflow-router"-version = "0.2.142"+version = "0.2.143" dependencies = [  "aiflow-board",  "aiflow-grid",@@ -111,7 +111,7 @@ dependencies = [  [[package]] name = "aiflow-run"-version = "0.2.142"+version = "0.2.143" dependencies = [  "aiflow-sys",  "serde",@@ -120,7 +120,7 @@ dependencies = [  [[package]] name = "aiflow-sys"-version = "0.2.142"+version = "0.2.143" dependencies = [  "serde_json", ]
Cargo.toml+1−1
@@ -15,7 +15,7 @@ members = [ ]  [workspace.package]-version = "0.2.142"+version = "0.2.143" edition = "2021" license = "MIT" repository = "https://wiki.adom.inc/adom/adom-aiflow"
crates/adom-aiflow/src/fields_suggest.rs+21
@@ -80,6 +80,19 @@ pub fn heat_paths(fields: &Value) -> Vec<String> {     }).collect() } +/// adom-fields 0.10.20 puts a hot part's watts into its tab net's pads: a part whose spec gives a tabNet that is a small+/// share of its pad area (`tabPadShare` under 0.4, one pin of a SOT-23 or SOIC) reads far hotter than it runs. One line+/// per such part, saying to leave tabNet out unless it has an exposed pad.+pub fn tab_share_lines(fields: &Value) -> Vec<String> {+    fields["chips"].as_array().into_iter().flatten().filter_map(|c| {+        let share = c["tabPadShare"].as_f64().filter(|s| *s < 0.4)?;+        let w = c["watts"].as_f64().unwrap_or(0.0);+        let net = c["tabNet"].as_str().unwrap_or("its tab net");+        Some(format!("{}: all {w:.2} W go through its {net} pad(s), {:.0} % of its pad area: unless it has an exposed pad or tab, take tabNet out of spec.hot and Fields spreads its heat through every pin by pad area",+            c["reference"].as_str().unwrap_or("?"), share * 100.0))+    }).collect()+}+ /// Capacitors within 20 C of their rating in the solve (6), and how many ratings were assumed. pub fn capacitor_lines(fields: &Value) -> Vec<String> {     let caps: Vec<&Value> = fields["review"]["checks"]["capacitors"].as_array().or(fields["review"]["capacitors"].as_array()).into_iter().flatten().collect();@@ -200,6 +213,14 @@ mod tests {         assert!(suggestions(&set, &board(), &fields, &json!({"enclosure": "sealed"})).is_empty());     } +    #[test]+    fn a_one_pin_tab_is_named() {+        let f = json!({"chips": [{"reference": "U7", "watts": 0.8, "tabNet": "GND", "tabPadShare": 0.18}, {"reference": "U2", "watts": 1.0, "tabNet": "GND", "tabPadShare": 0.62}, {"reference": "D1", "watts": 0.1}]});+        let l = tab_share_lines(&f);+        assert_eq!(l.len(), 1);+        assert!(l[0].starts_with("U7: all 0.80 W go through its GND pad(s), 18 % of its pad area"), "{l:?}");+    }+     #[test]     fn the_solves_details_are_read() {         let fields = json!({
crates/adom-aiflow/src/fields_versions.rs+34−2
@@ -17,6 +17,10 @@ //!   fix but stamped 0.10.12; a note on such a solve is harmless.) //! - 0.10.15 (adom/adom-fields#38, PR 23 from King Silver): a `hot` SMD part whose pads are all on B.Cu had its watts //!   put into F.Cu and its tab read there. A two-sided board read about 30 % low, a single-sided one far too hot.+//! - 0.10.20 (adom/adom-fields#42, King Silver and monrad): a hot part's watts went into a fixed 2.4 mm disk around each pad;+//!   they now go onto each pad's own copper. An exposed pad reads cooler, a small pin hotter, the headline peak no longer+//!   sits on bare board beside a pad, and a part whose spec names a one-pin tabNet reads much hotter (a SOIC-8 +26.5 to+//!   +45.6 C). Every board with a hot SMD part solves differently. //! - 0.10.19 (adom/adom-fields#44, #45, Jinwon Kim): a capacitor is a ceramic only when one exists at its value and voltage //!   rating (over 1.5x the largest ceramic at that rating it is electrolytic: 220 uF at 6.3 V, 100 at 16, 47 at 25, 22 at //!   50, 4.7 at 100), and a converter's input is never a switch or bootstrap net even when spec voltages lists one.@@ -71,6 +75,19 @@ pub fn stale_notes(fields: &Value, spec: &Value, board: &Path) -> Vec<String> {             }         }     }+    // 0.10.20: hot-part heat on each pad's own copper instead of a 2.4 mm disk+    if solver < (0, 10, 20) {+        if let Some(b) = plan_board(board, &text) {+            let smd: Vec<String> = spec["hot"].as_object().into_iter().flatten().map(|(r, _)| r.clone())+                .filter(|r| { let p = b.pads_of(r); !p.is_empty() && p.iter().any(|q| !q.thru) }).collect();+            if !smd.is_empty() {+                let top = fields["chips"].as_array().into_iter().flatten().filter_map(|c| c["riseC"].as_f64()).fold(f64::MIN, f64::max);+                let overhang = fields["scales"]["tMax"].as_f64().is_some_and(|t| top > f64::MIN && t > top + 0.5);+                out.push(format!("this Fields solve is adom-fields {}, before 0.10.20, which put each hot part's watts into a 2.4 mm disk around every pad instead of the pad's own copper ({}): an exposed pad read too hot, a small pin too cool, and a one-pin tabNet far too cool{}. Update adom-fields (adom-wiki pkg install adom/adom-fields) and analyze again",+                    version_text(solver), smd.join(", "), if overhang { "; its headline peak sat above every part's rise, on board beside a pad" } else { "" }));+            }+        }+    }     // 0.10.19: a capacitor its own rating rules out as a ceramic, and a switch or bootstrap net taken as a converter input     if solver < (0, 10, 19) {         if let Some(b) = plan_board(board, &text) {@@ -313,7 +330,7 @@ mod tests {         assert!(hot_spec_problems(&wrong, &b)[0].contains("not a net on any of Q1's pads (/GND, /SW)"));         let old = stale_notes(&json!({"inputIdentity": {"solverVersion": "0.10.11"}}), &json!({"hot": {"Q1": {"tabNet": "GND"}}}), &p);         assert!(old.iter().any(|n| n.contains("before 0.10.12") && n.contains("Q1")), "{old:?}");-        assert!(stale_notes(&json!({"inputIdentity": {"solverVersion": "0.10.12"}}), &json!({"hot": {"Q1": {"tabNet": "GND"}}}), &p).is_empty());+        assert!(!stale_notes(&json!({"inputIdentity": {"solverVersion": "0.10.12"}}), &json!({"hot": {"Q1": {"tabNet": "GND"}}}), &p).iter().any(|n| n.contains("before 0.10.12")));         let _ = std::fs::remove_dir_all(&d);     } @@ -352,6 +369,21 @@ mod tests {     }  +    /// adom-fields 0.10.20: every board with a hot SMD part solves differently; a through-hole-only hot part does not+    #[test]+    fn hot_smd_parts_are_told_to_solve_again() {+        let text = r#"(kicad_pcb (gr_rect (start 0 0) (end 30 10) (layer "Edge.Cuts"))+          (footprint "Package_SO:SOIC-8" (layer "F.Cu") (at 5 5) (property "Reference" "U7") (pad "1" smd rect (at 0 0) (size 1 0.6) (layers "F.Cu") (net 0 "")))+          (footprint "Package_TO_SOT_THT:TO-220-3" (layer "F.Cu") (at 20 5) (property "Reference" "Q1") (pad "1" thru_hole circle (at 0 0) (size 2 2) (drill 1) (layers "*.Cu") (net 0 ""))))"#;+        let p = tmp("hot20.kicad_pcb", text);+        let f = json!({"inputIdentity": {"solverVersion": "0.10.19"}, "chips": [{"riseC": 26.5}], "scales": {"tMax": 43.4}});+        let n = stale_notes(&f, &json!({"hot": {"U7": {"watts": 0.8, "tabNet": "GND"}}}), &p);+        assert!(n.iter().any(|x| x.contains("before 0.10.20") && x.contains("(U7)") && x.contains("headline peak sat above")), "{n:?}");+        let tht = stale_notes(&f, &json!({"hot": {"Q1": {"watts": 2.0}}}), &p);+        assert!(!tht.iter().any(|x| x.contains("before 0.10.20")), "{tht:?}");+        assert!(stale_notes(&json!({"inputIdentity": {"solverVersion": "0.10.20"}}), &json!({"hot": {"U7": {"watts": 0.8}}}), &p).is_empty());+    }+     /// adom-fields 0.10.19: a capacitor its rating rules out as a ceramic, and a switch net in spec voltages on a converter     #[test]     fn rated_electrolytics_and_switch_net_inputs_are_told_to_solve_again() {@@ -398,7 +430,7 @@ mod tests {         let old = stale_notes(&json!({"inputIdentity": {"solverVersion": "0.10.14"}}), &spec, &p);         assert!(old.iter().any(|n| n.contains("before 0.10.15") && n.contains("(U2)")), "{old:?}");         assert!(!old.iter().any(|n| n.contains("before 0.10.15") && n.contains("U1")), "a top-side part is unchanged");-        assert!(stale_notes(&json!({"inputIdentity": {"solverVersion": "0.10.15"}}), &spec, &p).is_empty());+        assert!(!stale_notes(&json!({"inputIdentity": {"solverVersion": "0.10.15"}}), &spec, &p).iter().any(|n| n.contains("before 0.10.15")));         let _ = std::fs::remove_dir_all(&dir);     } 
crates/adom-aiflow/src/main.rs+1−1
@@ -6796,7 +6796,7 @@ fn main() {                 Some(fd) => {                     let sug = fields_suggest::suggestions(&spec, &board_now, fd, &requirements_of(&r));                     let mut det = Vec::new();-                    if what == "thermal" { det.extend(fields_suggest::heat_paths(fd)); det.extend(fields_suggest::capacitor_lines(fd)); }+                    if what == "thermal" { det.extend(fields_suggest::heat_paths(fd)); det.extend(fields_suggest::tab_share_lines(fd)); det.extend(fields_suggest::capacitor_lines(fd)); }                     det.extend(fields_suggest::spec_net_lines(fd));                     det.extend(fields_suggest::board_line(fd));                     det.extend(fields_suggest::module_lines(fd, &fields_mod_plan.modules));
docs/release-0.2.143.mdadded+7
@@ -0,0 +1,7 @@+# adom-aiflow 0.2.143++Adopts adom-fields 0.10.20 (adom/adom-fields#42, King Silver and monrad): a hot part's heat now goes onto each pad's own copper instead of a fixed 2.4 mm disk around each pad.++- **Re-solve note:** `analyze` names a solve made before 0.10.20 when the spec has a hot SMD part: an exposed pad read too hot, a small pin too cool, and a one-pin tabNet far too cool. When that solve's headline peak sat above every part's rise (the disk overhanging bare board), the note says so too.+- **One-pin tabs:** `analyze thermal` names a part whose spec tabNet is under 40 % of its pad area (Fields' `tabPadShare`): from 0.10.20 all its watts go through that pin, so unless it has an exposed pad or tab, take tabNet out and Fields spreads its heat through every pin by pad area.+- **The skills:** aiflow-power-layout no longer suggests a tabNet for a SOT-23 (its GND pin is not a tab); both skills say tabNet is only for a part with an exposed pad or tab.
package.json+1−1
@@ -1,7 +1,7 @@ {   "slug": "adom-aiflow",   "type": "app",-  "version": "0.2.142",+  "version": "0.2.143",   "title": "AI Flow",   "description": "Adom's AI Flow: a tool to help the AI follow all of the steps it takes to build a board. One Rust binary with a crate per step (placement helpers, a grid router with Kelvin taps, pours with keepouts, KiCad's DRC gate, live landing through the KiCad Bridge, copper measurement, current and thermal analysis) and a finish line that refuses an unfinished board. Every command answers with hints for the AI; every turn, its thinking time and every rework loop go into run.jsonl, so Claude, Codex and any other engine are compared on the same flow. KiCad, Fusion 360 and Altium Designer today (the same steps and gates through each tool's bridge); Adom's own web apps next.",   "summary": "Adom's AI Flow: a tool to help the AI follow all of the steps it takes to build a board. The AI thinks its way from placement through routing, pours, current and thermal analysis to a delivered video; the binary does the fast, deterministic parts of every step, hands back hints, and keeps a ledger of every turn, every return to an earlier step, and the clock from the prompt to done.",
page.json+1−1
@@ -1,7 +1,7 @@ {   "slug": "adom-aiflow",   "type": "app",-  "version": "0.2.142",+  "version": "0.2.143",   "title": "AI Flow",   "description": "Adom's AI Flow: a tool to help the AI follow all of the steps it takes to build a board. One Rust binary with a crate per step (placement helpers, a grid router with Kelvin taps, pours with keepouts, KiCad's DRC gate, live landing through the KiCad Bridge, copper measurement, current and thermal analysis) and a finish line that refuses an unfinished board. Every command answers with hints for the AI; every turn, its thinking time and every rework loop go into run.jsonl, so Claude, Codex and any other engine are compared on the same flow. KiCad, Fusion 360 and Altium Designer today (the same steps and gates through each tool's bridge); Adom's own web apps next.",   "summary": "Adom's AI Flow: a tool to help the AI follow all of the steps it takes to build a board. The AI thinks its way from placement through routing, pours, current and thermal analysis to a delivered video; the binary does the fast, deterministic parts of every step, hands back hints, and keeps a ledger of every turn, every return to an earlier step, and the clock from the prompt to done.",
skills/adom-aiflow/SKILL.md+3−1
@@ -252,7 +252,9 @@ the library, simulation, current, thermal, fields and export, Fusion for everyth 10. **Heatsink vias.** `thermal-vias plan` (a target per hot part from spec.hot watts and the rise     budget, at least 6) and `thermal-vias land`. A hot part with no exposed tab (an LED, an     inductor, a small leaded IC) is listed with its watts and no tabNet: it is lead-cooled, gets no via-    target, and the Fields solve judges it (docs/lead-cooled-parts.md).+    target, and the Fields solve judges it (docs/lead-cooled-parts.md). Give `tabNet` only to a part with an exposed+    pad or tab: from adom-fields 0.10.20 a tabNet puts all the part's watts through that net's pads, so one pin of a+    SOT-23 or SOIC named as the tab reads far too hot (`analyze thermal` names a tab under 40 % of the part's pad area).     With nothing that dissipates (an empty `spec.hot`, the reason in `hotNote`), `thermal-vias plan` records     the step as not applicable, 0 vias (0.2.80, issue #206); finish refuses that record once spec.hot names a part. 11. **Pours**, then **rounded corners**: `outline round` (1.0 mm default, spec outline.cornerRadius).
skills/aiflow-power-layout/SKILL.md+1−1
@@ -15,7 +15,7 @@ Write `aiflow/spec.json` from the schematic before `start`, with a note on every - `wideNets` for VIN, VOUT, SW, GND (widths in preference order); `midNets` for BOOT. - `kelvin`: the divider's bottom returns to the IC GND pin (`"R3.2": "U1.1"`), the divider's top senses VOUT at the output cap (`"R1.1": "C6.1"`), per the datasheet's layout section. - `loads`: amps and `maxRiseC` per loaded net; VIN at the low end of the input range.-- `hot`: watts per part from calcs.json (aiflow-circuit-design) with the arithmetic in `hotNote`, and `tabNet` (the pin the heat leaves through; a SOT-23 has no pad, so GND and VIN pins are the heatsink).+- `hot`: watts per part from calcs.json (aiflow-circuit-design) with the arithmetic in `hotNote`, and `tabNet` only for a part with an exposed pad or tab (its net). A SOT-23, SOIC or TDFN without one gets no tabNet: adom-fields (0.10.20+) then spreads its heat through every pin by pad area, while a one-pin tabNet puts all its watts through that pin and reads far too hot (`analyze thermal` names such a part). - `pours`: GND on both layers from the outline; VIN and VOUT as `around` pours on F.Cu; SW as an explicit small `polygon`; `notPoured` for BOOT, FB and dividers. - `solidAt` for the IC GND pin and the inductor pads; thermal and stitch vias. - `decoupling` for each local cap and the supply pin it serves (`{"cap": "C2", "pin": "U1.2", "returnPins": ["U1.1"], "maxLengthMm": 3}`): `route` lays that connection before the rail and `gate` reports its copper path against the budget (adom-aiflow SKILL, Spec intent checked by the binary).