CN117938572A - Equipment control method, device, equipment and storage medium based on CAN communication - Google Patents

Equipment control method, device, equipment and storage medium based on CAN communication Download PDF

Info

Publication number
CN117938572A
CN117938572A CN202410022997.4A CN202410022997A CN117938572A CN 117938572 A CN117938572 A CN 117938572A CN 202410022997 A CN202410022997 A CN 202410022997A CN 117938572 A CN117938572 A CN 117938572A
Authority
CN
China
Prior art keywords
equipment
host
slave
communication
communication network
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202410022997.4A
Other languages
Chinese (zh)
Inventor
廖继华
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China And Korea Dooch Pump Manufacturing Shanghai Co ltd
Original Assignee
China And Korea Dooch Pump Manufacturing Shanghai Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by China And Korea Dooch Pump Manufacturing Shanghai Co ltd filed Critical China And Korea Dooch Pump Manufacturing Shanghai Co ltd
Priority to CN202410022997.4A priority Critical patent/CN117938572A/en
Publication of CN117938572A publication Critical patent/CN117938572A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/28Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
    • H04L12/40Bus networks
    • H04L12/40006Architecture of a communication node
    • H04L12/40013Details regarding a bus controller
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/28Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
    • H04L12/40Bus networks
    • H04L12/40006Architecture of a communication node
    • H04L12/40019Details regarding a bus master
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/28Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
    • H04L12/40Bus networks
    • H04L12/40169Flexible bus arrangements
    • H04L12/40176Flexible bus arrangements involving redundancy
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/28Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
    • H04L12/40Bus networks
    • H04L2012/40208Bus networks characterized by the use of a particular bus standard
    • H04L2012/40215Controller Area Network CAN

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Mobile Radio Communication Systems (AREA)

Abstract

The application provides a device control method, a device, equipment and a storage medium based on CAN communication, and relates to the technical field of network communication. When the host equipment in the CAN communication networking fails or fails to exit the network, the target slave equipment corresponding to the minimum identity number is determined in at least one slave equipment corresponding to the host equipment according to the identity number of the slave equipment, and the target slave equipment is set as new host equipment, so that the new host equipment is quickly selected to replace the original host equipment, the production continuity is guaranteed, and the production efficiency is improved.

Description

Equipment control method, device, equipment and storage medium based on CAN communication
Technical Field
The present application relates to the field of network communications technologies, and in particular, to a method, an apparatus, a device, and a storage medium for controlling a device based on CAN communications.
Background
The controller area network (Controller Area Network, abbreviated as CAN) bus is a serial communication protocol bus for real-time application, CAN use twisted pair to transmit signals, is one of the most widely used field buses at present, and is applied in various fields of automobile manufacturing, automatic control, aerospace, navigation, process industry, mechanical industry, textile machinery, agricultural machinery, robots, numerical control machine tools and the like due to high reliability and good error detection capability. Wherein, CAN equipment such as various sensors and controllers are connected with the CAN bus to form a CAN communication network. In a CAN communication network, the baud rate of each CAN device is the same, so that the CAN devices CAN communicate with each other; in addition, CAN devices typically also distinguish between a host device and a slave device, when a host device fails or fails, the corresponding slave device acts as a new host device to ensure that parameters and commands CAN be uniformly scheduled.
In the related art, when a host device in the CAN communication network fails or the host device is powered off to exit the CAN communication network, a slave device with the same ID number as the set device is selected from the slave devices as a new host device, but when no slave device with the same ID number as the set device exists, interruption of production occurs, and manual intervention and adjustment are required.
Disclosure of Invention
The embodiment of the application provides a device control method, a device, equipment and a storage medium based on CAN communication, which are used for rapidly selecting new host equipment from slave equipment after the host equipment in CAN communication networking fails or fails to exit the network so as to replace the original host equipment and ensure the production continuity.
In a first aspect, an embodiment of the present application provides an apparatus control method based on CAN communication, which is applied to a controller area network CAN communication network, where CAN equipment in the CAN communication network includes a host apparatus and at least one slave apparatus corresponding to the host apparatus; the device control method comprises the following steps: when the host equipment fails or fails to exit the network, determining a target slave equipment corresponding to the minimum identity number in at least one slave equipment according to the identity number of the slave equipment; the target slave device is set as the new master device.
In a possible implementation manner, the device control method based on CAN communication further includes: the method comprises the steps that a host device sends a parameter data packet to a corresponding slave device, wherein parameters carried by the parameter data packet comprise an operation mode of a water supply system, a water pressure mobilizing method, a water adding and subtracting pump algorithm and sensor calibration; after receiving the parameter data packet, the slave device performs parameter setting according to the parameter, and after finishing parameter setting, sends a setting finishing instruction to the corresponding host device.
In a possible implementation manner, the device control method based on CAN communication further includes: if the slave device comprises a first device newly accessed into the CAN communication network, the host device responds to receiving a setting completion instruction of the first device and determines whether the identity number of the first device is smaller than that of the host device; and if the identification number of the first equipment is smaller than the identification number of the host equipment, determining that the first equipment is the new host equipment.
In a possible implementation manner, the device control method based on CAN communication further includes: the original host device is set as the slave device.
In a possible implementation manner, the device control method based on CAN communication further includes: when the new second equipment is accessed into the CAN communication network, determining whether the baud rate of the second equipment is the same as the baud rate of the CAN communication network; if the baud rate of the second equipment is the same as that of the CAN communication networking, allowing the second equipment to join the CAN communication networking; and if the baud rate of the second equipment is different from the baud rate of the CAN communication network, prohibiting the second equipment from joining the CAN communication network.
In a possible implementation manner, the device control method based on CAN communication further includes: the host device periodically sends an inquiry frame to the corresponding slave device to determine whether the corresponding slave device has parameter change; if the parameter is changed, obtaining a changed parameter and a changed parameter value; sending updated parameter data packets to the corresponding slave equipment, wherein the updated parameter data packets at least carry changed parameters and changed parameter values; and/or after the local parameters of the host device are changed, the host device sends updated parameter data packets to the corresponding slave device.
In a second aspect, an embodiment of the present application provides an apparatus control device based on CAN communication, which is applied to a controller area network CAN communication network, where CAN equipment in the CAN communication network includes a host device and at least one slave device corresponding to the host device; the device control device based on CAN communication comprises: the first determining module is used for determining target slave equipment corresponding to the minimum identity number according to the identity number of the slave equipment in at least one slave equipment when the host equipment fails or fails to exit the network; and the setting module is used for setting the target slave device as a new host device.
In a possible implementation manner, the device control device based on the CAN communication further comprises a sending module, wherein the sending module is used for sending a parameter data packet to the corresponding slave device by the host device, and parameters carried by the parameter data packet comprise an operation mode of a water supply system, a water pressure mobilizing method, a water adding and subtracting pump algorithm and sensor calibration; after receiving the parameter data packet, the slave device performs parameter setting according to the parameter, and after finishing parameter setting, sends a setting finishing instruction to the corresponding host device.
In a possible implementation manner, the first determining module may be further configured to: when the slave device comprises a first device newly accessed into the CAN communication network, the host device responds to receiving a setting completion instruction of the first device and determines whether the identity number of the first device is smaller than that of the host device; and if the identification number of the first equipment is smaller than the identification number of the host equipment, determining that the first equipment is the new host equipment.
In a possible implementation, the setting module may be further configured to: the original host device is set as the slave device.
In a possible implementation manner, the device control apparatus based on CAN communication further includes a second determining module, configured to determine, when a new second device accesses the CAN communication network, whether the baud rate of the second device is the same as the baud rate of the CAN communication network; if the baud rate of the second equipment is the same as that of the CAN communication networking, allowing the second equipment to join the CAN communication networking; and if the baud rate of the second equipment is different from the baud rate of the CAN communication network, prohibiting the second equipment from joining the CAN communication network.
In a possible implementation manner, the device control apparatus based on CAN communication further includes a third determining module, configured to periodically send, by the host device, an inquiry frame to a corresponding slave device, so as to determine whether a parameter change exists in the corresponding slave device; if the parameter is changed, obtaining a changed parameter and a changed parameter value; sending updated parameter data packets to the corresponding slave equipment, wherein the updated parameter data packets at least carry changed parameters and changed parameter values; and/or after the local parameters of the host device are changed, the host device sends updated parameter data packets to the corresponding slave device.
In a third aspect, an embodiment of the present application provides a CAN communication network, where CAN devices in the CAN communication network include a host device and at least one slave device corresponding to the host device; wherein: and the at least one slave device is used for determining the target slave device corresponding to the minimum identity number according to the identity number of the slave device when the host device fails or fails to exit the network, and setting the target slave device as a new host device.
In a fourth aspect, an embodiment of the present application provides an electronic device, including:
At least one processor;
And a memory communicatively coupled to the at least one processor;
The memory is configured to store computer-executable instructions that, when executed by the at least one processor, implement steps executed by the host device or the slave device in the CAN communication-based device control method provided in the first aspect.
In a fifth aspect, an embodiment of the present application provides a computer-readable storage medium, in which computer-executable instructions are stored, the computer-executable instructions being executed by a processor to implement the CAN communication-based device control method provided in the first aspect.
In a sixth aspect, embodiments of the present application provide a program product comprising computer-executable instructions. When the computer-executable instructions are executed to implement the CAN communication-based device control method provided in the first aspect.
According to the equipment control method, the equipment and the storage medium based on CAN communication, when the host equipment in the CAN communication networking fails or fails to exit the network, the target slave equipment corresponding to the minimum identity number is determined in at least one slave equipment corresponding to the host equipment according to the identity number of the slave equipment, and the target slave equipment is set as new host equipment, so that the new host equipment is quickly selected to replace the original host equipment, the production continuity is ensured, and the production efficiency is improved.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the application and together with the description, serve to explain the principles of the application.
Fig. 1 is a schematic diagram of a CAN communication network according to an embodiment of the present application;
FIG. 2 is a flowchart of a method for controlling a CAN communication-based device according to an embodiment of the application;
FIG. 3 is a flowchart of a method for controlling a CAN communication-based device according to another embodiment of the application;
FIG. 4 is a flowchart of a method for controlling a CAN communication-based device according to another embodiment of the application;
fig. 5 is a schematic structural diagram of a device control apparatus based on CAN communication according to an embodiment of the present application;
Fig. 6 is a schematic structural diagram of an electronic device according to an embodiment of the application.
Specific embodiments of the present application have been shown by way of the above drawings and will be described in more detail below. The drawings and the written description are not intended to limit the scope of the inventive concepts in any way, but rather to illustrate the inventive concepts to those skilled in the art by reference to the specific embodiments.
Detailed Description
Reference will now be made in detail to exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, the same numbers in different drawings refer to the same or similar elements, unless otherwise indicated. The implementations described in the following exemplary examples do not represent all implementations consistent with the application. Rather, they are merely examples of apparatus and methods consistent with aspects of the application as detailed in the accompanying claims.
In the related technology, on one hand, the equipment newly connected with the CAN communication network needs to set parameters to be connected with the CAN communication network and controlled, and the parameters are manually set, but because of more parameters, the manual setting is time-consuming and labor-consuming and is easy to make mistakes; on the other hand, in the replacement strategies of the master equipment and the slave equipment in the CAN communication networking, the redundant design is insufficient, so that the CAN communication networking CAN be failed or cut off, and after the failure of the master equipment, the new master equipment CAN not be quickly replaced, so that the production is interrupted, and manual intervention and adjustment are needed.
Based on the problems in the related art, the embodiment of the application forms a redundant replacement strategy between the host equipment and the slave equipment by adopting a software strategy and an algorithm under the condition of not changing a hardware circuit, so that after the host equipment in the CAN communication networking fails or fails to power off and exits the network, new host equipment CAN be quickly selected from the slave equipment to replace the original host equipment, the production continuity is ensured, and the production efficiency is improved.
Fig. 1 is a schematic diagram of a CAN communication network according to an embodiment of the present application. As shown in fig. 1, the CAN devices in the CAN communication network 10 include a host device 11 and at least one slave device 12 corresponding to the host device 11. Wherein the host device 11 and at least one slave device 12 corresponding to the host device 11 are connected in a "hand-held" manner through the CAN communication bus 13.
The CAN communication bus may be, for example, a twisted pair shielded wire.
Specifically, at least one slave device 12 is configured to determine, according to the identity number of the slave device 12, a target slave device corresponding to the minimum identity number when the host device 11 fails or fails to log off, and set the target slave device as a new host device.
It CAN be understood that the CAN device in the CAN communication network 10 may be used as a host device, and send a parameter data packet to at least one slave device corresponding to the host device; the method can also be used as the slave device, when the host device fails or fails to exit the network, the target slave device corresponding to the minimum identity number is determined according to the identity number of the slave device, and the target slave device is set as a new host device.
In the device control method based on the CAN communication provided by the embodiment of the present application, the number of the slave devices corresponding to the host device in the CAN communication network is not limited, and specifically, the number of the slave devices is determined according to the actual requirement.
The CAN device may be a frequency converter, for example.
In an application scenario, such as a constant pressure water supply system, where the device control method based on CAN communication provided by the embodiment of the application is applicable, there are a plurality of water pumps, each water pump is connected with a frequency converter for controlling the rotation speed of the water pump, and each frequency converter is connected with a CAN communication bus, namely a twisted pair shielded wire, to form a CAN communication network.
The above-mentioned any application scenario provided by the embodiment of the present application is an apparatus control method based on CAN communication provided by the embodiment of the present application, and the type of CAN apparatus in the CAN communication network is not limited.
Based on the above-mentioned CAN communication networking, the implementation manner of the device control method based on CAN communication provided by the embodiment of the present application is described in detail below with reference to specific embodiments.
Fig. 2 is a flowchart of a method for controlling a device based on CAN communication according to an embodiment of the present application. The device control method based on CAN communication is applied to CAN communication networking, and CAN equipment in the CAN communication networking comprises a host device and at least one slave device corresponding to the host device. As shown in fig. 2, the device control method based on CAN communication includes the following steps:
s201, when the host equipment fails or fails to exit the network, in at least one slave equipment, determining the target slave equipment corresponding to the minimum identity number according to the identity number of the slave equipment.
The identification number may be specifically an ID number.
It CAN be understood that when the host device fails or fails to exit the network, the host device will not periodically send an inquiry frame to the slave device, i.e. the CAN communication bus is in an idle state, and at this time, at least one slave device corresponding to the host device may actively send a message to the CAN communication bus.
In the device control method based on CAN communication provided by the embodiment of the present application, the message sent by the at least one slave device to the CAN communication bus may be an identification number corresponding to the at least one slave device.
In a possible implementation manner, when the slave device cannot receive the query frame sent by the host device within a certain period of time, at least one slave device automatically sends an identification number corresponding to the slave device to the CAN communication bus, and at least one slave device performs communication interaction based on the CAN communication bus so as to compare the sizes of the identification numbers, and determines the slave device corresponding to the minimum identification number as the target slave device.
As an example, in at least one slave device, the identity numbers of the slave devices are 2, 4 and 6, respectively, and at this time, the slave device with the identity number of 2 is determined to be the target slave device.
S202, setting the target slave device as a new master device.
It CAN be understood that at least one slave device corresponding to the host device automatically sends a corresponding identity number to the CAN communication bus, and performs communication interaction based on the CAN communication bus, so as to automatically determine the slave device with the smallest identity number as a new host device when comparing the sizes of the identity numbers.
In the embodiment of the application, after the host equipment in the CAN communication networking fails or fails to power off and exits the network, the slave equipment corresponding to the minimum identity number is rapidly selected from the slave equipment to be the new host equipment, so that the original host equipment is replaced, the production continuity is ensured, and the production efficiency is improved; in addition, compared with the scheme that manual intervention and adjustment are needed when the slave equipment with the same equipment ID number is not arranged, the manual intervention and adjustment cost can be reduced.
Optionally, the primary master device is set as the slave device. That is, the master device that failed or was powered down off is set as the slave device.
Optionally, after the target slave device is set as a new host device, the new host device sends parameter data packets to other slave devices, so as to realize the consistency of parameters of the host device and the slave device, and ensure that parameters and commands of the CAN device in the CAN communication network CAN be uniformly scheduled.
Based on the above embodiment, optionally, in the device control method based on CAN communication provided by the embodiment of the present application, when the CAN device in the CAN communication network operates normally, the host device periodically sends an inquiry frame to the corresponding slave device, so as to determine whether the corresponding slave device has parameter change; if the parameter is changed, obtaining a changed parameter and a changed parameter value; sending updated parameter data packets to the corresponding slave equipment, wherein the updated parameter data packets at least carry changed parameters and changed parameter values; and/or after the local parameters of the host device are changed, the host device sends updated parameter data packets to the corresponding slave device.
Specifically, the user can change parameters in the master device or the slave device according to actual requirements.
Fig. 3 is a flowchart of a device control method based on CAN communication according to still another embodiment of the present application. As shown in fig. 3, the device control method based on CAN communication includes the following steps:
S301, the host device sends a parameter data packet to the corresponding slave device, wherein parameters carried by the parameter data packet comprise an operation mode of a water supply system, a water pressure mobilizing method, a water adding and subtracting pump algorithm and sensor calibration.
In the device control method based on CAN communication provided by the embodiment of the application, when a new slave device is accessed to the CAN communication network, the host device sends a parameter data packet to the new slave device, so that the new slave device completes the setting of corresponding parameters according to the parameter data packet sent by the host device; in response to detecting a change in a parameter in the slave device or the host device, the host device sends an updated parameter data packet to the slave device.
S302, after receiving the parameter data packet, the slave device performs parameter setting according to the parameter, and after finishing parameter setting, sends a setting finishing instruction to the corresponding host device.
It will be appreciated that the parameter settings of the slave device are consistent with the parameter settings of the master device.
In the embodiment of the application, the host device sends the parameter data packet to the corresponding slave device, the slave device performs parameter setting according to the parameters after receiving the parameter data packet, and sends a setting completion instruction to the corresponding host device after completing parameter setting. After the novel slave device is accessed into the CAN communication network, the application completes the setting of the parameters thereof by the parameter data packet sent by the host device, ensures the accuracy of the parameters and improves the setting efficiency of the parameters.
Optionally, if the slave device includes a first device newly connected to the CAN communication network, the host device determines whether the identity number of the first device is smaller than the identity number of the host device in response to receiving a setting completion instruction of the first device; and if the identification number of the first equipment is smaller than the identification number of the host equipment, determining that the first equipment is the new host equipment.
Optionally, if the identification number of the first device is greater than the identification number of the host device, determining that the first device is a slave device.
Optionally, the original master device is set as the slave device upon determining that the first device is a new master device.
It CAN be understood that the CAN equipment newly added into the CAN communication network is added into the CAN communication network as the identity of the slave equipment after being powered on.
It CAN be understood that the identity number of the CAN device newly added to the CAN communication network is different from the identity number of the host device or the slave device existing in the CAN communication network.
In a possible implementation manner, when the identity number of the new CAN device is the same as the identity number of the existing host device or slave device in the CAN communication network, the new CAN device fails to join the CAN communication network, and when the identity number of the new CAN device is different from the identity number of the existing host device or slave device in the CAN communication network, the new CAN device CAN successfully join the CAN communication network.
In the method for controlling the device based on the CAN communication according to the embodiment of the present application, a detailed description is given below of a manner in which a new CAN device is connected to the CAN communication network.
Fig. 4 is a flowchart of a device control method based on CAN communication according to another embodiment of the present application. As shown in fig. 4, the device control method based on CAN communication includes the following steps:
s401, when the new second equipment is accessed into the CAN communication network, determining whether the baud rate of the second equipment is the same as the baud rate of the CAN communication network.
The baud rate represents the number of symbol symbols transmitted per unit time, which is a measure of the symbol transmission rate, and when expressed in terms of the number of carrier modulation state changes per unit time, the baud rate refers to the number of transmitted symbols per unit time.
Specifically, when the baud rate of the second device is the same as the baud rate of the CAN communication network, step S402 is executed; and when the baud rate of the second device is different from the baud rate of the CAN communication network, executing step S403.
And S402, if the baud rate of the second equipment is the same as that of the CAN communication network, allowing the second equipment to join the CAN communication network.
S403, if the baud rate of the second device is different from the baud rate of the CAN communication network, prohibiting the second device from joining the CAN communication network.
In one possible implementation, when the baud rate of the second device is different from the baud rate of the CAN communication network, the baud rate of the second device is changed to be the same as the baud rate of the CAN communication network, so that the second device joins the CAN communication network.
In the embodiment of the application, when the new second equipment is connected into the CAN communication network, whether the baud rate of the second equipment is the same as the baud rate of the CAN communication network is determined, when the baud rate of the second equipment is the same as the baud rate of the CAN communication network, the second equipment is allowed to be connected into the CAN communication network, and when the baud rate of the second equipment is different from the baud rate of the CAN communication network, the second equipment is forbidden to be connected into the CAN communication network, so that the safety of the CAN communication network is improved.
It should be noted that, the networking information and the device information in the CAN communication networking provided by the embodiment of the application CAN be obtained through an upper computer, so as to realize remote monitoring of the CAN device. The networking information may include, for example, the number of CAN devices in the CAN communication network, whether the CAN devices CAN normally operate, stability of an operation state of the CAN devices, a host device, and a slave device; the device information may be a device currently accessing the CAN communication network.
The following are examples of the apparatus of the present application that may be used to perform the method embodiments of the present application. For details not disclosed in the embodiments of the apparatus of the present application, please refer to the embodiments of the method of the present application.
Fig. 5 is a schematic structural diagram of a device control apparatus based on CAN communication according to an embodiment of the present application. The CAN communication network controller is applied to a CAN communication network of a controller area network, and CAN equipment in the CAN communication network comprises a host equipment and at least one slave equipment corresponding to the host equipment. As shown in fig. 5, the CAN communication-based device control apparatus 50 includes: a first determination module 510 and a setting module 520.
The first determining module 510 is configured to determine, in at least one slave device, a target slave device corresponding to the minimum identity number according to the identity number of the slave device when the host device fails or fails to exit the network;
a setting module 520, configured to set the target slave device as a new master device.
In a possible implementation manner, the device control device based on CAN communication further includes a sending module (not shown), where the sending module is configured to send a parameter data packet to a corresponding slave device by using a host device, where parameters carried by the parameter data packet include an operation mode of a water supply system, a water pressure mobilizing method, a water adding and subtracting pump algorithm, and sensor calibration; after receiving the parameter data packet, the slave device performs parameter setting according to the parameter, and after finishing parameter setting, sends a setting finishing instruction to the corresponding host device.
In a possible implementation manner, the first determining module 510 may be further configured to: when the slave device comprises a first device newly accessed into the CAN communication network, the host device responds to receiving a setting completion instruction of the first device and determines whether the identity number of the first device is smaller than that of the host device; and if the identification number of the first equipment is smaller than the identification number of the host equipment, determining that the first equipment is the new host equipment.
In one possible implementation, the setting module 520 may also be configured to: the original host device is set as the slave device.
In a possible implementation manner, the device control apparatus based on CAN communication further includes a second determining module (not shown), configured to determine, when a new second device accesses the CAN communication network, whether the baud rate of the second device is the same as the baud rate of the CAN communication network; if the baud rate of the second equipment is the same as that of the CAN communication networking, allowing the second equipment to join the CAN communication networking; and if the baud rate of the second equipment is different from the baud rate of the CAN communication network, prohibiting the second equipment from joining the CAN communication network.
In a possible implementation manner, the device control apparatus based on CAN communication further includes a third determining module (not shown), configured to periodically send, by the host device, an inquiry frame to the corresponding slave device, so as to determine whether there is a parameter change in the corresponding slave device; if the parameter is changed, obtaining a changed parameter and a changed parameter value; sending updated parameter data packets to the corresponding slave equipment, wherein the updated parameter data packets at least carry changed parameters and changed parameter values; and/or after the local parameters of the host device are changed, the host device sends updated parameter data packets to the corresponding slave device.
The device control apparatus based on CAN communication provided in this embodiment may be used to execute the method steps in the foregoing method embodiment, and the specific implementation manner and technical effects are similar, and are not repeated herein.
It should be noted that, it should be understood that the division of the modules of the above apparatus is merely a division of a logic function, and may be fully or partially integrated into a physical entity or may be physically separated. And these modules may all be implemented in software in the form of calls by the processing element; or can be realized in hardware; the method can also be realized in a form of calling software by a processing element, and the method can be realized in a form of hardware by a part of modules. For example, the processing module may be a processing element that is set up separately, may be implemented in a chip of the above-mentioned apparatus, or may be stored in a memory of the above-mentioned apparatus in the form of program codes, and the functions of the above-mentioned processing module may be called and executed by a processing element of the above-mentioned apparatus. The implementation of the other modules is similar. In addition, all or part of the modules can be integrated together or can be independently implemented. The processing element here may be an integrated circuit with signal processing capabilities. In implementation, each step of the above method or each module above may be implemented by an integrated logic circuit of hardware in a processor element or an instruction in a software form.
For example, the modules above may be one or more integrated circuits configured to implement the methods above, such as: one or more Application SPECIFIC INTEGRATED Circuits (ASIC), or one or more microprocessors (DIGITAL SIGNAL Processor DSP), or one or more field programmable gate arrays (Field Programmable GATE ARRAY FPGA), etc. For another example, when a module above is implemented in the form of a processing element scheduler code, the processing element may be a general-purpose processor, such as a central processing unit (Central Processing Unit, CPU) or other processor that may invoke the program code. For another example, the modules may be integrated together and implemented in the form of a System-On-a-Chip (SOC).
In the above embodiments, it may be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer instructions are loaded and executed on a computer, the processes or functions in accordance with embodiments of the present application are produced in whole or in part. The computer may be a general purpose computer, a special purpose computer, a computer network, or other programmable apparatus. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center by a wired (e.g., coaxial cable, fiber optic, digital subscriber line (Digital Subscriber Line, DSL) or wireless (e.g., infrared, wireless, microwave, etc.). Computer readable storage media can be any available media that can be accessed by a computer or data storage devices, such as servers, data centers, etc., that contain an integration of one or more available media. Usable media may be magnetic media (e.g., floppy disks, hard disks, magnetic tape), optical media (e.g., digital versatile disks (Digital Video Disc, abbreviated to DVD)), or semiconductor media (e.g., solid state disk Solid STATE DISK (SSD)), etc.
Fig. 6 is a schematic structural diagram of an electronic device according to an embodiment of the application. As shown in fig. 6, the electronic device 60 includes: at least one processor 610, memory 620, communication interface 630, and system bus 640. The memory 620 and the communication interface 630 are connected to the processor 610 through the system bus 640 and complete communication therebetween, the memory 620 is used for storing instructions, the communication interface 630 is used for communicating with other devices, and the processor 610 is used for calling the instructions in the memory to execute the method steps provided in the method embodiments, and the specific implementation manner and technical effects are similar and are not repeated here.
The system bus 640 referred to in fig. 6 may be a peripheral component interconnect standard (PERIPHERAL COMPONENT INTERCONNECT, PCI) bus, or an extended industry standard architecture (Extended Industry Standard Architecture, EISA) bus, or the like. The system bus 640 may be divided into an address bus, a data bus, a control bus, and the like. For ease of illustration, the figures are shown with only one bold line, but not with only one bus or one type of bus.
The communication interface 630 is used to enable communication between the database access apparatus and other devices (e.g., clients, read-write libraries, and read-only libraries).
The memory 620 may include a random access memory (Random Access Memory, abbreviated as RAM) and may further include a non-volatile memory (non-volatile memory), such as at least one disk memory.
The processor 610 may be a general-purpose processor, including a central processing unit, a network processor (Network Processor, NP for short), etc.; a digital signal Processor (DIGITAL SIGNAL Processor, DSP), application SPECIFIC INTEGRATED Circuit (ASIC), field programmable gate array (Field Programmable GATE ARRAY, FPGA) or other programmable logic device, discrete gate or transistor logic device, discrete hardware components.
The embodiment of the application also provides a computer readable storage medium, in which computer executable instructions are stored, and the computer executable instructions are used for implementing the method steps in the method embodiment when being executed by a processor, and the specific implementation manner and technical effect are similar, and are not repeated here.
Embodiments of the present application also provide a program product containing computer-executable instructions. When the computer-executed instructions are executed to implement the method steps in the method embodiments described above, the specific implementation manner and technical effects are similar, and will not be described herein again.
Other embodiments of the application will be apparent to those skilled in the art from consideration of the specification and practice of the application disclosed herein. This application is intended to cover any variations, uses, or adaptations of the application following, in general, the principles of the application and including such departures from the present disclosure as come within known or customary practice within the art to which the application pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the application being indicated by the following claims.
It is to be understood that the application is not limited to the precise arrangements and instrumentalities shown in the drawings, which have been described above, and that various modifications and changes may be effected without departing from the scope thereof. The scope of the application is limited only by the appended claims.
It should be noted that, the user information (including but not limited to user equipment information, user personal information, etc.) and the data (including but not limited to data for analysis, stored data, presented data, etc.) related to the present application are information and data authorized by the user or fully authorized by each party, and the collection, use and processing of the related data need to comply with the related laws and regulations and standards of the related country and region, and provide corresponding operation entries for the user to select authorization or rejection.

Claims (10)

1. The equipment control method based on CAN communication is characterized by being applied to a controller area network CAN communication network, wherein CAN equipment in the CAN communication network comprises a host equipment and at least one slave equipment corresponding to the host equipment;
The device control method comprises the following steps:
When the host equipment fails or fails to exit the network, determining a target slave equipment corresponding to the minimum identity number in the at least one slave equipment according to the identity number of the slave equipment;
Setting the target slave device as a new master device.
2. The apparatus control method according to claim 1, characterized by further comprising:
The method comprises the steps that a host device sends a parameter data packet to a corresponding slave device, wherein parameters carried by the parameter data packet comprise an operation mode of a water supply system, a water pressure mobilizing method, a water adding and subtracting pump algorithm and sensor calibration;
And the slave equipment performs parameter setting according to the parameters after receiving the parameter data packet, and sends a setting completion instruction to the corresponding host equipment after completing parameter setting.
3. The apparatus control method according to claim 2, characterized by further comprising:
If the slave device comprises a first device newly accessed to the CAN communication network, the host device responds to receiving a setting completion instruction of the first device and determines whether the identity number of the first device is smaller than that of the host device;
and if the identity number of the first equipment is smaller than the identity number of the host equipment, determining that the first equipment is new host equipment.
4. The apparatus control method according to any one of claims 1 to 3, characterized by further comprising:
The original host device is set as the slave device.
5. The apparatus control method according to any one of claims 1 to 3, characterized by further comprising:
When a new second device is accessed into the CAN communication network, determining whether the baud rate of the second device is the same as the baud rate of the CAN communication network;
if the baud rate of the second equipment is the same as the baud rate of the CAN communication network, allowing the second equipment to join the CAN communication network;
and if the baud rate of the second equipment is different from the baud rate of the CAN communication network, prohibiting the second equipment from joining the CAN communication network.
6. The apparatus control method according to any one of claims 1 to 3, characterized by further comprising:
The host device periodically sends an inquiry frame to the corresponding slave device to determine whether the corresponding slave device has parameter change; if the parameter is changed, obtaining a changed parameter and a changed parameter value; sending updated parameter data packets to the corresponding slave equipment, wherein the updated parameter data packets at least carry changed parameters and changed parameter values;
and/or after the local parameters of the host device are changed, the host device sends updated parameter data packets to the corresponding slave device.
7. The utility model provides a device control device based on CAN communication, its characterized in that is applied to controller area network CAN communication network deployment, CAN equipment in the CAN communication network deployment includes host computer equipment and at least one slave machine equipment that the host computer equipment corresponds, device control device includes:
The first determining module is used for determining a target slave device corresponding to the minimum identity number according to the identity number of the slave device in the at least one slave device when the host device fails or fails to exit the network;
And the setting module is used for setting the target slave device as a new host device.
8. The CAN communication networking is characterized in that CAN equipment in the CAN communication networking comprises a host equipment and at least one slave equipment corresponding to the host equipment; wherein:
And the at least one slave device is used for determining the target slave device corresponding to the minimum identity number according to the identity number of the slave device when the host device fails or fails to exit the network, and setting the target slave device as a new host device.
9. An electronic device, comprising:
At least one processor;
And a memory communicatively coupled to the at least one processor;
Wherein the memory is adapted to store computer-executable instructions which, when executed by the at least one processor, implement the steps performed by the master device or the slave device in the method of any one of claims 1 to 6.
10. A computer readable storage medium having stored therein computer executable instructions which when executed implement the method of any one of claims 1 to 6.
CN202410022997.4A 2024-01-08 2024-01-08 Equipment control method, device, equipment and storage medium based on CAN communication Pending CN117938572A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410022997.4A CN117938572A (en) 2024-01-08 2024-01-08 Equipment control method, device, equipment and storage medium based on CAN communication

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410022997.4A CN117938572A (en) 2024-01-08 2024-01-08 Equipment control method, device, equipment and storage medium based on CAN communication

Publications (1)

Publication Number Publication Date
CN117938572A true CN117938572A (en) 2024-04-26

Family

ID=90760673

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410022997.4A Pending CN117938572A (en) 2024-01-08 2024-01-08 Equipment control method, device, equipment and storage medium based on CAN communication

Country Status (1)

Country Link
CN (1) CN117938572A (en)

Similar Documents

Publication Publication Date Title
CN111522264B (en) Control method and device of equipment, storage medium and electronic device
US10414629B2 (en) Mechanical system service tool
CN105183575A (en) Processor fault diagnosis method, device and system
CN112565348A (en) Intelligent equipment testing method and system, computer equipment and storage medium
US10659536B2 (en) Method of controlling inverters
CN109451518B (en) Method and equipment for distinguishing WLAN access mode of terminal
US7475164B2 (en) Apparatus, system, and method for automated device configuration and testing
CN117938572A (en) Equipment control method, device, equipment and storage medium based on CAN communication
CN110930110B (en) Distributed flow monitoring method and device, storage medium and electronic equipment
CN110730213B (en) Method, system, medium, and apparatus for monitoring life cycle of sensor device
CN113938351A (en) Data acquisition method, system and computer readable storage medium
CN116389505A (en) Networking method based on CAN bus and computer equipment
JP6958542B2 (en) Information processing equipment, information processing methods, information processing programs and information processing systems
CN112214437B (en) Storage device, communication method and device and computer readable storage medium
CN106028303B (en) Intelligent device discovery method and device
US20210373540A1 (en) Wireless Communication For Industrial Automation
CN111819039B (en) Robot control method, apparatus and readable storage medium
CN115495301A (en) Fault processing method, device, equipment and system
CN111010286A (en) Intelligent registration method and device based on serial bus, electronic equipment and medium
CN108882268A (en) A kind of method and apparatus of more new device configuration
CN115599631B (en) Component monitoring method and device, electronic equipment and storage medium
CN116155645B (en) CAN bus-based equipment network access method, device, equipment and medium
JP7120479B1 (en) Communication system, communication control method, and program
CN113824752B (en) Parameter processing method, electrical equipment and server
CN107295540B (en) Network element configuration method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination