Summary of the invention
In view of the above problems, it proposes on the present invention overcomes the above problem or at least be partially solved in order to provide one kindState problem a kind of ammeter data processing method and a kind of ammeter.
The embodiment of the invention discloses a kind of ammeter data processing methods characterized by comprising
Each ammeter in predeterminable area in different multicast groups, freezes current electricity every the preset time cycle, obtainsTo local electricity;
Each ammeter in multicast group, in preset first time period, other ammeters into multicast send multicast numberAccording to packet;
Each ammeter in multicast group, parses the multicast packet, obtains the electricity of other ammeters in multicast group;
Each ammeter in multicast group, in preset second time period, by the local of the electricity of other ammeters and ammeterElectricity is sent to server.
Optionally, further includes:
Receive the ID number that server is sent;
Multicast group belonging to the ammeter is determined according to the ID number.
Optionally, described in preset first time period, other ammeters into multicast send multicast packet, packetIt includes:
In preset first time period, the local electricity of ammeter is obtained;
Local electricity according to ammeter generates multicast packet;
The other ammeters multicast packet being sent in multicast group.
Optionally, the multicast packet is parsed, the latest update time of specified electric quantity is also obtained;The method is also wrappedIt includes:
Judge the specified electric quantity of ammeter the latest update time whether latest update with the specified electric quantity of other ammeters whenBetween it is identical;
If it is different, judging whether the latest update time of the specified electric quantity of ammeter is specified earlier than any one other ammeterThe renewal time of electricity;
If the latest update time of the specified electric quantity of ammeter earlier than the specified electric quantity of any one other ammeter update whenBetween, ammeter synchronization request information is sent to server;
It receives the specified electric quantity that server is sent and updates request command, to update local specified electric quantity.
Optionally, the specified electric quantity includes the local specified electric quantity of ammeter, the method also includes:
Each ammeter in multicast judges whether local electricity has been more than local specified electric quantity;
If being more than local specified electric quantity, super electric tripping operation is executed;
First tripping information is sent to server.
Optionally, the specified electric quantity includes total specified electric quantity of each ammeter in multicast group, the method also includes:
Each ammeter in multicast group, within the preset third period, calculate the electricity of all ammeters received withAnd the summation of local electricity, obtain total electricity;
Judge whether the total electricity has been more than total specified electric quantity;
If being more than total specified electric quantity, super electric tripping is executed;
Second tripping information is sent to server.
The invention also discloses a kind of ammeters, comprising:
Freezing unit obtains local electricity for freezing current electricity every the preset time cycle;
First transmission unit, in preset first time period, other ammeters into multicast to send multicast packetPacket;
Resolution unit obtains the electricity of other ammeters in multicast group for parsing the multicast packet received;
Second transmission unit is used in preset second time period, by the local electricity of the electricity of other ammeters and ammeterAmount is sent to server.
Optionally, the resolution unit is also used to:
The multicast packet is parsed, the latest update time of specified electric quantity is also obtained;
The ammeter further include:
First judging unit, for judging whether the latest update time of specified electric quantity of ammeter is specified with other ammetersThe latest update time of electricity is identical;
Second judgment unit, for if it is different, judge the specified electric quantity of ammeter the latest update time whether be later than it is anyThe renewal time of the specified electric quantity of one other ammeter;
Updating unit, the specified electric quantity for receiving server transmission updates request command, to update local specified electric quantity.
Optionally, the specified electric quantity includes the local specified electric quantity of ammeter, the ammeter further include:
Third judging unit, for judging whether local electricity has been more than local specified electric quantity;
First trip unit, if executing super electric tripping operation for being more than local specified electric quantity;
Third transmission unit, for the first tripping information to be sent to server.
Optionally, the local specified electric quantity includes total specified electric quantity of each ammeter in multicast group, and the ammeter also wrapsIt includes:
Computing unit, for calculating electricity and the local of all ammeters received within the preset third periodThe summation of electricity, obtains total electricity;
4th judging unit, for judging whether the total electricity has been more than total specified electric quantity;
Second trip unit, if executing super electric tripping for being more than total specified electric quantity;
4th transmission unit, for the second tripping information to be sent to server.
By above-mentioned technical proposal, a kind of ammeter data processing method provided by the invention, comprising: different in predeterminable areaEach ammeter in multicast group, freezes current electricity every the preset time cycle, obtains local electricity;Preset firstIn period, other ammeters into multicast group send user multicast data packet;Each ammeter in multicast group, parses described groupUnicast packets obtain the electricity of other ammeters in multicast group;Each ammeter in multicast group, in preset second time period,Server is sent by the local electricity of the electricity of other ammeters and ammeter.By individually being managed to each multicast group in a regionReason, realizes between the independent management each ovary in a room, for each ammeter in a multicast group, passes through multicastMode transmit data, and the ammeter data in multicast group is sent to server by each ammeter, ensure that electricity statisticsAccuracy.
Also, each ammeter in multicast group can also judge volume according to the renewal time of the specified electric quantity of other ammetersDetermine whether electricity is timely updated.
In addition to this, each ammeter in multicast group is required to the total electricity of all ammeters in statistics multicast group, and will be totalElectricity is compared with total specified electric quantity, if being more than total specified electric quantity, is powered off, and is avoided due to single ammeterNon- arrearage, total ammeter arrearage, but the problem of ammeter does not trip.
The above description is only an overview of the technical scheme of the present invention, in order to better understand the technical means of the present invention,And it can be implemented in accordance with the contents of the specification, and in order to allow above and other objects of the present invention, feature and advantage canIt is clearer and more comprehensible, the followings are specific embodiments of the present invention.
Specific embodiment
Exemplary embodiments of the present disclosure are described in more detail below with reference to accompanying drawings.Although showing the disclosure in attached drawingExemplary embodiment, it being understood, however, that may be realized in various forms the disclosure without should be by embodiments set forth hereIt is limited.On the contrary, these embodiments are provided to facilitate a more thoroughly understanding of the present invention, and can be by the scope of the present disclosureIt is fully disclosed to those skilled in the art.
With reference to Fig. 1, a kind of flow diagram of ammeter data processing method provided in an embodiment of the present invention is shown, at thisIn embodiment, this method comprises:
S101: each ammeter in predeterminable area in different multicast groups freezes current electricity every the preset time cycleAmount, obtains local electricity;
In the present embodiment, predeterminable area may include multiple and different multicast group, wherein predeterminable area can be expressed as appointingIt what space, can each wall in the room in order to facilitate the use of user's control electricity for example, indicate a roomOne ammeter is installed, the plug in ammeter of each wall can measure wall and insert electricity consumption in inserting.And it is possible to be more by a region divisionSub-regions, the electricity in each subregion are individually counted and are measured, such as: can using the not chummery in a house asAmmeter in each subregion is divided into a multicast group by the subregion in the room.
Specifically, may include: by the process that each ammeter is divided into different multicast groups
Receive the ID number that server is sent;
Multicast group belonging to the ammeter is determined according to the ID number.
For example: the ammeter in each subregion can have ammeter in identical ID number or each subregionID number is within the scope of the same preset field, that is to say, that can will have identical ID number or within the scope of the same fieldAmmeter be determined as a multicast group.
In the present embodiment, ammeter can update the electricity consumption of slotting wall in real time, but user can regularly carry out electricityStatistics, therefore can regularly freeze electricity, and then count to current electricity.
S102: each ammeter in multicast group, other ammeter transmission groups in preset first time period, into multicastUnicast packets;
In the present embodiment, multicast packet may include the data of the ammeter freezed, therefore obtain the ammeter freezedAfter data, the data of ammeter can be sent to in multicast other ammeters, specifically, S102 includes:
Within a preset time period, the local electricity of ammeter is obtained;
Local electricity according to ammeter generates multicast packet;
The other ammeters multicast packet being sent in multicast group.
In the present embodiment, in order to avoid due in the ammeter same time in the same multicast group simultaneously send electricity, fromAnd cause to transmit crowded problem, sending time can be broken up, i.e., each ammeter in multicast can be within a preset time periodThe electricity freezed is obtained at random.
For example: each ammeter can obtain a nearest integral point at random in the 1st~10 minute of each hour and freezeThe electricity of knot, wherein assuming that including 3 ammeters in multicast group, ammeter 1 can obtain the electricity of a nearest integral point at the 1st minuteAmount, and the multicast packet of ammeter 1 is sent to ammeter 2 and ammeter 3, ammeter 2 can obtain a nearest integral point at the 2nd minuteElectricity, and the multicast packet of ammeter 2 is sent to ammeter 1 and ammeter 3, ammeter 3 can obtain nearest one at the 5th minuteThe electricity of integral point, and the multicast packet of ammeter 3 is sent to ammeter 1 and ammeter 2.
It in the present embodiment, may include with multicast packet: ammeter data and/or command information.Wherein, command information tableShow, indication electric meter executes the instruction of relevant operation;Data information indicates the information comprising freezing the related datas such as electricity.
For example: table 1 can be a kind of format information of multicast packet, wherein 0x01 indicates command information, specificallyIt can be expressed as electricity consumption notification command, the ammeter data for including in data packet includes: information about power, the jelly that local ammeter freezesTie the acquisition time of electricity, the renewal time of specified electric quantity information and specified electric quantity.Wherein, electricity consumption notification command may includeIt is performed below to the update of other ammeter electricity and the update of specified electric quantity.
Table 1
Alternatively, multicast packet can also be comprising other forms, specifically, the ammeter information that the data packet includes can be withIt include: the renewal time of specified electric quantity information and specified electric quantity;Command information can be expressed as updating specified electric quantity order.
For example, as shown in table 2, wherein 0x02 is expressed as specified electric quantity more newer command.
It in addition to this, can also only include ammeter data in multicast packet, after ammeter receives multicast packet again, according to connecingThe related ammeter data received executes the update of relevant electricity consumption or the update of specified electric quantity.
S103: each ammeter in multicast group parses the multicast packet, obtains the electricity of other ammeters in multicast groupAmount;
In the present embodiment, after the electricity for obtaining other ammeters, the electricity of other ammeters can be cached, such as canTo be saved in interim global variable, after uploading the data to server, the data can be removed.
S104: each ammeter in multicast group, in preset second time period, by the electricity of other ammeters and ammeterLocal electricity is sent to server.
In the present embodiment, in order to improve the accuracy for the data that server receives, each ammeter can incite somebody to action oneself in multicastThe electricity (local electricity) of body and the electricity of the other ammeters received are sent to server.Server can be sent out according to each ammeterThe electricity of each ammeter, i.e., the slotting electricity consumption of the corresponding wall of each ammeter in the electricity record a cycle sent.Specifically, in order toThe electricity of each ammeter in multicast group is distinguished, each ammeter is in the other ammeters for sending local electricity to server and receivingElectricity when, each electricity for being sent to server carries the mark of ammeter.
Wherein, the electricity that server can send each ammeter in the multicast group received is compared, specifically,The electricity of the ammeter of the like-identified received is compared, if the electricity data for identifying identical ammeter is consistent, is savedA data can be stored if not identical according to default rule, for example, server can be received the latestThe electricity of ammeter stored as target electricity, or can also be stored maximum electricity as target electricity.
Wherein, preset second time period can be any a period of time for being later than preset first time period, in order to keep awayExempt from all ammeters in multicast group, while sending information to server and breaing up each ammeter so as to cause the low problem of communication efficiencySending time.Such as: each ammeter can be at one time point of any selection in 15~55 minutes of each hour, by ammeterElectricity be sent to server.
It is independent to each multicast group by the way that the ammeter in a region is divided into different multicast groups in the present embodimentManagement realizes and passes through group for each ammeter in a multicast group to the independent management ovarys different in a roomThe mode broadcast transmits data, and the ammeter data in multicast group is sent to server by each ammeter, ensure that electricity countsAccuracy.
With reference to Fig. 2, a kind of another flow diagram of ammeter data processing method provided in an embodiment of the present invention is shown,In the present embodiment, this method comprises:
It, must other than having obtained the electricity of other ammeters when parsing the multicast packet in the present embodiment, in S103It arrives: the latest update time of specified electric quantity;Then each ammeter in multicast group can be by comparing specified electric quantity latest updateThe mode of time determines whether local specified electric quantity is timely updated, specifically, further include:
S201: judge the local specified electric quantity of ammeter the latest update time whether with the specified electric quantities of other ammeters mostNew renewal time is identical;
In the present embodiment, ammeter can regularly update specified electric quantity, if but at the time of needing to update specified electric quantityCommunication failure occurs, the specified electric quantity of ammeter is not updated, and the calculating that specified electric quantity whether will be exceeded to subsequent electricity producesIt is raw to influence, therefore, before executing the calculating, first the update status of specified electric quantity can be detected.
S202: if it is different, judging the latest update time of the specified electric quantity of ammeter whether earlier than any one other ammeterSpecified electric quantity renewal time;
S203: if the latest update time of the specified electric quantity of ammeter earlier than any one other ammeter specified electric quantity moreThe new time sends ammeter synchronization request information to server;
S204: it receives the specified electric quantity that server is sent and updates request command, to update local specified electric quantity.
The specified electric quantity mentioned in the present embodiment can be expressed as, the maximum available power of ammeter setting, when ammeter is usedWhen electricity is more than specified electric quantity, ammeter meeting automatic trip, such as can be the total electricity of user's purchase or the volume of user settingDetermine electricity etc., wherein specified electric quantity can modify according to actual needs.
In the present embodiment, local specified electric quantity may include: each ammeter in the local specified electric quantity and multicast group of ammeterTotal specified electric quantity.Wherein, the local specified electric quantity of ammeter is expressed as the volume specified electric quantity of some ammeter itself.
For example: assuming that the renewal time of the specified electric quantity of ammeter 1 is at 3 points in afternoon, the specified electricity of the ammeter 2 receivedThe renewal time of amount is at 5 points in afternoon, it follows that the specified electric quantity of the renewal time of the specified electric quantity of ammeter 1 and ammeter 2 is moreThe new time is different, and the renewal time of the specified electric quantity of ammeter 1 is earlier than the renewal time of the specified electric quantity of ammeter 2, then it represents that, electricityTable 2 in the afternoon 5 points of update specified electric quantities when, the problems such as ammeter 1 may be due to communication failure, fails to execute specified electric quantity moreNewly, ammeter can be sent to server again in this way and update request command, update specified electric quantity.
In the present embodiment, the specified electric quantity update request command that server is sent may include: specified electric quantity and specifiedThe renewal time of electricity ensure that ammeter is synchronous with information on services.
In the present embodiment, renewal time of the specified electric quantity by analyzing different ammeters, the true table specified electric quantity of ammeterIn newest more new state.
With reference to Fig. 3, a kind of another flow diagram of ammeter data provided in an embodiment of the present invention is shown, wherein InIn the case that specified electric quantity includes the local specified electric quantity of ammeter, in the present embodiment, this method can also include:
S301: any one ammeter in multicast judges whether local electricity has been more than local specified electric quantity;
S302: if being more than local specified electric quantity, super electric tripping operation is executed;
S303: the first tripping information is sent to server.
For example: it is directed in a room, may include the plug in ammeter of video wall, water heater plugs in the ammeter of wall, usesFamily can specify that total electricity consumption of each ammeter, when any one ammeter has been more than the specified electric quantity of the ammeter, then holdRow tripping.
In the present embodiment, different specified electric quantities can be arranged to each ammeter in room (multicast group) in user, when appointAfter the electricity of what ammeter has been more than the specified electric quantity of the ammeter, then trip operation is executed, and the tripping information is sent toServer is so that it is convenient to which the electricity consumption that user inserts each wall in room controls.
In addition to this it is possible to judge whether to need to be implemented trip operation according to total electricity and total specified electric quantity, specifically,With reference to Fig. 4:
S401: each ammeter in multicast group calculates the electricity of all ammeters received within the preset third periodThe summation of amount and local electricity, obtains total electricity;
S402: judge whether the total electricity has been more than total specified electric quantity;
S403: if being more than total specified electric quantity, super electric tripping is executed;
S404: the second tripping information is sent to server.
In the present embodiment, preset three period can be any one period for being later than preset first time period,Such as: after ammeter has updated total specified electric quantity, for example, total specified electric quantity can be expressed as the total specified electricity of the multicast groupAmount, the total specified electric quantity being specifically also denoted as in certain region in some room, 11~15 minutes of each hourIt is interior, execute the scheme of S401~S404.
In the present embodiment, in order to avoid single ammeter does not have an arrearage and when total ammeter arrearage, the case where single ammeter does not trip,Each ammeter calculates total electricity, and total electricity and total specified electric quantity are counted, and determines whether arrearage, intoAnd it determines the need for executing trip operation.
With reference to Fig. 5, a kind of structural schematic diagram of ammeter data processing unit of this law inventive embodiments offer, In are shownIn the present embodiment, which includes:
Freezing unit 501 obtains local electricity for freezing current electricity every the preset time cycle;
First transmission unit 502, in preset first time period, other ammeters into multicast to send multicast numberAccording to packet;
Resolution unit 503 obtains the electricity of other ammeters in multicast group for parsing the multicast packet receivedAmount;
Second transmission unit 504 is used in preset second time period, by the local of the electricity of other ammeters and ammeterElectricity is sent to server.
Optionally, further includes:
Receiving unit, for receiving the ID number of server transmission;
Determination unit, for determining multicast group belonging to the ammeter according to the ID number.
Optionally, first transmission unit, comprising:
Subelement is obtained, for obtaining the local electricity of ammeter in preset first time period;
Subelement is generated, generates multicast packet for the local electricity according to ammeter;
Transmission sub-unit, other ammeters for being sent to the multicast packet in multicast group.
Optionally, the resolution unit is also used to:
The multicast packet is parsed, the latest update time of specified electric quantity is also obtained;
The ammeter further include:
First judging unit, for judging whether the latest update time of specified electric quantity of ammeter is specified with other ammetersThe latest update time of electricity is identical;
Second judgment unit, for if it is different, judge the specified electric quantity of ammeter the latest update time whether be later than it is anyThe renewal time of the specified electric quantity of one other ammeter;
Updating unit, the specified electric quantity for receiving server transmission updates request command, to update local specified electric quantity.
Optionally, the specified electric quantity includes the local specified electric quantity of ammeter, the ammeter further include:
Third judging unit, for judging whether local electricity has been more than local specified electric quantity;
First trip unit, if executing super electric tripping operation for being more than local specified electric quantity;
Third transmission unit, for the first tripping information to be sent to server.
Optionally, the local specified electric quantity includes total specified electric quantity of each ammeter in multicast group, and the ammeter also wrapsIt includes:
Computing unit, for calculating electricity and the local of all ammeters received within the preset third periodThe summation of electricity, obtains total electricity;
4th judging unit, for judging whether the total electricity has been more than total specified electric quantity;
Second trip unit, if executing super electric tripping for being more than total specified electric quantity;
4th transmission unit, for the second tripping information to be sent to server.
Device through this embodiment is realized by individually managing each multicast group in a region to a roomBetween in independent management between each ovary data are transmitted by way of multicast for each ammeter in a multicast group, andThe ammeter data in multicast group is sent to server by each ammeter, ensure that electricity statistical accuracy.Also, multicast groupInterior each ammeter can also judge whether local specified electric quantity is instant according to the renewal time of the specified electric quantity of other ammetersUpdated.In addition to this, each ammeter in multicast group is required to the total electricity of all ammeters in statistics multicast group,And be compared total electricity with total specified electric quantity, if being more than total specified electric quantity, powered off, is avoided due to listA non-arrearage of ammeter, total ammeter arrearage, but the problem of ammeter does not trip.
In order to realize the statistical method of ammeter that above embodiments are mentioned, ammeter can be arranged in the room, exampleAmmeter can be such as made into the slotting form of wall, the directly slotting wall (as shown in Figure 6) in replacement room, in this way without having changed roomSome configurations, while also can achieve beautiful effect.
In addition to this, each ammeter supports zigbee communication, in other words ZigBee wireless module built in each ammeter, workUnder Router Repeater-mode, gateway is Coordinator coordinator, and composition mesh network is communicated.
It should also be noted that, the terms "include", "comprise" or its any other variant are intended to nonexcludabilityIt include so that the process, method, commodity or the equipment that include a series of elements not only include those elements, but also to wrapInclude other elements that are not explicitly listed, or further include for this process, method, commodity or equipment intrinsic wantElement.In the absence of more restrictions, the element limited by sentence "including a ...", it is not excluded that including elementThere is also other identical elements in process, method, commodity or equipment.
It will be understood by those skilled in the art that embodiments herein can provide as method, system or computer program product.Therefore, complete hardware embodiment, complete software embodiment or embodiment combining software and hardware aspects can be used in the applicationForm.It is deposited moreover, the application can be used to can be used in the computer that one or more wherein includes computer usable program codeThe shape for the computer program product implemented on storage media (including but not limited to magnetic disk storage, CD-ROM, optical memory etc.)Formula.
The above is only embodiments herein, are not intended to limit this application.To those skilled in the art,Various changes and changes are possible in this application.It is all within the spirit and principles of the present application made by any modification, equivalent replacement,Improve etc., it should be included within the scope of the claims of this application.