CN114531317A - Communication method of generator set controller and upper computer - Google Patents
Communication method of generator set controller and upper computer Download PDFInfo
- Publication number
- CN114531317A CN114531317A CN202210085771.XA CN202210085771A CN114531317A CN 114531317 A CN114531317 A CN 114531317A CN 202210085771 A CN202210085771 A CN 202210085771A CN 114531317 A CN114531317 A CN 114531317A
- Authority
- CN
- China
- Prior art keywords
- data
- generator set
- controller
- upper computer
- set controller
- 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.)
- Granted
Links
- 238000000034 method Methods 0.000 title claims abstract description 24
- 230000005540 biological transmission Effects 0.000 abstract description 16
- 238000004806 packaging method and process Methods 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000006243 chemical reaction Methods 0.000 description 1
- 238000010586 diagram Methods 0.000 description 1
- 230000009365 direct transmission Effects 0.000 description 1
- 230000006870 function Effects 0.000 description 1
- 230000003993 interaction Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000004044 response Effects 0.000 description 1
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L12/00—Data switching networks
- H04L12/28—Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
- H04L12/40—Bus networks
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L69/00—Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
- H04L69/06—Notations for structuring of protocol data, e.g. abstract syntax notation one [ASN.1]
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L69/00—Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
- H04L69/26—Special purpose or proprietary protocols or architectures
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L12/00—Data switching networks
- H04L12/28—Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
- H04L12/40—Bus networks
- H04L2012/40208—Bus networks characterized by the use of a particular bus standard
- H04L2012/40215—Controller Area Network CAN
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L2212/00—Encapsulation of packets
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02P—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
- Y02P90/00—Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
- Y02P90/02—Total factory control, e.g. smart factories, flexible manufacturing systems [FMS] or integrated manufacturing systems [IMS]
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Computer Security & Cryptography (AREA)
- Computing Systems (AREA)
- Communication Control (AREA)
Abstract
The invention discloses a communication method of a generator set controller and an upper computer, which comprises the following steps: an upper computer control terminal group and a generator set controller which are composed of a plurality of upper computers are connected to a CAN bus; the upper computer control terminal group generates a control instruction set, and any upper computer packages the commands in the control instruction set into a CAN protocol frame format and sends the commands to the generator set controller through a CAN bus; the generator set controller receives the command frame in the CAN protocol frame format to respond and then replies the command frame, and sets an error code; the generator set controller automatically uploads data information and alarm information, and encapsulates the data information and the alarm information into a CAN protocol frame format; and the upper computer control terminal group receives the command frame, the error code, the data information and the alarm information which are transmitted by the CAN bus and replied by the generator set controller, and synchronizes. The invention can realize long-distance transmission, has high transmission efficiency and can ensure that the data detected by all nodes on the network are consistent at the same time.
Description
Technical Field
The invention relates to the technical field of generator set control, in particular to a communication method of a generator set controller and an upper computer.
Background
At present, communication between the generator set controller and an upper computer is generally carried out in a USB (universal serial bus), RS485 and RS232 mode, an MODBUS RTU (remote terminal unit), an MODBUS TCP/IP (transmission control protocol/Internet protocol) mode and the like, however, the USB, RS485 and RS232 communication methods cannot meet the requirement of long-distance transmission, and once the application scene of the generator set controller comprises places needing long-distance communication, such as trains, factories and the like, the functions of the generator set controller are lost; although the communication mode of MODBUS RTU can satisfy the requirement of long-distance transmission, the communication mode of MODBUS TCP/IP does not have the capacity of large data volume and high-frequency transmission, the communication requirement of the Internet of things for high-efficiency transmission of a large amount of data cannot be satisfied, the communication mode of MODBUS TCP/IP needs to communicate by means of Ethernet, under the coordination of a bus controller, the transmission of a large amount of data between two nodes is realized, the communication mode is limited by a MODBUS protocol, the consistency of data detected by all nodes on the network at the same time cannot be ensured, the strict requirements of high-safety industries such as industrial automation, building security, fire control and the like cannot be satisfied, and the prior art cannot satisfy the requirements of various users.
Disclosure of Invention
The invention provides a communication method of a generator set controller and an upper computer, aiming at solving the problems of high efficiency, short distance, long distance, low efficiency, long distance and high efficiency, incapability of ensuring the consistency of data among multiple nodes at the same time and the like of the existing communication method of the generator set controller and the upper computer.
In order to achieve the technical purpose, the invention discloses a communication method of a generator set controller and an upper computer, which comprises the following steps:
an upper computer control terminal group and a generator set controller which are composed of a plurality of upper computers are connected to a CAN bus;
the upper computer control terminal group generates a control instruction set, and any upper computer packages the commands in the control instruction set into a CAN protocol frame format and sends the commands to the generator set controller through a CAN bus;
the generating set controller receives a command frame in a CAN protocol frame format and replies the command frame after responding, and sets an error code;
the generator set controller automatically uploads data information and alarm information, and packages the data information and the alarm information into a CAN protocol frame format;
and the upper computer control terminal group receives the command frame, the error code, the data information and the alarm information which are transmitted by the CAN bus and replied by the generator set controller, and synchronizes.
Further, the data segment format of the control command in the control instruction set is: byte 1 is the command frame number, byte 2 is the instruction code, bytes 3-n are the instruction content, bytes n +1, n +2 are the check code, where n is a positive integer greater than 3.
Further, the data frame in the CAN protocol frame format comprises protocol data units, and each protocol data unit comprises a packet identifier, a target address, a source address, a subject number and a data field; if the byte length of the data segment is less than or equal to 8, the data segment is directly used as an independent packet loading sub-packet mark and is sent; if the byte length of the data segment exceeds 8, the data segment is sent in a sub-packet mode and a sub-packet flag is set, and the format of the data segment of each packet is as follows: byte 1 is the frame number, bytes 2-n ' are the data content, byte n ' +1 is the data length, bytes n ' +2, n ' +3 are the check value, where n ' is 3, 4 or 5.
Further, the endian used by the CAN protocol is little endian.
Further, the control instruction set includes a flow control instruction, an instruction to read controller configuration information, an instruction to read controller basic information, an instruction to read controller identity information, an instruction to write controller configuration information, and an instruction to write controller identity information.
Further, the format of the generator set controller reply command frame is the same as the format of the received command frame.
Further, the error code includes a frame number repetition error and a frame number discontinuity error.
Further, the data information automatically uploaded by the generator set controller is sent at regular time, and the alarm information automatically uploaded by the generator set controller is sent immediately.
The invention has the beneficial effects that:
the communication method of the generator set controller and the upper computer can realize long-distance transmission, has high transmission efficiency, can ensure that the data detected by all nodes on the network at the same time are consistent, and has the advantages of simple structure, high speed, interference resistance, reliability, low price and the like.
Drawings
Fig. 1 is a flowchart of a communication method between a generator set controller and an upper computer according to an embodiment of the present invention;
fig. 2 is a schematic diagram of a CAN protocol frame format according to an embodiment of the present invention.
Detailed Description
The following explains and explains the communication method between the generator set controller and the upper computer in detail with reference to the drawings of the specification.
The embodiment specifically discloses a communication method between a generator set controller and an upper computer, as shown in fig. 1, including:
step one, an upper computer control terminal group and a generator set controller which are composed of a plurality of upper computers are accessed to a CAN bus; in this embodiment, all devices (i.e., all the upper computers and the generator set controllers) initialize the CAN2.0b standard interface and access the CAN bus, and the plurality of upper computers and the generator set controllers access the CAN bus, so that data transmission between the plurality of upper computers and the generator set controllers is realized through the CAN bus. In this embodiment, with the extended frame mode, i.e. 29-bit ID, the transmission rate can be adjusted according to the communication distance, and the lower the rate, the longer the transmission distance.
Step two, the upper computer control terminal group generates a control instruction set, and any upper computer packages the commands in the control instruction set into a CAN protocol frame format and sends the commands to the generator set controller through a CAN bus; the data segment format of the control command in the control command set is as follows: byte 1 is the command frame number (the first frame of the command frame number is 0, and the subsequent cycle is from 1 to 255), byte 2 is the instruction code, bytes 3 to n are the instruction content, and bytes n +1 and n +2 are the check code, where n is a positive integer greater than 3. The checking method in this embodiment is exclusive or (only checking the content of the data segment), and the check code byte order is low first and then high (zero padding for high byte). In the present embodiment, the control instruction set includes a flow control instruction, an instruction to read controller configuration information, an instruction to read controller basic information, an instruction to read controller identity information, an instruction to write controller configuration information, and an instruction to write controller identity information. The data segment instructions of the flow control instruction, the instruction for reading the configuration information of the controller, the instruction for reading the basic information of the controller and the instruction for reading the identity information of the controller are as follows: byte 1 is the command frame number (first frame is 0, following cycle from 1 to 255), byte 2 is the command code, byte 3 is the command content, and bytes 4 to 5 are the check code. And the data field bytes of the instruction to write the controller configuration information and the instruction to write the controller identification information may exceed 8 bytes.
The data frame in the CAN protocol frame format includes Protocol Data Units (PDUs), each of which includes a packet identifier, a destination address, a source address, a subject number, and a data field. If the byte length of the data segment is less than or equal to 8, the data segment is directly used as an independent packet loading sub-packet mark and is sent, and the corresponding target address, source address, subject number and data field are sent as a protocol data unit; if the length of the data section exceeds 8 bytes, the data section is sent in a sub-packet mode and a sub-packet flag is set, and the format of each packet of the data section is as follows: byte 1 is the frame number, bytes 2-n ' are the data content, byte n ' +1 is the data length, bytes n ' +2, n ' +3 are the check value, where n ' is 3, 4 or 5. As shown in fig. 2, DF is a sub-packet flag, and when there is only one packet, DF is 00; when the number of packets is multiple, the first packet is DF 01; the last packet is DF ═ 11; the intermediate packet is DF-10, if the length BYTES of the data segment exceeds 8, the data segment needs to be sent in a sub-packet manner, and the receiving end needs to be combined and then analyzed; DA is the destination address (destination device number, broadcastable); SA is source address (source device number); PF is the topic number; the data content is filled in each packet data section, and the byte numbers are 1, 2 and 3 … … 8 in sequence according to the byte positions. And any upper computer packages the control instruction in the control command data segment format into a CAN protocol frame format, so that direct transmission of a CAN bus is facilitated.
The generator set controller receives the command frame in the CAN protocol frame format to respond and then replies the command frame, and sets an error code; the format of the command frame returned by the generator set controller is the same as that of the received command frame, and the command frame is a CAN protocol frame format and CAN be directly transmitted back to the upper computer control terminal group through a CAN bus. Error codes include frame number repetition errors and frame number discontinuity errors. If an erroneous frame sequence number is received, the corresponding command is not executed, i.e. no response is made, but the frame command reply is not affected.
Meanwhile, the generator set controller automatically uploads data information and alarm information, and encapsulates the data information and the alarm information into a CAN protocol frame format; the data information and the alarm information uploaded by the generator set controller are also uploaded according to a defined data segment format, the method for packaging the data by the generator set controller is the same as the method for packaging the data by an upper computer, if the number of data segment bytes is not more than 8, the data segment bytes are directly used as an independent packet to load a packet division mark, and then the data segment bytes, the source address, the subject number and the data field are used as a protocol data unit to be sent; if the number of the data section bytes exceeds 8, performing packetization and setting a packetization flag to send, wherein the format of the data section is as follows: byte 1 is a frame number, bytes 2-n 'are data contents, byte n' +1 is a data length, bytes n '+ 2 and n' +3 are check values, the check mode is exclusive-or (only the data segment contents are checked), the check code byte order is low first and high later (high byte is filled with zero), the low byte in the multi-byte field is sent first, and the high byte is sent later; a multi-byte type, such as float type, transmits or receives according to a memory copying mode, and pays attention to the conversion of a big end and a small end; the frame data content is limited to 8 bytes, and the byte numbers are 1, 2, and 3 … 8 in order of byte position. The uploading of the error code may be included in the alert information. The generator set controller packages the autonomously uploaded data information and alarm information into a CAN protocol frame format, and the replied command frame and the replied error code are both in the CAN protocol frame format and CAN be directly transmitted through a CAN bus.
And step three, the upper computer control terminal group receives the command frame, the error code, the data information and the alarm information replied by the generator set controller in the CAN protocol frame format transmitted by the CAN bus, synchronizes and synchronizes to the upper computer.
The data information automatically uploaded by the generator set controller is sent at regular time, and a sending interval (default 1s) can be set; the alarm information that the generating set controller independently uploaded is instant sending, can set up and send the cycle number (acquiesce for 3 times), improves transmission efficiency.
According to the communication method, the CAN buses are accessed by the upper computers, data interaction between the generator set controller and the upper computers is achieved through the CAN buses, the transmission efficiency is high, and the transmitted data volume is large. The upper computer packages the control command into a CAN protocol frame format, and the generator set controller also packages uploaded data information and alarm information into the CAN protocol frame format, so that the data detected by all nodes on the network at the same time CAN be ensured to be consistent, and long-distance transmission CAN be realized. Moreover, in the same bus, each upper computer can be guaranteed to acquire the latest control result, data information and alarm information in real time.
In the description of the present invention, it is to be understood that the terms "central," "longitudinal," "lateral," "length," "width," "thickness," "upper," "lower," "front," "rear," "left," "right," "vertical," "horizontal," "top," "bottom," "inner," "outer," "clockwise," "counterclockwise," "axial," "radial," "circumferential," and the like are used in the orientations and positional relationships indicated in the drawings for convenience in describing the invention and to simplify the description, and are not intended to indicate or imply that the referenced devices or elements must have a particular orientation, be constructed and operated in a particular orientation, and are therefore not to be considered limiting of the invention.
In the present invention, unless otherwise expressly stated or limited, the terms "mounted," "connected," "secured," and the like are to be construed broadly and can, for example, be fixedly connected, detachably connected, or integrally formed; can be mechanically or electrically connected; they may be directly connected or indirectly connected through intervening media, or they may be connected internally or in any other suitable relationship, unless expressly stated otherwise. The specific meanings of the above terms in the present invention can be understood by those skilled in the art according to specific situations.
In the description herein, references to the description of the term "the present embodiment," "one embodiment," "some embodiments," "an example," "a specific example," or "some examples," etc., mean that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the present invention. In this specification, the schematic representations of the terms used above are not necessarily intended to refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. Furthermore, various embodiments or examples and features of different embodiments or examples described in this specification can be combined and combined by one skilled in the art without contradiction.
Furthermore, the terms "first", "second" and "first" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or to implicitly indicate the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of the feature. In the description of the present invention, "a plurality" means at least two, e.g., two, three, etc., unless specifically limited otherwise.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents and simplifications made in the spirit of the present invention are intended to be included in the scope of the present invention.
Claims (8)
1. A communication method of a generator set controller and an upper computer is characterized by comprising the following steps:
an upper computer control terminal group and a generator set controller which are composed of a plurality of upper computers are connected to a CAN bus;
the upper computer control terminal group generates a control instruction set, and any upper computer packages the commands in the control instruction set into a CAN protocol frame format and sends the commands to the generator set controller through a CAN bus;
the generating set controller receives a command frame in a CAN protocol frame format and replies the command frame after responding, and sets an error code;
the generator set controller automatically uploads data information and alarm information, and packages the data information and the alarm information into a CAN protocol frame format;
and the upper computer control terminal group receives the command frame, the error code, the data information and the alarm information which are transmitted by the CAN bus and replied by the generator set controller, and synchronizes.
2. The communication method between the generator set controller and the upper computer according to claim 1, wherein the data segment format of the control command in the control command set is: byte 1 is the command frame number, byte 2 is the command code, bytes 3-n are the command content, bytes n +1, n +2 are the check code, where n is a positive integer greater than 3.
3. The method of claim 2, wherein the data frames in the CAN protocol frame format include protocol data units, each of the protocol data units including a packetization flag, a destination address, a source address, a subject number, and a data field; if the byte length of the data segment is less than or equal to 8, the data segment is directly used as an independent packet loading sub-packet mark and is sent; if the length of the data section exceeds 8 bytes, the data section is sent in a sub-packet mode and a sub-packet flag is set, and the format of each packet of the data section is as follows: byte 1 is the frame number, bytes 2-n ' are the data content, byte n ' +1 is the data length, bytes n ' +2, n ' +3 are the check value, where n ' is 3, 4 or 5.
4. The method of claim 3, wherein the byte order used by the CAN protocol is little-end byte order.
5. The method of claim 2, wherein the set of control commands includes flow control commands, commands for reading controller configuration information, commands for reading basic controller information, commands for reading controller identity information, commands for writing controller configuration information, and commands for writing controller identity information.
6. The method of claim 1, wherein the format of the gen-set controller reply command frame is the same as the format of the received command frame.
7. The method of claim 3, wherein the error code comprises frame number repetition errors and frame number discontinuity errors.
8. The communication method of the generator set controller and the upper computer according to claim 1, wherein the data information autonomously uploaded by the generator set controller is sent at regular time, and the alarm information autonomously uploaded by the generator set controller is sent immediately.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210085771.XA CN114531317B (en) | 2022-01-25 | Communication method of generator set controller and upper computer |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210085771.XA CN114531317B (en) | 2022-01-25 | Communication method of generator set controller and upper computer |
Publications (2)
Publication Number | Publication Date |
---|---|
CN114531317A true CN114531317A (en) | 2022-05-24 |
CN114531317B CN114531317B (en) | 2024-09-27 |
Family
ID=
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107483463A (en) * | 2017-08-30 | 2017-12-15 | 郑州众智科技股份有限公司 | A kind of method that host computer is communicated with generator set controller by ModbusTCP/IP |
CN111818060A (en) * | 2020-07-09 | 2020-10-23 | 厦门海为科技有限公司 | Communication protocol, method and system supporting hybrid and discrete data transmission |
CN112003823A (en) * | 2020-07-17 | 2020-11-27 | 江阴市富仁高科股份有限公司 | Information safety transmission method based on CAN bus and application |
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107483463A (en) * | 2017-08-30 | 2017-12-15 | 郑州众智科技股份有限公司 | A kind of method that host computer is communicated with generator set controller by ModbusTCP/IP |
CN111818060A (en) * | 2020-07-09 | 2020-10-23 | 厦门海为科技有限公司 | Communication protocol, method and system supporting hybrid and discrete data transmission |
CN112003823A (en) * | 2020-07-17 | 2020-11-27 | 江阴市富仁高科股份有限公司 | Information safety transmission method based on CAN bus and application |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US6438128B1 (en) | Alternate use of data packet fields to convey information | |
US8478908B2 (en) | Fieldbus gateway using virtual serial filedbus port and data transmission method thereof | |
CN113162931A (en) | Method for transmitting Modbus RTU protocol in wide area network | |
CN103746783A (en) | Extended communication method based on Modbus communication protocol | |
CN101552785B (en) | CAN bus communication method based on message mechanism used for massive data transmission | |
CN106603506B (en) | Data communication method, device and system based on multi-field bus | |
WO2004107089A2 (en) | Home network system | |
CN102053935A (en) | MODBUS serial communication protocol-based communication method | |
CN102611710A (en) | Data interaction method and data interaction system for scheduling master station and transformer substation based on MMS (Multimedia Messaging Service) | |
CN112887929A (en) | Data transmission method, device and system | |
US8307137B2 (en) | Remote communication method of a network | |
US20080164980A1 (en) | Home Network System | |
CN103581228A (en) | Method and system for device communication in Internet of Things | |
CN114531317A (en) | Communication method of generator set controller and upper computer | |
CN106790282A (en) | Protocol conversion method and device and air conditioning system | |
CN103346943B (en) | Data transmission method and system | |
GB2477652A (en) | Apparatus to couple field devices to a controller. | |
CN107483306A (en) | A kind of communication means, communication system and storage medium | |
Zeltwanger | CANopen | |
CN107911431A (en) | A kind of message synchronization method, client, computer-readable recording medium and storage control | |
CN112667555B (en) | Communication method and device of micro control unit | |
EA035228B1 (en) | Method for adaptive data transmission in an industrial controller | |
CN111005765B (en) | Underground coal mine data transmission method and system | |
Sun et al. | Bus data acquisition and romote monitoring system based on CAN bus and GPRS | |
CN114827222B (en) | Public equipment control method, system, equipment and storage medium thereof |
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 |