TVS二极管应用候选表怎样用脚本检查?波形条件不同不能直接排序

TVS候选表最常见的程序错误,是把VC、IPP或PPPM当成普通数值排序。两个数字如果对应不同波形、温度或测试电流,排序结果没有工程意义。

下面用Python标准库读取CSV。示例数据全部为合成字段,不代表任何实际品牌或型号。

CSV格式

candidates.csv:

arduino 复制代码
part,vrwm_v,vc_v,vc_at_ipp_a,waveform,temp_c,value_type
DEMO-A,24,38.0,10.0,8/20us,25,max
DEMO-B,24,36.0,8.0,8/20us,25,max
DEMO-C,24,32.0,2.0,10/1000us,25,max
DEMO-D,24,35.0,10.0,8/20us,25,typ

如果直接按vc_v升序,DEMO-C会排第一。但它的波形和电流都不同;DEMO-D又是典型值,不能和最大值混在一起。

检查脚本

python 复制代码
from __future__ import annotations

import csv
import sys
from collections import defaultdict

REQUIRED = {
    "part", "vrwm_v", "vc_v", "vc_at_ipp_a",
    "waveform", "temp_c", "value_type"
}


def read_rows(path: str) -> list[dict[str, str]]:
    with open(path, newline="", encoding="utf-8-sig") as file:
        reader = csv.DictReader(file)
        missing = REQUIRED - set(reader.fieldnames or [])
        if missing:
            raise ValueError(f"missing columns: {sorted(missing)}")
        rows = list(reader)
    if not rows:
        raise ValueError("candidate table is empty")
    return rows


def condition_key(row: dict[str, str]) -> tuple[str, float, float, str]:
    return (
        row["waveform"].strip().lower(),
        float(row["vc_at_ipp_a"]),
        float(row["temp_c"]),
        row["value_type"].strip().lower(),
    )


def group_comparable(rows: list[dict[str, str]]):
    groups: dict[tuple, list[dict[str, str]]] = defaultdict(list)
    for row in rows:
        groups[condition_key(row)].append(row)
    return groups


def main(path: str) -> int:
    rows = read_rows(path)
    groups = group_comparable(rows)

    if len(groups) > 1:
        print("STOP: VC rows use different test conditions.")
        for key, items in groups.items():
            names = ", ".join(item["part"] for item in items)
            print(f"  condition={key}: {names}")
        print("Compare VC only inside one condition group.")
        return 2

    ranked = sorted(rows, key=lambda row: float(row["vc_v"]))
    for row in ranked:
        print(row["part"], row["vc_v"])
    return 0


if __name__ == "__main__":
    raise SystemExit(main(sys.argv[1]))

运行:

复制代码
python check_tvs.py candidates.csv

脚本会以状态码2退出,并打印四组测试条件,而不是生成一个误导性的VC排行榜。

为什么条件键要包含四项

  • waveform:8/20 μs与10/1000 μs不能直接混排;
  • vc_at_ipp_a:VC随测试电流变化;
  • temp_c:温度会影响器件行为和降额;
  • value_type:典型值不能当成最大保证值。

真实项目还可以加入脉冲公差、封装、极性、数据手册版本和测试方法。

VRWM也不能只比较大小

脚本中vrwm_v尚未参与排序,因为VRWM首先是约束:候选值应覆盖线路最高持续电压。它不是越高越好。提高VRWM可能同时抬高VBR或VC,保护窗口需要重新核对。

可以先加入项目配置:

ini 复制代码
BUS_MAX_CONTINUOUS_V = 27.0  # 仅为演示值
eligible = [
    row for row in rows
    if float(row["vrwm_v"]) >= BUS_MAX_CONTINUOUS_V
]

生产系统不应把演示值写死,而应从经过批准的需求文件读取。

程序应该输出"待补证据"

缺少波形、温度或工作点时,不要填0,也不要猜。建议状态:

  • reject:已知不满足正常工作窗口;
  • needs_evidence:字段缺失或条件不可比较;
  • candidate:可以进入实板验证。

最终批准仍要由规格书、PCB布局、样机和测试结果完成。ASIM阿赛姆产品数据进入候选表时也使用同一规则,不能因为是自有品牌就跳过条件校验。

参考资料:

相关推荐
茶底世界之下7 天前
雨天的窗边:用 Awaking 轻轻提亮一盆蕨
ios·app·产品
茶底世界之下8 天前
海边书店的阴天:用 Awaking 留住青绿与暖灯
ios·app·产品
茶底世界之下9 天前
旧电影院的红座椅:用 Awaking 留住放映前的光
ios·app·产品
茶底世界之下10 天前
洗衣房的午后斜光:用 Awaking 把光和影分开
ios·app·产品
茶底世界之下11 天前
冬日窗边的早餐:用 Awaking 留住冷光里的暖意
ios·app·产品
茶底世界之下12 天前
雨后的黄电车:用 Awaking 给灰色街景定一个主角
ios·app·产品
华洛13 天前
【揭秘】深度拆解 WorkBuddy 产品能力的实现逻辑
程序员·产品经理·产品
茶底世界之下14 天前
海边游乐场的黄昏:用 Awaking 留住一层暖光
ios·app·产品
文谦南宁AI普工15 天前
把 eval 做成发布门禁:配对检验 + 三档判定,一个不到 200 行的纯标准库实现
agent·ai编程·产品
茶底世界之下15 天前
雾中山路的冷光层次:用 Awaking 留住红色背影
ios·app·产品