Skip to main content
 首页 » 编程设计

python之实现 Python CANopen

2024年11月01日7tuyile006

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

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

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

如有任何帮助,我们将不胜感激!

请您参考如下方法:

根据他们的文档,你需要提供电子数据表文件,查看 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