easyeda-mcp-pro 0.10.0 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bridge/types.d.ts +1 -1
- package/dist/config/profiles.js +5 -5
- package/dist/config/version.d.ts +1 -1
- package/dist/config/version.js +1 -1
- package/dist/pcb-layout/index.d.ts +2 -0
- package/dist/pcb-layout/index.js +2 -0
- package/dist/pcb-layout/index.js.map +1 -0
- package/dist/pcb-layout/planner.d.ts +5 -0
- package/dist/pcb-layout/planner.js +222 -0
- package/dist/pcb-layout/planner.js.map +1 -0
- package/dist/pcb-layout/types.d.ts +104 -0
- package/dist/pcb-layout/types.js +3 -0
- package/dist/pcb-layout/types.js.map +1 -0
- package/dist/power-tree/analysis.d.ts +8 -0
- package/dist/power-tree/analysis.js +343 -0
- package/dist/power-tree/analysis.js.map +1 -0
- package/dist/power-tree/errors.d.ts +11 -0
- package/dist/power-tree/errors.js +20 -0
- package/dist/power-tree/errors.js.map +1 -0
- package/dist/power-tree/index.d.ts +3 -0
- package/dist/power-tree/index.js +3 -0
- package/dist/power-tree/index.js.map +1 -0
- package/dist/power-tree/types.d.ts +173 -0
- package/dist/power-tree/types.js +11 -0
- package/dist/power-tree/types.js.map +1 -0
- package/dist/tools/L1_drc_erc.js +181 -0
- package/dist/tools/L1_drc_erc.js.map +1 -1
- package/dist/tools/L1_pcb_write.js +277 -0
- package/dist/tools/L1_pcb_write.js.map +1 -1
- package/easyeda-bridge-extension.eext +0 -0
- package/package.json +1 -1
|
@@ -0,0 +1,343 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Power-tree current budget and thermal analysis.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import { powerError, powerWarning } from './errors.js';
|
|
7
|
+
const DEFAULT_LIMITS = {
|
|
8
|
+
minCurrentMarginPercent: 20,
|
|
9
|
+
minThermalMarginC: 20,
|
|
10
|
+
ambientTempC: 25,
|
|
11
|
+
minBulkCapacitanceUfPerA: 47,
|
|
12
|
+
minBulkCapacitanceUf: 10,
|
|
13
|
+
};
|
|
14
|
+
function mergeLimits(limits) {
|
|
15
|
+
return { ...DEFAULT_LIMITS, ...limits };
|
|
16
|
+
}
|
|
17
|
+
function byRail(items) {
|
|
18
|
+
const map = new Map();
|
|
19
|
+
for (const item of items ?? []) {
|
|
20
|
+
const existing = map.get(item.railId) ?? [];
|
|
21
|
+
existing.push(item);
|
|
22
|
+
map.set(item.railId, existing);
|
|
23
|
+
}
|
|
24
|
+
return map;
|
|
25
|
+
}
|
|
26
|
+
function sum(values) {
|
|
27
|
+
return values.reduce((acc, value) => acc + value, 0);
|
|
28
|
+
}
|
|
29
|
+
function round(value, digits = 4) {
|
|
30
|
+
if (value === undefined || !Number.isFinite(value))
|
|
31
|
+
return undefined;
|
|
32
|
+
const scale = 10 ** digits;
|
|
33
|
+
return Math.round(value * scale) / scale;
|
|
34
|
+
}
|
|
35
|
+
function loadCurrent(loads) {
|
|
36
|
+
return sum(loads.map((load) => load.currentA));
|
|
37
|
+
}
|
|
38
|
+
function peakCurrent(loads) {
|
|
39
|
+
return sum(loads.map((load) => load.peakCurrentA ?? load.currentA));
|
|
40
|
+
}
|
|
41
|
+
function sourceCapacity(source) {
|
|
42
|
+
const values = [source.maxCurrentA, source.currentLimitA].filter((value) => value !== undefined);
|
|
43
|
+
if (values.length === 0)
|
|
44
|
+
return undefined;
|
|
45
|
+
return Math.min(...values);
|
|
46
|
+
}
|
|
47
|
+
function regulatorCapacity(regulator) {
|
|
48
|
+
const values = [regulator.maxOutputCurrentA, regulator.currentLimitA].filter((value) => value !== undefined);
|
|
49
|
+
if (values.length === 0)
|
|
50
|
+
return undefined;
|
|
51
|
+
return Math.min(...values);
|
|
52
|
+
}
|
|
53
|
+
function availableCurrentForRail(rail, sources, regulators) {
|
|
54
|
+
const capacities = [
|
|
55
|
+
rail.maxCurrentA,
|
|
56
|
+
...sources.map(sourceCapacity),
|
|
57
|
+
...regulators.map(regulatorCapacity),
|
|
58
|
+
].filter((value) => value !== undefined);
|
|
59
|
+
if (capacities.length === 0)
|
|
60
|
+
return undefined;
|
|
61
|
+
return Math.min(...capacities);
|
|
62
|
+
}
|
|
63
|
+
function railProtections(rail, protections) {
|
|
64
|
+
return protections.filter((protection) => protection.railId === rail.id);
|
|
65
|
+
}
|
|
66
|
+
function railBulkCapacitance(rail, capacitors) {
|
|
67
|
+
return sum(capacitors
|
|
68
|
+
.filter((capacitor) => capacitor.railId === rail.id && ['bulk', 'input', 'hold-up'].includes(capacitor.role))
|
|
69
|
+
.map((capacitor) => capacitor.capacitanceUf));
|
|
70
|
+
}
|
|
71
|
+
function requiredBulkCapacitance(loadA, limits) {
|
|
72
|
+
return Math.max(limits.minBulkCapacitanceUf, loadA * limits.minBulkCapacitanceUfPerA);
|
|
73
|
+
}
|
|
74
|
+
function railIsProtectionSensitive(rail, sources) {
|
|
75
|
+
return Boolean(rail.requiresProtection ||
|
|
76
|
+
rail.external ||
|
|
77
|
+
sources.some((source) => source.requiresProtection ||
|
|
78
|
+
['usb', 'battery', 'barrel-jack', 'external', 'ac-dc'].includes(source.kind)));
|
|
79
|
+
}
|
|
80
|
+
function createRailReport(rail, loads, sources, regulators, protections, capacitors, limits) {
|
|
81
|
+
const issues = [];
|
|
82
|
+
const railLoadCurrent = loadCurrent(loads);
|
|
83
|
+
const railPeakCurrent = peakCurrent(loads);
|
|
84
|
+
const availableCurrentA = availableCurrentForRail(rail, sources, regulators);
|
|
85
|
+
const marginA = availableCurrentA === undefined ? undefined : availableCurrentA - railPeakCurrent;
|
|
86
|
+
const marginPercent = availableCurrentA === undefined || availableCurrentA === 0
|
|
87
|
+
? undefined
|
|
88
|
+
: ((marginA ?? 0) / availableCurrentA) * 100;
|
|
89
|
+
const protectionsOnRail = railProtections(rail, protections);
|
|
90
|
+
const bulkCapacitanceUf = railBulkCapacitance(rail, capacitors);
|
|
91
|
+
const requiresBulk = Boolean(rail.requiresBulkCapacitance || railLoadCurrent > 0.25 || railPeakCurrent > 0.5);
|
|
92
|
+
const requiredBulkUf = requiresBulk
|
|
93
|
+
? requiredBulkCapacitance(railPeakCurrent, limits)
|
|
94
|
+
: undefined;
|
|
95
|
+
if (availableCurrentA !== undefined && railPeakCurrent > availableCurrentA) {
|
|
96
|
+
issues.push(powerError('POWER_RAIL_OVERCURRENT', `Rail ${rail.name} peak load ${round(railPeakCurrent)}A exceeds available current ${round(availableCurrentA)}A`, {
|
|
97
|
+
railId: rail.id,
|
|
98
|
+
railName: rail.name,
|
|
99
|
+
remediationHint: 'Reduce load current, choose a higher-current source/regulator, or split the rail into separately protected branches.',
|
|
100
|
+
details: { peakCurrentA: railPeakCurrent, availableCurrentA, marginA },
|
|
101
|
+
}));
|
|
102
|
+
}
|
|
103
|
+
else if (marginPercent !== undefined && marginPercent < limits.minCurrentMarginPercent) {
|
|
104
|
+
issues.push(powerWarning('POWER_RAIL_LOW_MARGIN', `Rail ${rail.name} current margin is ${round(marginPercent, 1)}%, below ${limits.minCurrentMarginPercent}%`, {
|
|
105
|
+
railId: rail.id,
|
|
106
|
+
railName: rail.name,
|
|
107
|
+
remediationHint: 'Increase source/regulator current rating or reduce peak load so the rail has adequate transient and tolerance margin.',
|
|
108
|
+
details: { peakCurrentA: railPeakCurrent, availableCurrentA, marginA, marginPercent },
|
|
109
|
+
}));
|
|
110
|
+
}
|
|
111
|
+
if (railIsProtectionSensitive(rail, sources) && protectionsOnRail.length === 0) {
|
|
112
|
+
issues.push(powerWarning('POWER_SOURCE_MISSING_PROTECTION', `Rail ${rail.name} is externally sourced or protection-sensitive but has no declared input protection`, {
|
|
113
|
+
railId: rail.id,
|
|
114
|
+
railName: rail.name,
|
|
115
|
+
remediationHint: 'Add fuse/polyfuse, reverse-polarity protection, TVS/ESD protection, or a current-limited switch near the connector/source.',
|
|
116
|
+
details: {
|
|
117
|
+
sourceKinds: sources.map((source) => source.kind),
|
|
118
|
+
requiresProtection: rail.requiresProtection,
|
|
119
|
+
},
|
|
120
|
+
}));
|
|
121
|
+
}
|
|
122
|
+
if (requiresBulk && requiredBulkUf !== undefined && bulkCapacitanceUf < requiredBulkUf) {
|
|
123
|
+
issues.push(powerWarning('POWER_MISSING_BULK_CAPACITANCE', `Rail ${rail.name} has ${round(bulkCapacitanceUf, 2)}µF bulk capacitance; ${round(requiredBulkUf, 2)}µF is recommended for ${round(railPeakCurrent)}A peak load`, {
|
|
124
|
+
railId: rail.id,
|
|
125
|
+
railName: rail.name,
|
|
126
|
+
remediationHint: 'Add appropriately voltage-rated bulk capacitance near the source/regulator and local decoupling near loads.',
|
|
127
|
+
details: {
|
|
128
|
+
bulkCapacitanceUf,
|
|
129
|
+
requiredBulkCapacitanceUf: requiredBulkUf,
|
|
130
|
+
peakCurrentA: railPeakCurrent,
|
|
131
|
+
},
|
|
132
|
+
}));
|
|
133
|
+
}
|
|
134
|
+
const report = {
|
|
135
|
+
railId: rail.id,
|
|
136
|
+
railName: rail.name,
|
|
137
|
+
voltage: rail.voltage,
|
|
138
|
+
loadCurrentA: round(railLoadCurrent) ?? railLoadCurrent,
|
|
139
|
+
peakCurrentA: round(railPeakCurrent) ?? railPeakCurrent,
|
|
140
|
+
availableCurrentA: round(availableCurrentA),
|
|
141
|
+
marginA: round(marginA),
|
|
142
|
+
marginPercent: round(marginPercent, 2),
|
|
143
|
+
loadCount: loads.length,
|
|
144
|
+
sourceRefs: sources.map((source) => source.id),
|
|
145
|
+
regulatorRefs: regulators.map((regulator) => regulator.id),
|
|
146
|
+
protectionRefs: protectionsOnRail.map((protection) => protection.ref ?? protection.id),
|
|
147
|
+
bulkCapacitanceUf: round(bulkCapacitanceUf, 2) ?? bulkCapacitanceUf,
|
|
148
|
+
requiredBulkCapacitanceUf: round(requiredBulkUf, 2),
|
|
149
|
+
passed: !issues.some((issue) => issue.severity === 'error'),
|
|
150
|
+
};
|
|
151
|
+
return { report, issues };
|
|
152
|
+
}
|
|
153
|
+
function regulatorInputVoltage(regulator, rails) {
|
|
154
|
+
return regulator.inputVoltage ?? rails.get(regulator.inputRailId)?.voltage ?? 0;
|
|
155
|
+
}
|
|
156
|
+
function regulatorOutputVoltage(regulator, rails) {
|
|
157
|
+
return regulator.outputVoltage ?? rails.get(regulator.outputRailId)?.voltage ?? 0;
|
|
158
|
+
}
|
|
159
|
+
function estimateDissipationW(regulator, inputVoltage, outputVoltage, outputCurrentA) {
|
|
160
|
+
if (outputCurrentA <= 0)
|
|
161
|
+
return 0;
|
|
162
|
+
if (regulator.kind === 'ldo' || regulator.kind === 'linear') {
|
|
163
|
+
return Math.max(0, inputVoltage - outputVoltage) * outputCurrentA;
|
|
164
|
+
}
|
|
165
|
+
if (regulator.kind === 'load-switch') {
|
|
166
|
+
return undefined;
|
|
167
|
+
}
|
|
168
|
+
const efficiency = regulator.efficiency;
|
|
169
|
+
if (efficiency === undefined || efficiency <= 0 || efficiency > 1)
|
|
170
|
+
return undefined;
|
|
171
|
+
const outputPower = outputVoltage * outputCurrentA;
|
|
172
|
+
return outputPower * (1 / efficiency - 1);
|
|
173
|
+
}
|
|
174
|
+
function createRegulatorReport(regulator, outputLoads, rails, limits) {
|
|
175
|
+
const issues = [];
|
|
176
|
+
const inputVoltage = regulatorInputVoltage(regulator, rails);
|
|
177
|
+
const outputVoltage = regulatorOutputVoltage(regulator, rails);
|
|
178
|
+
const outputCurrentA = peakCurrent(outputLoads);
|
|
179
|
+
const capacity = regulatorCapacity(regulator);
|
|
180
|
+
const currentMarginA = capacity === undefined ? undefined : capacity - outputCurrentA;
|
|
181
|
+
const currentMarginPercent = capacity === undefined || capacity === 0 ? undefined : ((currentMarginA ?? 0) / capacity) * 100;
|
|
182
|
+
const dropoutMarginV = regulator.dropoutVoltage === undefined
|
|
183
|
+
? undefined
|
|
184
|
+
: inputVoltage - outputVoltage - regulator.dropoutVoltage;
|
|
185
|
+
const dissipationW = estimateDissipationW(regulator, inputVoltage, outputVoltage, outputCurrentA);
|
|
186
|
+
const estimatedJunctionTempC = dissipationW !== undefined && regulator.thermalResistanceCPerW !== undefined
|
|
187
|
+
? limits.ambientTempC + dissipationW * regulator.thermalResistanceCPerW
|
|
188
|
+
: undefined;
|
|
189
|
+
const thermalMarginC = estimatedJunctionTempC !== undefined && regulator.maxJunctionTempC !== undefined
|
|
190
|
+
? regulator.maxJunctionTempC - estimatedJunctionTempC
|
|
191
|
+
: undefined;
|
|
192
|
+
if (capacity !== undefined && outputCurrentA > capacity) {
|
|
193
|
+
issues.push(powerError('POWER_REGULATOR_OVERLOAD', `Regulator ${regulator.ref ?? regulator.id} output current ${round(outputCurrentA)}A exceeds capacity ${round(capacity)}A`, {
|
|
194
|
+
railId: regulator.outputRailId,
|
|
195
|
+
railName: rails.get(regulator.outputRailId)?.name,
|
|
196
|
+
componentRef: regulator.ref ?? regulator.id,
|
|
197
|
+
remediationHint: 'Choose a regulator with higher output-current rating, reduce load, or split the load across multiple rails.',
|
|
198
|
+
details: { outputCurrentA, capacity, currentMarginA },
|
|
199
|
+
}));
|
|
200
|
+
}
|
|
201
|
+
if (dropoutMarginV !== undefined && dropoutMarginV < 0) {
|
|
202
|
+
issues.push(powerError('POWER_REGULATOR_DROPOUT', `Regulator ${regulator.ref ?? regulator.id} dropout margin is ${round(dropoutMarginV, 3)}V`, {
|
|
203
|
+
railId: regulator.outputRailId,
|
|
204
|
+
railName: rails.get(regulator.outputRailId)?.name,
|
|
205
|
+
componentRef: regulator.ref ?? regulator.id,
|
|
206
|
+
remediationHint: 'Increase input voltage headroom, choose a lower-dropout regulator, or reduce the output voltage requirement.',
|
|
207
|
+
details: {
|
|
208
|
+
inputVoltage,
|
|
209
|
+
outputVoltage,
|
|
210
|
+
dropoutVoltage: regulator.dropoutVoltage,
|
|
211
|
+
dropoutMarginV,
|
|
212
|
+
},
|
|
213
|
+
}));
|
|
214
|
+
}
|
|
215
|
+
if (thermalMarginC !== undefined && thermalMarginC < 0) {
|
|
216
|
+
issues.push(powerError('POWER_REGULATOR_THERMAL_OVER_LIMIT', `Regulator ${regulator.ref ?? regulator.id} estimated junction temperature ${round(estimatedJunctionTempC, 1)}°C exceeds limit ${regulator.maxJunctionTempC}°C`, {
|
|
217
|
+
railId: regulator.outputRailId,
|
|
218
|
+
railName: rails.get(regulator.outputRailId)?.name,
|
|
219
|
+
componentRef: regulator.ref ?? regulator.id,
|
|
220
|
+
remediationHint: 'Reduce dissipation, improve thermal resistance with copper/thermal vias, lower input voltage, use a switching regulator, or choose a higher-power package.',
|
|
221
|
+
details: {
|
|
222
|
+
dissipationW,
|
|
223
|
+
estimatedJunctionTempC,
|
|
224
|
+
thermalMarginC,
|
|
225
|
+
maxJunctionTempC: regulator.maxJunctionTempC,
|
|
226
|
+
},
|
|
227
|
+
}));
|
|
228
|
+
}
|
|
229
|
+
else if (thermalMarginC !== undefined && thermalMarginC < limits.minThermalMarginC) {
|
|
230
|
+
issues.push(powerWarning('POWER_REGULATOR_THERMAL_RISK', `Regulator ${regulator.ref ?? regulator.id} thermal margin is ${round(thermalMarginC, 1)}°C`, {
|
|
231
|
+
railId: regulator.outputRailId,
|
|
232
|
+
railName: rails.get(regulator.outputRailId)?.name,
|
|
233
|
+
componentRef: regulator.ref ?? regulator.id,
|
|
234
|
+
remediationHint: 'Increase thermal margin by reducing load, improving copper area, using a more efficient regulator, or selecting a lower thermal-resistance package.',
|
|
235
|
+
details: {
|
|
236
|
+
dissipationW,
|
|
237
|
+
estimatedJunctionTempC,
|
|
238
|
+
thermalMarginC,
|
|
239
|
+
minThermalMarginC: limits.minThermalMarginC,
|
|
240
|
+
},
|
|
241
|
+
}));
|
|
242
|
+
}
|
|
243
|
+
const report = {
|
|
244
|
+
regulatorId: regulator.id,
|
|
245
|
+
ref: regulator.ref,
|
|
246
|
+
kind: regulator.kind,
|
|
247
|
+
inputRailId: regulator.inputRailId,
|
|
248
|
+
outputRailId: regulator.outputRailId,
|
|
249
|
+
inputVoltage: round(inputVoltage) ?? inputVoltage,
|
|
250
|
+
outputVoltage: round(outputVoltage) ?? outputVoltage,
|
|
251
|
+
outputCurrentA: round(outputCurrentA) ?? outputCurrentA,
|
|
252
|
+
maxOutputCurrentA: round(capacity),
|
|
253
|
+
currentMarginA: round(currentMarginA),
|
|
254
|
+
currentMarginPercent: round(currentMarginPercent, 2),
|
|
255
|
+
dropoutMarginV: round(dropoutMarginV, 4),
|
|
256
|
+
estimatedDissipationW: round(dissipationW, 4),
|
|
257
|
+
estimatedJunctionTempC: round(estimatedJunctionTempC, 2),
|
|
258
|
+
thermalMarginC: round(thermalMarginC, 2),
|
|
259
|
+
passed: !issues.some((issue) => issue.severity === 'error'),
|
|
260
|
+
};
|
|
261
|
+
return { report, issues };
|
|
262
|
+
}
|
|
263
|
+
function checkSequencing(input, railsById) {
|
|
264
|
+
const issues = [];
|
|
265
|
+
for (const rail of input.rails) {
|
|
266
|
+
for (const dependency of rail.sequenceAfterRailRefs ?? []) {
|
|
267
|
+
if (!railsById.has(dependency)) {
|
|
268
|
+
issues.push(powerWarning('POWER_SEQUENCE_MISSING', `Rail ${rail.name} has sequencing dependency ${dependency}, but that rail is not modeled`, {
|
|
269
|
+
railId: rail.id,
|
|
270
|
+
railName: rail.name,
|
|
271
|
+
remediationHint: 'Add the upstream rail to the power-tree model or remove the stale sequencing dependency.',
|
|
272
|
+
details: { sequenceAfterRailRef: dependency },
|
|
273
|
+
}));
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
return issues;
|
|
278
|
+
}
|
|
279
|
+
function buildHumanSummary(report) {
|
|
280
|
+
const railSummary = `${report.rails.length} rail${report.rails.length === 1 ? '' : 's'}`;
|
|
281
|
+
const regulatorSummary = `${report.regulators.length} regulator${report.regulators.length === 1 ? '' : 's'}`;
|
|
282
|
+
const errorCount = report.issues.filter((issue) => issue.severity === 'error').length;
|
|
283
|
+
const warningCount = report.issues.filter((issue) => issue.severity === 'warning').length;
|
|
284
|
+
if (errorCount > 0) {
|
|
285
|
+
return `Power tree failed: ${railSummary}, ${regulatorSummary}, ${errorCount} error(s), ${warningCount} warning(s). Resolve blocking overcurrent, dropout, or thermal issues before release.`;
|
|
286
|
+
}
|
|
287
|
+
if (warningCount > 0) {
|
|
288
|
+
return `Power tree needs review: ${railSummary}, ${regulatorSummary}, 0 errors, ${warningCount} warning(s). Review margin, protection, and capacitance warnings.`;
|
|
289
|
+
}
|
|
290
|
+
return `Power tree passed: ${railSummary}, ${regulatorSummary}, no errors or warnings.`;
|
|
291
|
+
}
|
|
292
|
+
/** Analyze current budget, regulator dissipation, protection, and bulk capacitance. */
|
|
293
|
+
export function analyzePowerTree(input) {
|
|
294
|
+
const limits = mergeLimits(input.limits);
|
|
295
|
+
const railsById = new Map(input.rails.map((rail) => [rail.id, rail]));
|
|
296
|
+
const loadsByRail = byRail(input.loads);
|
|
297
|
+
const sourcesByRail = byRail(input.sources);
|
|
298
|
+
const regulatorsByOutputRail = new Map();
|
|
299
|
+
for (const regulator of input.regulators ?? []) {
|
|
300
|
+
const existing = regulatorsByOutputRail.get(regulator.outputRailId) ?? [];
|
|
301
|
+
existing.push(regulator);
|
|
302
|
+
regulatorsByOutputRail.set(regulator.outputRailId, existing);
|
|
303
|
+
}
|
|
304
|
+
const allIssues = [];
|
|
305
|
+
const railReports = [];
|
|
306
|
+
for (const rail of input.rails) {
|
|
307
|
+
const { report, issues } = createRailReport(rail, loadsByRail.get(rail.id) ?? [], sourcesByRail.get(rail.id) ?? [], regulatorsByOutputRail.get(rail.id) ?? [], input.protections ?? [], input.capacitors ?? [], limits);
|
|
308
|
+
railReports.push(report);
|
|
309
|
+
allIssues.push(...issues);
|
|
310
|
+
}
|
|
311
|
+
const regulatorReports = [];
|
|
312
|
+
for (const regulator of input.regulators ?? []) {
|
|
313
|
+
const { report, issues } = createRegulatorReport(regulator, loadsByRail.get(regulator.outputRailId) ?? [], railsById, limits);
|
|
314
|
+
regulatorReports.push(report);
|
|
315
|
+
allIssues.push(...issues);
|
|
316
|
+
}
|
|
317
|
+
allIssues.push(...checkSequencing(input, railsById));
|
|
318
|
+
const errorCount = allIssues.filter((issue) => issue.severity === 'error').length;
|
|
319
|
+
const warningCount = allIssues.filter((issue) => issue.severity === 'warning').length;
|
|
320
|
+
const partialReport = {
|
|
321
|
+
projectId: input.projectId ?? '',
|
|
322
|
+
passed: errorCount === 0,
|
|
323
|
+
rails: railReports,
|
|
324
|
+
regulators: regulatorReports,
|
|
325
|
+
issues: allIssues,
|
|
326
|
+
};
|
|
327
|
+
return {
|
|
328
|
+
...partialReport,
|
|
329
|
+
summary: {
|
|
330
|
+
railCount: input.rails.length,
|
|
331
|
+
sourceCount: input.sources?.length ?? 0,
|
|
332
|
+
regulatorCount: input.regulators?.length ?? 0,
|
|
333
|
+
loadCount: input.loads?.length ?? 0,
|
|
334
|
+
totalLoadCurrentA: round(sum(railReports.map((rail) => rail.loadCurrentA))) ?? 0,
|
|
335
|
+
totalPeakCurrentA: round(sum(railReports.map((rail) => rail.peakCurrentA))) ?? 0,
|
|
336
|
+
errorCount,
|
|
337
|
+
warningCount,
|
|
338
|
+
passed: errorCount === 0,
|
|
339
|
+
humanSummary: buildHumanSummary(partialReport),
|
|
340
|
+
},
|
|
341
|
+
};
|
|
342
|
+
}
|
|
343
|
+
//# sourceMappingURL=analysis.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analysis.js","sourceRoot":"","sources":["../../src/power-tree/analysis.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAgBvD,MAAM,cAAc,GAA8B;IAChD,uBAAuB,EAAE,EAAE;IAC3B,iBAAiB,EAAE,EAAE;IACrB,YAAY,EAAE,EAAE;IAChB,wBAAwB,EAAE,EAAE;IAC5B,oBAAoB,EAAE,EAAE;CACzB,CAAC;AAEF,SAAS,WAAW,CAAC,MAAwB;IAC3C,OAAO,EAAE,GAAG,cAAc,EAAE,GAAG,MAAM,EAAE,CAAC;AAC1C,CAAC;AAED,SAAS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AAE,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC;YAChF,UAAU;YACV,YAAY;YACZ,MAAM,EAAE,UAAU,KAAK,CAAC;YACxB,YAAY,EAAE,iBAAiB,CAAC,aAAa,CAAC;SAC/C;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** Power-tree analyzer issue factories. */
|
|
2
|
+
import type { PowerTreeIssue, PowerTreeIssueCode, PowerTreeSeverity } from './types.js';
|
|
3
|
+
export declare function powerIssue(code: PowerTreeIssueCode, severity: PowerTreeSeverity, message: string, opts: {
|
|
4
|
+
railId?: string;
|
|
5
|
+
railName?: string;
|
|
6
|
+
componentRef?: string;
|
|
7
|
+
remediationHint: string;
|
|
8
|
+
details?: Record<string, unknown>;
|
|
9
|
+
}): PowerTreeIssue;
|
|
10
|
+
export declare function powerError(code: PowerTreeIssueCode, message: string, opts: Omit<Parameters<typeof powerIssue>[3], never>): PowerTreeIssue;
|
|
11
|
+
export declare function powerWarning(code: PowerTreeIssueCode, message: string, opts: Omit<Parameters<typeof powerIssue>[3], never>): PowerTreeIssue;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** Power-tree analyzer issue factories. */
|
|
2
|
+
export function powerIssue(code, severity, message, opts) {
|
|
3
|
+
return {
|
|
4
|
+
code,
|
|
5
|
+
severity,
|
|
6
|
+
message,
|
|
7
|
+
railId: opts.railId,
|
|
8
|
+
railName: opts.railName,
|
|
9
|
+
componentRef: opts.componentRef,
|
|
10
|
+
remediationHint: opts.remediationHint,
|
|
11
|
+
details: opts.details,
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
export function powerError(code, message, opts) {
|
|
15
|
+
return powerIssue(code, 'error', message, opts);
|
|
16
|
+
}
|
|
17
|
+
export function powerWarning(code, message, opts) {
|
|
18
|
+
return powerIssue(code, 'warning', message, opts);
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/power-tree/errors.ts"],"names":[],"mappings":"AAAA,2CAA2C;AAI3C,MAAM,UAAU,UAAU,CACxB,IAAwB,EACxB,QAA2B,EAC3B,OAAe,EACf,IAMC;IAED,OAAO;QACL,IAAI;QACJ,QAAQ;QACR,OAAO;QACP,MAAM,EAAE,IAAI,CAAC,MAAM;QACnB,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,YAAY,EAAE,IAAI,CAAC,YAAY;QAC/B,eAAe,EAAE,IAAI,CAAC,eAAe;QACrC,OAAO,EAAE,IAAI,CAAC,OAAO;KACtB,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,UAAU,CACxB,IAAwB,EACxB,OAAe,EACf,IAAmD;IAEnD,OAAO,UAAU,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;AAClD,CAAC;AAED,MAAM,UAAU,YAAY,CAC1B,IAAwB,EACxB,OAAe,EACf,IAAmD;IAEnD,OAAO,UAAU,CAAC,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;AACpD,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/** Power-tree analyzer public API. */
|
|
2
|
+
export { analyzePowerTree } from './analysis.js';
|
|
3
|
+
export type { CapacitorRole, PowerCapacitorInput, PowerLoadInput, PowerProtectionInput, PowerRailInput, PowerRegulatorInput, PowerSourceInput, PowerSourceKind, PowerTreeInput, PowerTreeIssue, PowerTreeIssueCode, PowerTreeLimits, PowerTreeReport, PowerTreeSeverity, ProtectionKind, RailPowerReport, RegulatorKind, RegulatorThermalReport, } from './types.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/power-tree/index.ts"],"names":[],"mappings":"AAAA,sCAAsC;AAEtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Power-tree analyzer types.
|
|
3
|
+
*
|
|
4
|
+
* Models sources, regulators, rails, loads, protection devices, and bulk
|
|
5
|
+
* capacitance so agents can reason about current margin, dropout, and thermal
|
|
6
|
+
* risk before committing a circuit or PCB handoff.
|
|
7
|
+
*
|
|
8
|
+
* @module
|
|
9
|
+
*/
|
|
10
|
+
export type PowerSourceKind = 'usb' | 'battery' | 'barrel-jack' | 'bench' | 'ac-dc' | 'external' | 'custom';
|
|
11
|
+
export type RegulatorKind = 'ldo' | 'linear' | 'buck' | 'boost' | 'buck-boost' | 'load-switch' | 'custom';
|
|
12
|
+
export type ProtectionKind = 'fuse' | 'polyfuse' | 'tvs' | 'reverse-polarity' | 'ideal-diode' | 'current-limit' | 'esd' | 'custom';
|
|
13
|
+
export type CapacitorRole = 'bulk' | 'input' | 'output' | 'decoupling' | 'hold-up' | 'custom';
|
|
14
|
+
export type PowerTreeSeverity = 'error' | 'warning' | 'info';
|
|
15
|
+
export type PowerTreeIssueCode = 'POWER_RAIL_OVERCURRENT' | 'POWER_RAIL_LOW_MARGIN' | 'POWER_SOURCE_MISSING_PROTECTION' | 'POWER_MISSING_BULK_CAPACITANCE' | 'POWER_REGULATOR_OVERLOAD' | 'POWER_REGULATOR_DROPOUT' | 'POWER_REGULATOR_THERMAL_RISK' | 'POWER_REGULATOR_THERMAL_OVER_LIMIT' | 'POWER_SEQUENCE_MISSING' | 'POWER_TREE_INTERNAL';
|
|
16
|
+
export interface PowerRailInput {
|
|
17
|
+
id: string;
|
|
18
|
+
name: string;
|
|
19
|
+
voltage: number;
|
|
20
|
+
/** Maximum current capacity for this rail when known. */
|
|
21
|
+
maxCurrentA?: number;
|
|
22
|
+
/** Optional explicit source ids driving this rail. */
|
|
23
|
+
sourceRefs?: string[];
|
|
24
|
+
/** Optional explicit regulator ids driving this rail. */
|
|
25
|
+
regulatorRefs?: string[];
|
|
26
|
+
/** Whether this rail is externally accessible or directly fed from outside the board. */
|
|
27
|
+
external?: boolean;
|
|
28
|
+
/** Whether this rail is safety-critical or expected to be protected. */
|
|
29
|
+
requiresProtection?: boolean;
|
|
30
|
+
/** Whether bulk capacitance is expected on this rail. */
|
|
31
|
+
requiresBulkCapacitance?: boolean;
|
|
32
|
+
/** Optional sequencing dependency: this rail should come up after listed rail ids. */
|
|
33
|
+
sequenceAfterRailRefs?: string[];
|
|
34
|
+
}
|
|
35
|
+
export interface PowerSourceInput {
|
|
36
|
+
id: string;
|
|
37
|
+
name?: string;
|
|
38
|
+
kind: PowerSourceKind;
|
|
39
|
+
railId: string;
|
|
40
|
+
voltage: number;
|
|
41
|
+
maxCurrentA?: number;
|
|
42
|
+
currentLimitA?: number;
|
|
43
|
+
requiresProtection?: boolean;
|
|
44
|
+
}
|
|
45
|
+
export interface PowerRegulatorInput {
|
|
46
|
+
id: string;
|
|
47
|
+
ref?: string;
|
|
48
|
+
kind: RegulatorKind;
|
|
49
|
+
inputRailId: string;
|
|
50
|
+
outputRailId: string;
|
|
51
|
+
inputVoltage?: number;
|
|
52
|
+
outputVoltage?: number;
|
|
53
|
+
maxOutputCurrentA?: number;
|
|
54
|
+
currentLimitA?: number;
|
|
55
|
+
dropoutVoltage?: number;
|
|
56
|
+
efficiency?: number;
|
|
57
|
+
quiescentCurrentA?: number;
|
|
58
|
+
thermalResistanceCPerW?: number;
|
|
59
|
+
maxJunctionTempC?: number;
|
|
60
|
+
package?: string;
|
|
61
|
+
}
|
|
62
|
+
export interface PowerLoadInput {
|
|
63
|
+
id: string;
|
|
64
|
+
ref?: string;
|
|
65
|
+
railId: string;
|
|
66
|
+
currentA: number;
|
|
67
|
+
peakCurrentA?: number;
|
|
68
|
+
category?: string;
|
|
69
|
+
required?: boolean;
|
|
70
|
+
}
|
|
71
|
+
export interface PowerProtectionInput {
|
|
72
|
+
id: string;
|
|
73
|
+
railId: string;
|
|
74
|
+
kind: ProtectionKind;
|
|
75
|
+
ref?: string;
|
|
76
|
+
currentRatingA?: number;
|
|
77
|
+
location?: 'input' | 'output' | 'rail' | 'connector';
|
|
78
|
+
}
|
|
79
|
+
export interface PowerCapacitorInput {
|
|
80
|
+
id: string;
|
|
81
|
+
railId: string;
|
|
82
|
+
ref?: string;
|
|
83
|
+
capacitanceUf: number;
|
|
84
|
+
role: CapacitorRole;
|
|
85
|
+
voltageRating?: number;
|
|
86
|
+
}
|
|
87
|
+
export interface PowerTreeLimits {
|
|
88
|
+
/** Warning threshold for available-current margin. Default: 20%. */
|
|
89
|
+
minCurrentMarginPercent?: number;
|
|
90
|
+
/** Warning threshold for junction temperature margin. Default: 20°C. */
|
|
91
|
+
minThermalMarginC?: number;
|
|
92
|
+
/** Default ambient temperature. Default: 25°C. */
|
|
93
|
+
ambientTempC?: number;
|
|
94
|
+
/** Default minimum bulk capacitance per ampere. Default: 47µF/A. */
|
|
95
|
+
minBulkCapacitanceUfPerA?: number;
|
|
96
|
+
/** Default bulk capacitance floor when a rail requires bulk capacitance. Default: 10µF. */
|
|
97
|
+
minBulkCapacitanceUf?: number;
|
|
98
|
+
}
|
|
99
|
+
export interface PowerTreeInput {
|
|
100
|
+
projectId?: string;
|
|
101
|
+
rails: PowerRailInput[];
|
|
102
|
+
sources?: PowerSourceInput[];
|
|
103
|
+
regulators?: PowerRegulatorInput[];
|
|
104
|
+
loads?: PowerLoadInput[];
|
|
105
|
+
protections?: PowerProtectionInput[];
|
|
106
|
+
capacitors?: PowerCapacitorInput[];
|
|
107
|
+
limits?: PowerTreeLimits;
|
|
108
|
+
}
|
|
109
|
+
export interface PowerTreeIssue {
|
|
110
|
+
code: PowerTreeIssueCode;
|
|
111
|
+
severity: PowerTreeSeverity;
|
|
112
|
+
message: string;
|
|
113
|
+
railId?: string;
|
|
114
|
+
railName?: string;
|
|
115
|
+
componentRef?: string;
|
|
116
|
+
remediationHint: string;
|
|
117
|
+
details?: Record<string, unknown>;
|
|
118
|
+
}
|
|
119
|
+
export interface RailPowerReport {
|
|
120
|
+
railId: string;
|
|
121
|
+
railName: string;
|
|
122
|
+
voltage: number;
|
|
123
|
+
loadCurrentA: number;
|
|
124
|
+
peakCurrentA: number;
|
|
125
|
+
availableCurrentA?: number;
|
|
126
|
+
marginA?: number;
|
|
127
|
+
marginPercent?: number;
|
|
128
|
+
loadCount: number;
|
|
129
|
+
sourceRefs: string[];
|
|
130
|
+
regulatorRefs: string[];
|
|
131
|
+
protectionRefs: string[];
|
|
132
|
+
bulkCapacitanceUf: number;
|
|
133
|
+
requiredBulkCapacitanceUf?: number;
|
|
134
|
+
passed: boolean;
|
|
135
|
+
}
|
|
136
|
+
export interface RegulatorThermalReport {
|
|
137
|
+
regulatorId: string;
|
|
138
|
+
ref?: string;
|
|
139
|
+
kind: RegulatorKind;
|
|
140
|
+
inputRailId: string;
|
|
141
|
+
outputRailId: string;
|
|
142
|
+
inputVoltage: number;
|
|
143
|
+
outputVoltage: number;
|
|
144
|
+
outputCurrentA: number;
|
|
145
|
+
maxOutputCurrentA?: number;
|
|
146
|
+
currentMarginA?: number;
|
|
147
|
+
currentMarginPercent?: number;
|
|
148
|
+
dropoutMarginV?: number;
|
|
149
|
+
estimatedDissipationW?: number;
|
|
150
|
+
estimatedJunctionTempC?: number;
|
|
151
|
+
thermalMarginC?: number;
|
|
152
|
+
passed: boolean;
|
|
153
|
+
}
|
|
154
|
+
export interface PowerTreeSummary {
|
|
155
|
+
railCount: number;
|
|
156
|
+
sourceCount: number;
|
|
157
|
+
regulatorCount: number;
|
|
158
|
+
loadCount: number;
|
|
159
|
+
totalLoadCurrentA: number;
|
|
160
|
+
totalPeakCurrentA: number;
|
|
161
|
+
errorCount: number;
|
|
162
|
+
warningCount: number;
|
|
163
|
+
passed: boolean;
|
|
164
|
+
humanSummary: string;
|
|
165
|
+
}
|
|
166
|
+
export interface PowerTreeReport {
|
|
167
|
+
projectId: string;
|
|
168
|
+
passed: boolean;
|
|
169
|
+
rails: RailPowerReport[];
|
|
170
|
+
regulators: RegulatorThermalReport[];
|
|
171
|
+
issues: PowerTreeIssue[];
|
|
172
|
+
summary: PowerTreeSummary;
|
|
173
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Power-tree analyzer types.
|
|
3
|
+
*
|
|
4
|
+
* Models sources, regulators, rails, loads, protection devices, and bulk
|
|
5
|
+
* capacitance so agents can reason about current margin, dropout, and thermal
|
|
6
|
+
* risk before committing a circuit or PCB handoff.
|
|
7
|
+
*
|
|
8
|
+
* @module
|
|
9
|
+
*/
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/power-tree/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG"}
|