A kind of PLC double-machine redundancy systems based on MAC
Technical field
The present invention relates to industrial control automation technical field, more particularly to a kind of PLC dual-computer redundancies system based on MAC
System.
Background technology
Programmable logic controller (PLC) (PLC) plays the role of and its important in industrial control automation field, particularly exists
In the control Process Control System that technological process is more complicated, controlled device number of species is more, built using general PLC as core
Control system has stronger flexibility, applicability and autgmentability than nonshared control unit mode.Cores of the PLC as control system
Control unit, its reliability are directly related to the safety and stability of whole control system, therefore in order to improve control system
Robustness, first have to improve the robustness of PLC, and while PLC robustnesses itself lifts, introducing PLC dual-computer redundancy machines
System can significantly improve the global reliability of control system.It is double compared to the mode of simple lifting PLC reliabilities itself, PLC
Machine redundant fashion can reach main PLC abnormal failures, standby PLC takes over whole control system and unperturbed continues to run with control logic
Target so that whole control system eliminates the influence of abnormal failure to greatest extent, the availability of control system is improved
An order of magnitude.
PLC dual-computer redundancies technology mainly has soft redundancy and base based on PLC interior communications in the controls at present
In the hard redundancy of special redundant communication module.The former needs user to write the control logic with redundancy feature, and whole
The fault diagnosis judgement and state switching of redundancy are participated in, to the more demanding of user, and since no dedicated redundancy communication leads to
Road, the data of redundancy are synchronous and state switching carries very big hysteresis quality.Hard redundancy based on special redundant communication module
With dedicated redundant communication paths, can effectively lift that data are synchronous and the real-time of state switching, but its cost compared with
It is high and be not easy to safeguard, it can be only applied among the control system that some input costs are higher, extremely sensitive to reliability, this
It significantly limit the application and popularization of this redundancy.
In order to overcome the close coupling and redundancy of user engineering and redundancy in the soft redundant fashions of PLC to handle braking problems,
And in hard redundancy it is of high cost, difficult in maintenance the problem of, it is necessary to develop a kind of break away from special redundant communication module limitation
PLC dual-computer redundancy technologies, participate in synchronous redundant data, fault diagnosis judgement and state switching without user, neatly realize high
Reliably, the PLC dual-computer redundancy functions of high robustness, reduce the construction cost of PLC dual-computer redundancy control systems.
The content of the invention
The object of the present invention is to provide a kind of PLC dual-computer redundancy method and system based on MAC, using MAC as redundancy
The mode of communication transceiver, double-machine redundancy system is formed by identical redundant host and redundancy standby host.Redundant system need not
Dedicated redundant communication module, without use high-level Ethernet protocol stack;Redundant system offer is totally independent of user and patrols
Redundancy communication, fault diagnosis judgement and the state handover mechanism collected, participate in redundant system specific implementation, to user's water without user
Put down without higher requirement;Towards the highly reliable application demand of industrial control automation system, using the teaching of the invention it is possible to provide convenient, flexible, high
Effect, PLC dual-computer redundancy functions inexpensive, easy to maintain.
To reach above-mentioned purpose, according to the one side of invention, it is proposed that a kind of PLC dual-computer redundancy methods based on MAC, institute
The both sides for stating PLC dual-computer redundancy methods are redundant host and redundancy standby host, are made inside redundancy both sides comprising mac controller chip
For the transceiver of redundancy communication, the both sides of the PLC dual-computer redundancies are carried independently of the fault diagnosis judgement of user logic and master
Standby host handover mechanism, it is characterised in that this method comprises the following steps:
Step 1, the bipartite redundant communication channel of PLC dual-computer redundancies is established;
Step 2, the PLC dual-computer redundancies both sides utilize the redundant communication channel synchronizing redundant configuration established;
Step 3, the PLC dual-computer redundancies both sides determine the master of the both sides by received other side's redundancy configuration information
Standby relation, and respectively with host work pattern or standby host operating mode initialization system;
Step 4, after the PLC dual-computer redundancies both sides are determined main and standby relation and are initialized successfully with corresponding operating mode,
The redundant host is run with host work mode operation, the redundancy standby host with standby host operating mode.
Wherein, the main feature of the step 1 is that redundancy both sides controller all carries two dedicated for redundancy communication
MAC, be respectively MAC0 and MAC1, MAC0 and MAC1 MAC Address it is different, but the MAC0 of all redundant manipulators is set
For same MAC Address, the MAC1 of all redundant manipulators is set to same MAC Address, the redundancy communication thing of the both sides
Reason connection is using succession is intersected, i.e., the MAC0 of one controller connects the MAC1 of another controller, without router or friendship
Change planes and participate in networking;The data collector that MAC is directly used as redundancy communication uses, and the Ethernet protocol stack without more top participates in
Communication.
The main feature of the step 3 is that redundancy both sides controller is superfluous according to itself redundant configuration and the other side received
Remaining configuration information determines redundancy of effort pattern, redundancy configuration information be mainly used for distinguishing redundancy both sides CPU options (CPU0 or
CPU1), the selection of CPU options realizes that the controller for being typically configured to CPU0 can preferential work by the toggle switch of controller back plate
Make in host work pattern.Do not conflict there is no host and redundancy both sides' redundant configuration (CPU options not phase in the controls
In the case of together), being configured to the controller of CPU0 can be started with host work pattern, and the controller for being configured to CPU1 can be with standby host
Operating mode starts;If redundancy both sides' redundant configuration conflict (CPU options are the same, are all CPU0 or CPU1), redundancy both sides all without
Method starts.In the controls there are host in the case of, if redundancy both sides' redundant configuration does not conflict, no matter be configured to
CPU0 or CPU1, the machine are all run with standby host operating mode;If redundancy both sides' redundant configuration conflict, the machine can not start.
The main feature of the step 4 be redundant system redundant host and redundancy standby host Each performs its own functions, perform respectively
Different functions, both sides pass through redundant communication channel synchronizing process data and operating status.In described in host work pattern
Redundant host normal operation user logic, and refresh I/O data, while periodically by redundant communication channel by control logic
The process data of operation result is synchronized to the redundancy standby host;The redundancy standby host in standby host operating mode does not run user
Logic, does not refresh I/O data yet, only arrives the user's control logic operation outcome procedure data update that the host synchronization comes
Corresponding procedure data area, at the same the moment monitor the working status of the host, there is abnormal failure in the host at any time
Shi Shengwei hosts, the whole control system of adapter, and unperturbed bring into operation and user logic and perform I/O data refresh operations.
According to another aspect of the present invention, it is also proposed that a kind of PLC double-machine redundancy systems based on MAC, it is characterised in that
The system include two completely the same PLC controllers and it is multiple directly with live controlled device (collecting device or execution set
It is standby) connected slave station module, wherein,
When the PLC double-machine redundancy systems work, a controller works in host work mould as redundant host
Formula, another controller work in standby host operating mode as redundancy standby host;
The PLC controller mainly includes being used for the main control unit for performing user's control logic, communicates for dual-computer redundancy
Redundancy communication unit, and the fieldbus main station unit for communicating with slave station module, meanwhile, main control unit also undertake with
Host computer Logical Configuration software interactive and the task that general industry control communication protocol stack is provided;
Mac controller as the redundancy communication unit core is directly hung on the cpu bus of the main control unit;
Communicated between the fieldbus main station unit and the main control unit by dual port RAM and exchange data, mainly
For the I/O refresh operations between the PLC controller and the slave station module;
The slave station module and PLC controller composition industrial field bus network simultaneously realize the brush of live I/O data
New operation, slave station module mainly includes being used for the digital quantity input module (DI) for gathering digital quantity input signal, for gathering mould
The Analog input mModule (AI) of analog quantity input signal, for exporting the digital output module (DO) of discrete control signal,
For exporting the analog output module (AO) of Analog control signal, and a variety of gateway modules for communication Protocol Conversion
With the function module for realizing some special functions.
According to another aspect of the present invention, it is also proposed that a kind of PLC redundant manipulators based on MAC, it is superfluous as PLC two-shippers
The key control unit of remaining system, it is characterised in that the controller includes certain domestic space flight processor, mac controller and institute
The corresponding PHY controllers of MAC, fieldbus main website and power conversion module are stated, wherein,
The processor is used to run user's control logic, is refreshed I/O data using the fieldbus main station unit, also
Carry out data transmission for sending instruction to the mac controller, and establish PLC dual-computer redundancy communication channels, so as to carry out double
Data synchronization and state synchronized between machine;
The instruction that the mac controller is used to be sent according to the processor carries out data sending and reception, and it is double to establish PLC
Communication connection in machine redundant system between redundant host and redundancy standby host, so that synchrodata and state between;
The periphery of the processor is connected with clock circuit, reset circuit, memory peripheral hardware and programming interface and debugging
Interface;
The processor expands 3 mac controllers and corresponding PHY controllers and RJ45 interfaces, wherein
One carries complete upper strata Ethernet protocol stack, for communicating with host computer, two other without upper strata Ethernet protocol stack,
It is intended only as the data collector of dual-computer redundancy communication connection;
The fieldbus main website is used to the input signal that control system slave station gathers flushing to controller data area, together
When the control of controller user's control logic operation result output signal flushed into corresponding slave station, and moment monitoring scene is total
The operating status of gauze network and the working status of slave station;
The power conversion module is connected with the processor, for the DC voltage of input to be converted into processor, institute
State the voltage needed for mac controller, the PHY controllers, fieldbus and memory peripheral hardware.
The distinguishing feature of the present invention is foundation and the number that mac controller is applied to PLC dual-computer redundancy communication channels
According in communication process, both sides' redundant host and the redundancy standby host of PLC dual-computer redundancies physically intersect the side being connected using double MAC
Formula establishes redundancy communication connection so that the both sides of redundancy are full symmetric, any one controller can work in redundant host
Or redundancy standby host pattern, it is not necessary to which individually exploitation PLC redundant hosts and PLC redundancy standby hosts, not only avoid highly reliable PLC two-shippers
Redundant system has the rigors of independent special redundant communication module for controller, without upper strata Ethernet protocol stack
Support, mac controller is used directly as the data collector of redundancy communication, improves the real-time and system of data communication
Flexibility, also saves the construction cost of PLC double-machine redundancy systems.
The present invention provides the redundancy both sides state synchronized and the data method of synchronization independently of user's control logic, and to control
The transparent fault diagnosis judgement of Logical Configuration personnel processed and state handover mechanism, control logic configuration personnel only need to be absorbed in control
The technological process of system processed and control logic in itself, building and running without direct or excessive participation PLC double-machine redundancy systems,
The timeliness of PLC dual-computer redundancy treatment mechanisms is not only increased, also improves the convenience and high efficiency of control system's development, is saved
Development of manpower cost has been saved, while has improved the maintainability of control system.
Brief description of the drawings
Fig. 1 is the composition frame chart of PLC double-machine redundancy systems of the present invention;
Fig. 2 is the system flow chart of PLC double-machine redundancy systems of the present invention;
Fig. 3 is the redundancy communication flow chart of PLC dual-computer redundancies method of the present invention;
Fig. 4 is the redundant state machine of PLC dual-computer redundancies method of the present invention;
Fig. 5 is the hardware circuit connection figure of PLC controller of the present invention.
Embodiment
For the object, technical solutions and advantages of the present invention are more clearly understood, below in conjunction with specific embodiment, and reference
Attached drawing, the present invention is described in more detail.
PLC dual-computer redundancy methods based on MAC, are the effective of inexpensive, the highly reliable industrial control automation system of structure
Settling mode, directly using data collectors of the MAC as redundancy communication, the redundancy communication side without upper strata Ethernet protocol stack
Formula, efficiently solves height Dependence Problem of the highly reliable PLC double-machine redundancy systems to special redundant communication module, reduces control
The construction cost of system processed;The redundant system transparent and unrelated with user's control logic to control logic configuration personnel is provided at the same time
Operating mechanism, improves convenience and agility of the PLC double-machine redundancy systems during concrete application, also improves redundancy system
The reliability of system.The embodiment of the invention is illustrated below in conjunction with attached drawing.It is pointed out that the present invention is carried
The embodiment of confession is a kind of embodiment in the content of the invention, its content of the invention is including but not limited to the embodiment.
Fig. 1 is the composition frame chart of PLC double-machine redundancy systems.The system includes two duplicate PLC controllers, and
Multiple slave station modules being connected with live controlled device, thus constitute PLC double-machine redundancy systems and fieldbus networks.Wherein
Redundant manipulator is made of main control unit, the redundancy communication unit based on MAC and fieldbus main website, main control unit and scene
Connected between bus master by dual port RAM, and the mac controller as redundancy communication unit core is directly hung to main control unit
In the bus of processor.Redundant manipulator all carries two independent MAC, is respectively MAC0 and MAC1, its MAC Address differs
Sample, the MAC0 of all controllers share a MAC Address, and the MAC1 of all controllers also shares a MAC Address.Composition
Two controllers of PLC double-machine redundancy systems physically form redundancy link by interleaved mode, i.e. redundant manipulator A's
MAC0 meets the MAC1 of redundant manipulator B, and the MAC1 of redundant manipulator A meets the MAC0 of redundant manipulator B, as shown in Figure 1.Redundancy connects
Connect letter direction be forever from MAC0 to MAC1, such as redundant manipulator A to redundant manipulator B send request to pass through redundancy
The MAC1 of the MAC0 of controller A to redundant manipulator B, redundant manipulator B are connected on MAC1 comes from asking for redundant manipulator A
After asking, response can be sent to the MAC1 of redundant manipulator A by the MAC0 of itself.Slave station module mainly includes DI, DO, AI, AO
And other function modules, it is mainly used for connecting the controlled devices such as the functional component of data acquisition and function control, for example sense
Device, motor, solenoid valve, relay etc..Communicated between slave station module and redundant manipulator by fieldbus networks, Ge Gecong
Communicated between module of standing by core bus, fieldbus data bag is converted to core bus signal by Coupler Module.
Fig. 2 is the system flow chart of the PLC double-machine redundancy systems, and the redundant PLC controller may operate in redundancy
Two kinds of operating modes of host and redundancy standby host, the function that both of which performs are different with being undertaken for task.Redundant host works
Under pattern, the perform function of controller is mainly comprising initialization, communication process, state switching, I/O outputs, I/O inputs, operation
User's control logic, the several steps of synchronizing process data.Under redundancy standby host operating mode, the perform function of controller mainly includes
Initialization, communication process, state switching, acquisition synchrodata.Compared to redundant host, redundancy standby host does not run user's control and patrols
Volume, do not refresh I/O data, the operation result data and I/O data of its all user's control logic all arise directly from redundancy yet
The data simultaneously operating of host.Redundancy standby host monitors the operating status of redundant host by the redundancy communication connection moment, is examining
Redundant host is upgraded to when measuring redundant host abnormal failure, and takes over whole control system, and unperturbed continue to execute control and patrol
Volume.
Fig. 3 is the redundancy communication flow chart of the PLC double-machine redundancy systems, is broadly divided into redundant host and redundancy standby host two
Part.
As shown in figure 3, redundant host uses following redundancy communication flow:
A1. controller initializes redundancy communication, and is built with another controller of the PLC double-machine redundancy systems
Vertical redundancy link, turns B1;
B1. controller is configured to the controller synchronizing redundant that redundancy link is established with it, and redundant configuration is predominantly used for area
It is divided to the CPU options of two controllers, is set by the toggle switch of controller back plate, have CPU0 and CPU1 both of which, turn C1;
C1. judge whether the redundant configuration of two controllers of the PLC double-machine redundancy systems conflicts, i.e., whether be all
CPU0 is all CPU1, turns D1 if do not conflicted, otherwise turns I1;
D1. judge that controller is configured to host, acquiescence is set to the controller of CPU0 options with redundant host mode operation, turns
E1;
E1. refresh I/O data and run user's control logic, turn F1;
F1. the result data of user's control logic operation is mainly included to redundancy standby host synchronizing process data, process data
With I/O variable datas, turn G1;
G1. redundancy heartbeat is sent to redundancy standby host, turns H1;
H1. judge whether to receive the operation operation of user's finishing control device, if not receiving end operation operation, turn I1
Terminate operation controller, otherwise turn E1 and continue to run with controller;
I1. operation controller is terminated.
Redundancy standby host uses following redundancy communication flow:
A2. controller initializes redundancy communication, and is built with another controller of the PLC double-machine redundancy systems
Vertical redundancy link, turns B2;
B2. controller is configured to the controller synchronizing redundant that redundancy link is established with it, turns C2;
C2. judge whether the redundant configuration of two controllers of the PLC double-machine redundancy systems conflicts, turn if do not conflicted
D2, otherwise turns I2;
D2. judge that controller is configured to host, acquiescence is set to the controller of CPU1 options with redundancy standby host mode operation, turns
E2;
E2. the process data for receiving redundant host and synchronously coming is connected by redundancy communication, and writes corresponding data field,
Turn F2;
F2. the redundancy heartbeat for obtaining redundant host and sending over is connected by redundancy communication, turns G2;
G2. whether diagnosis host is abnormal failure, if being diagnosed to be host is abnormal failure, controller is upgraded to master
Machine, and the effective procedure data to be most recently received continue to run with user's control logic and perform and refresh I/O operation as starting point,
Otherwise H2 is turned;
H2. judge whether to receive the operation operation of user's finishing control device, if not receiving end operation operation, turn I2
Terminate operation controller, otherwise turn E2 and continue to run with controller;
I2. operation controller is terminated.
Fig. 4 is the state transition diagram of the redundant manipulator, and state machine mainly includes 9 states, state definition and condition
Redirect shown in the following form 1 of relation:
1 redundant state machine handoff relation of form
Fig. 5 is a kind of hardware connection block diagram of embodiment of PLC double-machine redundancy system redundant manipulators.The redundant manipulator
Including certain domestic processor, fieldbus master station module, mac controller, the PHY being connected with the mac controller, power conversion
Module, memory peripheral hardware, clock circuit, reset circuit and detail programming interface.
The MAC is mainly used for the data collector of redundancy communication connection between redundant manipulator, and PHY is mainly used for communicating
Level signal is changed.
Fieldbus main website is used to provide the communication connection between the support of field bus protocol stack, maintenance controller and slave station
And perform actual I/O variable refresh operations.
The redundant manipulator for core, is being handled with certain domestic processor (domestic aerospace CPU is used in the embodiment)
Business processing program, user's control logic, redundancy communication and redundant fault diagnosis judgement and state changeover program are run on device.
Specifically, then certain affiliated domestic processor is performed by the input signal of the fieldbus main website collection site equipment
The control output information of the implementing result of control logic, is finally sent to by user's control logic by the fieldbus main website
Controlled device, while user's control logic can also be crossed number of passes by the processor in redundant host operating mode in real time
Redundancy standby host is synchronized to according to the redundancy communication connection being made up of the mac controller, and works in redundancy standby host operating mode
The process data that redundant host can synchronously be come of the processor be written to corresponding data field, and the moment monitors redundancy
The operating status of host, is ready to liter principal and subordinate and takes over whole control system.
Enclose outside the processor and clock circuit, reset circuit, memory peripheral hardware and detail programming interface are provided, form certain state
Produce the minimum system of processor.The redundant manipulator also comprising the power conversion module that is connected with processor, by the 9 of input~
30V DC voltages are converted to the 5V and 3.3V electricity needed for the peripheral components such as processor, mac controller, fieldbus master station module
Pressure.
The present invention uses the PLC dual-computer redundancy methods based on MAC, and the data transmit-receive of redundancy communication is used as using mac controller
Device, there is provided redundant data communication, redundant fault diagnosis judgement and the redundancy fully transparent to control logic configuration developer
State handover mechanism, allows PLC double-machine redundancy systems flexibly, easily to apply in the control that construction cost is low, reliability is high
In system, from the restriction of special redundant communication module, also from the influence of particular user control logic, PLC is greatly facilitated
Application of the double-machine redundancy system in industrial automation control system.
Particular embodiments described above, has carried out the purpose of the present invention, technical solution and beneficial effect further in detail
Describe in detail it is bright, it should be understood that the foregoing is merely the present invention specific embodiment, be not intended to limit the invention, it is all
Within the spirit and principles in the present invention, any modification, equivalent substitution, improvement and etc. done, should be included in the guarantor of the present invention
Within the scope of shield.