analyze-power-nets
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseAnalyze Power Nets
分析电源网络
When this skill is invoked, perform a full AI-powered analysis of the PCB to identify power nets and recommend track widths.
调用此技能时,将对PCB进行全AI驱动的分析,以识别电源网络并推荐走线宽度。
Step 1: Load and Extract Components
步骤1:加载并提取元件
python
from analyze_power_paths import (
analyze_pcb, get_components_needing_analysis, classify_component,
trace_power_paths, get_power_net_recommendations, format_analysis_report,
ComponentRole
)
components, pcb_data = analyze_pcb("path/to/file.kicad_pcb")
unknown = get_components_needing_analysis(components)python
from analyze_power_paths import (
analyze_pcb, get_components_needing_analysis, classify_component,
trace_power_paths, get_power_net_recommendations, format_analysis_report,
ComponentRole
)
components, pcb_data = analyze_pcb("path/to/file.kicad_pcb")
unknown = get_components_needing_analysis(components)Step 2: Auto-Classify Obvious Components
步骤2:自动分类明显元件
These are already handled automatically - no AI needed:
| Prefix | Role | Reason |
|---|---|---|
| R (resistor) | SHUNT | Pull-ups, voltage dividers |
| C (capacitor) | SHUNT | Decoupling caps |
| L (inductor) | PASS_THROUGH | Series filter element |
| FB (ferrite bead) | PASS_THROUGH | Series filter element |
| F (fuse) | PASS_THROUGH | Series protection |
| LED | CURRENT_SINK | Consumes current |
| SW (switch) | PASS_THROUGH | Power switching |
这些元件会自动处理,无需AI参与:
| 前缀 | 角色 | 原因 |
|---|---|---|
| R(电阻) | SHUNT | 上拉电阻、分压器 |
| C(电容) | SHUNT | 去耦电容 |
| L(电感) | PASS_THROUGH | 串联滤波元件 |
| FB(磁珠) | PASS_THROUGH | 串联滤波元件 |
| F(保险丝) | PASS_THROUGH | 串联保护元件 |
| LED | CURRENT_SINK | 消耗电流 |
| SW(开关) | PASS_THROUGH | 电源开关 |
Step 3: AI Analysis for Unknown Components
步骤3:未知元件的AI分析
For each component in the list, you MUST:
unknown对于列表中的每个元件,你必须:
unknown3a. Identify What It Is
3a. 识别元件类型
Use WebSearch to look up the component:
WebSearch: "<part_value> <footprint_hint> datasheet"Examples:
- - Is it signal or power?
"DB9 connector pinout" - - Rectifier vs signal diode
"1N4004 diode datasheet" - - Power switch or signal amp?
"3906 transistor datasheet" - - Voltage regulator specs
"LT1129 regulator datasheet" - - IC current requirements
"MCF5213 power consumption"
使用WebSearch查询元件:
WebSearch: "<元件值> <封装提示> datasheet"示例:
- - 是信号连接器还是电源连接器?
"DB9 connector pinout" - - 整流二极管还是信号二极管?
"1N4004 diode datasheet" - - 电源开关还是信号放大器?
"3906 transistor datasheet" - - 稳压器规格参数
"LT1129 regulator datasheet" - - IC电流需求
"MCF5213 power consumption"
3b. Determine Its Role
3b. 确定元件角色
Based on the datasheet/search results, classify as:
| Role | Criteria |
|---|---|
| POWER_SOURCE | Supplies current to the board: power jacks, battery connectors, regulator outputs, USB power inputs |
| CURRENT_SINK | Consumes significant current: ICs, MCUs, CPLDs, FPGAs, motor drivers, high-power LEDs |
| PASS_THROUGH | Current flows through it: power switches, transistors used as switches, protection diodes in series |
| SHUNT | Branches off the power path: ESD protection diodes, TVS diodes, signal connectors |
根据datasheet/搜索结果,将元件分类为:
| 角色 | 判断标准 |
|---|---|
| POWER_SOURCE | 为电路板供电:电源插孔、电池连接器、稳压器输出、USB电源输入 |
| CURRENT_SINK | 消耗大量电流:IC、MCU、CPLD、FPGA、电机驱动器、大功率LED |
| PASS_THROUGH | 电流流经该元件:电源开关、用作开关的晶体管、电源路径中的串联保护二极管 |
| SHUNT | 从电源路径分支:ESD保护二极管、TVS二极管、信号连接器 |
3c. Estimate Current Rating
3c. 估算电流额定值
From the datasheet, find:
- For ICs: Total supply current (ICC, IDD)
- For regulators: Maximum output current
- For connectors: Expected load current
从datasheet中查找:
- 对于IC:总电源电流(ICC、IDD)
- 对于稳压器:最大输出电流
- 对于连接器:预期负载电流
3d. Apply Classification
3d. 应用分类
python
classify_component(components, 'J201', ComponentRole.POWER_SOURCE,
current_rating_ma=1000,
notes="DC barrel jack - main power input")python
classify_component(components, 'J201', ComponentRole.POWER_SOURCE,
current_rating_ma=1000,
notes="DC barrel jack - main power input")Step 4: Key Components to Analyze
步骤4:重点分析的元件类型
Focus AI analysis on these component types:
将AI分析集中在以下元件类型:
Power Input Connectors (J*, P*, TB*, CN*)
电源输入连接器(J*, P*, TB*, CN*)
- Question: Is this a power input or signal connector?
- Look for: Connection to power nets, barrel jack footprints, terminal blocks
- Classify as: POWER_SOURCE if it brings power onto the board
- 问题:这是电源输入连接器还是信号连接器?
- 查找要点:与电源网络的连接、桶形插孔封装、接线端子
- 分类为:如果是向电路板供电,则为POWER_SOURCE
Diodes (D* followed by digit)
二极管(D*后跟数字)
- Question: Protection diode, rectifier, or LED?
- Look for: Part number (1N4004 = rectifier, BAT54 = Schottky, LED = LED)
- Classify as:
- SHUNT if reverse protection (cathode to power, anode to GND)
- PASS_THROUGH if series rectifier in power path
- CURRENT_SINK if LED
- 问题:保护二极管、整流二极管还是LED?
- 查找要点:元件型号(1N4004=整流二极管,BAT54=肖特基二极管,LED=发光二极管)
- 分类为:
- 若为反向保护(阴极接电源,阳极接地)则为SHUNT
- 若为电源路径中的串联整流二极管则为PASS_THROUGH
- 若为LED则为CURRENT_SINK
Transistors (Q*)
晶体管(Q*)
- Question: Power switch or signal amplifier?
- Look for: Connections to power nets, gate/base drive signals
- Classify as: PASS_THROUGH if switching power, SHUNT if signal
- 问题:电源开关还是信号放大器?
- 查找要点:与电源网络的连接、栅极/基极驱动信号
- 分类为:若用于开关电源则为PASS_THROUGH,若用于信号则为SHUNT
ICs (U*)
IC(U*)
- Question: How much current does it consume?
- Look for: ICC/IDD in datasheet, number of I/O pins
- Classify as: CURRENT_SINK with appropriate current rating
- Note: Regulators are auto-detected by power_out pins
- 问题:它消耗多少电流?
- 查找要点:datasheet中的ICC/IDD参数、I/O引脚数量
- 分类为:带有相应电流额定值的CURRENT_SINK
- 注意:稳压器会通过power_out引脚自动检测
Voltage Regulators (VR*, or U* with regulator part number)
电压稳压器(VR*,或带有稳压器型号的U*)
- Question: What is the maximum output current?
- Look for: Output current spec in datasheet
- Classify as: POWER_SOURCE with max output current
- 问题:最大输出电流是多少?
- 查找要点:datasheet中的输出电流规格
- 分类为:带有最大输出电流的POWER_SOURCE
Step 5: Trace Power Paths
步骤5:追踪电源路径
After classifying all components:
python
paths = trace_power_paths(pcb_data, components)
recommendations = get_power_net_recommendations(pcb_data, components, paths)完成所有元件分类后:
python
paths = trace_power_paths(pcb_data, components)
recommendations = get_power_net_recommendations(pcb_data, components, paths)Step 6: Generate Report
步骤6:生成报告
python
print(format_analysis_report(pcb_data, components, paths, recommendations))Provide the user with:
- Summary of component classifications
- Traced power paths showing current flow
- Recommended power nets and track widths
- Ready-to-use command line arguments
--power-nets
python
print(format_analysis_report(pcb_data, components, paths, recommendations))向用户提供:
- 元件分类摘要
- 显示电流流向的已追踪电源路径
- 推荐的电源网络和走线宽度
- 可直接使用的命令行参数
--power-nets
Example Analysis Session
示例分析会话
When analyzing a board like kit-dev-coldfire-xilinx_5213:
- J201 (JACK_2P): WebSearch "DC barrel jack 2.1mm" → POWER_SOURCE, 1000mA
- TB201 (CONN_2): Terminal block on same net as J201 → POWER_SOURCE, 1000mA
- D201 (1N4004): WebSearch "1N4004 datasheet" → Rectifier, but connected cathode-to-power → SHUNT (reverse protection)
- Q101 (3906): WebSearch "2N3906 PNP transistor" → Emitter on +3.3V → PASS_THROUGH (power switch)
- U102 (MCF5213): WebSearch "MCF5213 power consumption" → CURRENT_SINK, 200mA
- U301 (XCR3256): WebSearch "XCR3256 CPLD power" → CURRENT_SINK, 150mA
分析kit-dev-coldfire-xilinx_5213这类电路板时:
- J201 (JACK_2P):WebSearch "DC barrel jack 2.1mm" → POWER_SOURCE,1000mA
- TB201 (CONN_2):与J201同网络的接线端子 → POWER_SOURCE,1000mA
- D201 (1N4004):WebSearch "1N4004 datasheet" → 整流二极管,但阴极接电源 → SHUNT(反向保护)
- Q101 (3906):WebSearch "2N3906 PNP transistor" → 发射极接+3.3V → PASS_THROUGH(电源开关)
- U102 (MCF5213):WebSearch "MCF5213 power consumption" → CURRENT_SINK,200mA
- U301 (XCR3256):WebSearch "XCR3256 CPLD power" → CURRENT_SINK,150mA
Output Format
输出格式
undefinedundefinedPower Net Analysis for board.kicad_pcb
Power Net Analysis for board.kicad_pcb
AI-Classified Components
AI-Classified Components
| Ref | Value | Role | Current | Notes |
|---|---|---|---|---|
| J201 | JACK_2P | POWER_SOURCE | 1000mA | DC power input |
| U102 | MCF5213 | CURRENT_SINK | 200mA | ColdFire MCU |
| Ref | Value | Role | Current | Notes |
|---|---|---|---|---|
| J201 | JACK_2P | POWER_SOURCE | 1000mA | DC power input |
| U102 | MCF5213 | CURRENT_SINK | 200mA | ColdFire MCU |
Power Paths Traced
Power Paths Traced
TB201 (power input) → SW_ONOFF201 → F201 → VR201 → +3.3V → U102 (MCU)
TB201 (power input) → SW_ONOFF201 → F201 → VR201 → +3.3V → U102 (MCU)
Recommended Power Nets
Recommended Power Nets
| Net | Width | Reason |
|---|---|---|
| Net-(TB201-P1) | 0.5mm | Power input path |
| Net-(F201-Pad1) | 0.5mm | After fuse |
| +3.3V | 0.5mm | Main rail, 500mA total |
| /VDDPLL | 0.3mm | PLL supply, 10mA |
| Net | Width | Reason |
|---|---|---|
| Net-(TB201-P1) | 0.5mm | Power input path |
| Net-(F201-Pad1) | 0.5mm | After fuse |
| +3.3V | 0.5mm | Main rail, 500mA total |
| /VDDPLL | 0.3mm | PLL supply, 10mA |
Routing Command
Routing Command
--power-nets "GND" "+3.3V" "/VDDPLL" "/VCCA" "Net-(TB201-P1)" --power-nets-widths 0.5 0.5 0.3 0.3 0.5
undefined--power-nets "GND" "+3.3V" "/VDDPLL" "/VCCA" "Net-(TB201-P1)" --power-nets-widths 0.5 0.5 0.3 0.3 0.5
undefinedImportant Notes
重要说明
- Do not rely on component reference prefixes for ICs, connectors, or transistors - always look up the actual part
- Check net connections - a connector on a power net is likely a power connector
- Trace upstream - if a component feeds into a known power net, its input is also a power net
- Ground nets are always power nets - include GND, GNDA, AGND, VSS, etc.
- 不要依赖元件参考前缀来判断IC、连接器或晶体管的类型——务必查询实际元件型号
- 检查网络连接——连接到电源网络的连接器很可能是电源连接器
- 向上游追踪——如果一个元件连接到已知的电源网络,那么它的输入也是电源网络
- 地网络始终属于电源网络——包括GND、GNDA、AGND、VSS等