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, log_path="uds.log")

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",
    log_path="canoe.log",
)

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.1.8-cp310-abi3-win_amd64.whl (125.7 kB view details)

Uploaded CPython 3.10+Windows x86-64

File details

Details for the file ecu_test-1.1.8-cp310-abi3-win_amd64.whl.

File metadata

  • Download URL: ecu_test-1.1.8-cp310-abi3-win_amd64.whl
  • Upload date:
  • Size: 125.7 kB
  • Tags: CPython 3.10+, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.20

File hashes

Hashes for ecu_test-1.1.8-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 3b789c338063039c7e4977da9105a85f9f062ffaf4187a01eda666c3b72a169a
MD5 01b5a83d8c2d3f9dc4e1bd027bc75729
BLAKE2b-256 48d09773d65db44ba360ace1a14c70ca599bc97b2655f8e684987a2e1c8302a9

See more details on using hashes here.

Release history Release notifications | RSS feed

1.2.2

1 file

1.2.1

1 file

1.2.0

1 file

This release

1.1.8 This release

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