Summary of the invention
For the above-mentioned prior art problem, coordinator node and field controller are mounted on trolley by the present invention
On, it is on the one hand easily installed on trolley and collected audio and video information is transmitted to field control by the camera at scene in real time
In device, simultaneously as the coordinator node being mounted on trolley is removable node, the spirit of tree network networking on the spot is improved
Activity.Also, coordinator node can be by the direct battery power on trolley, it has the sufficient energy, can extend the section
The service life of point.During the networking of wireless sensor network, in order to overcome existing wireless sensor network to will appear isolated node
Network difficult deficiency, and the present invention also proposes a kind of new to borrow address routing algorithm.Addition one is attempted when an isolated node not having
When the father node of available free address space, which will inquire the neighbor node within its double bounce to borrow address sky
Between, realize the networking of isolated node.By borrowing location range to be set as two-hop neighbor node routing node, and it is set as with minor matters point
By means of the preferred node of address, the isolated node in pig farm is enabled rapidly to realize networking, while reducing routing node
Energy consumption.This system can efficiently reduce network isolated node, improve node networking rate, extend pig farm wireless sensor network
Service life.
The technical scheme adopted by the invention to solve the technical problem is that: one kind is calculated based on routing inspection trolley with address routing is borrowed
The pig farm environment control method of method, comprising the following steps:
Step 1, it constructs based on routing inspection trolley and the pig farm environmental monitoring system for borrowing address routing algorithm, comprising:
The pig farm wireless sensor network with moving hormany device node of ZigBee wireless communication technique establishment, pig farm are embedded existing
Field control centre and user's remote control center;Pig farm wireless sensor network with moving hormany device node includes removable
Coordinator node, routing node and terminal node;Removable coordinator node and the setting of pig farm embedded field control centre
On routing inspection trolley;By Zigbee protocol stack, collected data are converged into removable coordinator node, moves and coordinates
Device node is realized by the direct battery power on routing inspection trolley, and by serial communication interface and embedded field control centre
Data exchange;Embedded field control centre includes field controller, embedded field control centre by network access point and
Wireless network card is connect with user's remote control center;User's remote control center includes computer, network access point and wireless network card,
User's remote control center is connected into internet access field controller by Internet network agreement;
Step 2, for Zigbee protocol transmission range it is limited caused by network acnode problem, using a kind of new based on two
The network of hop neighbor borrows address routing algorithm, which includes two parts:
New to borrow address routing algorithm, estimate network isolated node first borrows location space size, then by routing node
Borrow location range to be set as two-hop neighbor node, the address information of the neighbor node in the available double bounce communication range of father node,
Xiang Tongzhi descendant nodes can be paid the utmost attention to simultaneously by means of location;
By means of the Route Selection of address arithmetic, i.e. tree routing first judges the type of destination node, then carries out data
The forwarding of packet.
Further, in the step 1, pig farm wireless sensor network is mainly the ZigBee by being distributed in each swinery
Node composition, ZigBee node connect temperature and humidity and harmful gas concentration sensor, infrared monitoring camera and standard ventilation
One's intention as revealed in what one says machine, evaporative cooling pad pump, negative-pressure air fan, hot-blast stove, electric hot plate etc. control equipment;Pass through the temperature and humidity and nocuousness gas on node
Audio sensor and camera in concentration sensors and routing inspection trolley, user can environment to pig house, sow just before giving birth
And the animation of piglet is monitored in real time, wherein audio sensor, all kinds of environment parameter sensings on routing inspection trolley
Device and camera can arbitrarily move on the routing inspection trolley magnetic stripe track preset in pig farm, by mobile routing inspection trolley
All kinds of environmental parameter sensors, monitoring system obtain pig farm internal environment parameter;After each information collection, node is to coordination
Device sends data information, and coordinator node is connected by serial ports with field controller, and collected data are transmitted to live control
In device processed;User's remote control center is connected into internet by Internet network agreement, and remote user is logged in by browser
Field controller observes pig house in real time and can regulate and control pig house environment at any time.
Further, in the step 2, the new detailed process by means of address routing algorithm are as follows:
Step 2.1, nodes X sends a free address request to routing node Y, and routing node Y judges whether oneself has
Free address, if available free address, assigns address to nodes X;Otherwise, routing node Y, which enters, borrows address function;
Step 2.2, routing node Y gives nodes X to send the information containing network depth dy, it is desirable that nodes X is by network
Depth dx is set as dy+1, and network is added as the child node of Y;
Step 2.3, routing node Y sends one and responds to nodes X, it is desirable that X calculates the address space size of its application, then
Nodes X needs to calculate its child node address space size;If nodes X is full-function device FFD, child node address sky is calculated
Between be o (x), and by o (x)+x be used as borrow location packet be sent to routing node Y;If nodes X is half function device RFD, child node
Address space o (x)=0, and o (x)+x is used as, location packet is borrowed to be sent to routing node Y;
Step 2.4, routing node Y receive nodes X borrow location packet after, location is borrowed in the forwarding of node into its two-hop neighbors
Packet, the neighbor node received by means of location packet make reply according to the address space left space of oneself;Meet if do not find herein by means of location
It is required that neighbor node, then return step 2.1, nodes X is sent to new routing node again borrows location to request;
Step 2.5, routing node Y receive neighbor node borrow location to reply packet after, judgement is met node by means of location condition by Y
In whether have the same minor matters point of oneself, if so, then selecting the more node conduct of address space left in the descendant nodes under same branch
By means of location node;Location section is borrowed if no, selecting the more node of address space left in meeting the neighbor node by means of location condition and being used as
Point;Then by the address space allocation of borrow to nodes X, then by nodes X free address is distributed to following child node;On if
The process of stating cannot complete that location is borrowed to operate, then when removable coordinator node being waited to reach in transmission range, then by a distributed manner
Location allocation algorithm completes the networking request of isolated node.
Further, in the step 2, by means of the detailed process of the Route Selection of address arithmetic are as follows:
Tree, which is routed through, judges the type of destination node, if destination node is routing node itself, directly connects
By data packet;If destination node is the sub-route node of routing node, it is sent directly to meet item after calculating next hop address
The sub-route node of part;If destination node is the sub- terminal device of routing node, sub- terminal device is transferred a packet to;If
Above-mentioned condition does not comply with, then this data packet is sent to its father node by routing node, by its father node according to above-mentioned path
Selection course continues to forward the data packet.
Further, in the step 1, user's remote control center can use PC machine as monitor supervision platform, by controlling at the scene
SQLite database is transplanted on device S3C6410 development board processed, BOA server and writes cgi script, and parameter is sent to
Internet, the environmental parameter on monitoring pig farm is shown by Internet in time in PC machine, and administrator can pass through browsing
Device remote access data, while the data acquired will be stored in SQLite database, be convenient for administrator's enquiry of historical data.
The beneficial effects of the present invention are:
ZigBee radio network technique borrows address arithmetic using a kind of new network based on two-hop neighbors, which passes through
Father node borrows the method for free address to the neighbor node within double bounce to alleviate acnode problem.For network acnode problem,
Existing routing algorithm is suitable for the less tree network of node more, and the problem of increase networking time-consuming and energy loss.
For the deficiency of existing route algorithm, the present invention borrows address arithmetic and tree routing algorithm to be improved to original.New borrows
Address arithmetic formulated it is detailed borrow address step, i.e., when network isolated node attempts to be added a not free address
When father node, which estimates the size by means of location space first, and father node is sent to two-hop neighbor node at this time borrows location to request,
And the address information of the neighbor node in double bounce communication range is obtained, while paying the utmost attention to Xiang Tongzhi descendant nodes by means of location, then will
The address space allocation borrowed is to isolated node.
By the way that coordinator node and field controller to be installed on robot car, make to be mounted on trolley and scene
The collected audio and video information of camera can be transmitted in field controller in real time, while coordinator node is direct by battery
Power supply, extends node lifetime.Network acnode problem, passes through optimization design caused by limited for Zigbee protocol transmission range
It is existing to borrow address routing algorithm, borrow location range to be set as two-hop neighbor node father node, while paying the utmost attention to same branch
Sun Jiedian borrows location, alleviates network acnode problem, improves the networking rate of network node, reduces networking consumption
When and energy loss, on the other hand realize coordinator as mobile node pig farm environmental monitoring system lower network isolate section
The efficient networking of point.
Specific embodiment
Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention carries out clear, complete
Site preparation description.
Technical solution of the present invention is further illustrated below in conjunction with attached drawing 1,2,3,4,5.
Borrow the overall framework of the pig farm environmental monitoring system of address assignment algorithm by three parts group based on ZigBee-network
At: the pig farm wireless sensor network with moving hormany device node of ZigBee wireless communication technique establishment, pig farm insertion
Formula field control center (routing inspection trolley) and user's remote control center.The master-plan block diagram of system is as shown in Figure 1.Wherein support
Pig farm wireless sensor network is mainly made of the ZigBee terminal node being distributed in each swinery.In farm's different zones
Interior place has various kinds of sensors terminal node, and the temperature of real-time monitoring farm ambient enviroment, humidity and pernicious gas are dense
Degree.Collected data will be sent to coordinator node by ZigBee wireless network, then transmit data to via 232 serial ports
In field controller S3C6410 (ARM+Linux).Pass through the database and server transplanted on S3C6410 platform, Yong Huke
Real time data is remotely accessed and be inquired by internet.Once the data of system acquisition are beyond setting in computer
Healthy early warning boundary, control system just can automatic identification come out, manager can have found in time.Culture control system then leads at this time
The operation of the equipment such as negative-pressure air fan, evaporative cooling pad pump, negative-pressure air fan, hot-blast stove, the electric hot plate crossed in control farm comes automatic
Adjust out the environment of optimum piglet growth.MT-AR robot routing inspection trolley is used in the regulator control system simultaneously, inspection is small
It is integrated with sound-detection gear, all kinds of environmental parameter sensors and all kinds of cameras on vehicle, while being mounted with coordinator node and showing
Field controller, and the magnetic stripe track of trolley traveling is laid in pig farm in advance, such manager can observe children in real time
Whether the animation of pig is abnormal with the behavior for judging pig, mobile node design frame chart such as Fig. 2 on robot routing inspection trolley
It is shown.This terminal node, routing node, the coordinator that will be placed in conservation pigsty in each swinery using ZigBee technology
Node group builds up a Radio Network System, realizes dispersion observing and controlling and centralized management, allows manager to each swinery
Environment carries out long-range precision and intelligently adjusts.
1, the pig farm wireless sensor network with moving hormany device node that ZigBee wireless communication technique is set up
In the environmental monitoring system of pig farm, removable coordinator node and field controller are mounted on routing inspection trolley
On, it is on the one hand easily installed on routing inspection trolley and collected audio and video information is transmitted to now by the camera at scene in real time
In the controller of field, simultaneously as the coordinator node being mounted on routing inspection trolley is removable node, tree network is improved just
The flexibility of ground networking.Also, removable coordinator node can be by the direct battery power on routing inspection trolley, it has abundance
The energy, the service life of the node can be extended.During the networking of wireless sensor network, using ZigBee radio network technique
By the terminal node and routing node one wireless network of composition in swinery.By Zigbee protocol stack, by collected data
It is sent to coordinator node, and by serial communication interface, is transferred data in field controller, field controller analyzes number
ZigBee-network node is fed back information to after, node controls the fortune of pig farm relevant device by the closure of relay
Make, above procedure realizes the data interaction of field controller and wireless sensor network.The suitable wireless communication module of selection, energy
The development cycle for enough reducing node, overhead is saved, system energy consumption is reduced, to improve system entirety life span.It is based on
Requirements above selects wireless communication module of the integrated CC2430 chip as this monitoring system.
Pass through the temperature and humidity on ZigBee node and the audio sensor on harmful gas concentration sensor and routing inspection trolley
And all kinds of cameras, user can environment to pig house, sow just before giving birth and the animation of piglet is monitored in real time,
Some of them node, since Zigbee protocol transmission range is typically in the range of between 10~100m, so when exceeding transmission range
The routing node being directly connected with coordinator node will carry out node disconnection process.When routing node and network disconnect, the road
Isolated node is all become by the node that all subtrees of node include.For guarantee pig farm site environment parameter real-time acquisition,
Isolated node needs to rejoin tree network.If these isolated nodes cannot be networked by new father node, will lead to
The generation of network acnode.
According to DAAM algorithm principle, AmThe maximum address for indicating distribution, as shown in formula (1):
Am=Cskip(0)×Rm+Cm-Rm (1)
Wherein Cskip(0) be network depth be 0 routing node address offset amount, as shown in formula (2):
Work as RmWhen=1, Am=(1+Cm×(Lm-1))×Rm+Cm-Rm=Cm×Lm, thus formula is it is found that address space AmWith net
Network depth LmIt is linear.Due to Rm=1 and communication radius it is identical, so every node layer number it is equal be Nc, so address uses
Rate ArConstant is Nc/Cm。
Work as RmWhen ≠ 1,This season Lm2-Lm1=1, Am2-
Am1For Lm2The address space of layer, arranges:
The area coverage of the every node layer of tree network can approximation regard as radius be Lm, central angle is the annulus of α, then anchor ring
ProductEnabling node density is μ, then number of nodes NcIt is as follows:
Nc=α (2Lm+1)×μ
So address utilization rate is because of Lm2-Lm1=1, Rm> 1, LmIt >=1 and is positive whole
Number, i.e.,It can thus be appreciated that network depth is bigger, address
Utilization rate is lower, i.e., address space left is more.So the descendant nodes of same minor matters point are set as can be improved by means of the preferred node of address
By means of location success rate.
The present invention proposes that a kind of new network based on two-hop neighbors borrows address arithmetic on the basis of analyzing reason, real
The efficient networking of network acnode in pig farm is showed.Specific algorithm is as follows.
New to borrow address routing algorithm, estimate network isolated node first borrows location space size, then by routing node
Borrow location range to be set as two-hop neighbor node, the address information of the neighbor node in the available double bounce communication range of father node,
Xiang Tongzhi descendant nodes can be paid the utmost attention to simultaneously by means of location;
By means of the Route Selection of address arithmetic, i.e. tree routing first judges the type of destination node, then carries out data
The forwarding of packet.
(1) new to borrow address arithmetic
The location range of borrowing for borrowing address routing algorithm default route node based on distributed address assignment mechanism mechanism is that a jump is adjacent
Node is occupied, and routing node is borrowed location range to be set as the neighbor node within double bounce, the available double bounce of father node by the present invention
The address information of neighbor node in communication range.By the improvement to address mode is borrowed, set forth herein new based on double bounce neighbour
The network in residence borrows address arithmetic, and the detailed step of the algorithm is as follows.
1) nodes X sends a free address request to routing node Y.Routing node Y judges whether oneself is free public land
Location, if available free address, assigns address to nodes X;Otherwise, routing node Y, which enters, borrows address function.
2) routing node Y gives nodes X to send the information containing network depth dy, it is desirable that nodes X is by network depth dx
It is set as dy+1, and network is added as the child node of Y.
3) routing node Y sends one and responds to nodes X, it is desirable that X calculates the address space size of its application, then nodes X
Need to calculate its child node address space size.If nodes X is full-function device FFD, calculating child node address space is o
(x), and o (x)+x is used as borrows location packet to be sent to routing node Y;If nodes X is half function device RFD, child node address is empty
Between o (x)=0, and by o (x)+x be used as borrow location packet be sent to routing node Y.
4) routing node Y receive nodes X borrow location packet after, the forwarding of node into its two-hop neighbors borrows location to wrap.It receives
Reply is made according to the address space left space of oneself to the neighbor node for borrowing location to wrap.Meet if do not find herein by means of location requirement
Neighbor node, then return step 1), nodes X is sent to new routing node again borrows location to request.
5) routing node Y receive neighbor node borrow location to reply packet after, Y will judgement meet in the node by means of location condition whether
There is the same minor matters point of oneself, borrows location to save if so, then selecting the more node of address space left in the descendant nodes under same branch and being used as
Point;If the more node of address space left no, is selected in meeting the neighbor node by means of location condition to be used as by means of location node.Then
By the address space allocation of borrow to nodes X, then by nodes X free address is distributed to following child node.Based on double bounce neighbour
The network in residence borrows routing algorithm block diagram in address as shown in Figure 3.If the above process cannot complete that location is borrowed to operate, removable association is waited
When device node being adjusted to reach in transmission range, then pass through the networking request of distributed address assignment mechanism algorithm completion isolated node.
As shown in figure 4, robot car is travelled from swinery 1 to swinery n, the air-heater node at swinery 1 and coordination
ZigBee transmission range is had exceeded between device node, air-heater node will carry out network disconnection with coordinator node at this time, and
The node that all subtrees of air-heater node include all becomes isolated node.Routing node and terminal node in swinery 1 need
Application networks nearby, such as father node of the electric heating plate node as not free address outside swinery 1, borrows location to walk according to above
Suddenly, from two-hop neighbors range, i.e., borrow address at the Temperature Humidity Sensor node in swinery 2 and distribute to air-heater node with
And its child node.Isolated node networks successfully, and network acnode problem is addressed.
(2) Route Selection of address arithmetic is borrowed
By means of the detailed process of the Route Selection of address arithmetic are as follows: tree, which is routed through, judges the type of destination node,
If destination node is routing node itself, directly receive data packet;If destination node is the sub-route node of routing node,
Qualified sub-route node is sent directly to after calculating next hop address;If the sub- terminal that destination node is routing node is set
It is standby, then transfer a packet to sub- terminal device;If above-mentioned condition does not comply with, routing node sends this data packet to it
Father node, continued to forward the data packet according to above-mentioned path selection process by its father node.
It raises pigs in farm monitoring system wireless sensor network, the address of routing node Y is A, network depth d, when node Y connects
When being had the data packet of destination address D by one, tree routing algorithm path selection process is as shown in Figure 5.
1) if destination node is routing node Y itself, i.e. A=D, then node Y directly receives the data packet, stops forwarding.
2) if destination node is the sub-route node of routing node Y, i.e. A < D≤A+Rmax·Cskip(d-1), then node Y
A+1+ { [D- (A+1)]/C will be calculatedskip(d)}·Cskip(d) it is used as next hop address, and under the data packet sent to meeting
One jumps the sub-route node of address.
3) if destination node is the sub- terminal device of routing node Y, i.e. A+Rmax·Cskip(d) < A < A+Cskip(d-1),
Then send the data packet to sub- terminal device.
If 4) above-mentioned condition does not comply with, this data packet is sent to its father node by routing node Y, by its father node
Continued to forward the data packet according to above-mentioned path selection process.
Address arithmetic is borrowed based on new, as shown in figure 4, the air-heater node in swinery 1 is isolated node, electric heating plate node
Location is borrowed to the descendant nodes Temperature Humidity Sensor node under same branch as its father node, and air-heater is distributed into the address borrowed
Node.According to tree routing algorithm, certain source node in wireless sensor network on any position will send data packet in swinery 1
Air-heater node, data packet transmitting path, which must be first passed through, is resent to destination node by means of location node, thus preferentially select to
Location is borrowed to avoid path detour problem with the double bounce descendant nodes under branch.New algorithm not only realizes tree routed path and selected
Journey, and by carrying out topology optimization during borrowing location, reduce the energy consumption of routing node, so new borrows address to calculate
Method is mutually compatible with tree routing algorithm.
The experimental results showed that the coordinator node being mounted on trolley in monitoring system of the invention is removable node,
Coordinator node extends the service life of the node by the direct battery power on trolley simultaneously, then borrows address road by new
By algorithm, the flexibility of tree network networking on the spot is improved, reduces that networking is time-consuming and energy loss.The system can be accurate
Obtain the environmental parameter on pig farm in time, and can the animation to live pig observed in real time, with real-time, stabilization
The features such as property and high efficiency, the monitoring and control of pig farm environment is effectively realized, pig farm environmental monitoring system is played
Preferable effect.
2, pig farm embedded field control centre
Microcontroller is the core of whole system, acquires and handles data, communicated and judged with wireless communication module
When send and receive these data.S3C6410 processor is 32 8-digit microcontrollers, support ARM, executable java bytecode and
Some DSP instruction set, using 32/64 internal bus architecture.S3C6410 can be expanded by built-in 2 external memory ports
A variety of external memories are opened up, many equipment interfaces are internally integrated, whole design cost is greatly reduced in this way, eliminates configuration volume
Outer expense improves whole system function.S3C6410 processor is cheap, and oneself power consumption is low.In summary advantage, this
Monitoring system data processing module selects S3C6410.
Pig farm scene embedded controller S3C6410 obtains the environment of ZigBee wireless sensor network acquisition by serial ports
Information after preservation and automatically analyzes data.The running of each equipment in pig farm is automatically controlled by analysis result.In order to realize pig raising
The remote real-time monitoring of field environment, system have data acquisition, Image Acquisition, storage management, analysis processing, automatically control, net
The functions such as network publication.Using lightweight built-in Linux operating system, and transplant embedded database, WEB server etc..Its
Middle embedded database, which uses, is directed to Embedded lightweight SQLite database, and WEB server is serviced using embedded BOA
Device.Make webpage that there is interactive function, input information of the interpretation process from list using CGI (CGI(Common gateway interface)), and is taking
Being engaged in, device generation is corresponding to be handled, or corresponding information is fed back to browser.Control centre can preset the environment such as temperature and humidity
The range of parameter, the automatic sending control command that overruns are adjusted to relevant device through row.
3, user's remote control center
User's remote control center can use PC machine as monitor supervision platform.By transplanting SQLite on S3C6410 development board
Database, BOA server and writes cgi script, and parameter is sent to Internet, by Internet in PC machine in time
The environmental parameter on display monitoring pig farm, administrator can be by browser remote access data, while the data acquired will be by
It is stored in SQLite database, is convenient for administrator's enquiry of historical data.If the real time environmental data of system acquisition is more than to set
Definite value, control system timely automated can identify that administrator can also have found in time, and control system then passes through control pig raising at this time
The equipment such as negative-pressure air fan runs to automatically adjust out the environment of optimum pig growth in.
Using BOA framework WEB server, B/S remote management mode is designed, B/S structure is a kind of browser/server knot
Structure, i.e. one server of installation maintenance, and client uses browser execution software.In B/S structure, user passes through browsing
Device is filed a request in the form of hypertext to the server being distributed on network, after server receives request, is carried out using cgi script
Processing.CGI(Common gateway interface) CGI makes the page have interactive function, the order letter that design cgi script processing user browser is submitted
Breath, and pass through the feedback of html format progress result.Using WIFI wireless communication technique, pig farm field controller is realized
Internet connection, so that the equipment such as computer, smart phone can be used to obtain pig farm real time data whenever and wherever possible for remote user
Information simultaneously manages pig farm.
In the description of this specification, reference term " one embodiment ", " some embodiments ", " illustrative examples ",
The description of " example ", " specific example " or " some examples " etc. means specific features described in conjunction with this embodiment or example, knot
Structure, material or feature are included at least one embodiment or example of the invention.In the present specification, to above-mentioned term
Schematic representation may not refer to the same embodiment or example.Moreover, specific features, structure, material or the spy of description
Point can be combined in any suitable manner in any one or more of the embodiments or examples.
Although an embodiment of the present invention has been shown and described, it will be understood by those skilled in the art that: not
A variety of change, modification, replacement and modification can be carried out to these embodiments in the case where being detached from the principle of the present invention and objective, this
The range of invention is defined by the claims and their equivalents.