Disclosure of Invention
In view of this, an object of the present invention is to provide a data processing method and apparatus, so as to alleviate the technical problem in the prior art that when a communication connection between an intelligent electric meter and a server is abnormal, the intelligent electric meter cannot upload data effectively in real time, and data loss is easily caused.
In a first aspect, an embodiment of the present invention provides a data processing method, where the method is applied to a smart meter, and the method includes: acquiring monitoring data of monitored equipment, and sending the monitoring data to a server, wherein the monitoring data comprises at least one of the following data: electric quantity data, time parameters, current data, voltage data, active power, reactive power and apparent power; if the confirmation information sent by the server is not obtained within a first preset time period, the monitoring data are repeatedly sent to the server, wherein the confirmation information is response information fed back to the intelligent electric meter after the server receives the monitoring data; and if the sending times of the monitoring data sent to the server reach preset times, determining that the network connection between the intelligent electric meter and the server is in a disconnected state, and performing statistical processing on local monitoring data.
Further, the statistical processing of the local monitoring data includes: counting the monitoring data acquired in each time period from the monitoring data acquired at the moment of network disconnection until the network connection between the intelligent electric meter and the server is in a connection state; and performing summation statistical calculation on the electric quantity data in the monitoring data acquired in each time period to obtain a data packet acquired in at least one time period, and storing the data packet in a local database, wherein the data packet also comprises a time parameter in the last monitoring data acquired in the time period.
Further, the summing statistical calculation of the monitoring data acquired in each time period includes: monitoring data Ai,jAnd the monitoring data Ai,j+1Performing a sum statistical calculation, wherein Ai,jRepresents the jth monitoring data acquired in the ith time period, Ai,j+1And j represents j +1 th monitoring data acquired in the ith time period, wherein j is 1 to M in sequence, and M is the total amount of the monitoring data acquired in the ith time period.
Further, when the ith time period is the time period of the network disconnection time, Ai,1Monitoring data collected at the moment of network disconnection; when the ith time period is a time period after the time period of the network disconnection time, Ai,1Monitoring data collected at the beginning of the ith time period; when the ith time period is the time period of the target time, Ai,MFor the monitoring data collected at the target time, the target time is that the intelligent ammeter and the server reestablish network connectionThe time of day.
Further, the method further comprises: in the process of carrying out statistical processing on local monitoring data, restarting a network connection module in the intelligent electric meter every other second preset time period; after restarting the network connection module, sending a reconnection request to the server; if first feedback information sent by the server based on the reconnection request is not acquired, determining that the network connection between the server and the intelligent electric meter is in a disconnected state; and if first feedback information sent by the server based on the reconnection request is acquired, sending the data packet to the server.
Further, if the confirmation information sent by the server is not obtained within a first preset time period, repeatedly sending the monitoring data to the server includes: if the confirmation information sent by the server is not obtained within a first preset time period, the monitoring data are repeatedly sent to the server until the newly acquired monitoring data are obtained; and after the newly acquired monitoring data is acquired, transmitting the newly acquired monitoring data to the server under the condition that the confirmation information transmitted by the server is not acquired.
In a second aspect, an embodiment of the present invention provides a data processing apparatus, where the apparatus includes: the device comprises an acquisition unit, a judgment unit and a data processing unit, wherein the acquisition unit is used for acquiring monitoring data of monitored equipment and sending the monitoring data to a server, and the monitoring data comprises at least one of the following data: electric quantity data, time parameters, current data, voltage data, active power, reactive power and apparent power; the judging unit is used for repeatedly sending the monitoring data to the server if the confirmation information sent by the server is not obtained within a first preset time period, wherein the confirmation information is response information fed back to the intelligent electric meter after the server receives the monitoring data; and the data processing unit is used for determining that the network connection between the intelligent electric meter and the server is in a disconnected state and carrying out statistical processing on local monitoring data if the sending times of sending the monitoring data to the server reach preset times.
Further, the data processing unit is further configured to: counting the monitoring data acquired in each time period from the monitoring data acquired at the moment of network disconnection until the network connection between the intelligent electric meter and the server is in a connection state; and performing summation statistical calculation on the monitoring data acquired in each time period to obtain a data packet acquired in at least one time period, and storing the data packet in a local database, wherein the data packet also comprises a time parameter in the last monitoring data acquired in the time period.
Further, the data processing unit is also used for monitoring data Ai,jAnd the monitoring data Ai,j+1Performing a sum statistical calculation, wherein Ai,jRepresents the jth monitoring data acquired in the ith time period, Ai,j+1And j represents j +1 th monitoring data acquired in the ith time period, wherein j is 1 to M in sequence, and M is the total amount of the monitoring data acquired in the ith time period.
Further, the data processing unit is further configured to, when the ith time period is the time period of the network disconnection time, ai,1Monitoring data collected at the moment of network disconnection; when the ith time period is a time period after the time period of the network disconnection time, Ai,1Monitoring data collected at the beginning of the ith time period; when the ith time period is the time period of the target time, Ai,MAnd the target time is the time when the intelligent ammeter and the server reestablish network connection.
In the embodiment of the invention, after the intelligent electric meter and the server are disconnected, the intelligent electric meter continuously acquires the monitoring data of the monitored equipment, then performs statistical processing on the acquired data to obtain statistical data, and sends the statistical data to the server after the intelligent electric meter and the server are restored to be connected, so that the technical problem that when communication connection between the intelligent electric meter and the server is abnormal in the prior art, data loss is easily caused because the intelligent electric meter cannot effectively upload the monitoring data in real time, and the server cannot acquire complete monitoring data is solved, and the technical effect that the server can completely acquire the monitoring data acquired by the intelligent electric meter is realized.
Additional features and advantages of the invention will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. The objectives and other advantages of the invention will be realized and attained by the structure particularly pointed out in the written description and claims hereof as well as the appended drawings.
In order to make the aforementioned and other objects, features and advantages of the present invention comprehensible, preferred embodiments accompanied with figures are described in detail below.
Detailed Description
To make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings, and it is apparent that the described embodiments are some, but not all embodiments of the present invention. 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 first embodiment is as follows:
in accordance with an embodiment of the present invention, there is provided a method embodiment of data processing, it being noted that the steps illustrated in the flowchart of the figure may be performed in a computer system such as a set of computer-executable instructions and that, although a logical order is illustrated in the flowchart, in some cases the steps illustrated or described may be performed in an order different than here.
Fig. 1 is a method of data processing according to an embodiment of the present invention, as shown in fig. 1, the method including the steps of:
step S102, obtaining monitoring data of monitored equipment, and sending the monitoring data to a server, wherein the monitoring data comprises at least one of the following data: electric quantity data, time parameters, current data, voltage data, active power, reactive power and apparent power;
step S104, if the confirmation information sent by the server is not obtained within a first preset time period, the monitoring data is repeatedly sent to the server, wherein the confirmation information is response information fed back to the intelligent electric meter after the server receives the monitoring data.
Step S106, if the sending times of the monitoring data sent to the server reach preset times, determining that the network connection between the intelligent electric meter and the server is in a disconnected state, and performing statistical processing on local monitoring data;
in the embodiment of the invention, after the intelligent electric meter and the server are disconnected, the intelligent electric meter continuously acquires the monitoring data of the monitored equipment, then performs statistical processing on the acquired data to obtain statistical data, and sends the statistical data to the server after the intelligent electric meter and the server are restored to be connected, so that the technical problem that when communication connection between the intelligent electric meter and the server is abnormal in the prior art, data loss is easily caused because the intelligent electric meter cannot effectively upload the monitoring data in real time, and the server cannot acquire complete monitoring data is solved, and the technical effect that the server can completely acquire the monitoring data acquired by the intelligent electric meter is realized.
It should be noted that the preset number of times may be set by a user, and is not limited in the embodiment of the present invention.
In addition, it should be noted that if the server does not acquire the monitoring data sent by the smart meter within the first preset time, the server broadcasts information to the smart meter according to a preset period.
Then, if the feedback information generated according to the broadcast information and sent by the smart meter is not obtained within a period of time after the server sends the broadcast information, it can also be determined that the network connection between the smart meter and the server is in a disconnected state, and the specific time length of the period of time may be set by the user, which is not specifically limited in the embodiment of the present invention.
In the embodiment of the present invention, as shown in fig. 2, step S104 further includes the following steps:
step S1041, if the confirmation information sent by the server is not obtained within the first preset time period, repeatedly sending the monitoring data to the server until the newly acquired monitoring data is obtained.
Step S1042, after acquiring the newly acquired monitoring data, and in a case where the confirmation information sent by the server is not acquired, sending the newly acquired monitoring data to the server.
In the embodiment of the invention, after the smart meter sends the monitoring data1 to the server, if the confirmation information sent by the server is not obtained within the first preset time, the smart meter repeatedly sends the monitoring data 1.
If the monitoring data1 cannot be sent to the server after the smart meter acquires the new monitoring data2, the monitoring data1 is stored in the local database, and the smart meter sends the monitoring data2 to the server.
In the embodiment of the present invention, on the basis of the embodiment shown in fig. 1, as shown in fig. 2, the statistical processing of the local monitoring data includes the following steps:
step S1061, counting the monitoring data acquired in each time period from the monitoring data acquired at the moment of network disconnection until the network connection between the intelligent electric meter and the server is in a connection state.
Step S1062, performing summation statistical calculation on the monitoring data acquired in each time period to obtain a data packet acquired in at least one time period, and storing the data packet in a local database, wherein the data packet further includes a time parameter in the last monitoring data acquired in the time period.
In the embodiment of the invention, after the network connection between the intelligent electric meter and the server is determined to be disconnected, the intelligent electric meter continuously acquires the monitoring data of the monitored equipment, and the acquired monitoring data is processed according to the preset time period until the intelligent electric meter and the server reply the connection.
And then, summing up and counting the monitoring data acquired in each preset time period to obtain at least one data packet, wherein one time period corresponds to one data packet.
And finally, storing the data packet into the body database.
It should be noted that the time period may be set by a user, and is not limited in the embodiment of the present invention.
In the embodiment of the present invention, on the basis of the embodiment shown in fig. 1, the summing statistical calculation of the monitoring data acquired in each time period includes the following steps:
step S11, monitoring data Ai,jAnd the monitoring data Ai,j+1Performing a sum statistical calculation, wherein Ai,jRepresents the jth monitoring data acquired in the ith time period, Ai,j+1And j represents j +1 th monitoring data acquired in the ith time period, wherein j is 1 to M in sequence, and M is the total amount of the monitoring data acquired in the ith time period.
It should be noted that, when the ith time period is the time period of the network disconnection time, ai,1Monitoring data collected at the moment of network disconnection; when the ith time period is a time period after the time period of the network disconnection time, Ai,1Monitoring data collected at the beginning of the ith time period; when the ith time period is the time period of the target time, Ai,MAnd the target time is the time when the intelligent ammeter and the server reestablish network connection.
In the embodiment of the invention, when the network connection between the intelligent electric meter and the server is determined to be disconnected, the first monitoring data A collected by the intelligent electric meter at the network disconnection time is acquiredi,jAnd storing the data into the first data packet.
Then, second monitoring data A collected by the intelligent electric meteri,j+1Storing the data into the first data packet, adding and counting the first monitoring data to obtain statistical data, and covering the statistical data with the first monitoring data Ai,jAnd in the same way, in the time period i of the network disconnection time, all the monitoring data acquired by the intelligent electric meter are subjected to addition statistics and covering operation to obtain a first data packet, and the first data packet is stored in the local database.
If the intelligent ammeter and the server are not successfully reconnected in the time period of the network disconnection time, storing the first monitoring data acquired by the intelligent ammeter into a second data packet in the next time period i +1, and processing the monitoring data acquired by the intelligent ammeter in the time period i +1 according to the data processing method in the previous monitoring period i.
In the embodiment of the present invention, as shown in fig. 3, the method further includes the following steps:
and S108, restarting the network connection module in the intelligent electric meter every second preset time period in the process of carrying out statistical processing on the local monitoring data.
Step S110, after restarting the network connection module, sending a reconnection request to the server.
Step S112, if the first feedback information sent by the server based on the reconnection request is not obtained, determining that the network connection between the server and the intelligent electric meter is in a disconnected state.
Step S114, if first feedback information sent by the server based on the reconnection request is acquired, sending the data packet to the server.
In the embodiment of the invention, the network connection module in the intelligent electric meter is restarted every second preset time period in the process of carrying out statistical processing on the local monitoring data by the intelligent electric meter.
And after the network connection module is restarted successfully every time, sending a reconnection request to the server.
And if the first feedback information sent by the server based on the reconnection request is not acquired, determining that the network connection between the server and the smart meter is still in a disconnected state, and executing the step S110 again.
If the first feedback information sent by the server based on the reconnection request is obtained, the reconnection between the intelligent electric meter and the server is successful, and the intelligent electric meter sends the monitoring data and the data packet stored in the local database to the server during the network disconnection period.
Example two:
the present invention further provides a data processing apparatus, where the system is configured to execute the after-sales service management method provided in the foregoing content of the embodiment of the present invention, and the following is a specific description of the after-sales service management system provided in the embodiment of the present invention
As shown in fig. 4, the apparatus includes: an acquisition unit 10, a determination unit 20, a data processing unit 30, wherein,
the acquiring unit 10 is configured to acquire monitoring data of a monitored device, and send the monitoring data to a server, where the monitoring data includes at least one of: electric quantity data, time parameters, current data, voltage data, active power, reactive power and apparent power;
the judging unit 20 is configured to repeatedly send the monitoring data to the server if a confirmation message sent by the server is not obtained within a first preset time period, where the confirmation message is a response message fed back to the smart meter after the server receives the monitoring data;
the data processing unit 30 is configured to determine that the network connection between the smart meter and the server is in a disconnected state if the sending times of sending the monitoring data to the server reaches preset times, and perform statistical processing on local monitoring data.
In the embodiment of the invention, after the connection between the intelligent electric meter and the server is disconnected, the acquisition unit of the intelligent electric meter continues to acquire the monitoring data of the monitored equipment, the data processing unit performs statistical processing on the acquired data to obtain statistical data, and the statistical data is sent to the server after the intelligent electric meter and the server are restored to be connected, so that the technical problem that when the communication connection between the intelligent electric meter and the server is abnormal in the prior art, the monitoring data cannot be effectively uploaded by the intelligent electric meter in real time, the data is easily lost, and the server cannot acquire complete monitoring data is solved, so that the technical effect that the server can completely acquire the monitoring data acquired by the intelligent electric meter is realized.
Optionally, the data processing unit 30 is further configured to: counting the monitoring data acquired in each time period from the monitoring data acquired at the moment of network disconnection until the network connection between the intelligent electric meter and the server is in a connection state; and performing summation statistical calculation on the monitoring data acquired in each time period to obtain a data packet acquired in at least one time period, and storing the data packet in a local database, wherein the data packet also comprises a time parameter in the last monitoring data acquired in the time period.
Optionally, the data processing unit 30 is further configured to: monitoring data Ai,jAnd the monitoring data Ai,j+1Performing a sum statistical calculation, wherein Ai,jRepresents the jth monitoring data acquired in the ith time period, Ai,j+1And j represents j +1 th monitoring data acquired in the ith time period, wherein j is 1 to M in sequence, and M is the total amount of the monitoring data acquired in the ith time period.
Optionally, the data processing unit 30 is further configured to: when the ith time period is the time period of the network disconnection time, Ai,1Monitoring data collected at the moment of network disconnection; when the ith time period is a time period after the time period of the network disconnection time, Ai,1Monitoring data collected at the beginning of the ith time period; when the ith time period is the time period of the target time, Ai,MAnd the target time is the time when the intelligent ammeter and the server reestablish network connection.
Optionally, the apparatus further comprises a reconnection unit, configured to: in the process of carrying out statistical processing on local monitoring data, restarting a network connection module in the intelligent electric meter every other second preset time period; after restarting the network connection module, sending a reconnection request to the server; if first feedback information sent by the server based on the reconnection request is not acquired, determining that the network connection between the server and the intelligent electric meter is in a disconnected state; and if first feedback information sent by the server based on the reconnection request is acquired, sending the data packet to the server.
Optionally, the determining unit 20 is further configured to: if the confirmation information sent by the server is not obtained within a first preset time period, the monitoring data are repeatedly sent to the server until the newly acquired monitoring data are obtained; and after the newly acquired monitoring data is acquired, transmitting the newly acquired monitoring data to the server under the condition that the confirmation information transmitted by the server is not acquired.
In addition, in the description of the embodiments of the present invention, unless otherwise explicitly specified or limited, the terms "mounted," "connected," and "connected" are to be construed broadly, e.g., as meaning either a fixed connection, a removable connection, or an integral connection; can be mechanically or electrically connected; they may be connected directly or indirectly through intervening media, or they may be interconnected between two elements. The specific meanings of the above terms in the present invention can be understood in specific cases to those skilled in the art.
In the description of the present invention, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicate orientations or positional relationships based on the orientations or positional relationships shown in the drawings, and are only for convenience of description and simplicity of description, but do not indicate or imply that the device or element being referred to must have a particular orientation, be constructed and operated in a particular orientation, and thus, should not be construed as limiting the present invention. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the several embodiments provided in the present application, it should be understood that the disclosed system, apparatus and method may be implemented in other ways. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units is only one logical division, and there may be other divisions when actually implemented, and for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection of devices or units through some communication interfaces, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a non-volatile computer-readable storage medium executable by a processor. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
Finally, it should be noted that: the above-mentioned embodiments are only specific embodiments of the present invention, which are used for illustrating the technical solutions of the present invention and not for limiting the same, and the protection scope of the present invention is not limited thereto, although the present invention is described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: any person skilled in the art can modify or easily conceive the technical solutions described in the foregoing embodiments or equivalent substitutes for some technical features within the technical scope of the present disclosure; such modifications, changes or substitutions do not depart from the spirit and scope of the embodiments of the present invention, and they should be construed as being included therein. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.