CN111654425B - Fault recording information acquisition method based on Modbus protocol and related equipment - Google Patents
Fault recording information acquisition method based on Modbus protocol and related equipment Download PDFInfo
- Publication number
- CN111654425B CN111654425B CN202010771196.XA CN202010771196A CN111654425B CN 111654425 B CN111654425 B CN 111654425B CN 202010771196 A CN202010771196 A CN 202010771196A CN 111654425 B CN111654425 B CN 111654425B
- Authority
- CN
- China
- Prior art keywords
- recording information
- fault recording
- fault
- master station
- slave station
- 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.)
- Active
Links
- 238000000034 method Methods 0.000 title claims abstract description 195
- 230000006854 communication Effects 0.000 claims abstract description 29
- 238000004891 communication Methods 0.000 claims abstract description 25
- 238000001514 detection method Methods 0.000 claims abstract description 24
- 230000008569 process Effects 0.000 claims description 142
- 230000004044 response Effects 0.000 claims description 79
- 230000005540 biological transmission Effects 0.000 claims description 19
- 230000011664 signaling Effects 0.000 description 10
- 238000010586 diagram Methods 0.000 description 8
- 238000005259 measurement Methods 0.000 description 7
- 238000004590 computer program Methods 0.000 description 6
- 230000008859 change Effects 0.000 description 5
- 238000012545 processing Methods 0.000 description 5
- 230000009471 action Effects 0.000 description 3
- 238000005516 engineering process Methods 0.000 description 3
- 230000000694 effects Effects 0.000 description 2
- 230000006870 function Effects 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 230000001960 triggered effect Effects 0.000 description 2
- 230000003111 delayed effect Effects 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 230000003068 static effect 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
- H04L12/40006—Architecture of a communication node
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F13/00—Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
- G06F13/38—Information transfer, e.g. on bus
- G06F13/40—Bus structure
- G06F13/4063—Device-to-bus coupling
- G06F13/4068—Electrical coupling
-
- 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/40228—Modbus
Landscapes
- Engineering & Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Computer Hardware Design (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Selective Calling Equipment (AREA)
Abstract
The invention provides a fault recording information acquisition method based on a Modbus protocol and related equipment. The master station can also determine the time for sending the acquisition request of the fault recording information next time according to the condition of the fault recording information in the last fault recording information message, and if part of the fault recording information in the last fault recording information message is obtained before, a new fault recording detection request can be sent to the slave station when a detection period comes. The method and the device can realize that the master station equipment acquires the fault recording information from the slave station equipment only when the slave station equipment generates new fault recording information, and only acquires the fault recording information newly generated in the slave station equipment, so that the communication process of acquiring the fault recording information is greatly shortened, and the excessive communication time is avoided.
Description
Technical Field
The invention relates to the technical field of data transmission, in particular to a fault recording information acquisition method based on a Modbus protocol and related equipment.
Background
The Modbus protocol was a serial communication protocol published in 1979 for communication using Programmable Logic Controllers (PLCs). The Modbus protocol has become an industry standard for industrial field communication protocols and is now a common connection between industrial electronic devices. In practical application of the Modbus protocol, all remote signaling, remote sensing and other data of the device often need to contain N (N > 1) rounds of requests/responses to complete. During Modbus master-slave communication, a master station not only needs to poll to obtain data information of slave station equipment such as remote signaling and remote measurement, but also needs to trigger remote control and remote measurement commands to enable the slave station equipment to execute remote control and remote measurement instructions. In an industrial control system, such as a power plant and a substation, fault recording information of slave station equipment is often required to be obtained, the fault recording information can automatically and accurately record the change conditions of various electrical quantities before and after a fault when the system fails, and the analysis and comparison of the electrical quantities have important effects on analyzing and processing the fault, judging whether protection acts correctly and improving the safe operation level of a power system.
At present, a master station generally sets a request for acquiring fault recording information in a common polling list, so that the request for acquiring fault recording information occupies the communication time of the request for acquiring data such as remote signaling and remote sensing, and all fault recording information stored by slave station equipment is acquired through multiple requests each time for acquiring fault recording information, so that the speed for acquiring data such as remote signaling and remote sensing by the master station is seriously delayed, and the data is slowly updated.
Disclosure of Invention
An object of the embodiments of the present invention is to provide a fault recording information obtaining method and related device based on a Modbus protocol, so that when a slave station device generates new fault recording information, a master station device obtains the fault recording information from the slave station device, and only obtains the fault recording information newly generated in the slave station device, so that a communication process of obtaining the fault recording information is greatly shortened, and excessive communication time is avoided, so that data such as remote signaling and remote sensing of the master station is updated in time. The specific technical scheme is as follows:
in a first aspect, a fault recording information obtaining method based on a Modbus protocol includes:
the process that the master station obtains the fault recording information from the slave station each time comprises at least one request and response process, and each request and response process comprises the following steps:
the master station sends a fault recording information acquisition request which is based on a Modbus protocol and comprises a fault recording information storage address to the slave station; the master station acquires fault recording information from the slave station, wherein a fault recording information storage address in a first fault recording information acquisition request sent in the process of acquiring the fault recording information from the slave station each time is a storage address for storing the fault recording information of the latest event at the slave station side, and a fault recording information storage address in a subsequent fault recording information acquisition request sent in the process of acquiring the fault recording information from the slave station at the same time is a storage address which is behind the fault recording information storage address in the previous fault recording information acquisition request and is separated by a preset storage space; the slave station side stores the fault recording information of each event into a plurality of continuous storage addresses in sequence according to the sequence of the events, wherein each storage address stores the fault recording information of one event, and the storage spaces corresponding to the storage addresses are the same in size;
the master station obtains a fault recording information message which is returned by the slave station and is based on the Modbus protocol;
the master station obtains at least one fault recording message returned by the slave station from the fault recording message;
the main station compares at least one returned fault recording message with the latest fault recording message last time, and determines the fault recording messages which are not acquired by the main station in each returned fault recording message according to the comparison result, wherein the latest fault recording message last time is: fault recording information of the latest event obtained in the process of obtaining the fault recording information from the slave station last time;
when the returned fault recording information does not include fault recording information which is not acquired by the master station, the master station finishes the process of acquiring the fault recording information from the slave station;
when all returned fault recording information is the fault recording information which is not acquired by the master station, the master station stores the returned fault recording information, and returns the fault recording information to the slave station to send a fault recording information acquisition request which is based on a Modbus protocol and comprises a fault recording information storage address;
and when the returned part of the fault recording information is the fault recording information which is not acquired by the master station, the master station stores the fault recording information which is not acquired by the master station, and the process of acquiring the fault recording information from the slave station is finished.
With reference to the first aspect, in some optional embodiments, the comparing, by the master station, at least one piece of returned fault recording information with last-time latest fault recording information, and determining, according to a comparison result, fault recording information that is not acquired by the master station, in each piece of returned fault recording information, includes:
the master station compares the latest event fault recording information in the returned fault recording information with the latest fault recording information in the last time;
if the fault record information is consistent with the fault record information, the main station determines that the returned fault record information does not include the fault record information which is not acquired by the main station;
if the fault record information is inconsistent with the latest fault record information, the main station compares the returned fault record information with the latest fault record information in sequence from the late to the early of the event, if all the returned fault record information is inconsistent with the latest fault record information, the main station determines that all the returned fault record information is the fault record information which is not acquired by the main station, and otherwise, the main station determines that part of the returned fault record information is the fault record information which is not acquired by the main station.
With reference to the first aspect, in some optional embodiments, the obtaining, by the master station, at least one piece of fault recording information returned by the slave station from the fault recording information message includes:
and the master station judges whether the fault recording information message carries an identifier for identifying that the fault recording information message comprises fault recording information or not, and if so, the master station obtains at least one piece of fault recording information returned by the slave station from the fault recording information message.
With reference to the first aspect, in some optional embodiments, after the master station saves the returned fault recording information, the method further includes:
and the master station performs at least one transmission process of non-fault recording information, and returns to the step that the master station sends a fault recording information acquisition request which is based on a Modbus protocol and comprises a fault recording information storage address to the slave station after the at least one transmission process of the non-fault recording information is finished.
With reference to the first aspect, in some optional embodiments, the master station stores a fault recording information identifier, and when all returned fault recording information is fault recording information that is not acquired by the master station, the method further includes:
the master station changes the fault recording information identification into a new fault recording information identification;
and the master station determines whether the fault recording information identifier is a new fault recording information identifier, and if so, returns to the step that the master station sends a fault recording information acquisition request which is based on a Modbus protocol and comprises a fault recording information storage address to the slave station.
With reference to the first aspect, in some optional embodiments, when the returned partial fault recording information is fault recording information that has not been acquired by the primary station, the method further includes:
the master station changes the fault recording information identifier into an old fault recording information identifier;
and when a detection time corresponding to a preset fault recording detection period arrives, sending a new fault recording detection request to the slave station according to the old fault recording information identifier so as to detect whether new fault recording information which is never acquired by the master station is stored in the slave station side.
In combination with the previous embodiment, in certain alternative embodiments, the method further comprises:
and after the master station determines that the slave station side stores new fault recording information which is never acquired by the master station through the fault recording detection request, the master station enters the process of acquiring the fault recording information from the slave station next time.
In a second aspect, a trouble record information acquisition device based on Modbus agreement is applied to main website, the device includes: the information acquisition unit is used for acquiring fault recording information from the slave station, and the process of acquiring the fault recording information from the slave station by the information acquisition unit each time comprises at least one request response process;
the information acquisition unit includes: the request response unit is used for executing at least one request response process;
the request response unit comprises: the device comprises a request sending unit, a message obtaining unit, a fault recording information obtaining unit, a comparison unit, a first result unit, a second result unit and a third result unit;
the request sending unit is used for sending a fault recording information acquisition request which is based on a Modbus protocol and comprises a fault recording information storage address to the slave station in the process that the request response unit executes one request response; the master station acquires fault recording information from the slave station, wherein a fault recording information storage address in a first fault recording information acquisition request sent in the process of acquiring the fault recording information from the slave station each time is a storage address for storing the fault recording information of the latest event at the slave station side, and a fault recording information storage address in a subsequent fault recording information acquisition request sent in the process of acquiring the fault recording information from the slave station at the same time is a storage address which is behind the fault recording information storage address in the previous fault recording information acquisition request and is separated by a preset storage space; the slave station side stores the fault recording information of each event into a plurality of continuous storage addresses in sequence according to the sequence of the events, wherein each storage address stores the fault recording information of one event, and the storage spaces corresponding to the storage addresses are the same in size;
the message obtaining unit is used for obtaining a fault recording information message which is returned by the slave station and is based on the Modbus protocol in the process that the request response unit executes one request response;
the fault recording information obtaining unit is configured to obtain at least one fault recording information returned by the slave station from the fault recording information message in a process that the request responding unit executes a request responding;
the comparison unit is configured to compare at least one returned fault recording message with latest fault recording message last time in a process of executing a request response by the request response unit, and determine fault recording messages that are not acquired by the master station in each returned fault recording message according to a comparison result, where the latest fault recording message last time is: fault recording information of the latest event obtained in the process of obtaining the fault recording information from the slave station last time;
the first result unit is configured to, in a process that the request response unit executes a request response, when returned fault recording information does not include fault recording information that is not acquired by the master station, end, by the master station, a process of acquiring fault recording information from the slave station this time;
the second result unit is configured to, in the process of executing one request response by the request response unit, store, by the master station, each piece of returned fault recording information when all pieces of returned fault recording information are fault recording information that has not been acquired by the master station, and return to the step of sending, by the master station, a fault recording information acquisition request including a fault recording information storage address based on a Modbus protocol to the slave station;
and the third result unit is configured to, in the process of executing one request response by the request response unit, when part of returned fault recording information is fault recording information that is not acquired by the master station, store the fault recording information that is not acquired by the master station, and end the process of acquiring the fault recording information from the slave station this time.
In a third aspect, the fault recording information acquiring device based on the Modbus protocol comprises at least one processor, at least one memory and a bus, wherein the at least one memory and the bus are connected with the processor; the processor and the memory complete mutual communication through the bus; the processor is used for calling a program in the memory, and the program is at least used for realizing any one of the fault recording information acquisition methods based on the Modbus protocol.
In a fourth aspect, the storage medium is used for storing a program, and the program when executed by a processor implements the fault recording information acquiring method based on the Modbus protocol.
The embodiment of the invention provides a fault recording information obtaining method based on a Modbus protocol and related equipment, wherein the process that a master station obtains fault recording information from a slave station each time comprises at least one request and response process, and each request and response process comprises the following steps: the master station sends a fault recording information acquisition request which is based on a Modbus protocol and comprises a fault recording information storage address to the slave station; the master station acquires fault recording information from the slave station, wherein a fault recording information storage address in a first fault recording information acquisition request sent in the process of acquiring the fault recording information from the slave station each time is a storage address for storing the fault recording information of the latest event at the slave station side, and a fault recording information storage address in a subsequent fault recording information acquisition request sent in the process of acquiring the fault recording information from the slave station at the same time is a storage address which is behind the fault recording information storage address in the previous fault recording information acquisition request and is separated by a preset storage space; the slave station side stores the fault recording information of each event into a plurality of continuous storage addresses in sequence according to the sequence of the events, wherein each storage address stores the fault recording information of one event, and the storage spaces corresponding to the storage addresses are the same in size; the master station obtains a fault recording information message which is returned by the slave station and is based on the Modbus protocol; the master station obtains at least one fault recording message returned by the slave station from the fault recording message; the main station compares at least one returned fault recording message with the latest fault recording message last time, and determines the fault recording messages which are not acquired by the main station in each returned fault recording message according to the comparison result, wherein the latest fault recording message last time is: fault recording information of the latest event obtained in the process of obtaining the fault recording information from the slave station last time; when the returned fault recording information does not include fault recording information which is not acquired by the master station, the master station finishes the process of acquiring the fault recording information from the slave station; when all returned fault recording information is the fault recording information which is not acquired by the master station, the master station stores the returned fault recording information, and returns the fault recording information to the slave station to send a fault recording information acquisition request which is based on a Modbus protocol and comprises a fault recording information storage address; and when the returned part of the fault recording information is the fault recording information which is not acquired by the master station, the master station stores the fault recording information which is not acquired by the master station, and the process of acquiring the fault recording information from the slave station is finished. Therefore, according to the method and the device, when the slave station equipment generates new fault recording information, the master station equipment acquires the fault recording information from the slave station equipment, and only acquires the fault recording information newly generated in the slave station equipment, so that the communication process for acquiring the fault recording information is greatly shortened, excessive communication time is avoided, and the remote signaling data and the remote measuring data of the master station are updated in time. Of course, it is not necessary for any product or method of practicing the invention to achieve all of the above-described advantages at the same time.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a flowchart of a fault recording information obtaining method based on a Modbus protocol according to the present invention;
FIG. 2 is a flowchart of another fault recording information acquiring method based on a Modbus protocol according to the present invention;
FIG. 3 is a flowchart of another fault recording information acquiring method based on a Modbus protocol according to the present invention;
fig. 4 is a schematic structural diagram of a fault recording information acquiring device based on a Modbus protocol according to the present invention;
fig. 5 is a schematic structural diagram of a fault recording information acquiring device based on a Modbus protocol according to the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The Modbus protocol is a response communication protocol widely used in the field of industrial automation, and has become a general industrial standard. The Modbus protocol is divided into a Modbus RTU protocol based on serial ports (RS-232, RS-422 and RS-485) and a Modbus TCP protocol based on TCP/IP Ethernet. Modbus communication uses a Master (Master) and Slave (Slave) technology, the Master initializes transmission (Query, also called request, and in turn Query is called polling), and the Slave responds accordingly according to data provided by the Master Query. The master station can communicate with the slave stations individually or in a broadcast manner. If communicating alone, the slave station returns a message in response, and if queried in a broadcast manner, the slave station does not respond.
In the Modbus protocol, only the master station has the right to initiate a request (Query), and the slave station has the right to send a Response message (Response) to the master station only after receiving the request. In other words, in the Modbus protocol, the master station can only obtain the data of the slave station through Query/Response, and the slave station can never send any message to the master station.
The inventor of the scheme finds that in the practical application of the Modbus protocol, all data such as remote signaling and remote measurement of the slave station can be completed only by requests/responses containing N (N is more than 1) turns. The N requests (abbreviated as polling list) can be respectively recorded as: q1, Q2, … … and Qn, and the answers corresponding to the N requests are recorded as R1, R2, … … and Rn in sequence. The Modbus protocol is a typical request/response type communication protocol, and the conventional process is always one question and one response, i.e. the last request is either timed out or is responded, and the next request is sent, and the master station only sends one request each time. When the master station is initialized, a request Q1 is sent firstly, the master station can send a next request Q2 after receiving a response R1 or reaching the overtime, the master station sends a request Q3 again after receiving a response R2 or reaching the overtime, the process is repeated until the master station sends a request Qn, and the master station can complete one complete polling of the equipment after receiving a response Rn or reaching the overtime; the master then sends a request Q1 to begin a new round of requests, and so on.
During Modbus master-slave communication, a master station not only needs to poll to obtain data information of equipment such as remote signaling and remote measurement, but also needs to trigger remote control and remote measurement commands to enable the equipment to execute remote control and remote measurement instructions. In an industrial control system, such as a power plant and a substation, fault recording information of equipment is often required to be obtained, the fault recording information can automatically and accurately record the change conditions of various electrical quantities before and after a fault when the system fails, and the analysis and comparison of the electrical quantities have important effects on analyzing and processing the fault, judging whether protection acts correctly and improving the safe operation level of a power system.
The inventor of the scheme finds that the conventional request for acquiring the fault recording information is arranged in the polling list, and a plurality of requests for acquiring the fault recording information are arranged in the polling list because a large amount of fault recording information can be stored in the fault recording information register of the slave station. The master station completes polling in sequence according to the sequence of the requests in the polling list, so that the number and frequency of the requests for sending and acquiring the fault recording information are large, and communication time of other requests in the polling list is greatly occupied. For example, the communication time of the request for acquiring data such as remote signaling and remote sensing is occupied, so that the corresponding data in the master station is updated slowly, and the control process is seriously influenced.
As shown in fig. 1, the present invention provides a fault recording information obtaining method based on a Modbus protocol, including:
the process that the master station obtains the fault recording information from the slave station each time comprises at least one request and response process, and each request and response process comprises the following steps:
s100, the master station sends a fault recording information acquisition request which is based on a Modbus protocol and comprises a fault recording information storage address to the slave station; the master station acquires fault recording information from the slave station, wherein a fault recording information storage address in a first fault recording information acquisition request sent in the process of acquiring the fault recording information from the slave station each time is a storage address for storing the fault recording information of the latest event at the slave station side, and a fault recording information storage address in a subsequent fault recording information acquisition request sent in the process of acquiring the fault recording information from the slave station at the same time is a storage address which is behind the fault recording information storage address in the previous fault recording information acquisition request and is separated by a preset storage space; the slave station side stores the fault recording information of each event into a plurality of continuous storage addresses in sequence according to the sequence of the events, wherein each storage address stores the fault recording information of one event, and the storage spaces corresponding to the storage addresses are the same in size;
in practical applications, the master station may obtain the fault recording information from the slave station multiple times, and the process of obtaining the fault recording information from the slave station by the master station each time may include at least one request response process.
And the storage address of the fault recording information in the first fault recording information acquisition request sent in the process that the master station acquires the fault recording information from the slave station every time is the storage address of the fault recording information of the latest event stored by the slave station side. For example, the first fault recording information acquisition request sent by the master station in the process of acquiring fault recording information from the slave station at a time may be fault recording information including fault recording information of the latest event stored in the slave station.
It should be understood that a complete fault recording datum may include values of up to thousands of data points and time data thereof, and the values of the data points may be arranged according to the sequence of the time data to form a complete fault recording datum. The data points may be analog quantity input points (AI) and digital quantity input points (DI). An event referred to herein may be a data point, and the fault recording information of the latest event stored from the station side may be the fault recording information of the data point of the latest time data stored from the station side. That is, the fault recording information of an event may be information of a specific data point on a complete piece of equipment fault recording data, which is not limited by the present invention.
For one fault recording information acquisition request, the requested fault recording information may include a plurality of fault recording information, the specific number is not limited in the present invention, and any feasible number belongs to the protection scope of the present invention. One of the plurality of requested fault recording information may be fault recording information of the latest event currently requested.
The subsequent fault recording information acquisition request refers to a fault recording information acquisition request sent after a first fault recording information acquisition request sent in the process that the master station acquires the fault recording information from the slave station at one time.
It should be understood that the slave station side stores the fault recording information of each event into a plurality of continuous storage addresses in sequence according to the early and late sequence of the events, so that the master station can conveniently request the newer fault recording information from the fault recording information of the latest event in the fault recording information of each event stored in the slave station side.
Optionally, the fault recording information of the slave station may be stored in an independent fault recording register, where each fault recording information at least includes: the event occurrence time, that is, the time data may be the event occurrence time, and the event occurrence time may be a time accurate to nanosecond, microsecond, millisecond, or second, and certainly may also be accurate to minute or hour, etc., and the accuracy of the event occurrence time is not limited by the present invention, and any feasible manner is within the protection scope of the present invention.
It should be understood that each fault recording message may also include: the numerical data may be the numerical value of the data point at the time of the event occurrence, which is not limited by the invention. Of course, each fault recording message may only include time data, and when a specific fault recording numerical data needs to be obtained, corresponding numerical data is obtained, and the numerical data and the time data do not need to be stored in the fault recording register together, so that the number of registers occupied by one fault recording message can be saved, and the number of fault recording messages stored in the fault recording register can be increased to a certain extent, which is not limited by the present invention.
The storage positions of the fault recording information in the fault recording register can be sorted from new to old according to the event occurrence time. For example, the fault recording register includes 500 register addresses (000 to 499), and one fault recording message is stored in a corresponding one of the register addresses. The register address corresponding to the failure recording information whose event occurrence time is newer is larger, and the failure recording information whose event occurrence time is latest (i.e., the event occurrence time is latest) is kept stored in the register area whose address is 499. When the fault recording information of the new latest event is generated, the fault recording information with the latest event occurrence time is stored in 499, and the original fault recording information in 499 is stored in a smaller register address in sequence.
Of course, one fault recording message may occupy multiple register addresses. For example, if the occurrence time of one fault recording message occupies 7 registers (year, month, day, hour, minute, second and millisecond), the numerical value occupies 1 register, and one fault recording message occupies 8 registers. In this case, a register address corresponding to one fault recording information described herein may be "initial address + offset", where the initial address may be 000, the sequence number of the storage sequence of the fault recording information in the fault recording register minus a difference of 1, and a product of the difference and the number of registers occupied by one fault recording information is used as the offsetAnd (5) moving amount. For example, if the number of registers occupied by one fault recording message is fixed to 8, the register address of the 3 rd fault recording message stored in the fault recording register may be:the present invention is not limited in this regard.
Optionally, the number of the fault recording information requested by the master station to the slave station each time may be fixed, for example, 10, 20, or 30 fault recording information may be provided, or other numbers of fault recording information may also be provided, which is not limited in the present invention.
Optionally, the number of the fault wave recording information requested by the master station to the slave station each time may be set according to needs, for example, 10 fault wave recording information are requested last time, and 20 or other numbers of fault wave recording information may be requested next time, which is not limited in the present invention.
Optionally, when the number of the fault wave recording information requested by the master station to the slave station each time can be adjusted, the fault wave recording information acquisition request may carry a number identifier of the fault wave recording information to be acquired. For example, the number flag in the fault recording information acquisition request may be 20, which indicates that 20 pieces of fault recording information need to be acquired this time.
Optionally, the fault recording information obtaining request may further carry a register address, where the register address may be a register address of fault recording information with the latest event occurrence time in each fault recording information of the current request. For example, 10 pieces of fault recording information with the register addresses 499 to 490 need to be acquired this time, the register identifier in the fault recording information acquisition request may be 499, which is not limited by the present invention.
The slave station will copy 499 the fault logging information in 499 to 490, starting from the register area with register address 499. When 20 pieces of fault recording information are required to be obtained at this time, the fault recording information in 499 to 480 can be copied, and the copied content is sent to the master station through the fault recording information message, which is not limited by the present invention.
Optionally, the register address carried in the fault recording information obtaining request may also be a set of register addresses corresponding to a plurality of pieces of fault recording information of the current request. For example, 10 pieces of fault recording information with the register addresses 499 to 490 need to be acquired at this time, the register address in the fault recording information acquisition request may be 499, 490, which is not limited by the present invention.
S200, the master station obtains a fault recording information message which is returned by the slave station and is based on the Modbus protocol;
it should be understood that, after receiving the fault recording information acquisition request sent by the master station, the slave station may search the fault recording information stored in the slave station side to obtain the fault recording information requested by the fault recording information acquisition request. If the fault recording information requested by the fault recording information acquisition request is successfully searched, the searched fault recording information can be returned to the master station through the fault recording information message.
Optionally, each fault recording information in the fault recording information message may be sorted according to the sequence of the time for generating each fault recording information, that is, the event occurrence time referred to herein may be the generation time corresponding to each fault recording information. For example, the fault recording information with the latest generation time may be arranged at the head position of the fault recording information message, the fault recording information with the second latest generation time may be arranged at the second position of the head of the fault recording information message, the fault recording information may be arranged in sequence in this order, and the fault recording information with the earliest generation time may be arranged at the end of the fault recording information message, which is not limited by the present invention.
It should be understood that arranging the fault recording information according to the generation time can facilitate the subsequent step of determining whether the fault recording information is the fault recording information which is not acquired.
S300, the master station obtains at least one fault recording message returned by the slave station from the fault recording message;
it should be understood that the fault recording information message may carry a plurality of fault recording information, and the master station may obtain one or more or all of the fault recording information in the fault recording information message, which is not limited in the present invention. For example, the master station may first obtain the fault recording information from the fault recording information with the latest event occurrence time in the current fault recording information message, and execute step S400. When the fault recording information is determined to be the fault recording information which is not acquired by the main station in the returned fault recording information and is determined to be the fault recording information which is not acquired by the main station, the next fault recording information is obtained according to the sequence of the event occurrence time, and the next fault recording information can not be obtained any more when the fault recording information is determined not to be the fault recording information which is not acquired by the main station in the returned fault recording information or when all the fault recording information in the fault recording information message is determined to be the fault recording information which is not acquired by the main station in the returned fault recording information.
S400, the main station compares at least one returned fault recording message with the latest fault recording message last time, and determines the fault recording messages which are not acquired by the main station in the returned fault recording messages according to the comparison result, wherein the latest fault recording message last time is: fault recording information of the latest event obtained in the process of obtaining the fault recording information from the slave station last time;
it should be understood that after the process of acquiring the fault recording information from the slave station by the master station is finished, the fault recording information stored at the slave station side and having the latest event occurrence time in the process of acquiring the fault recording information can be stored locally so as to serve as "latest fault recording information" of the process of acquiring the fault recording information from the slave station by the master station next time.
Optionally, if the returned one piece of fault recording information is the same as the latest fault recording information last time, it is indicated that the returned one piece of fault recording information and the other remaining pieces of fault recording information after the event occurrence time are also the fault recording information that has been obtained before, and it is not necessary to continuously obtain the fault recording information that has been obtained before, so that the communication time can be saved.
S500, when the returned fault recording information does not include fault recording information which is not acquired by the master station, the master station finishes the process of acquiring the fault recording information from the slave station;
it should be understood that, when the latest fault recording information of the event occurrence time in the fault recording information returned by the first fault recording information acquisition request is the same as the latest fault recording information of the last time, it indicates that the latest fault recording information stored in the slave station is the latest fault recording information of the last time, that is, the latest fault recording information stored in the slave station has been acquired before, and the remaining other fault recording information stored in the slave station has been acquired before, in which case the process of the master station acquiring the fault recording information from the slave station may be ended.
S600, when all returned fault recording information is fault recording information which is not acquired by the master station, the master station stores the returned fault recording information, and returns to the step that the master station sends a fault recording information acquisition request which is based on a Modbus protocol and comprises a fault recording information storage address to the slave station;
it should be understood that, when all the returned fault recording information is the fault recording information that has not been acquired by the master station, it indicates that other remaining fault recording information stored in the slave station side may also include the fault recording information that has not been acquired by the master station, and the fault recording information acquisition request may be continuously sent, that is, the request response process is returned to be executed once.
S700, when the returned part of the fault recording information is the fault recording information which is not acquired by the master station, the master station stores the fault recording information which is not acquired by the master station, and the process of acquiring the fault recording information from the slave station is finished.
It should be understood that, when part of the returned fault recording information is fault recording information that has not been acquired by the master station, it indicates that all the other remaining fault recording information stored in the slave station side are fault recording information that has been acquired by the master station before, and the process of the master station acquiring the fault recording information from the slave station at this time may be ended.
As shown in fig. 2, in combination with the embodiment shown in fig. 1, in some optional embodiments, step S400 in fig. 1 may specifically include:
s401, the master station compares the latest event fault recording information in the returned fault recording information with the latest fault recording information in the last time; if they match, step S402 is executed, and if they do not match, step S403 is executed.
It should be understood that, for the first request response process of the process in which the primary station obtains the fault recording information from the secondary station, the fault recording information of the latest event in the returned fault recording information described herein may be the fault recording information of the latest event stored from the station side, and the latest fault recording information of the last time may be the fault recording information of the latest event stored from the station side in the process in which the primary station obtained the fault recording information from the secondary station. That is, in the process of acquiring the fault recording information from the slave station by the master station this time, the fault recording information of the latest event stored in the slave station side is compared with the fault recording information of the latest event stored in the slave station side in the process of acquiring the fault recording information from the slave station by the master station last time.
It should be understood that, for any request response process of the process in which the master station obtains the fault recording information from the slave station, the fault recording information obtaining request may be the first fault recording information obtaining request of the process in which the master station obtains the fault recording information from the slave station, or may not be the first fault recording information obtaining request. When the fault recording information acquisition request is not the first fault recording information acquisition request in the process that the master station acquires the fault recording information from the slave station, the fault recording information of the latest event in the returned fault recording information may be the fault recording information of the latest event in a plurality of pieces of fault recording information requested by the current request. Namely, the fault recording information of the latest event in the plurality of fault recording information requested by the current request is compared with the fault recording information of the latest event stored by the slave station side in the process that the master station obtains the fault recording information from the slave station last time.
It should be understood that whether the event occurrence time of the fault recording information of the latest event in the returned fault recording information coincides with the event occurrence time of the latest fault recording information last time can be obtained by comparison.
It should be understood that the event occurrence time may be the time of generating the corresponding fault recording information, and the present invention is not limited thereto.
S402, the main station determines that returned fault recording information does not include fault recording information which is not acquired by the main station;
it should be understood that, if the fault recording information of the latest event in the returned fault recording information is consistent with the latest fault recording information last time, it indicates that the fault recording information of the latest event in the returned fault recording information has been obtained in the process of obtaining the fault recording information from the slave station by the master station last time.
The fault recording information stored in the slave station side may be stored according to the sequence of the event occurrence time of each fault recording information, and if the fault recording information of the latest event in the returned fault recording information is already acquired in the process that the master station acquires the fault recording information from the slave station last time, it indicates that the remaining other fault recording information of the slave station side is already acquired in the process that the master station acquires the fault recording information from the slave station last time or earlier, and it may be determined that the returned fault recording information does not include the fault recording information that the master station has not acquired.
And S403, the main station compares the returned fault recording information with the latest fault recording information in sequence from the late to the early of the event, if all the returned fault recording information is inconsistent with the latest fault recording information, the main station determines that all the returned fault recording information is the fault recording information which is not acquired by the main station, and if not, the main station determines that part of the returned fault recording information is the fault recording information which is not acquired by the main station.
It should be understood that, if the fault recording information of the latest event in the returned fault recording information is inconsistent with the latest fault recording information last time, it indicates that the fault recording information of the latest event in the returned fault recording information has not been obtained in the process of obtaining the fault recording information from the slave station by the master station last time. The fault recording information stored in the slave station side can be stored according to the sequence of the event occurrence time of each fault recording information, if the fault recording information of the latest event in the returned fault recording information is not acquired in the last fault recording information acquisition request, it indicates that the remaining other fault recording information of the slave station side may not be acquired, and it can be determined that the returned fault recording information includes the fault recording information that is not acquired by the master station. In this case, if all the returned fault recording information is inconsistent with the latest fault recording information last time, the master station determines that all the returned fault recording information is fault recording information that is not acquired by the master station, and otherwise, the master station determines that part of the returned fault recording information is fault recording information that is not acquired by the master station.
As shown in fig. 3, in combination with the embodiment shown in fig. 1, in some optional embodiments, step S300 in fig. 1 may specifically include:
s301, the master station judges whether the fault wave recording information message carries an identifier for identifying that the fault wave recording information message comprises fault wave recording information, and if so, the step S302 is triggered;
it should be understood that, if the fault wave recording information message carries an identifier for identifying that the fault wave recording information message includes fault wave recording information, it can be said that the fault wave recording information message carries fault wave recording information requested by the fault wave recording information acquisition request. That is, the fault wave recording information requested by the fault wave recording information acquisition request is stored in the fault wave recording register on the station side, and the slave station successfully copies the fault wave recording information requested by the fault wave recording information acquisition request into the fault wave recording information message.
It should be understood that, if the fault wave recording information message does not carry an identifier for identifying that the fault wave recording information message includes fault wave recording information, it may be indicated that the fault wave recording information message does not carry fault wave recording information requested by the fault wave recording information obtaining request. That is, the slave station does not search the fault recording information requested by the fault recording information acquisition request in the fault recording register of the slave station. At this time, the slave station may transmit a request for obtaining the telemetry data and/or the remote sensing data, or transmit a telemetry control command or a remote sensing control command to the slave station, which is not limited in the present invention.
Optionally, the identifier may be a register address of the fault recording information where the event occurrence time is latest in the fault recording information message, may also be a register address of the fault recording information where the event occurrence time is earliest in the fault recording information message, or may be a register address of any one fault recording information in the fault recording information message, which is not limited in the present invention. Of course, the identifier may also be a set of register addresses where each fault recording message in the fault recording message is located, which is not limited in the present invention.
It should be understood that by determining whether the fault wave recording information message carries the identifier, it can be quickly determined whether the fault wave recording information message carries the fault wave recording information requested by the fault wave recording information acquisition request, and in the case that the fault wave recording information message carries the fault wave recording information, the next step S302 can be executed. If the fault recording information message does not carry the identifier, other operations can be carried out. For example, returning to a normal polling list, the master station sends a request for obtaining remote control data and telemetering data to the slave station, or sends some control instructions to the slave station, so that the communication time occupied by the process that the master station obtains fault recording information from the slave station can be reduced, and the data updating speed is further improved.
S302, the master station obtains at least one fault recording message returned by the slave station from the fault recording message.
It should be understood that the fault recording information in the fault recording information message may be arranged according to the event occurrence time. For example, the fault recording information with the latest event occurrence time in each fault recording information in the fault recording information message may be arranged at the beginning of the fault recording information message, and the remaining other fault recording information may be arranged backwards according to the event occurrence time.
Optionally, if the fault recording information with the latest event occurrence time in the fault recording information message is the fault recording information that has never been obtained, it may be determined that the fault recording information message includes the fault recording information that has never been obtained.
It should be understood that, when the fault recording information message includes the fault recording information that has never been obtained, the next step S600 or S700 is performed; when the fault recording information message does not include the fault recording information which is never obtained, the process that the master station obtains the fault recording information from the slave station can be ended, the remote sensing data and/or the remote sensing data in the slave station are obtained, or a remote sensing control command and/or a remote sensing control command are sent to the slave station, so that the communication time occupied by obtaining the fault recording information can be saved, the saved time is used for obtaining the remote sensing data and/or the remote sensing data in the slave station, or the remote sensing control command and/or the remote sensing control command is sent to the slave station, and the remote sensing data of the master station are further updated timely.
It should be understood that if all the returned fault recording information determined by the master station is the fault recording information which is not acquired by the master station, all the fault recording information in the current fault recording information message can be acquired; if the main station determines that part of the returned fault recording information is the fault recording information which is not acquired by the main station, the fault recording information which is determined to be not acquired by the main station in the current fault recording information message can be acquired.
With reference to the embodiment shown in fig. 1, in some optional embodiments, after the master station saves the returned fault recording information in step S600, the method further includes:
and the master station performs at least one transmission process of non-fault recording information, and returns to the step that the master station sends a fault recording information acquisition request which is based on a Modbus protocol and comprises a fault recording information storage address to the slave station after the at least one transmission process of the non-fault recording information is finished.
It should be understood that step S600 is executed when each piece of fault recording information in the current fault recording information message is fault recording information that has not been acquired by the master station. Because the equipment executing the method needs to occupy a certain communication time when executing the request response process which is described herein once, theoretically, all fault recording information in the request response process is fault recording information which is not acquired by the main station, and the equipment can directly enter the next request response process, but communication resources of the equipment executing the method are occupied by the process of acquiring the fault recording information in a longer time, and the transmission process of other non-fault recording information is blocked. Therefore, before entering the next request response process, the other non-fault recording information transmission processes can be entered first, and one or more non-fault recording information transmission processes are executed, and the specific times of the non-fault recording information transmission processes can be set according to the actual conditions, which is not limited by the invention. For example, obtaining telemetry data and/or telemetry data from the slave station, or sending telemetry control commands and/or telemetry control commands to the slave station. And returning to enter the next request response process after the execution of other non-fault recording information transmission processes is finished, namely returning to the request response process again. Therefore, the use of communication resources can be more balanced.
Optionally, the present invention does not limit the specific process of at least one transmission process of the non-fault recording information, and any feasible manner is within the protection scope of the present invention.
With reference to the embodiment shown in fig. 1, in some optional embodiments, the master station stores a fault recording information identifier, and when all returned fault recording information is fault recording information that is not acquired by the master station, the method further includes:
step one, the master station changes the fault recording information identification into a new fault recording information identification;
and step two, the master station determines whether the fault recording information identifier is a new fault recording information identifier, and if so, returns to the step that the master station sends a fault recording information acquisition request which is based on a Modbus protocol and comprises a fault recording information storage address to the slave station.
It should be understood that the fault recording information identifier may be used to characterize whether the obtained fault recording information in the current request response process includes latest fault recording information last time, if so, the master station may change the fault recording information identifier to an old fault recording information identifier, and if not, the master station may change the fault recording information identifier to a new fault recording information identifier.
It should be understood that the device for setting the fault recording information identifier to facilitate the execution of the method of the present invention can determine whether the next request response process can be entered according to the fault recording information identifier. I.e. whether a request reply procedure can be returned.
With reference to the embodiment shown in fig. 1, in some optional embodiments, when the returned partial fault recording information is fault recording information that has not been acquired by the primary station, the method further includes:
step one, the master station changes the fault recording information identification into an old fault recording information identification;
and step two, when a detection time corresponding to a preset fault recording detection period arrives, sending a new fault recording detection request to the slave station according to the old fault recording information identifier so as to detect whether the slave station side stores new fault recording information which is never acquired by the master station.
It should be understood that when it is determined that the fault recording information identifier has been changed to the old fault recording information identifier, it indicates that the process of the master station obtaining fault recording information from the slave station has ended since the last request response process ended, and at the end, the slave station side has no fault recording information that the master station has not obtained yet. Before entering a first request response process of a process that the master station obtains fault recording information from the slave station next time, whether the detection time arrives or not can be judged, and if the detection time arrives, a new fault recording detection request can be sent.
It should be understood that the new fault recording detection request may be a request for obtaining the current latest fault recording information stored by the slave station side, and if the current latest fault recording information is the fault recording information that has not been obtained by the master station, it may be indicated that the slave station side already stores the fault recording information that has not been obtained by the master station. In this case, the process of the master station obtaining the fault recording information from the slave station may be entered next time, otherwise, the master station may not enter the process of the master station obtaining the fault recording information from the slave station. In this way, the communication time for acquiring the fault recording information can be saved, that is, after the slave station side generates the new fault recording information, the master station enters the process of acquiring the fault recording information from the slave station by the master station next time.
In combination with the previous embodiment, in certain alternative embodiments, the method further comprises:
and after the master station determines that the slave station side stores new fault recording information which is never acquired by the master station through the fault recording detection request, the master station enters the process of acquiring the fault recording information from the slave station next time.
As shown in fig. 4, the invention provides a fault recording information acquiring device based on a Modbus protocol, which is applied to a master station, and the device includes: the information acquisition unit is used for acquiring fault recording information from the slave station, and the process of acquiring the fault recording information from the slave station by the information acquisition unit each time comprises at least one request response process;
the information acquisition unit includes: the request response unit is used for executing at least one request response process;
the request response unit comprises: the device comprises a request sending unit 100, a message obtaining unit 200, a fault recording information obtaining unit 300, a comparison unit 400, a first result unit 500, a second result unit 600 and a third result unit 700;
the request sending unit 100 is configured to send a fault recording information obtaining request including a fault recording information storage address to the slave station based on a Modbus protocol in a process that the request responding unit executes a request response; the master station acquires fault recording information from the slave station, wherein a fault recording information storage address in a first fault recording information acquisition request sent in the process of acquiring the fault recording information from the slave station each time is a storage address for storing the fault recording information of the latest event at the slave station side, and a fault recording information storage address in a subsequent fault recording information acquisition request sent in the process of acquiring the fault recording information from the slave station at the same time is a storage address which is behind the fault recording information storage address in the previous fault recording information acquisition request and is separated by a preset storage space; the slave station side stores the fault recording information of each event into a plurality of continuous storage addresses in sequence according to the sequence of the events, wherein each storage address stores the fault recording information of one event, and the storage spaces corresponding to the storage addresses are the same in size;
the message obtaining unit 200 is configured to obtain a fault recording information message based on the Modbus protocol, which is returned by the slave station, in a process that the request responding unit executes a request responding;
the fault recording information obtaining unit 300 is configured to obtain at least one fault recording information returned by the slave station from the fault recording information message in a process that the request responding unit executes a request responding;
the comparing unit 400 is configured to, in the process that the request responding unit executes one request responding process, compare at least one returned fault recording message with latest fault recording message of the last time, and determine fault recording messages that are not acquired by the master station in each returned fault recording message according to a comparison result, where the latest fault recording message of the last time is: fault recording information of the latest event obtained in the process of obtaining the fault recording information from the slave station last time;
the first result unit 500 is configured to, in a process that the request response unit executes a request response, when returned fault recording information does not include fault recording information that is not obtained by the master station, the master station finishes a process of obtaining fault recording information from the slave station this time;
the second result unit 600 is configured to, in the process that the request response unit executes a request response, when all returned fault recording information is fault recording information that has not been acquired by the master station, store each returned fault recording information by the master station, and return to a step in which the master station sends a fault recording information acquisition request including a fault recording information storage address based on a Modbus protocol to the slave station;
the third result unit 700 is configured to, in the process of executing a request response by the request response unit, when part of returned fault recording information is fault recording information that is not acquired by the master station, store the fault recording information that is not acquired by the master station, and end the process of acquiring the fault recording information from the slave station this time.
In some alternative embodiments, in combination with the embodiment shown in fig. 4, the comparison unit 400 includes: a first comparison subunit, a second comparison subunit, a first determination unit, a second determination unit, and a third determination unit;
the first comparison subunit is configured to compare the latest event fault recording information in the returned fault recording information with the latest fault recording information in the last time;
if the two are consistent, triggering the first determination unit; if not, triggering the second comparison subunit;
the first determining unit is configured to determine that returned fault recording information does not include fault recording information that is not acquired by the master station;
the second comparison subunit is configured to compare the returned fault recording information with the latest fault recording information in sequence from late to early according to the event, and if all the returned fault recording information are inconsistent with the latest fault recording information, trigger the second determining unit, otherwise trigger the third determining unit;
the second determining unit is used for determining that all returned fault recording information is fault recording information which is not acquired by the main station,
and the third determining unit is used for determining that the returned part of the fault recording information is the fault recording information which is not acquired by the main station.
In some optional embodiments, in combination with the embodiment shown in fig. 4, the fault recording information obtaining unit 300 includes: the first fault recording information acquisition subunit and the second fault recording information acquisition subunit are connected;
the first fault recording information obtaining subunit is configured to determine whether the fault recording information message carries an identifier for identifying that the fault recording information message includes fault recording information, and if so, trigger the second fault recording information obtaining subunit;
and the second fault recording information obtaining subunit is configured to obtain at least one piece of fault recording information returned by the slave station from the fault recording information message.
In some alternative embodiments, in combination with the embodiment shown in fig. 4, the apparatus further comprises: a non-fault recording information transmission unit;
and the non-fault recording information transmission unit is used for performing at least one non-fault recording information transmission process after the main station stores the returned fault recording information, and returning to the step that the main station sends a fault recording information acquisition request which is based on a Modbus protocol and comprises a fault recording information storage address to the slave station after the at least one non-fault recording information transmission process is finished.
In some alternative embodiments, in combination with the embodiment shown in fig. 4, the apparatus further comprises: a new identifier setting unit and a new identifier judging unit;
the master station stores a fault recording information identifier, and when all returned fault recording information is fault recording information which is not acquired by the master station, the new identifier setting unit is triggered;
the new identifier setting unit is used for changing the fault recording information identifier into a new fault recording information identifier;
and the new identifier judging unit is used for determining whether the fault recording information identifier is a new fault recording information identifier or not, and if so, triggering the request responding unit.
In some alternative embodiments, in combination with the embodiment shown in fig. 4, the apparatus further comprises: an old identifier setting unit and a new fault recording detection request sending unit;
when the returned part of fault recording information is the fault recording information which is not acquired by the main station, triggering the old identifier setting unit;
the old identifier setting unit is used for changing the fault recording information identifier into an old fault recording information identifier;
and the new fault recording detection request sending unit is used for sending a new fault recording detection request to the slave station according to the old fault recording information identifier when a detection time corresponding to a preset fault recording detection period arrives, so as to detect whether new fault recording information which is never acquired by the master station is stored in the slave station side.
In some alternative embodiments, in combination with the embodiment shown in fig. 4, the apparatus further comprises: a new process unit;
and the new process unit is used for entering the process of obtaining the fault recording information from the slave station next time after the master station determines that the slave station side stores new fault recording information which is never obtained by the master station through the fault recording detection request.
The embodiment of the invention provides a fault recording information obtaining method based on a Modbus protocol and related equipment, wherein the process that a master station obtains fault recording information from a slave station each time comprises at least one request and response process, and each request and response process comprises the following steps: the master station sends a fault recording information acquisition request which is based on a Modbus protocol and comprises a fault recording information storage address to the slave station; the master station acquires fault recording information from the slave station, wherein a fault recording information storage address in a first fault recording information acquisition request sent in the process of acquiring the fault recording information from the slave station each time is a storage address for storing the fault recording information of the latest event at the slave station side, and a fault recording information storage address in a subsequent fault recording information acquisition request sent in the process of acquiring the fault recording information from the slave station at the same time is a storage address which is behind the fault recording information storage address in the previous fault recording information acquisition request and is separated by a preset storage space; the slave station side stores the fault recording information of each event into a plurality of continuous storage addresses in sequence according to the sequence of the events, wherein each storage address stores the fault recording information of one event, and the storage spaces corresponding to the storage addresses are the same in size; the master station obtains a fault recording information message which is returned by the slave station and is based on the Modbus protocol; the master station obtains at least one fault recording message returned by the slave station from the fault recording message; the main station compares at least one returned fault recording message with the latest fault recording message last time, and determines the fault recording messages which are not acquired by the main station in each returned fault recording message according to the comparison result, wherein the latest fault recording message last time is: fault recording information of the latest event obtained in the process of obtaining the fault recording information from the slave station last time; when the returned fault recording information does not include fault recording information which is not acquired by the master station, the master station finishes the process of acquiring the fault recording information from the slave station; when all returned fault recording information is the fault recording information which is not acquired by the master station, the master station stores the returned fault recording information, and returns the fault recording information to the slave station to send a fault recording information acquisition request which is based on a Modbus protocol and comprises a fault recording information storage address; and when the returned part of the fault recording information is the fault recording information which is not acquired by the master station, the master station stores the fault recording information which is not acquired by the master station, and the process of acquiring the fault recording information from the slave station is finished.
The fault recording information acquisition device based on the Modbus protocol comprises a processor and a memory, wherein the request sending unit 100, the message obtaining unit 200, the fault recording information obtaining unit 300, the comparing unit 400, the first result unit 500, the second result unit 600, the third result unit 700 and the like are stored in the memory as program units, and the processor executes the program units stored in the memory to realize corresponding functions.
The processor comprises a kernel, and the kernel calls the corresponding program unit from the memory. The kernel can be set to be one or more than one, when the slave station equipment generates new fault recording information, the master station equipment acquires the fault recording information from the slave station equipment by adjusting the kernel parameters, and only the newly generated fault recording information in the slave station equipment is acquired, so that the communication process for acquiring the fault recording information is greatly shortened, the excessive communication time is avoided, and the remote signaling data and the remote sensing data of the master station are updated in time.
The embodiment of the invention provides a storage medium, wherein a program is stored on the storage medium, and when the program is executed by a processor, the fault recording information acquisition method based on a Modbus protocol is realized.
The embodiment of the invention provides a processor, which is used for running a program, wherein the fault recording information acquisition method based on a Modbus protocol is executed when the program runs.
As shown in fig. 5, an embodiment of the present invention provides a fault recording information acquiring device 70 based on a Modbus protocol, where the fault recording information acquiring device 70 based on the Modbus protocol includes at least one processor 701, at least one memory 702 connected to the processor 701, and a bus 703; the processor 701 and the memory 702 complete mutual communication through a bus 703; the processor 701 is configured to call the program instructions in the memory 702 to execute the above-mentioned fault recording information obtaining method based on the Modbus protocol. The device herein may be a server, a PC, a PAD, a mobile phone, etc.
The present application also provides a computer program product adapted to execute a program initialized with the steps included in a fault recording information acquisition method based on the Modbus protocol when executed on a data processing apparatus.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In a typical configuration, a device includes one or more processors (CPUs), memory, and a bus. The device may also include input/output interfaces, network interfaces, and the like.
The memory may include volatile memory in a computer readable medium, Random Access Memory (RAM) and/or nonvolatile memory such as Read Only Memory (ROM) or flash memory (flash RAM), and the memory includes at least one memory chip. The memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in the process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the system embodiment, since it is substantially similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
The above are merely examples of the present application and are not intended to limit the present application. Various modifications and changes may occur to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.
Claims (10)
1. A fault recording information obtaining method based on a Modbus protocol is characterized by comprising the following steps:
the process that the master station obtains the fault recording information from the slave station each time comprises at least one request and response process, and each request and response process comprises the following steps:
the master station sends a fault recording information acquisition request which is based on a Modbus protocol and comprises a fault recording information storage address to the slave station; the master station obtains fault recording information from the slave station at each time, wherein a fault recording information storage address in a first fault recording information obtaining request sent in the process of obtaining the fault recording information from the slave station at each time is a storage address of fault recording information of the latest event stored at the slave station side, and a fault recording information storage address in a subsequent fault recording information obtaining request sent in the process of obtaining the fault recording information from the slave station at the same time is a storage address which is behind the fault recording information storage address in a previous fault recording information obtaining request and is separated by a preset storage space; the slave station side stores the fault recording information of each event into a plurality of continuous storage addresses in sequence according to the sequence of the events, wherein each storage address stores the fault recording information of one event, and the storage spaces corresponding to the storage addresses are the same in size;
the master station obtains a fault recording information message which is returned by the slave station and is based on the Modbus protocol;
the master station obtains at least one fault recording message returned by the slave station from the fault recording message;
the main station compares at least one returned fault recording message with the latest fault recording message last time, and determines the fault recording messages which are not acquired by the main station in each returned fault recording message according to the comparison result, wherein the latest fault recording message last time is: fault recording information of the latest event obtained in the process of obtaining the fault recording information from the slave station last time;
when the returned fault recording information does not include fault recording information which is not acquired by the master station, the master station finishes the process of acquiring the fault recording information from the slave station;
when all returned fault recording information is the fault recording information which is not acquired by the master station, the master station stores the returned fault recording information, and returns the fault recording information to the slave station to send a fault recording information acquisition request which is based on a Modbus protocol and comprises a fault recording information storage address;
and when the returned part of the fault recording information is the fault recording information which is not acquired by the master station, the master station stores the fault recording information which is not acquired by the master station, and the process of acquiring the fault recording information from the slave station is finished.
2. The method of claim 1, wherein the master station compares at least one returned fault record message with the latest fault record message of the last time, and determines the fault record messages which are not acquired by the master station in the returned fault record messages according to the comparison result, including:
the master station compares the latest event fault recording information in the returned fault recording information with the latest fault recording information in the last time;
if the fault record information is consistent with the fault record information, the main station determines that the returned fault record information does not include the fault record information which is not acquired by the main station;
if the fault record information is inconsistent with the latest fault record information, the main station compares the returned fault record information with the latest fault record information in sequence from the late to the early of the event, if all the returned fault record information is inconsistent with the latest fault record information, the main station determines that all the returned fault record information is the fault record information which is not acquired by the main station, and otherwise, the main station determines that part of the returned fault record information is the fault record information which is not acquired by the main station.
3. The method of claim 1, wherein the obtaining, by the master station, the at least one fault recording message returned by the slave station from the fault recording message comprises:
and the master station judges whether the fault recording information message carries an identifier for identifying that the fault recording information message comprises fault recording information or not, and if so, the master station obtains at least one piece of fault recording information returned by the slave station from the fault recording information message.
4. The method of claim 1, wherein after the master station saves the returned fault logging information, the method further comprises:
and the master station performs at least one transmission process of non-fault recording information, and returns to the step that the master station sends a fault recording information acquisition request which is based on a Modbus protocol and comprises a fault recording information storage address to the slave station after the at least one transmission process of the non-fault recording information is finished.
5. The method of claim 1, wherein the master station stores therein a fault recording information identifier, and when all the returned fault recording information is fault recording information that has not been acquired by the master station, the method further comprises:
the master station changes the fault recording information identification into a new fault recording information identification;
and the master station determines whether the fault recording information identifier is a new fault recording information identifier, and if so, returns to the step that the master station sends a fault recording information acquisition request which is based on a Modbus protocol and comprises a fault recording information storage address to the slave station.
6. The method of claim 1, wherein the master station stores an identifier of fault recording information, and when the returned part of the fault recording information is fault recording information that has not been acquired by the master station, the method further comprises:
the master station changes the fault recording information identifier into an old fault recording information identifier;
and when a detection time corresponding to a preset fault recording detection period arrives, sending a new fault recording detection request to the slave station according to the old fault recording information identifier so as to detect whether new fault recording information which is never acquired by the master station is stored in the slave station side.
7. The method of claim 6, further comprising:
and after the master station determines that the slave station side stores new fault recording information which is never acquired by the master station through the fault recording detection request, the master station enters the process of acquiring the fault recording information from the slave station next time.
8. The utility model provides a trouble record ripples information acquisition device based on Modbus agreement which characterized in that is applied to main website, the device includes: the information acquisition unit is used for acquiring fault recording information from a slave station, and the process of acquiring the fault recording information from the slave station by the information acquisition unit each time comprises at least one request response process;
the information acquisition unit includes: the request response unit is used for executing at least one request response process;
the request response unit comprises: the device comprises a request sending unit, a message obtaining unit, a fault recording information obtaining unit, a comparison unit, a first result unit, a second result unit and a third result unit;
the request sending unit is used for sending a fault recording information acquisition request which is based on a Modbus protocol and comprises a fault recording information storage address to the slave station in the process that the request response unit executes one request response; the master station acquires fault recording information from the slave station, wherein a fault recording information storage address in a first fault recording information acquisition request sent in the process of acquiring the fault recording information from the slave station each time is a storage address for storing the fault recording information of the latest event at the slave station side, and a fault recording information storage address in a subsequent fault recording information acquisition request sent in the process of acquiring the fault recording information from the slave station at the same time is a storage address which is behind the fault recording information storage address in the previous fault recording information acquisition request and is separated by a preset storage space; the slave station side stores the fault recording information of each event into a plurality of continuous storage addresses in sequence according to the sequence of the events, wherein each storage address stores the fault recording information of one event, and the storage spaces corresponding to the storage addresses are the same in size;
the message obtaining unit is used for obtaining a fault recording information message which is returned by the slave station and is based on the Modbus protocol in the process that the request response unit executes one request response;
the fault recording information obtaining unit is configured to obtain at least one fault recording information returned by the slave station from the fault recording information message in a process that the request responding unit executes a request responding;
the comparison unit is configured to compare at least one returned fault recording message with latest fault recording message last time in a process of executing a request response by the request response unit, and determine fault recording messages that are not acquired by the master station in each returned fault recording message according to a comparison result, where the latest fault recording message last time is: fault recording information of the latest event obtained in the process of obtaining the fault recording information from the slave station last time;
the first result unit is configured to, in a process that the request response unit executes a request response, when returned fault recording information does not include fault recording information that is not acquired by the master station, end, by the master station, a process of acquiring fault recording information from the slave station this time;
the second result unit is configured to, in the process of executing one request response by the request response unit, store, by the master station, each piece of returned fault recording information when all pieces of returned fault recording information are fault recording information that has not been acquired by the master station, and return to the step of sending, by the master station, a fault recording information acquisition request including a fault recording information storage address based on a Modbus protocol to the slave station;
and the third result unit is configured to, in the process of executing one request response by the request response unit, when part of returned fault recording information is fault recording information that is not acquired by the master station, store the fault recording information that is not acquired by the master station, and end the process of acquiring the fault recording information from the slave station this time.
9. The fault recording information acquisition equipment based on the Modbus protocol is characterized by comprising at least one processor, at least one memory and a bus, wherein the at least one memory and the bus are connected with the processor; the processor and the memory complete mutual communication through the bus; the processor is used for calling a program in the memory, and the program is at least used for realizing the fault recording information acquisition method based on the Modbus protocol in any one of claims 1 to 7.
10. A storage medium for storing a program, wherein the program when executed by a processor implements the fault recording information acquisition method based on the Modbus protocol according to any one of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010771196.XA CN111654425B (en) | 2020-08-04 | 2020-08-04 | Fault recording information acquisition method based on Modbus protocol and related equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010771196.XA CN111654425B (en) | 2020-08-04 | 2020-08-04 | Fault recording information acquisition method based on Modbus protocol and related equipment |
Publications (2)
Publication Number | Publication Date |
---|---|
CN111654425A CN111654425A (en) | 2020-09-11 |
CN111654425B true CN111654425B (en) | 2020-10-30 |
Family
ID=72345587
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010771196.XA Active CN111654425B (en) | 2020-08-04 | 2020-08-04 | Fault recording information acquisition method based on Modbus protocol and related equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111654425B (en) |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112468269B (en) * | 2020-11-26 | 2024-05-10 | 北京中电飞华通信有限公司 | Controller communication method, system and electronic equipment |
CN112261512B (en) * | 2020-12-07 | 2021-03-12 | 北京和利时系统工程有限公司 | Master station remote control method, device, storage medium and equipment of unbalanced polling protocol |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102170298A (en) * | 2011-03-31 | 2011-08-31 | 重庆新世杰电气股份有限公司 | Power communication method and system based on MODBUS TCP/IP (Transmission Control Protocol/ Internet Protocol) |
WO2012012723A2 (en) * | 2010-07-23 | 2012-01-26 | Saudi Arabian Oil Company | Machines, computer program products, and computer-implemented methods providing an integrated node for data acquisition and control |
CN104215878A (en) * | 2014-08-12 | 2014-12-17 | 上海交通大学 | Device and method for recording fault waveforms of power distribution lines |
CN105259437A (en) * | 2015-10-14 | 2016-01-20 | 株洲变流技术国家工程研究中心有限公司 | Method for achieving fault analysis of high-voltage frequency converter |
CN109698553A (en) * | 2018-12-29 | 2019-04-30 | 中国南方电网有限责任公司 | A method of optimizing transmission mechanism suitable for wave-record chart under emergency environmental |
-
2020
- 2020-08-04 CN CN202010771196.XA patent/CN111654425B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2012012723A2 (en) * | 2010-07-23 | 2012-01-26 | Saudi Arabian Oil Company | Machines, computer program products, and computer-implemented methods providing an integrated node for data acquisition and control |
CN102170298A (en) * | 2011-03-31 | 2011-08-31 | 重庆新世杰电气股份有限公司 | Power communication method and system based on MODBUS TCP/IP (Transmission Control Protocol/ Internet Protocol) |
CN104215878A (en) * | 2014-08-12 | 2014-12-17 | 上海交通大学 | Device and method for recording fault waveforms of power distribution lines |
CN105259437A (en) * | 2015-10-14 | 2016-01-20 | 株洲变流技术国家工程研究中心有限公司 | Method for achieving fault analysis of high-voltage frequency converter |
CN109698553A (en) * | 2018-12-29 | 2019-04-30 | 中国南方电网有限责任公司 | A method of optimizing transmission mechanism suitable for wave-record chart under emergency environmental |
Also Published As
Publication number | Publication date |
---|---|
CN111654425A (en) | 2020-09-11 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110321387B (en) | Data synchronization method, equipment and terminal equipment | |
CN109558065B (en) | Data deleting method and distributed storage system | |
CN109741060B (en) | Information inquiry system, method, device, electronic equipment and storage medium | |
CN111654425B (en) | Fault recording information acquisition method based on Modbus protocol and related equipment | |
US9686131B2 (en) | System, gateway, and method for automatic setting configuration by learning commands | |
CN112115200B (en) | Data synchronization method, device, electronic equipment and readable storage medium | |
CN111654426B (en) | Event sequence recording event information acquisition method based on Modbus protocol and related equipment | |
CN109241165B (en) | Method, device and equipment for determining database synchronization delay | |
CN107959695B (en) | Data transmission method and device | |
CN111225082B (en) | Identity management method and device of Internet of things intelligent equipment and Internet of things platform | |
CN111726185B (en) | Method for synchronizing system clock of external device and local computing device | |
CN113993002A (en) | Cable monitoring data reporting method and device | |
CN110188081B (en) | Log data storage method and device based on cassandra database and computer equipment | |
CN116192707A (en) | Big data evaluation management method | |
CN108038127B (en) | Data synchronization method, device, terminal equipment and storage medium | |
CN111291127B (en) | Data synchronization method, device, server and storage medium | |
CN112565015B (en) | Internet of things communication method and device, computer equipment and storage medium | |
CN113568781B (en) | Database error processing method and device and database cluster access system | |
CN111708335A (en) | Equipment data acquisition method based on smart factory | |
CN115098525A (en) | Index updating method and device, electronic equipment and storage medium | |
CN114745609A (en) | Energy consumption monitoring system | |
CN112600638A (en) | Power grid clock synchronization method and device | |
CN114422621B (en) | Communication connection method, station control layer device and storage medium | |
CN111078232A (en) | Application program packaging method, device, equipment and medium | |
CN112652087B (en) | Processing method of boarding bridge use record and related equipment |
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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant | ||
TR01 | Transfer of patent right | ||
TR01 | Transfer of patent right |
Effective date of registration: 20211108 Address after: 100176 room 3412, floor 4, building 3, yard 2, Desheng Middle Road, Beijing Economic and Technological Development Zone, Daxing District, Beijing Patentee after: Beijing Helishi system integration Co.,Ltd. Address before: 100176 courtyard 2, Disheng Middle Road, Daxing Economic and Technological Development Zone, Beijing Patentee before: BEIJING HOLLYSYS Co.,Ltd. |