Specific embodiments
The embodiment of the invention as shown in Figure 1, gateway comprise the on-the-spot subnet interface of CAN/DeviceNet, CAN/DeviceNet-TCP/IP data processing card, Wide Area Network interface.The on-the-spot subnet interface of described CAN/DeviceNet comprises the on-the-spot subnet interface circuit of reception, forwarding CAN2.0A/B or GB/T 18858.2-2002 normal data and the described data that on-the-spot subnet interface circuit receives or transmits is carried out the buffer circuit of anti-interference process.Described Wide Area Network interface comprises the Wide Area Network interface circuit of reception, forwarding IEEE802.3 normal data and the data that the Wide Area Network interface circuit receives or transmits is carried out the buffer circuit of anti-interference process.Described CAN/DeviceNet-TCP/IP data processing card comprises the stored program digital computer, will import CAN protocol chip that data encapsulation becomes to meet the CAN2.0A/B normal data, will import ICP/IP protocol chip, CAN/DeviceNet network selecting switch that data encapsulation one-tenth meets the IEEE802.3 normal data; Described CAN protocol chip, ICP/IP protocol chip link to each other with the stored program digital computer by data, address bus, control line.The stored program digital computer comprises microprocessor, data storage, program storage, microprocessor is by reading many instructions that are stored in the program storage with logical order, the protocol conversion of control ICP/IP protocol chip and CAN protocol chip, by the state of CAN/DeviceNet network selecting switch, the data that are stored in the data storage are carried out DviceNet protocol encapsulation and conversion.
Shown in Fig. 2,3, on-the-spot subnet interface circuit adopts the 82C250 chip, on-the-spot subnet interface buffer circuit adopts 6N 137 chips, the CAN protocol chip adopts the SJA1000 chip, microprocessor adopts AT8051 chip, data storage to adopt 6264 chips, and program storage adopts 2764 chips, and the ICP/IP protocol chip adopts 8029 chips, Wide Area Network interface buffer circuit adopts high-frequency isolation transformer, and the Wide Area Network interface circuit adopts 8209 chips.CAN/DeviceNet network selecting switch adopts the wire jumper mode.
Workflow is as follows: when fieldbus is the CAN fieldbus, CAN/DeviceNet network selecting switch is selected the corresponding wire jumper of CAN network, when fieldbus has communication request, microprocessor sends control signal to the CAN protocol chip, the CAN protocol chip carries out the CAN2.0A/B standard packaging with the ICP/IP protocol data of buffer circuit input, and the data after will encapsulate are through buffer circuit, on-the-spot subnet interface circuit transmission on-the-spot subnet extremely;
When fieldbus is the DviceNet fieldbus, CAN/DeviceNet network selecting switch is selected the corresponding wire jumper of DeviceNet network, when fieldbus has communication request, microprocessor carries out the GB/T18858.2-2002 standard packaging with the ICP/IP protocol data of buffer circuit input, and the data after will encapsulate are through buffer circuit, on-the-spot subnet interface circuit transmission on-the-spot subnet extremely;
When Wide Area Network has communication request, microprocessor sends control signal to the ICP/IP protocol chip, the ICP/IP protocol chip carries out the IEEE802.3 standard packaging with the CAN/DeviceNet protocol data of buffer circuit input, and the data after will encapsulating transfer to Wide Area Network through buffer circuit, Wide Area Network interface circuit.
In embodiment of the invention embedded system, realize the key technology of fieldbus and ICP/IP protocol conversion: mainly consider that solution needs the ICP/IP protocol subclass that realizes and this agreement and the Interface Matching and the data of lower-layer protocols to link in embedded system.Its hierarchical mode and agreement such as Fig. 4, the functional structure of its realization such as Fig. 5.
In the design of this gateway, look to the future with the coupling of different bus subnet be connected with the key technology that solves different fieldbus information sharings and in this design, realized; In order to realize the information integration of different fieldbus subnets, the subnet of each type has an independently gateway, an operation Subagent (SA) on it, each SA is connected with the Manager Server of the unified platform by local area network (LAN), an operation Master Agent (MA) on Manager Server, it obtains the information of each subnet by the information exchange with SA, and converts them to based on wide area network shared information pattern.
(1) message structure design: message structure also is divided into two-layer generally, adopts MIB technology, core database system to adopt total relation type Database Systems in MANAGER, and based on network SQL general polling language is adopted in information exchange.Because each fieldbus generally adopts DDE or OPC technology to carry out information integration, therefore core database should be with reference to above-mentioned message structure, consider to be fit to the operation of supervisory control system again, also will be fit to convert to the information bank structure of network browsing simultaneously, basic configuration such as Fig. 6.
(2) communication structure design
Consider the network configuration versatility, the local area network (LAN) trunk portion adopts the Ethernet structure, and communication protocol adopts the exploitation standard of current widely used standard Simple Network Management Protocol SNMP (Simple Network Management Protocol) as the fieldbus unified platform.SNMP is a kind of procotol of widely carrying out, and it uses the agent software (agent) that is embedded in the network facilities to come the communication information of collection network and the statistics of related network equipment.Agent software is constantly collected, statistics, and in these data record to one management information bank (MIB).Management station sends request signal by the MIB to the agency can obtain these data.
The downlink information of network feedback adopts two kinds of schemes to realize that a kind of is the feedback information storehouse, and its message structure that provides is complete, adaptability and good reliability, but real-time a little less than; A kind of is the direct message feedback by the Socket interface, and it is real-time, but message structure adaptability a little less than.
MA adopts the CORBA technology with communicating by letter of wide area network, because it is based on OO technical characterstic, therefore has good versatility with portable.
Analyze definite variety of protocol and reasonably subclass and realization thereof at the requirement of embedded system;
(1) DeviceNet realizes:
DeviceNet
TMBe a low side network system its act as between simple industrial equipment such as transducer, exciter etc. and high-end devices controller and realize being connected.DeviceNet can provide: the low-cost solution of the low side network equipment and the intellectuality of low side devices.The communication characteristic that it is mainly realized:
Media interviews control and physical signalling use controller area net CAN
The connection-oriented pattern of communication between helping using
The typical request of network-oriented communication
The high efficiency of transmission of I/O data
The segmentation of high information quantity is moved
MAC ID duplicate detection
(2) OPC realizes: be divided into OPC Server and OPC Client two parts and realize
Opc server is made up of object linking and embedding thread process.Object linking and embedding will make server can use the requirement of a thread process All Clients of or far-end own.Article one, the path that replaces is submitted to " modular circuit " by all object linking of this circuit with embed constantly the allocating object link and the embedding server.Modular circuit has been simplified the problem of various client access approach.To an advantage of this single thread approach is its realization about the reentrancy problem when having simplified the server operation.All like this methods by information circuits automatically are called continuously.Additional advantage is that all paths that it guarantees (when needing COM port) machine all are made up of the thread that produces path.
The client service program of OPC be an object only by the thread of having created it by the exclusive requirement of the serial communication port of access.This is not only applicable to now at the server of carrying out and is applicable to the pairing object of any execution processor.Notice that some method can partly relax this restriction (for example store address register and can use linear identification form).Yet this thread dispatching information route of setting up by object simply needs very high expense.In addition, no matter there are how many threads to attempt access object simultaneously, they will get rid of outside the object thread dispensing loop of carrying out, and not have any improvement in performance.
Change to multi-level complex protocols such as TCP/IP owing to relate to, must consider interface compatibility, stability and real-time between the variety of protocol from CAN, DeviceNet, OPC;
The overall realization of the characteristic of physics/medium of DeviceNet:
Backbone-branch line structure
Can support 64 nodes at most
Just can remove node without interrupt network
While network enabled powered sensor and self-powered actuator equipment
Use the connector of sealing or opening mode
The wiring error protection
Optionally data rate is 125k baud 250k baud and 500k baud
Adjustable power supply architecture is to satisfy the needs of each classification application
Each power supply heap(ed) capacity of high current capacity can reach 16 amperes
Can under charged state, operate
Attaching plug can connect the different manufacturers electric supply installation that meets the DeviceNet standard
Built-in type overload protection
Comprise power line and holding wire in the bus-powered backbone
This gateway works in industry spot, therefore will solve on-the-spot anti-interference and emc issue.This design is main adopts the measure of two aspects of software and hardware to be realized.
Main hardware measure has: equipment adopts isolates the DC/DC power supply, guarantees the stable, clean of power supply; CAN/DeviceNet end adopts the photoelectricity quarantine measures, device adopt the 6N137 high-speed light every; The TCP/IP end adopts special-purpose high-frequency isolation transformer.Main decoding and interface circuit adopt the CPLD/FPGA design, improve the antijamming capability of system.Main electric power loop adopts reverse impulse cut-off circuit filtering negative pulse to disturb.CPU adopts watchdog circuit to guarantee the stable of Single Chip Microcomputer (SCM) system.
Main software measure has: the self-recovering function that adopts cold and hot startup to differentiate; Adopt data redundancy and voting mechanism to guarantee data reliability; Adopt software trap to improve the system restoration ability; Work control flow such as Fig. 7 of ICP/IP protocol chip, the work control flow of CAN protocol chip and the work control flow of ICP/IP protocol chip are in like manner.