A kind of field-bus interface abstract method
Technical field
The present invention relates to fields of numeric control technique, specifically a kind of interface abstract method of supporting multiple bus module compatibility.
Background technology
Fieldbus has very important status in digital control system: it is to realize the important carrier of communicating by letter between control module and execution module.Digital control system in open type requires numerical control bus to satisfy periodicity, real-time, reliability, security and open requirement.At present, the numerical control bus module can be divided into two kinds of emulation bus module and number bus modules, and different bus modules has again the incompatible different product of a variety of agreements.A common digital control system only provides the interface support to a kind of bus, this a kind of bus module that just must provide this system to support in the time of the actual use of user, and original other bus modules just can't recycle, and obviously this is very irrational.
Existing digital control system at the middle and upper levels module and the man-to-man close-coupled implementation of bus module can not satisfy the ability of supporting simultaneously multiple bus, a kind of effective ways of head it off are to set up one deck bus middle layer on the basis of existing bus module, realization is to the unified abstraction interface of different bus, specify or the mode of self-identifying obtains that current system connects is which kind of bus module by the user, then the relevant data structure of initialization bus communication, call corresponding bus driver, upper layer module is masked the concrete bus module of bottom, a unified user interface only simply is provided.
Summary of the invention
In order to solve multibus compatible problem in the present digital control system, the invention provides a kind of method of supporting the configurable loading of multibus module.The method can realize communicating by letter of same number of units control system and multiple bus (comprising analog-and digital-two large classes), only be simply to revise corresponding parameter by man-machine interface to get final product and the user need to make, strengthened greatly dirigibility and the extensibility of existing digital control system.
For solving the problems of the technologies described above, the present invention by the following technical solutions:
A kind of field-bus interface abstract method is characterized in that may further comprise the steps:
Parameter configuration module reads configuration file, distributes one section shared drive, defines the structure of this section shared drive;
The field-bus interface abstraction layer module defines the structure of its built-in bus apparatus station number-driving function mapping table according to the structure of this section shared drive;
Upper strata digital control system module is called the interface function of unified interface collection of functions inside in the field-bus interface abstraction layer module;
At the scene in the bus interface abstraction layer module, the bus apparatus station number that described interface function provides when calling according to upper strata digital control system module, inquire about bus apparatus station number-driving function mapping table, and this interface function is mapped to the corresponding interface function that drives in the bus driver interface function collection;
The field-bus interface abstraction layer module is called this driving interface function, make the bus module driver operation in bottom bus driver module corresponding to this driving interface function, each bus of finishing bottom bus driver module and upper strata digital control system intermodule alternately.
Described configuration file comprises the configuration information of total bobbin, and by there being the user who revises authority to revise.
Described configuration information comprises axle numbering, axle name, bus apparatus numbering, bus apparatus title.
Described bottom bus driver module comprises a plurality of bus modules, and described bus module is number bus module or emulation bus module.
The present invention has following beneficial effect and advantage:
1. support multiple bus communication mode.Using the digital control system of the inventive method and can change at any time as required different bus modules, is that hardware or software layer all need not to revise.
2. convenient easy-to-use.The digital control system of using the inventive method has user friendly, and the user does not need to understand the realization details of bottom, only needs to revise corresponding configuration parameter by simple man-machine interface and can finish digital control system to identification and the control of new bus and bus apparatus.
Individual packages, interface opening, be convenient to secondary development.This method is mainly by two independently module realizations: parameter initialization module and bus module middleware.Because the bus module middleware is unified to upper strata numerical control program interface, when the user need to add new bus support function, only need to carry out secondary development to these two modules, and upper application software does not need to do any change.
Description of drawings
Fig. 1 is the overall construction drawing of the inventive method;
Fig. 2 is the inventive method multibus configuration flow figure;
Fig. 3 is the field-bus interface abstraction layer module internal core functional diagram of the inventive method.
Embodiment
The present invention is described in further detail below in conjunction with drawings and Examples.
The multibus compatible field-bus interface level of abstraction of a kind of realization digital control system method, add a field-bus interface abstraction layer module by the upper strata digital control system intermodule to existing digital control system bottom bus driver module and digital control system, with the coupling of upper strata digital control system module and bottom bus driver module solution, but and then reach the dynamically effect of reprovision of digital control system bottom bus driver module.
The field-bus interface abstraction layer module is to realize the nucleus module of this method, the configuration file that writes according to the user, one of initialization drives the mapping table of interface function from the bus apparatus station number to specific bus, and provides unified interface function according to this table for the user;
Parameter configuration module, auxiliary field-bus interface abstraction layer module reads the information (present embodiment refers to the bus apparatus station number) of user's appointment, by creating communicating by letter of a Sharing Memory Realization and field-bus interface abstraction layer module, the bus interface abstraction layer module starts before the operation at the scene, this module is read in the configuration file that the user finishes writing, each data structure in the initialization shared drive, this module is waited for reading of field-bus interface abstraction layer module after finishing, and then withdraws from;
The unified interface collection of functions, multiple bus module and upper strata digital control system intermodule basic, unified interface function collection of interface function class suggestion commonly used according to bottom bus driver module, which kind of bus module assurance is regardless of current use, to the collection of functions view that upper strata digital control system module remains unchanged, upper strata digital control system module only need be called this unified interface collection of functions can realize operation to the different bus module;
Bus apparatus station number-driving function mapping table, its major function is by the Unified coding to all kinds of bus station numbers, make its implicit bus type information, and pass to unified interface function as parameter, so that this Function Mapping is to the specific bus driving interface function collection of the corresponding bus of this bus apparatus station number institute; Its necessary initialization is finished by parameter configuration module;
Specific bus drives the interface function collection, and this set owner will comprise the driving interface function of all multiple buses that can be connected with this numerical control system interface;
What parameter configuration module was read in is a configuration file, and this document content can be revised and preserve through man-machine interface by the user; Parameter configuration module has read after the configuration file, the communication mechanism (can be structurized shared drive) that defines in use and the field-bus interface abstraction layer module carries out the parameter initialization of field-bus interface abstraction layer module, parameter configuration module withdrawed from after parameter initialization was complete, the field-bus interface abstraction layer module is finished the map bindings with concrete bus module according to the necessary structure of parameter configuration module initialization that communication mechanism (can be structurized shared drive) obtains.
Bottom bus driver module comprises a plurality of bus modules, this bus module can be number bus module or emulation bus module, bus module is connected by industrial bus with the field-bus interface abstraction layer module, bus module comprises the circuit board that links to each other with motor, has the driver of motor in the circuit board.
As shown in Figure 1, be the structural drawing of the inventive method.This figure relates to the field-bus interface abstraction layer module that digital control system upper strata digital control system module, bottom bus driver module and the inventive method newly add.In the digital control system before using the inventive method, upper strata digital control system module is directly called the bus driver module of bottom, and therefore, the employed bus module of same digital control system is fixing can not the change normally, this mode is dumb, poor expandability.As can be seen from Figure 1, adopt the digital control system of the inventive method to support multiple bus, comprise dissimilar number buss and dissimilar emulation buss, specifically can change by revising configuration file as required.
As shown in Figure 2, be the multibus configuration flow of the inventive method.The user obtains the configuration information of total bobbin by man-machine interface, and can use the role with modification authority to revise these configuration informations, and configuration information comprises: axle numbering, axle name, bus apparatus numbering, bus apparatus title etc.These information will be written back in the corresponding configuration file by the task module of man-machine interface lower floor after revising.When system restarts again, the parameter configuration module that starts at first operation in the whole numerical control software will be read this configuration file, and according to the value of parameters in the configuration file, distribute and shared drive of initialization, for the loading of field-bus interface abstraction layer module is prepared.
As shown in Figure 3, be the field-bus interface abstraction layer module internal core functional diagram of the inventive method.After the parameter configuration module operation is finished, information in the configuration file is all being updated in the relevant bus interface abstraction layer module by communication mechanism (present embodiment is as shared drive), adopts the mode of structure to deposit in system's shared drive in the present embodiment and suffered.The field-bus interface abstraction layer module will be according to its built-in bus apparatus station number-driving function mapping table of this structure initialization, when upper strata digital control system module need to be called the bus driver module of bottom, it is actual that what use is the concrete bus apparatus station number that the unified interface function that provides of field-bus interface abstraction layer module and this interface function comprise, this interface function will be searched bus apparatus station number-driving function mapping table to determine to call the driving interface function of which kind of bus according to the bus apparatus station number of reality, finally finishes the mutual of the concrete bus driver module of upper layer module and bottom.