Summary of the invention
For the deficiency of the existing industrial control system of mentioning in above-mentioned background technology, the present invention proposes a kind of distributed self study sequence control system and method based on wireless network.
Technical scheme of the present invention is that a kind of distributed self study sequence control system based on wireless network, for field apparatus is controlled, is characterized in that this system comprises host computer, base station and wireless switching amount module;
Described host computer is connected with base station; Base station and the wireless connections of wireless switching amount module;
Described base station comprises power supply, power transfer module, wireless communication module, base station master chip, Ethernet protocol chip and RJ45 interface; Power supply is connected with power transfer module; Power transfer module is connected with wireless communication module, base station master chip and Ethernet protocol chip respectively; Wireless communication module is connected with base station master chip; Base station master chip is connected with Ethernet protocol chip; Ethernet protocol chip is connected with RJ45 interface;
Described wireless switching amount module comprises sets a wireless switching amount acquisition module and wireless switching amount output module;
Described wireless switching amount acquisition module comprises battery, external power source, switch acquisition wireless communication module, level-conversion circuit, signal converter and switch acquisition connection terminal; Battery is connected with switch acquisition wireless communication module and level-conversion circuit respectively; External power source is connected with level-conversion circuit and signal converter respectively; Switch acquisition wireless communication module is connected with level-conversion circuit; Level-conversion circuit is connected with signal converter; Signal converter is connected with switch acquisition connection terminal;
Described wireless switching amount output module comprises power supply, level conversion and mu balanced circuit, switching value output wireless communication module, multi-channel driver circuit, relay and switching value output wiring terminal; Power supply is connected with level conversion and mu balanced circuit; Level conversion is connected with switching value output wireless communication module, multi-channel driver circuit and relay respectively with mu balanced circuit; Switching value output wireless communication module is connected with multi-channel driver circuit; Multi-channel driver circuit is connected with relay; Relay and switching value outlet terminal sub-connection;
Described host computer is for carrying out status surveillance and operation to wireless switching amount module;
Described base station is changed, the steering order of host computer is sent to corresponding wireless switching amount module, automatically each steering order of receiving increased progressively to the sequence number of numbering as instruction for the data of setting up wireless Ad Hoc mesh network, wireless switching amount module is sent;
Described wireless switching amount module possesses self-learning capability, for generating steering logic.
Described wireless communication module, switch acquisition wireless communication module or switching value output wireless communication module are JN5148 module.
Described wireless switching amount module has routing function.
Based on a distributed self study sequence control method for wireless network, it is characterized in that the method comprises the following steps:
Step 1: wireless switching amount acquisition module is connected with field apparatus with wireless switching amount output module;
Step 2: host computer sends instruction by base station to wireless switching amount module, and wireless switching amount module is controlled field apparatus according to instruction;
Step 3: the sequence number of wireless switching amount acquisition module and wireless switching amount output module recording instruction and instruction, and generate steering logic according to the field device information gathering;
Step 4: wireless switching amount acquisition module and wireless switching amount output module piece produce steering order according to the steering logic generating, and by wireless switching amount output module output steering order, field apparatus is controlled.
Described wireless switching amount output module receives from the instruction of wireless switching amount acquisition module and drives field apparatus.
Beneficial effect of the present invention is embodied in:
1. the structure of system is more brief
Control task is distributed in on-the-spot wireless switching amount module and is carried out, cancel centralized controller in traditional control system, thereby not be used in switch board is installed in pulpit, the structure of whole system just only comprises monitoring level and field level, the structure of system is more brief, has greatly reduced the cost of system.
2. self study generates steering logic
After system installation, as long as operation person completes a manual operation according to producing step order sending controling instruction, be dispersed in just record controls instruction and instruction sequence number automatically of on-the-spot wireless switching amount module, and generate steering logic by self study, without carrying out special Logical Configuration, save the debug time of system.
3. without concentrated fault
Because system has been cancelled controller concentrated in legacy system, and the fault of the wireless switching amount module equipment that also only impact is connected with this wireless switching amount module, in the time that the part wireless switching amount module in system breaks down, can not cause the collapse of whole control system, effectively eliminate centralized fault.
4. the signal cable that minimizing system is required
The cable that the Ethernet cable of the cable that needs to lay in the system of invention between comprising from base station to host computer and wireless switching amount module are connected with field apparatus.Base station only needs a netting twine just can realize and the connection of host computer, simultaneously because wireless switching amount module is to install on the spot, with field apparatus close together, therefore, the cable that whole system consumes is than traditional control system much less, both the cost and the erected cost that had reduced system, facilitate again the maintenance of system.
5. reliable and stable wireless Ad Hoc mesh network
Use wireless network to substitute wired, due to the defect of wireless channel, point-to-point communication quality is under some influence, but adopts wireless Ad Hoc mesh network, by redundant transmission paths, ensures the integrated communication quality of network.If certain module in network breaks down, wireless Ad Hoc mesh network can be walked around these faults, and data are by the path implement transmission by other.Meanwhile, the wireless Ad Hoc mesh network building based on ZigBee technology has the ability of self-organization, selfreparing, has effectively improved the reliability of wireless network transmissions.
6. system installation is convenient
The wireless communication module using in system has high receiving sensitivity, long-range communications capabilities, what adopt is wireless Ad Hoc mesh network simultaneously, therefore in the time on the spot wireless module being installed, as long as ensure and the connectedness of network, apart from cabling, also need not consider the restriction of geographical conditions without long, even wireless switching amount module integration at the scene in switching value equipment, not only can be saved to cable but also do not take additional space.The placement of base station can consider wireless switching amount module distribution situation at the scene and the wiring situation of Ethernet, selects suitable mounting points.It is much convenient and swift that the installation of whole system is wanted compared with legacy system.
7. the communication load of network is more balanced
Steering logic is distributed to after on-site wireless module, and control task has been coordinated by on-the-spot control module.Only need wireless switching amount module to carry out local communication, and need not pass through concentrated communication facilities, the communication load of network is more balanced, is conducive to the reliably working of system.
Embodiment
Below in conjunction with accompanying drawing, preferred embodiment is elaborated.Should be emphasized that, following explanation is only exemplary, instead of in order to limit the scope of the invention and to apply.
The present invention utilizes ZigBee technology, between wireless switching amount module at the scene, sets up wireless Ad Hoc mesh network, makes on-the-spot wireless switching amount module can carry out information interaction, the cable that saving system is required.Simultaneously, based on the design concept of distributed system, steering logic is distributed in on-the-spot wireless switching amount module and is carried out, cancel concentrated controller, wireless switching amount module can record steering order and the instruction sequence number that operation person sends, and carry out self study generation steering logic, realize the wireless distributed self study sequence control system based on ZigBee.Wireless communication module of the present invention is JN 5148 modules that Jennic releases, and has high efficiency of code execution and enough storage space and can build reliable wireless network, for realization of the present invention provides condition.
The invention provides a kind of cheap, convenient, the safe and reliable wireless distributed self study sequence control system based on ZigBee is installed, its object is to cancel concentrated controller and Logical Configuration process, the steering logic of system is dispersed in on-the-spot wireless switching amount module, the communication load of not only balanced system but also avoid concentrated fault.Communication aspects, set up the wireless Ad Hoc mesh network with self-healing and self by the ZigBee wireless communication module that on-the-spot wireless switching amount module utilization is subsidiary, module can add at any time and exit network, and carries out message exchange between module by the wireless link of redundancy simultaneously.
The present invention is the wireless distributed self study sequence control system based on ZigBee, and described system comprises host computer, base station and wireless switching amount module, and host computer is connected with base station; Base station and the wireless connections of wireless switching amount module; Base station comprises 24V direct supply, power transfer module, wireless communication module, base station master chip, Ethernet protocol chip and RJ45 interface; 24V direct supply is connected with power transfer module; Power transfer module is connected with wireless communication module, base station master chip and Ethernet protocol chip respectively; Wireless communication module is connected with base station master chip; Base station master chip is connected with Ethernet protocol chip; Ethernet protocol chip is connected with RJ45 interface; Wireless switching amount module comprises sets a wireless switching amount acquisition module and wireless switching amount output module; Wireless switching amount acquisition module comprises battery, external power source, switch acquisition wireless communication module, level-conversion circuit, signal converter and switch acquisition connection terminal; Battery is connected with switch acquisition wireless communication module and level-conversion circuit respectively; External power source is connected with level-conversion circuit and signal converter respectively; Switch acquisition wireless communication module is connected with level-conversion circuit; Level-conversion circuit is connected with signal converter; Signal converter is connected with switch acquisition connection terminal; Wireless switching amount output module comprises power supply, level conversion and mu balanced circuit, switching value output wireless communication module, multi-channel driver circuit, relay and switching value output wiring terminal; Power supply is connected with level conversion and mu balanced circuit; Level conversion is connected with switching value output wireless communication module, multi-channel driver circuit and relay respectively with mu balanced circuit; Switching value output wireless communication module is connected with multi-channel driver circuit; Multi-channel driver circuit is connected with relay; Relay and switching value outlet terminal sub-connection.
In system of the present invention, the function of component devices is as follows:
Host computer is compared with host computer in traditional industry control system, except needing the state of monitoring field equipment, also increased the status surveillance to wireless switching amount module, and on picture for operation person provides operation interface, wireless switching amount module is operated;
Wireless communication module on base station starts as telegon, set up wireless Ad Hoc mesh network, base station is to changing for host computer picture configuration software and show from the data layout of wireless switching amount module, receive the manual operation instruction that host computer sends simultaneously and send to corresponding wireless switching amount module, base station is in the time receiving steering order, the instruction of receiving is numbered according to incremental order, as the sequence number of instruction, send to corresponding wireless switching amount module together with steering order;
Wireless switching amount module comprises wireless switching amount acquisition module and wireless switching amount output module.Wireless switching amount acquisition module and wireless switching amount output module, all with wireless communication module, are set up wireless Ad Hoc mesh network.Wireless switching amount module all has routing function, and the communication link of intermodule does not rely on individual module, and in the time of module failure on link, the module that can walk around fault re-establishes transmission path.Wherein, wireless switching amount acquisition module adopts powered battery, sends energy consumption for reducing, and adopts maximum exception report, in the Refresh Data time allowing, in the time that the state of equipment remains unchanged, does not carry out the transmission of status information in system.
Maximum feature of the present invention is to cancel concentrated logic controller and without carrying out special programming in logic configuration, utilizes storage and the calculation resources of wireless communication module, makes wireless switching amount module have the ability of self study, thereby generates steering logic.The control task of whole system is coordinated mutually by being distributed to on-the-spot wireless switching amount module, completes according to steering logic order.
Step of the present invention is:
Step 1: wireless switching amount acquisition module is connected with field apparatus with wireless switching amount output module;
Initiated by base station, wireless switching amount module adds, and sets up wireless Ad Hoc mesh network, by wireless switching amount module and on-the-spot switching value equipment connection, and identifies field apparatus by the field of indication equipment in wireless switching amount module Frame used;
Step 2: host computer sends instruction by base station to wireless switching amount module, and wireless switching amount module is controlled field apparatus according to instruction;
Upper function monitors and operates wireless switching amount module.Host computer is first broadcasted configuration mode mark by base station to wireless switching amount module, operation person carries out single-step operation sending controling instruction according to producing step order on host computer, base station is numbered steering order, add sequence number, steering order and instruction sequence number are sent to corresponding wireless switching amount module;
Step 3: the sequence number of wireless switching amount acquisition module and wireless switching amount output module recording instruction and instruction, and generate steering logic according to the field device information gathering;
Under configuration mode, be set with the sequence number m of the wireless switching amount module steering order Y that automatically record receives, the steering order of self-learning function, field equipment state X while receiving steering order and the duration T of this state, can determine the logical relation between X and Y by self study, and delayed trigger time using T as logical relation, thereby determine the function Y=F that represents steering logic
i(X, T, m), wherein, i represents i wireless switching amount module that is set with self-learning function, m is the sequence of movement in step order as wireless switching amount module.Completing after single job according to producing step order, realize the steering logic F of whole system
systembe distributed in wireless switching amount module, be expressed as F
system={ F
1, F
2..., F
n, n is the quantity that is set with the wireless switching amount module of self-learning function;
Step 4: wireless switching amount acquisition module and wireless switching amount output module piece produce steering order according to the steering logic generating, and by wireless switching amount output module output steering order, field apparatus is controlled.
Wireless switching amount module enters operational mode, and the control task of system is completed with distributed mode order by wireless switching amount acquisition module and the wireless switching amount output module with self-learning function; Under operational mode, wireless switching amount module, according to the sequence number m of record, is obtained field equipment state X, in the time meeting the condition of state duration T, automatically performs the steering logic Y=F generating under configuration mode
i(X, T, m), generate steering order Y, and complete instruction output and drive field apparatus action, and wireless switching amount module according to the value of m from small to large order carry out steering logic, complete the control task of whole system in distributed mode, realize wireless distributed self study sequence control system based on ZigBee.
Feature of the present invention comprises following:
A. wireless switching amount module is installed to behind scene, under the effect of base station, set up wireless Ad Hoc mesh network, can be monitored by host computer and operate, and in the Frame of radio communication, be provided with special field and be used for representing on-site producing devices associated with the data simultaneously;
B. wireless switching amount acquisition module and wireless switching amount output module can utilize the FLASH store control logic of wireless communication module, can be according to practical application steering logic need to be distributed to wireless switching amount acquisition module or wireless switching amount output module.
C. the control task of system is dispersed in on-the-spot wireless switching amount module, and wireless switching amount module is by wireless mesh network exchange message; Requirement order according to production technology completes steering logic; In each wireless switching amount module, the execution result of steering logic only affects the equipment being connected with it, and other equipment are not had a direct impact, and has eliminated concentrated fault.
D. system is divided into configuration mode and operational mode: under configuration mode, operation person by host computer first to the wireless switching amount module broadcast configuration mode mark in network, the wireless switching amount module that makes setting have self-learning function enters the state that generates steering logic, by the sequence number m of recording instruction Y and instruction, and according to the field apparatus letter state X and the state duration T that gather, generate steering logic F by self study
i; Under operational mode, all wireless switching amount modules start automatic operation, there is the wireless switching amount module of self-learning function according to the size order of m, obtain the state X of field apparatus by wireless network, in the time meeting T condition, carry out the steering logic generating under configuration mode, automatically generate steering order Y, and drive field apparatus to move by wireless switching amount output module output steering order.The control task of whole system is completed with distributed mode order by wireless switching amount module.
E. wireless switching amount acquisition module periodically collection site equipment state and the state collecting is transmitted by wireless network; If carry out steering logic on wireless switching amount acquisition module, by according to the state of field apparatus and steering logic, produce steering order and send to corresponding wireless switching amount output module;
F. wireless switching amount output module passes through wireless communication module transceiving data, and exports the action of steering order driving on-site producing devices.If carry out steering logic in wireless switching amount output module, using the information from other wireless switching amount modules as input, generate steering order, directly drive field apparatus action;
G. wireless switching amount module sends information in real time to base station, and base station receives the information that wireless switching amount module transmits, and is converted into after the data layout of host computer configuration software requirement, on monitoring image, shows; In the time that operation person carries out manual operation to field apparatus on picture, host computer is passed to base station by cable network by operational order, by base station, operational order is issued to the wireless switching amount module of appointment;
Fig. 1 is the structural representation of the wireless distributed self study sequence control system based on ZigBee that provides of system embodiment of the present invention, for convenience of explanation, only provides the part that the embodiment of the present invention is relevant.In the present embodiment, the composition of the wireless distributed self study sequence control system based on ZigBee comprises host computer, base station, wireless switching amount module.Wherein, base station comprises gateway and wireless communication module.Wireless switching amount module is divided into wireless switching amount acquisition module and wireless switching amount output module, wherein wireless switching amount acquisition module comprises wireless communication module and switching value acquisition module, and wireless switching amount output module comprises wireless communication module and switching value output module.Wireless switching amount module is by cable and on-the-spot switching value equipment connection, and on-the-spot switching value equipment comprises that valve letter in reply device, solenoid valve etc. provide switching value signal or the on-site producing devices by switching value control.
Host computer is responsible for monitoring site equipment running status, and (monitoring software has IFIX, Intouch, WinCC, Freelance etc., in the present embodiment, adopt Intouch), Intouch provides the support to several data agreement, uses Modbus ICP/IP protocol in the present embodiment.Host computer monitors the state of production run and on-site wireless network, and in display frame for operation person provides corresponding action button, can carry out manual operation to the each wireless switching amount module in network;
What Fig. 2 provided is the wireless communication module using in described system, is released by Jennic company, and model is JN 5148.The core of wireless communication module is the RISC CPU of 32.Wireless communication module provides hardware timer, on this timer basis, multiple software timers can be set and carry out writing time.Wireless communication module is supported UART and SPI communication mode, is wherein connected with stored program outside Flash by SPI, by UART and other chip swap datas.In addition, also provide DIO pin to be connected with switch acquisition/output module, and by 2.4GHz wireless transceiver access of radio network.
Fig. 3 provides the structural representation of base station.In whole system, base station is born uploading of data and is issued task.The composition of base station comprises supply power, wireless communication module and gateway, and wherein gateway part comprises base station master chip and Ethernet protocol chip.The course of work of base station is: first wireless communication module starts with network coordinator, sets up wireless Ad Hoc mesh network; In the time that the data of wireless switching amount module are received in base station, wireless communication module sends data to base station master chip by UART, then base station master chip is converted to data Modbus form and sends to Ethernet protocol chip, finally obtain the data of Modbus ICP/IP protocol form, then send on Ethernet by RJ 45 interfaces; In the time of the downward sending controling instruction of host computer, Ethernet protocol chip by RJ 45 interfaces from host computer obtains data, the data that receive are resolved, then send the data to base station master chip by data line and address wire, base station master chip completes data receiver, if under configuration mode, to be issued by host computer after the steering order of wireless switching amount module in judgement, the value of a variable is increased progressively, as the sequence number of instruction, and by UART, steering order and instruction sequence number are sent to wireless communication module;
As shown in Figure 4, wireless switching amount acquisition module chief component comprises switch acquisition wireless communication module and switching value acquisition module.Switching value acquisition module is converted to on-the-spot switching value signal and the logic level of the CPU compatibility of switch acquisition wireless communication module.When switch acquisition wireless communication module is started working, RISC CPU is from outside Flash calling program, start the periodically state of collection site production equipment of timer, and according to the program of design, the equipment state collecting is carried out to logic judgement, as whether fault of checkout facility, then the state of equipment is sent by 2.4GHz wireless transceiver.Meanwhile, wireless switching amount acquisition module also can respond the information from base station, such as the reset operation of host computer to module.Because used wireless communication module provides 21 DIO pins, therefore switching value acquisition module can have multiple signal sampling channels, can be according to actual conditions designed channel quantity, in figure, only provide principle signal.
Fig. 5 provides the structure of wireless switching amount output module, mainly comprises switching value output wireless communication module and switching value output module.In the present embodiment, carry out steering logic by switching value output wireless switching amount output module.Therefore, on switching value output wireless communication module, automatically generate steering logic, and be stored in outside Flash.When the output of wireless switching amount output module, produce steering order by switching value output wireless communication module according to steering logic, then, by DIO pin, steering order is passed to driving circuit, drive the actuating of relay, complete the control to field apparatus.
In the present embodiment, generate and store steering logic by wireless switching amount output module by self study, and the corresponding on-the-spot equipment of wireless switching amount output module.What Fig. 6 provided is the specific works process of the wireless distributed self study sequence control system based on ZigBee.
Under configuration mode, operation person by host computer first to the wireless switching amount output module broadcast configuration mode mark in network, make wireless switching amount output module all enter the state that generates steering logic, and wireless switching amount acquisition module periodically collection site equipment status information and in network, broadcast, field apparatus when beginning is in original state X
1, duration T
1=0, then operation person sends first steering order Y
1to the operate of first element in step order, receive the wireless switching amount output module record controls instruction Y of steering order
1, the sequence number m=1 of steering order, represents that this wireless switching amount module is the module of moving at first, thereby determines the steering logic Y that represents this wireless switching amount output module
1=F
1(X
1, 0,1).After wireless switching amount output module output steering order, corresponding wireless switching amount acquisition module detects the state of field apparatus, in network, broadcast, other wireless switching amount output modules are after the state of receiving first element equipment changes, start timer, and wait for the steering order of host computer.When host computer sends second steering order Y
2time, corresponding wireless switching amount output module output steering order, the instruction of record controls simultaneously Y
2, the sequence number m=2 of steering order and the timer numerical value T while receiving steering order
2, then according to the state X of current field apparatus
2, wireless switching amount output module, by self study, is determined the function Y that represents steering logic
2=F
2(X
2, T
2, 2), the timer numerical value zero clearing of remaining wireless switching amount output module, receiving after the state of wireless switching amount acquisition module broadcast of second action equipment, restarts timer.Repeat said process, just can in the corresponding wireless switching amount output module of each equipment, generate to meet and produce the steering logic that step order requires, the steering logic F of whole system
system={ F
1, F
2..., F
n, n is the quantity of wireless switching amount output module.Under operational mode, the wireless switching amount output module of m=1 is carried out steering logic F at first
1, generate steering order, then output drives field apparatus, and Broadcasting Control instruction, receives that the wireless switching amount output module of broadcast checks whether the m of storage is whether 2 field equipment states of collecting are X
2, whether state duration arrive T
2, if so, carry out steering logic F
2, generate steering order Y
2, if not, continue to wait for.By that analogy, wireless switching amount output module is according to the size of the m value of storage, and order is carried out steering logic F
i, complete the control task of whole sequence control system, realize the wireless distributed self study sequence control system based on ZigBee.
The above; only for preferably embodiment of the present invention, but protection scope of the present invention is not limited to this, is anyly familiar with in technical scope that those skilled in the art disclose in the present invention; the variation that can expect easily or replacement, within all should being encompassed in protection scope of the present invention.Therefore, protection scope of the present invention should be as the criterion with the protection domain of claim.