Skip to main content

ECU_TEST 使用说明

1. 包简介

ECU_TEST 是一个基于 Python 的 ECU 测试辅助包


2. 环境要求

请先确认环境中已经安装:

  • Python 3.10+
  • 依赖的构建工具(如有需要)
  • Vector 驱动 / Vector 硬件(如果要实际通过 Vector 设备通信)

如果没有安装 Vector 驱动,初始化时可能会出现连接失败或无法收发数据的问题。


3. 安装方式

在项目根目录执行:

pip install .

如果你希望在开发模式下使用:

pip install -e .

4. 导入方式

安装完成后,可以这样导入:

from ecu_test import UDS, CANape, CANoe

5. 基本使用示例

5.1 配置参数

config = {
    "tr_id": "0x7E0",
    "rx_id": "0x7E8",
    "ch": 1,
    "fd": False,
    "app_name": "CANoe",
    "bitrate": 500000,
    "stmin": 20,
    "mask": "0xFF",
    "pad": "0x55",
}

5.2 初始化 UDS 对象

uds = UDS(config)

5.3 发送 UDS 请求

resp = uds.send_req("10 01", dlc=8, t=30)
print(resp)

5.4 初始化 CANape / CANoe 对象

canape = CANape()
canoe = CANoe()

5.5 CANape 使用说明

from ecu_test import CANape

canape = CANape(
    path=r"E:\CANape\",
    cna=r"E:\CANape\config.cna",
)

canape.set_log(r"E:\CANape\logs\test.mf4")
canape.start_mse()

value = canape.get_sig("SignalName")
canape.set_sig("SignalName", 1.23)

canape.stop_mse()
canape.close()

常用方法:

  • CANape(path, cna)
  • set_log(file)
  • start_mse()
  • stop_mse()
  • get_sig(sig)
  • set_sig(sig, val)
  • close()

5.6 CANoe 使用说明

from ecu_test import CANoe

canoe = CANoe(
    path=r"D:\CANoe\CANoe_Test\CANoe_Test.cfg",
)

canoe.open()
canoe.start_mse()

value = canoe.get_sig("CAN", "MessageName", "SignalName")
canoe.set_sig("CAN", "MessageName", "SignalName", 1.23)

env_value = canoe.get_env("Namespace", "VariableName")
canoe.set_env("Namespace", "VariableName", 42)

canoe.set_log(r"D:\CANoe\logs\test.blf")

canoe.stop_mse()
canoe.close()

常用方法:

  • CANoe(path)
  • open()
  • start_mse()
  • stop_mse()
  • is_running()
  • get_sig(ch, msg, sig)
  • set_sig(ch, msg, sig, val)
  • get_env(ns, var)
  • set_env(ns, var, val)
  • set_log(file)
  • close()

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ecu_test-1.2.1-cp310-abi3-manylinux_2_17_x86_64.whl (255.0 kB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ x86-64

File details

Details for the file ecu_test-1.2.1-cp310-abi3-manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for ecu_test-1.2.1-cp310-abi3-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 a15bd80dadd2caa514401e02b58702f31203abbba51787dc40bbec3d69798d64
MD5 0b73278f614a4ab7d63dd2c62e0c0124
BLAKE2b-256 b0b7f4ed13d1a07342c6aad90600022db761a8353c39f560eb3039ccfd046956

See more details on using hashes here.

Release history Release notifications | RSS feed

1.2.2

1 file

This release

1.2.1 This release

1 file

1.2.0

1 file

1.1.8

1 file

1.1.7

1 file

1.1.6

1 file

1.1.5

1 file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page