首页 > 解决方案 > 实现 Python CANopen

问题描述

我是 CANopen 的新手,我正在努力使用它来连接微处理器和电池管理系统。我有几个问题。

  1. 制造商提供的电池管理系统等对象字典、电子数据表和设备配置文件?

  2. 我必须自己生成这些文件吗?

任何帮助将不胜感激!

标签: pythoncan-buscanopen

解决方案


根据他们的文档,您需要提供电子数据表文件,查看 git repo ( https://github.com/christiansandberg/canopen/tree/3d3d46beae7f6aad65d58b1247eab5ae758fb9e2 ),很明显您需要 eds 文件:

  # Add some nodes with corresponding Object Dictionaries
    node = canopen.BaseNode402(35, '/home/andre/Code/test/jupiter.eds')
    network.add_node(node)
    # network.add_node(34, '/home/andre/Code/test/jupiter.eds')
    # node = network[34]

创建节点时通常会提供对象字典文件node = network.add_node(6, 'od.eds'),您可以在下面找到add_node函数定义:

def add_node(self, node, object_dictionary=None, upload_eds=False):
        """Add a remote node to the network.
        :param node:
            Can be either an integer representing the node ID, a
            :class:`canopen.RemoteNode` or :class:`canopen.LocalNode` object.
        :param object_dictionary:
            Can be either a string for specifying the path to an
            Object Dictionary file or a
            :class:`canopen.ObjectDictionary` object.
        :param bool upload_eds:
            Set ``True`` if EDS file should be uploaded from 0x1021.
        :return:
            The Node object that was added.
        :rtype: canopen.RemoteNode
        """

也许您可以在这里找到所需的数据表:https ://compatibility.rockwellautomation.com/pages/search.aspx?crumb=117&q=EDS%20files


推荐阅读