Magnetic Circuit Calculator

v1.2.0

电机磁路计算助手 | 基于等效磁路法计算气隙磁通、磁密分布、永磁体工作点、漏磁系数。适用于电机设计初期快速估算和Maxwell仿真对比验证。

0· 132·1 current·1 all-time
Security Scan
VirusTotalVirusTotal
Benign
View report →
OpenClawOpenClaw
Benign
medium confidence
Purpose & Capability
Name/description, SKILL.md, and the two Python scripts consistently implement magnetic equivalent-circuit calculations and related analyses (hm sweep, slot comparison). Required capabilities are limited to local numeric computation and optional plotting.
Instruction Scope
SKILL.md instructs running the included Python scripts and describes command-line/interactive usage — it does not request reading unrelated files, env vars, or contacting external endpoints. Note: SKILL.md does not declare Python dependencies (numpy/matplotlib) that the v2 script imports; the script degrades gracefully if plotting libs are missing but users should be aware of dependency needs.
Install Mechanism
No install spec provided (instruction-only). No downloads or external install steps are invoked by the skill metadata.
Credentials
No required environment variables, no credentials, and no config-path access are declared or used in the visible code.
Persistence & Privilege
Skill does not request permanent presence (always=false) and does not modify other skills or system agent settings in the visible materials.
Assessment
This skill appears coherent and local-only: it provides Python scripts that compute magnetic-circuit metrics and save optional plot PNGs. Before running: (1) inspect the complete mec_calculator_v2.py file (the provided listing was truncated) to ensure there are no unexpected network, subprocess, or file-exfiltration calls in the unseen portion; (2) run in an isolated environment or VM if you downloaded the package from an untrusted source; (3) install needed Python packages (numpy, matplotlib) in a virtualenv; (4) validate outputs against a known case or reference (the SKILL.md provides example inputs) before using results for critical design decisions; (5) if you need higher confidence, request the full untruncated source for a complete audit.

Like a lobster shell, security has layers — review code before you run it.

latestvk97fcnh2rfke2z3q31xdcxjhnd83gd9e
132downloads
0stars
3versions
Updated 3w ago
v1.2.0
MIT-0

电机磁路计算助手

基于等效磁路法(Magnetic Equivalent Circuit, MEC),对永磁电机进行快速磁路计算,输出气隙磁通、磁密、永磁体工作点等关键参数。

适用场景

  • 电机设计初期快速估算(替代耗时 FEA)
  • Maxwell 静磁场仿真前的参数预验证
  • 极槽配合方案比选
  • 漏磁系数快速评估
  • 设计方案合理性判断

计算输入参数

参数符号单位示例
极数2p-8
槽数Q-36
相数m-3
铁心长度Lmm60
气隙长度δmm0.5
定子内径Dimm54
永磁体厚度hmmm3
永磁体剩磁BrT1.25
永磁体矫顽力HckA/m955
永磁体宽度bmmm沿弧长
轭部磁路长度lcmm视结构而定

核心计算模块

1. 极距计算

极距 τ = π × Di / (2p)
示例:Di=54mm, 2p=8 → τ = π×54/8 ≈ 21.2mm

2. 每极每相槽数

q = Q / (2p × m)
分数槽:q = Q/(2p×m) = a/b(最简分数)

3. 气隙磁通密度(估算)

方法A:经验公式

Bg = σ × (Br × Am × Hc) / (δ × Ae)
其中:
  σ = 漏磁系数(1.1~1.4),初次估算取 1.2
  Am = 永磁体截面积 = bm × L(mm²)
  Ae = 气隙截面积 = τ × L(mm²)
  δ = 气隙长度(mm)

方法B:磁动势法(更精确)

F_total = F_pm - F_gap - F_core
F_pm = Hc × hm(永磁体提供的磁动势)
F_gap = Bg/μ0 × δ(气隙所需磁动势)
F_core = H_cu × lc(轭部铁损磁动势)

迭代求解:Bg = μ0 × (F_pm - F_core) / δ

4. 永磁体工作点(开路)

工作点坐标:(Bm, Hm)
Bm = Φm / Am = σ × Bg × (Ae/Am)
Hm = (Hc × hm - F_core) / hm
退磁曲线位置:Hm 应位于第二象限

判断标准:
  Bm/Br > 0.6 → 工作点合理
  Bm/Br < 0.5 → 存在退磁风险

5. 漏磁系数 σ

σ = Φm / Φg = (Φg + Φσ) / Φg
典型值:
  表贴式 PMSM:σ = 1.10 ~ 1.25
  内嵌式 PMSM:σ = 1.20 ~ 1.40
  磁阻电机:σ = 1.30 ~ 1.60

6. 反电动势常数 Ke

Ke = (4.44 × f × Nph × Kw × Φg) / n_s
或:
Ke = (2 × π × Nph × Kw × Φg) / 60

其中:
  Nph = 每相串联匝数
  Kw = 绕组系数
  Φg = 每极气隙磁通(Wb)
  f = 频率(Hz)

7. 同步电抗(估算)

Xd = 2 × f × μ0 × (Nph)² × τ × L / (δ × π × p)
Xq ≈ Xd(隐极机)
Xq > Xd(凸极机,表贴式差距小,内嵌式差距大)

计算输出格式

===== 磁路计算结果 =====
【基本参数】
极距 τ = XX mm
每极每相槽数 q = XX
绕组系数 Kw = XX

【气隙磁场】
气隙磁密 Bg = XX T
每极气隙磁通 Φg = XX mWb

【永磁体工作点】
永磁体截面积 Am = XX mm²
气隙截面积 Ae = XX mm²
漏磁系数 σ = XX
工作点 Bm/Br = XX%
工作点 Bm = XX T,Hm = XX kA/m

【性能估算】
反电动势常数 Ke = XX V/(rad/s)
转矩常数 Kt = XX Nm/A

【结论】
工作点状态:[正常/偏低/有退磁风险]
建议:[继续优化/调整hm/更换磁钢牌号]

典型设计案例

案例:8极36槽表贴式 PMSM

输入参数

极数 2p = 8
槽数 Q = 36
铁心长度 L = 60mm
气隙长度 δ = 0.5mm
定子内径 Di = 54mm
永磁体厚度 hm = 3mm(N42SH,Br=1.25T)
永磁体宽度 bm = 17mm(弧长)

计算过程

τ = π×54/8 = 21.2mm
q = 36/(8×3) = 1.5(分数槽)
Ae = 21.2×60 = 1272mm²
Am = 17×60 = 1020mm²
Ae/Am = 0.802

假设 σ=1.2:
Bg = 1.2 × 1.25 × 1020 / (0.5 × 1272) = 0.76T

开路校验(忽略铁心压降):
Bm = 0.76 × 1.2 × 0.802 = 0.73T
Bm/Br = 58.4% → 偏低,建议增加 hm 至 4mm 重新计算

设计问题诊断

现象原因调整方向
Bg 偏低hm 太小、Br 不足增加 hm 或选更高 Br 牌号
Bg 过高hm 太大可能导致磁钢浪费,适当减小
Bm/Br < 50%存在退磁风险增加 hm、减小气隙、换高矫顽力牌号
σ 过大漏磁严重优化磁钢布局、增加隔磁桥宽度
Ke 偏低匝数不够、磁通偏低增加匝数或提高 Bg

参考资源

  • scripts/mec_calculator.py - 磁路计算脚本(基础版)
  • scripts/mec_calculator_v2.py - 磁路计算脚本 v2(增强版,支持迭代求解、永磁体库、hm扫描、极槽方案对比)
  • references/steel_pm_materials.md - 硅钢片和永磁体牌号参数库(快速查阅)

快速使用

# 交互模式(引导输入参数)
python scripts/mec_calculator_v2.py

# 命令行模式(直接计算)
python scripts/mec_calculator_v2.py --poles 8 --Q 36 --L 60 --delta 0.5 --Di 54 --hm 3

# 永磁体厚度扫描分析
python scripts/mec_calculator_v2.py --poles 8 --Q 36 --sweep_hm

# 极槽配合方案对比
python scripts/mec_calculator_v2.py --poles 8 --L 60 --compare_slots

注意:计算基于线性磁路假设(忽略铁心饱和),结果为初估参考。高精度设计请用 Maxwell 静磁场仿真验证。

注意事项

  • 本计算基于线性磁路假设,忽略铁心饱和,适合初步估算
  • 高精度结果需用 Maxwell 静磁场仿真验证
  • 内嵌式电机需考虑 d/q 轴磁路不对称
  • 分数槽集中绕组漏磁系数通常较大

Comments

Loading comments...