CN100401707C - Remote process transfering method and system in distribution type control system - Google Patents

Remote process transfering method and system in distribution type control system Download PDF

Info

Publication number
CN100401707C
CN100401707C CNB2006100836292A CN200610083629A CN100401707C CN 100401707 C CN100401707 C CN 100401707C CN B2006100836292 A CNB2006100836292 A CN B2006100836292A CN 200610083629 A CN200610083629 A CN 200610083629A CN 100401707 C CN100401707 C CN 100401707C
Authority
CN
China
Prior art keywords
module
server
rpc
thread
service
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CNB2006100836292A
Other languages
Chinese (zh)
Other versions
CN1852209A (en
Inventor
方垒
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Helishi Control Technology Co ltd
Original Assignee
Beijing Hollysys Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Hollysys Co Ltd filed Critical Beijing Hollysys Co Ltd
Priority to CNB2006100836292A priority Critical patent/CN100401707C/en
Publication of CN1852209A publication Critical patent/CN1852209A/en
Application granted granted Critical
Publication of CN100401707C publication Critical patent/CN100401707C/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

The present invention relates to a remote procedure call system in a distributed control system and a method. Both ends of the remote procedure call (RPC) comprise an external interface module which is in charge of externally supplying a unified interface, a client end module and a server module which are accessed by the external interface module, a network interface module accessed by the client end module and the server module and a service processing thread pool module accessed by the server module. After the external interface module receives RPC calling information, all configuration parameters of server tasks are obtained, and a case of the client end module is built and is used for calling. The client end module is used for completing data seal and data slicing, the network interface module is used for sending the data to the server module at the opposite end, and simultaneously, the switching treatment is carried out. The server module is used for starting a treating thread after the RPC information is sliced and regrouped, and treating results are returned to a caller along the original path in the form of the RPC information. The present invention has the advantages of easy use and easy network complexity shielding, and the dual-network redundant switching can be realized.

Description

Remote procedure calling (PRC) method in a kind of dcs and system
Technical field
The present invention relates to remote procedure call, relate in particular to the implementation method and the device thereof of distributed control (DCS) the system medium-long range invocation of procedure.
Background technology
No matter be the dcs (DCS) in the industrial process control, the power station computer system (KIT) of nuclear power station, or large-scale Supervised Control and the data acquisition system (SCADA) used in the track traffic, all relate to a key problem, i.e. the communication issue of each inter-module of system of bringing of distributed data acquisition and centralized calculation.Simultaneously, along with Application Expansion, engineering requires more and more higher to deployment flexibility, the extensibility of system.
This has just proposed a very problem of reality: how to set up one and improve reliable Distributed Calculation infrastructure (Distributed Computing Infrastructure (DCI)), make DCS, KIT, the personnel of designing and developing of large scale systems such as SCADA can concentrate on main energy on the concrete transaction, needn't too much be concerned about bottom-layer network communication, network redundancy, simultaneously can be deployed in each serviced component of on this infrastructure, setting up on the different machines flexibly, (be provided with private server to satisfy large scale system simultaneously, the multitiered network structure) and mini-system (active station and server software are installed on the same machines, and adopt individual layer flat network topology structure, to save cost) needs.
The similar technology that realizes DCI at present comprises: RPC, DCE, CORBAL, DCOM, remote procedure call (RPC:Remote Procedure Call) is the DCI realization technology that is suggested the earliest.Just had document to begin to propose the RPC notion as far back as 1976, complete RPC technology realizes appearing at the beginning of the eighties at the end of the seventies.Early stage program is used the goto statement in a large number, afterwards the program function of the maturation form with " process " was provided, the user taps into " procedure library " chain in the process of oneself, just can call easily, and this " invocation of procedure " carries out in the same process space.Along with computer operating system technology and development of internet technology, the demand of Distributed Calculation is suggested, and " invocation of procedure " also is required to be expanded to a plurality of processes of machine and the difference that links together by network by individual process
In order to visit one " process " of remote process, RPC is inserted into one section " client stake program " in the client process code, simultaneously one section " server stake program " is inserted in the server processes code; When client process is initiated once " remote procedure call ", " client stake program " is packaged into network message with this each parameter of calling, and message is sent to the computer at server processes place by network, after " server stake program " receives this message, parse procedure parameter, form with call back function passes to server processes, the result of server processes is through same processing procedure, pass to " client stake program " by " server stake program ", return to client process then, so just finished once complete " remote procedure call ".The code of RPC is embedded in two process spaces of server and client side as can be seen.
All there are two same class problems in general RPC and the various DCI technology that derive from thus:
1, RPC, DCE, CORBAL, DCOM are the technology towards commercial development, reliability, network switching aspect are not well solved, as be difficult to realize the redundant switching of quick dual network; Also there are numerous security breaches of having grasped for the hacker in the RPC of Windows, and these defectives cause these technology to be not suitable for being applied directly to the exigent technical grade of security reliability system.
2, the underground or code of code problem such as complexity too need be carried out suitable customization work, just can be applied to the Industry Control Application occasion.Though each producer all provides a lot of code samples, but should never think and develop DCOM, CORBA assembly, can reduce requirement to network knowledge, this customization work, need on the one hand suitable network foundation knowledge and practical experience, also need on the other hand the working machine of RPC etc. is shaped on thorough understanding, experience is told us to customize link and is varied with each individual, often go wrong, risk is difficult to control herein.
The commercial Distributed Calculation solution of using in DCS system and the present common working environment has diverse historical background and current demand, solves the present problem of DCS, must not simply divert technology such as general DCOM, RPC.But the user requires the DCS system platform that a kind of basic software that is easy to use, shield network complexity that possesses commercial DCI characteristics is arranged again to the fast development of DCS demand, this basic software shortens the new function development cycle of DCS system on the one hand, reduces the impact of new function to system reliability, complexity; On the other hand, can not run counter to the consistent demand of DCS system, as double-network redundant, data heat is equipped with or the like.
Summary of the invention
The technical problem to be solved in the present invention is RPC system and the method thereof in a kind of dcs, except that being easy to use, shield the network complexity, can realize that double-network redundant switches.
In order to solve the problems of the technologies described above, the invention provides the RPC system in a kind of dcs, it is characterized in that, two ends at remote procedure call RPC include: be responsible for externally providing unified interface the external interface module, can for the client modules of external interface module accesses and server module, can be by the Network Interface Module of client modules and server module accesses, and can be by the service processing thread pool module of server module visit, wherein:
Described external interface module comprises: RPC calling interface unit, for new RPC call request, obtain configuration parameter by the server task name from configuration file, create an example of client modules, initiate to call and return then to call the result, this example is then reused in the subsequent calls request; RPC service interface unit, use the external interface module be the server end task time, create a Service Instance of server module,, start the reception processing threads of server module then according to the thread pool of the parameter initialization service processing thread pool module that reads;
Described client modules is after receiving call request, the data encapsulation that will send burst in the RPC message sends to server end, and the RPC message that server returns carried out burst reorganization and application layer data is verified, return the RPC caller through the external interface module; And this module is preserved the address and the port of the server task of the same name of all deployment according to configuration parameter, automatically switches to the next one when finding a servers off-line, returns the result of malloc failure malloc when Servers-all all can't be worked to the external interface module;
Described server module comprises the reception processing threads and handles main thread, creates the Network Interface Module example after the reception processing threads starts, and starts the processing main thread; Handle main thread and call Network Interface Module reception RPC request message, from service processing thread pool module, distribute a processing threads, the burst reorganization and the application layer data checking back of finishing RPC message start this processing threads, finish the various operations that thread pool is safeguarded simultaneously;
Described Network Interface Module is used to realize the communication between client modules and the server module;
Described service processing thread pool module is carried out event handling by the processing main thread triggering processing threads wherein of server module, calling the corresponding layer functions of going up handles, and result sent to client modules by Network Interface Module, client modules receive the RPC message that server returns and verify errorless after, after carrying out burst reorganization and application layer data checking, by after external interface module and IO server module return to the RPC requesting party, discharge thread context then;
Above-mentioned module all needs the parameter of the message of receiving is carried out validity checking.
Further, above-mentioned RPC system also can have following characteristics: described Network Interface Module further comprises a network interface abstraction layer module and a network interface realization layer module, wherein: described network interface abstraction layer module is used for that procotol interface that RPC system must be used is abstract to come out, only responsible defining interface, to the complex operations of the concrete procotol of external shield, there is not the specific implementation code; Described network interface realizes that layer module is used for the above-mentioned interface of the described network interface abstraction layer module definition of specific implementation, with the basic communication protocol of seamless replacement RPC system.
Further, above-mentioned RPC system also can have following characteristics: the interface of described network interface abstraction layer module definition comprises: transmission interface, send data to given server address, port, and return the transmission result; Receiving interface receives data, returns reception result; Remove message interface, can remove and receive all message of waiting in line to handle in the formation, be used to remove out-of-date historical data, restart the interface of a session; Wait for transmission interface, wait for to send data, be used for transmit leg and realize asynchronous call, do not get clogged up to network; And the wait receiving interface, wait for can receiving data up to network, be used for the recipient and realize asynchronous call, do not get clogged.
Further, above-mentioned RPC system also can have following characteristics: all also comprise at the two ends of calling one with the main service dispatch module of external interface module bi-directional association, the RPC service interface unit of described external interface module use the external interface module be the server end task time, also create an example of this main service dispatch module, start and select main thread, the form that this selects main thread to call with RPC, obtain the current master slave mode of current online server task of the same name by the external interface module, in a plurality of " server tasks " of the same name, select unique main task.
Further, above-mentioned RPC system also can have following characteristics: described external interface module reads configuration parameter from a configuration file, this configuration file has defined some server tasks, and the configuration parameter of each server task comprises: number of threads in the thread pool, ask buffer size, reply buffer size, server address and port numbers on two heterogeneous networks of the Service Instance number of request timed out time of network switching time, acquiescence, network protocol type, deployment and each Service Instance correspondence.
Further, above-mentioned RPC system also can have following characteristics: also safeguarded a thread context array in the described server module, the unidirectional thread context of quoting of described service processing thread pool module, reception processing threads in the described server module starts also this thread context array of initialization of back, and the switching of processing threads realizes by this thread context structure fully in processing main thread in the described server module and the thread pool.
Further, above-mentioned RPC system also can have following characteristics: also comprise a thread control module, be used for finishing initialization, startup, the safe processing of withdrawing from of server module, service processing thread pool module and main service dispatch module thread.
In order to solve the problems of the technologies described above, it is a kind of based on the remote procedure calling (PRC) method of system according to claim 1 that the present invention also provides, and may further comprise the steps:
(a) the server end task is used the external interface module, create a Service Instance of server module, thread pool according to the static pre-initialize service processing of the parameter that reads thread pool module, start server module then and receive processing threads, this thread creation network interface is realized layer module instance, the context in initialization thread pond starts then and handles main thread, finishes the various attended operations of thread pool simultaneously;
(b) upper application module sends to the external interface module with the RPC message call, carry the server task name, after the external interface module is received, obtain all configurable parameters of this server task from configuration file by the server task name, create an example of client modules, initiate RPC then and call;
(c) client modules is received the data encapsulation that will send after the call request in the RPC call request message, hands over the Network Interface Module of local terminal to send to long-range Network Interface Module through network behind the burst, and waits for return results; Simultaneously, this module is preserved the address and the port of the server task of the same name of all deployment according to configuration parameter, when finding a servers off-line, automatically switch to the next one, when Servers-all all can't be worked, then return the result of malloc failure malloc to the external interface module;
(d) long-range server module receives this RPC call request message by the Network Interface Module that calls homonymy, and from processing threads of service processing thread pool module assignment, the burst reorganization back of finishing this RPC message starts this processing threads;
(e) described service processing thread pool module is carried out event handling, calls corresponding top service process and handles, and result is sent to client modules with the Network Interface Module of form through calling two ends of RPC message;
(f) client modules receive the RPC message that server returns and verify errorless after, carry out burst reorganization and application layer data and verify, by after external interface module and IO server module return to the RPC caller.
Further, above-mentioned remote procedure calling (PRC) method also can have following characteristics: described remote procedure call also comprises a main service dispatch module, in the described step (a), after thread pool according to the static pre-initialize service processing of the parameter that reads thread pool module, before starting server module reception processing threads, also start the main thread that selects of this main service dispatch module, this thread calls form with RPC, regularly obtain the master slave mode of current online server task of the same name by the external interface module, in a plurality of " server tasks " of the same name, select unique main task.
Further, above-mentioned remote procedure calling (PRC) method also can have following characteristics: the main thread that selects of described main service dispatch module also obtains the port numbers of current online server task of the same name, select and handle in the following manner when main: A, if book server task current state is " master ", and the other side also is main, then compare port numbers, be as the little this locality of then forcing of the other side's port numbers " from "; B, if book server task current state be " from ", and the other side also be from, it is main putting this locality immediately; C, if book server task current state be " from ", and the other side continues 3 seconds off-lines, it is main putting this locality immediately.
Further, above-mentioned remote procedure calling (PRC) method also can have following characteristics: in step (a) before, earlier generate described configuration file automatically according to device configuration information, the configuration parameter of each server task comprises in this configuration file: number of threads in the thread pool, ask buffer size, reply buffer size, server address and port numbers on two heterogeneous networks of the Service Instance number of request timed out time of network switching time, acquiescence, network protocol type, deployment and each Service Instance correspondence; Wherein the number of Service Instance and relevant parameter read and are appended in the above-mentioned configuration file when starting.
Further, above-mentioned remote procedure calling (PRC) method also can have following characteristics: among step (a), also derive an IO server module according to the external interface module, this module externally provides read write tag value interface, the third party can directly read and revise the label instantaneous value of the IO service that is deployed to any position by this interface, described step (b) upper application module is that the reading tag instantaneous value interface by this IO server module is initiated a RPC and called, and by this IO server module call request sent to described external interface module.
Further, above-mentioned remote procedure calling (PRC) method also can have following characteristics: described each module is all carried out validity checking to parameter wherein when receiving message, wherein client modules and server module also carry out error checking and correction to the data that receive, and this verification comprises to the verification of the RPC message data behind the burst with to the verification of the application layer data after the reorganization.
As from the foregoing, the present invention promptly is easy to use, shield outside the network complexity except possessing commercial DCI characteristics, has also realized the double-network redundant handoff functionality that industrial control system is necessary.And further have following characteristics:
1) bottom-layer network communication protocol is replaceable, and convenience is expansion and cross-platform later on, can shorten the new function development cycle of DCS system, reduces the impact of new function to system reliability, complexity.
2) but Service Instance number flexible configuration, in order further to improve system reliability, the IO server can be configured to triple redundance.
3) the choosing master between a plurality of examples of realization serviced component, server task can be known the master slave mode of oneself by FLRPC.
Description of drawings
Fig. 1 is the structural representation of DCS system.
Fig. 2 is the functional block diagram of present embodiment RPC system.
Fig. 3 is the schematic flow sheet of present embodiment remote procedure calling (PRC) method.
Embodiment
No matter all invocations of procedure how complicated, all can be summed up as unified pattern, that is: the request-reply pattern.In this pattern, the requesting party passes to service side with request type, required parameter with message mode, the service root is handled according to request type and required parameter, the result is returned to the requesting party in the response message mode, if the requesting party is replied at the appointed time, just complete successfully remote procedure call one time, call overtime otherwise just declare this.
Fig. 2 shows the functional block diagram of embodiment of the invention remote procedure call (FLRPC) system, all is same structure at the both-end that calls.As shown in the figure, every end includes external interface module CFLRPCApi, client modules CFLRPCClient, server module CFLRPCServer, network interface abstraction layer module CNet, network interface realization layer module CNetUdp, main service dispatch module CFLRPCMasterSelectThread and service processing threads pond module CFLRPCServerThread.These functional modules are made of MFC, all will carry out validity checking to parameter after receiving message, below just narration one by one.Wherein:
The external interface module is in the top layer of every other module, is responsible for unified interface externally is provided, and extraneous user can only visit inner all functions by this module.This module all is unidirectional related with the relation of client modules and server module, and promptly the external interface module can access client module and server module, but client modules and server module are indifferent to the existence of external interface module.
As the external interface of whole software bag, the external interface module comprises two interface units:
RPC calling interface unit is used to initiate RPC and calls and the result is returned caller.For new RPC call request, obtain all configurable parameters of this server task by the server task name from configuration file, create an example of client modules, to initiate RPC then and call, follow-up call request is then reused this example and is initiated RPC and call.
RPC service interface unit is used to provide RPC service.If what use the external interface module is the server end task, create a Service Instance of server module, thread pool according to the static pre-initialize service processing of the parameter that reads thread pool module, and create an example of main service dispatch module, start and select main thread, start server module then and receive processing threads.
FLRPC adopts the method for " finding server according to configuration file ", and this is simple and reliable method to industrial control system, and this configuration file is generated according to device configuration information automatically by engineer station's software.Wherein defined some server tasks, the service parameter district of each server task has disposed following parameter: number of threads in the thread pool, ask buffer size, reply buffer size, request timed out time, network protocol type, the Service Instance number of deployment and the relevant parameter of each Service Instance of network switching time, acquiescence.In the present embodiment, in order to realize the flexible configuration of Service Instance number, number that can not the dead Service Instance of simple write, should when starting, read the number and the relevant parameter of Service Instance, be appended to the service parameter district of above-mentioned configuration file, for the UPD procotol, the parameter of each Service Instance comprises at least: the A network server network address, the B network server network address and port numbers A.To support the function of double-network redundant.
Client modules is used to realize the RPC client functionality.Server module is used to realize the RPC server capability.Client modules and server module are not participated in the operational network agreement directly, communication between them realizes by the network interface abstraction layer module, the relation of client modules and server module and network interface abstraction layer module is reciprocity, it all is unidirectional incidence relation, be that client modules and server module two modules can have access to the network interface abstraction layer module, but the inverted access relation needn't exist.
After client modules is received call request, carry out verification, by after the data encapsulation that will send in RPC message, burst sends to server end, receive the RPC message that server returns and verify errorless after, carry out burst reorganization and application layer data checking, return to the RPC caller by the external interface module again.Simultaneously, this client modules adds the address and the port of the server task of the same name of all deployment to address list according to configuration parameter, when finding a servers off-line, automatically switch to the next one, Servers-all all travels through back as also not success, returns malloc failure malloc to the external interface module.
After server module is received the request of client modules, can not handle, otherwise the new request meeting during handling is lost by self.Therefore in order to realize the concurrent processing client-requested, must handle concrete request by proprietary module, service processing thread pool module is exactly to handle the special module of concrete request.Relation between server module and the service processing threads pond module is unidirectional incidence relation, and service processing thread pool module is as the static pre-initialize of thread pool.
Server module is the communication equity side of client modules, comprises receiving processing threads and handling main thread.After receiving the processing threads startup, create network interface according to protocol type and realize a layer module instance, the context in initialization thread pond starts the processing main thread then; This processing main thread calls network interface and realizes that layer module receives the RPC request message, verify errorless after, from the processing threads of thread of service processing thread pool module assignment as this RPC message, the burst reorganization and the application layer data checking back of finishing RPC message start this processing threads.This module is finished the various operations that thread pool is safeguarded, as adds a thread, discharges a thread, reclaims orphan's thread, searches a thread etc.
Service processing thread pool module is exactly to handle the special module of concrete request.Processing threads in this module is after finishing initialization, processing main thread triggering processing threads wherein by server module carries out event handling, calling the corresponding layer functions of going up handles, and result realized that by network interface a layer module sends to the RPC requesting party, discharges thread context then.Relation between server module and the service processing threads pond module is unidirectional incidence relation, and server module is safeguarded a thread context array, the thread context in the unidirectional quote server module of service processing thread pool module.The switching of handling main thread and thread pool processing threads realizes by the thread context structure fully.
Generally can need unique main service between each example of the service of many redundancies or two redundancies, other are from service, each Service Instance carries out different processing according to the master slave mode needs of oneself, the function of this general character realizes greatly alleviating the burden of using open personnel in MFC, and the unified holotype of selecting can reduce the possibility that system makes mistakes.Therefore, need be provided with main service dispatch module select main thread to finish CFLRPC to select the function of tonic chord, if the user of external interface module is a server task, select main thread to be started automatically, in a plurality of " server tasks " of the same name, select unique main task.It between this module and the external interface module bi-directional association relation.
Select when main, earlier call form with RPC, current master slave mode and port numbers by the current online server task of the same name of regularly obtaining of external interface module, handle in the following manner then: A, if book server task current state is " master ", and the other side also is main, compares port numbers so, as the little this locality of then forcing of the other side's port numbers is " from "; B, if book server task current state be " from ", and the other side also be from, it is main putting this locality immediately; C, if book server task current state be " from ", and the other side continues 3 seconds off-lines, it is main putting this locality immediately.It should be noted that above-mentioned principal and subordinate's processing mode is not unique, can logic be set according to any principal and subordinate in the existing Industry Control and dispose.
Can draw from last surface analysis, server module, service processing thread pool module and main service dispatch module all must be used thread, in order to simplify this processing, strengthen the readable and portable of code, in another embodiment, thread control module be can also add, initialization, startup, the safe processing of withdrawing from of above-mentioned three module threads are used for finishing.
The network interface abstraction layer module is used for that procotol interface that FLRPC must be used is abstract to come out, and forms one " procotol abstract class ", and all FLRPC communication all pass through to point to a pointer of this " abstract class " and finished." abstract class " is not finish any actual functional capability in the Object-Oriented Design schema concept, its only responsible defining interface, and with the complex operations to the concrete procotol of external shield, this module is an abstraction interface, does not have the specific implementation code.
In the present embodiment, the interface of this module definition has following several, but the present invention is not limited to this, but relevant with the demand of actual engineering.
Transmission interface sends data to given server address, port, returns the transmission result;
Receiving interface receives data, returns reception result;
Remove message interface, can remove and receive all message that queuing waits the marquis to handle in the formation, be used to remove out-of-date historical data, restart the interface of a session;
Wait for transmission interface, wait for to send data, be used for transmit leg and realize asynchronous call, do not get clogged up to network;
Wait for receiving interface, wait for to receive data, be used for the recipient and realize asynchronous call, do not get clogged up to network.
Network interface realizes that layer module is parent with the network interface abstraction layer module, and realizes the above-mentioned interface of its definition, with the basic communication protocol of seamless replacement FLRPC.
For example, if configuration file regulation FLRPC uses udp protocol, the concrete class of system creation UDP example then, any network operation of FLRPC all can pass to " the concrete class of udp protocol " by " procotol abstract class " interface, be delivered to the other side with the UDP message format then.In like manner, if the configuration file use is " DRTE " agreement, then, request is taken over by " the concrete class of DRTE agreement ".The purpose of doing like this is can seamlessly to replace for the stub network agreement that makes entire CF LRPC communication.Concrete concept is with reference to " Design Mode (Design Patterns Elements of ReusableObject-Oriented Software) " (U.S.) Erich Gamma work).
IO server module CIOServerApi is the basis of the whole upper layer software (applications) of server and DCS system, when using the FLRPC storehouse to realize the IO service, need only derive from from CFLRPCApi and get final product, its realization is very simple, needn't be concerned about network details, it externally provides read write tag value interface the IO server module, the third party can directly read and revise the label instantaneous value of the IO service that is deployed to any position by this RPC interface, process needn't be concerned about IO service actual physical location, needn't know network details, be one common " invocation of procedure " fully.Operations of operators sends to field control station by this interface.
Before handling the RPC call request, should when starting, read the relevant parameters such as address, port of server task, and be appended to the service parameter district of configuration file, read for the external interface module.Simultaneously, long-range FLRPC system must finish following initial work earlier:
The server end task is used the external interface module, create a Service Instance of server module, thread pool according to the static pre-initialize service processing of the parameter that reads thread pool module, and create an example of main service dispatch module, start and select main thread, start server module then and receive processing threads.
After the reception processing threads of server module starts, create network interface according to protocol type and realize layer module instance, the context in initialization thread pond starts then and handles main thread, and this processing main thread can call network interface and realize that layer module receives the RPC request message and handle.Simultaneously, server module need be finished the various attended operations of thread pool.
Main service dispatch module select the function of tonic chord automatically to be started after, call form with RPC, by the master slave mode and the port numbers of the current online server task of the same name of regularly obtaining of external interface module, in a plurality of " server tasks " of the same name, select unique main task.
Fig. 3 is the schematic flow sheet of present embodiment remote procedure calling (PRC) method.Man-machine interface HMI initiates once successful RPC when asking by the FLRPC system, calls ordinal relation between each module.This process may further comprise the steps:
Step 1, human-computer interface module HMI initiates a RPC by the reading tag instantaneous value interface of IO server module CIOServerApi and calls, and earlier the RPC message call is sent to external interface module CFLRPCApi, carries the server task name;
Step 2, after the external interface module is received the RPC message call, obtain all configurable parameters of this server task from configuration file, create the example of client modules CFLRPCClient by the server task name, initiate RPC then and call, send out the RPC call request message to client;
Step 3, client modules is received call request, carries out verification, by after the data encapsulation that will send in RPC message, hand over network interface to realize that a layer module CNetUdp sends behind the burst, and wait for return results;
In the example of creating this client modules, add at least two server address and the port of the server task of the same name of all deployment to address list according to configuration parameter, when client modules is found a servers off-line, automatically switch to the next one, thereby realized the double-network redundant operation.All travel through back as also not success as Servers-all, return the result of malloc failure malloc to the external interface module.
What the parameter size of the invocation of procedure was commonly used is about 10K, the longest 2M that reaches.This requires unpack group bag of FLRPC to handle, because the general applied environment of DCS system is a Local Area Network, does not have out of order problem, so simple relatively in " group of unpacking bag " realization.Transmit leg splits into the segment of message one by one that is not more than network physical message MTU size with message, and number consecutively sends to the recipient, and the recipient receives these sheets and has no progeny, according to numbering judge whether to finish all segments reception, whether lose segment.The recipient also carries out CRC check simultaneously.
Step 4, network interface realize that layer module sends to long-range network interface by local area network (LAN) or other network with the RPC request message and realize layer module, and are received by the Receive interface by long-range server module CFLRPCServer;
Step 5, after long-range server module verifies that this RPC request message is errorless, distribute the processing threads of a thread as this RPC message from service processing thread pool module CFLRPCServerThread, the burst reorganization and the application layer data checking back of finishing RPC message start this processing threads;
Step 6, long-range service processing thread pool module is carried out event handling, call corresponding top service process IOServer and handle, and result is realized that through long-range and requesting party's network interface a layer module sends to client modules with the form of RPC message;
Step 7, client modules receive the RPC message that server returns and verify errorless after, carry out burst reorganization and application layer data and verify, by after external interface module and IO server module return to the RPC caller.
In sum, the present invention promptly is easy to use, shield outside the network complexity except possessing commercial DCI characteristics, has also realized the double-network redundant handoff functionality that industrial control system is necessary.
In addition, by above-mentioned external interface module and main service dispatch module, the foregoing description has also been realized the function of tonic chord of selecting between a plurality of examples of serviced component, and server task can be known the master slave mode of oneself by FLRPC.But in another embodiment, also this function can be placed in the upper layer application and realize.
In addition, present embodiment is divided into Network Interface Module level of abstraction and realizes layer, makes that bottom-layer network communication protocol is replaceable, convenient expansion and cross-platform later on, can shorten the new function development cycle of DCS system, reduce of the impact of new function system reliability, complexity.But this mode is an optional function for purposes of the invention.
In addition, but the Service Instance number flexible configuration of present embodiment, and in order further to improve system reliability, the IO server module can be configured to triple redundance.This also is an optional function, is in the further optimization of satisfying on the basis of basic function.

Claims (13)

1. the RPC system in the dcs, it is characterized in that, two ends at remote procedure call RPC include: be responsible for externally providing unified interface the external interface module, can for the client modules of external interface module accesses and server module, can be by the Network Interface Module of client modules and server module accesses, and can be by the service processing thread pool module of server module visit, wherein:
Described external interface module comprises: RPC calling interface unit, for new RPC call request, obtain configuration parameter by the server task name from configuration file, create an example of client modules, initiate to call and return then to call the result, this example is then reused in the subsequent calls request; RPC service interface unit, use the external interface module be the server end task time, create a Service Instance of server module,, start the reception processing threads of server module then according to the thread pool of the parameter initialization service processing thread pool module that reads;
Described client modules is after receiving call request, the data encapsulation that will send burst in the RPC message sends to server end, and the RPC message that server returns carried out burst reorganization and application layer data is verified, return the RPC caller through the external interface module; And this module is preserved the address and the port of the server task of the same name of all deployment according to configuration parameter, automatically switches to the next one when finding a servers off-line, returns the result of malloc failure malloc when Servers-all all can't be worked to the external interface module;
Described server module comprises the reception processing threads and handles main thread, creates the Network Interface Module example after the reception processing threads starts, and starts the processing main thread; Handle main thread and call Network Interface Module reception RPC request message, from service processing thread pool module, distribute a processing threads, the burst reorganization and the application layer data checking back of finishing RPC message start this processing threads, finish the various operations that thread pool is safeguarded simultaneously;
Described Network Interface Module is used to realize the communication between client modules and the server module;
Described service processing thread pool module is carried out event handling by the processing main thread triggering processing threads wherein of server module, calling the corresponding layer functions of going up handles, and result sent to client modules by Network Interface Module, client modules receive the RPC message that server returns and verify errorless after, carry out burst reorganization and application layer data checking, by after external interface module and IO server module return to the RPC requesting party, discharge thread context then;
Above-mentioned module all needs the parameter of the message of receiving is carried out validity checking.
2. RPC system as claimed in claim 1, it is characterized in that, described Network Interface Module further comprises a network interface abstraction layer module and a network interface realization layer module, wherein: described network interface abstraction layer module is used for that procotol interface that RPC system must be used is abstract to come out, only responsible defining interface, to the complex operations of the concrete procotol of external shield, there is not the specific implementation code; Described network interface realizes that layer module is used for the above-mentioned interface of the described network interface abstraction layer module definition of specific implementation, with the basic communication protocol of seamless replacement RPC system.
3. RPC system as claimed in claim 2 is characterized in that, the interface of described network interface abstraction layer module definition comprises: transmission interface, send data to given server address, port, and return the transmission result; Receiving interface receives data, returns reception result; Remove message interface, can remove and receive all message of waiting in line to handle in the formation, be used to remove out-of-date historical data, restart the interface of a session; Wait for transmission interface, wait for to send data, be used for transmit leg and realize asynchronous call, do not get clogged up to network; And the wait receiving interface, wait for can receiving data up to network, be used for the recipient and realize asynchronous call, do not get clogged.
4. RPC system as claimed in claim 1, it is characterized in that, all also comprise at the two ends of calling one with the main service dispatch module of external interface module bi-directional association, the RPC service interface unit of described external interface module use the external interface module be the server end task time, also create an example of this main service dispatch module, start and select main thread, the form that this selects main thread to call with RPC, obtain the current master slave mode of current online server task of the same name by the external interface module, in a plurality of " server tasks " of the same name, select unique main task.
5. RPC system as claimed in claim 1, it is characterized in that, described external interface module reads configuration parameter from a configuration file, this configuration file has defined some server tasks, and the configuration parameter of each server task comprises: number of threads in the thread pool, ask buffer size, reply buffer size, server address and port numbers on two heterogeneous networks of the Service Instance number of request timed out time of network switching time, acquiescence, network protocol type, deployment and each Service Instance correspondence.
6. RPC system as claimed in claim 1, it is characterized in that, also safeguarded a thread context array in the described server module, the unidirectional thread context of quoting of described service processing thread pool module, reception processing threads in the described server module starts also this thread context array of initialization of back, and the switching of processing threads realizes by this thread context structure fully in processing main thread in the described server module and the thread pool.
7. RPC system as claimed in claim 4, it is characterized in that, also comprise a thread control module, be used for finishing initialization, startup, the safe processing of withdrawing from of server module, service processing thread pool module and main service dispatch module thread.
8. one kind based on the remote procedure calling (PRC) method of system according to claim 1, may further comprise the steps:
(a) the server end task is used the external interface module, create a Service Instance of server module, thread pool according to the static pre-initialize service processing of the parameter that reads thread pool module, start server module then and receive processing threads, this thread creation network interface is realized layer module instance, the context in initialization thread pond starts then and handles main thread, finishes the various attended operations of thread pool simultaneously;
(b) upper application module sends to the external interface module with the RPC message call, carry the server task name, after the external interface module is received, obtain all configurable parameters of this server task from configuration file by the server task name, create an example of client modules, initiate RPC then and call;
(c) client modules is received the data encapsulation that will send after the call request in the RPC call request message, hands over the Network Interface Module of local terminal to send to long-range Network Interface Module through network behind the burst, and waits for return results; Simultaneously, this module is preserved the address and the port of the server task of the same name of all deployment according to configuration parameter, when finding a servers off-line, automatically switch to the next one, when Servers-all all can't be worked, then return the result of malloc failure malloc to the external interface module;
(d) long-range server module receives this RPC call request message by the Network Interface Module that calls homonymy, and from processing threads of service processing thread pool module assignment, the burst reorganization back of finishing this RPC message starts this processing threads;
(e) described service processing thread pool module is carried out event handling, calls corresponding top service process and handles, and result is sent to client modules with the Network Interface Module of form through calling two ends of RPC message;
(f) client modules receive the RPC message that server returns and verify errorless after, carry out burst reorganization and application layer data and verify, by after external interface module and IO server module return to the RPC caller.
9. remote procedure calling (PRC) method as claimed in claim 8, it is characterized in that, described remote procedure call also comprises a main service dispatch module, in the described step (a), after thread pool according to the static pre-initialize service processing of the parameter that reads thread pool module, starting server module receives before the processing threads, also start the main thread that selects of this main service dispatch module, this thread calls form with RPC, regularly obtain the master slave mode of current online server task of the same name by the external interface module, in a plurality of " server tasks " of the same name, select unique main task.
10. remote procedure calling (PRC) method as claimed in claim 9, it is characterized in that, the main thread that selects of described main service dispatch module also obtains the port numbers of current online server task of the same name, select and handle in the following manner when main: A, if book server task current state is " master ", and the other side also is main, then compares port numbers, as the little this locality of then forcing of the other side's port numbers is " from "; B, if book server task current state be " from ", and the other side also be from, it is main putting this locality immediately; C, if book server task current state be " from ", and the other side continues 3 seconds off-lines, it is main putting this locality immediately.
11. remote procedure calling (PRC) method as claimed in claim 8, it is characterized in that, in step (a) before, earlier generate described configuration file automatically according to device configuration information, the configuration parameter of each server task comprises in this configuration file: number of threads in the thread pool, ask buffer size, reply buffer size, server address and port numbers on two heterogeneous networks of the Service Instance number of request timed out time of network switching time, acquiescence, network protocol type, deployment and each Service Instance correspondence; Wherein the number of Service Instance and relevant parameter read and are appended in the above-mentioned configuration file when starting.
12. remote procedure calling (PRC) method as claimed in claim 8, it is characterized in that, among step (a), also derive an IO server module according to the external interface module, this module externally provides read write tag value interface, the third party can directly read and revise the label instantaneous value of the IO service that is deployed to any position by this interface, described step (b) upper application module is that the reading tag instantaneous value interface by this IO server module is initiated a RPC and called, and by this IO server module call request sent to described external interface module.
13. remote procedure calling (PRC) method as claimed in claim 8, it is characterized in that, described each module is all carried out validity checking to parameter wherein when receiving message, wherein client modules and server module also carry out error checking and correction to the data that receive, and this verification comprises to the verification of the RPC message data behind the burst with to the verification of the application layer data after the reorganization.
CNB2006100836292A 2006-05-31 2006-05-31 Remote process transfering method and system in distribution type control system Active CN100401707C (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CNB2006100836292A CN100401707C (en) 2006-05-31 2006-05-31 Remote process transfering method and system in distribution type control system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CNB2006100836292A CN100401707C (en) 2006-05-31 2006-05-31 Remote process transfering method and system in distribution type control system

Publications (2)

Publication Number Publication Date
CN1852209A CN1852209A (en) 2006-10-25
CN100401707C true CN100401707C (en) 2008-07-09

Family

ID=37133679

Family Applications (1)

Application Number Title Priority Date Filing Date
CNB2006100836292A Active CN100401707C (en) 2006-05-31 2006-05-31 Remote process transfering method and system in distribution type control system

Country Status (1)

Country Link
CN (1) CN100401707C (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101969435A (en) * 2010-09-30 2011-02-09 北京新媒传信科技有限公司 Interaction method and system based on SIP (Session Initiation Protocol)-C protocol

Families Citing this family (40)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101236513B (en) 2007-01-30 2012-07-18 阿里巴巴集团控股有限公司 Distributed task system and distributed task management process
US20090076628A1 (en) * 2007-09-18 2009-03-19 David Mark Smith Methods and apparatus to upgrade and provide control redundancy in process plants
CN101599876B (en) * 2008-06-06 2013-08-28 华为技术有限公司 Method and system for transferring service of universal service interface system
US8060560B2 (en) * 2009-08-27 2011-11-15 Net Power And Light, Inc. System and method for pervasive computing
CN101706815B (en) * 2009-12-03 2012-06-27 北京和利时系统工程有限公司 Database equipment and system
CN101795289B (en) * 2009-12-30 2013-01-23 华为技术有限公司 Method, device and system for remote procedure call control
CN102540911B (en) * 2010-12-10 2014-08-27 北京北方微电子基地设备工艺研究中心有限责任公司 Control device and control method for equipment
CN102215181A (en) * 2011-06-13 2011-10-12 航天科工深圳(集团)有限公司 Mass data processing method based on gateway
CN102594891A (en) * 2012-02-17 2012-07-18 中国科学院计算技术研究所 Method and system for processing remote procedure call request
CN102760504B (en) * 2012-07-24 2015-11-25 中广核工程有限公司 The digital control system of the full brand-name computer group of nuclear power station and non-core level control system, method
CN103116520B (en) * 2012-11-02 2016-07-06 深圳键桥通讯技术股份有限公司 Method based on the remote procedure call of TCP/ UDP
CN103246741A (en) * 2013-05-20 2013-08-14 成都市欧冠信息技术有限责任公司 Remote fast call method of distributed database system
CN103347053A (en) * 2013-06-19 2013-10-09 成都市欧冠信息技术有限责任公司 Remote coprocessing procedure call method based on pipeline technology
CN103576600A (en) * 2013-10-23 2014-02-12 北京和隆优化科技股份有限公司 PLC-based optimization station undisturbed and safe switching method
CN103699450B (en) * 2013-12-20 2017-02-15 国云科技股份有限公司 Linux adaptive component communication method
CN105022622B (en) * 2014-04-29 2018-09-28 鼎捷软件股份有限公司 Overtime control unit and remote procedure call method suitable for remote procedure call
CN104168306A (en) * 2014-06-26 2014-11-26 湖北安标信息技术有限公司 Configuration integration method based on distributed system
CN105282128B (en) * 2014-08-29 2018-10-16 中国科学院信息工程研究所 A kind of two-way call method and system based on long connection
CN106161537B (en) * 2015-04-10 2019-12-13 阿里巴巴集团控股有限公司 Method, device and system for processing remote procedure call and electronic equipment
CN106453213B (en) * 2015-08-11 2019-09-17 阿里巴巴集团控股有限公司 Call method and device between a kind of system
CN106598706B (en) * 2015-10-15 2022-11-08 五八同城信息技术有限公司 Method and device for improving stability of server and server
CN105530123A (en) * 2015-12-07 2016-04-27 厦门雅迅网络股份有限公司 Intelligent configuring method of GPS terminal parameters
CN106339229A (en) * 2016-08-31 2017-01-18 虎扑(上海)文化传播股份有限公司 Hybrid development method and hybrid development system for mobile platform
US10725974B2 (en) * 2016-11-22 2020-07-28 Huawei Technologies Co., Ltd. Systems, devices and methods for managing file system replication
CN108733461B (en) * 2017-04-18 2021-09-14 北京京东尚科信息技术有限公司 Distributed task scheduling method and device
CN107832144B (en) * 2017-10-20 2020-07-28 南方电网科学研究院有限责任公司 Distributed parallel computing method and device
CN109992465B (en) * 2017-12-29 2023-05-16 中国电信股份有限公司 Service tracking method, device and computer readable storage medium
CN110300082B (en) * 2018-03-21 2022-03-08 腾讯科技(深圳)有限公司 Interface generation method and device and storage medium
CN108509313B (en) * 2018-03-23 2021-03-19 深圳乐信软件技术有限公司 Service monitoring method, platform and storage medium
CN110971637B (en) * 2018-09-30 2022-02-08 武汉斗鱼网络科技有限公司 Method for calling third-party service interface, scheduler and storage medium
CN109981674B (en) * 2019-04-04 2021-08-17 北京信而泰科技股份有限公司 Remote procedure calling method, device, equipment and medium
CN110262420A (en) * 2019-06-18 2019-09-20 国家计算机网络与信息安全管理中心 A kind of distributed industrial control network security detection system
CN110650188B (en) * 2019-09-19 2022-09-23 深圳昆仑通态科技有限责任公司 Remote control method and system of HMI equipment and computer equipment
CN110830461B (en) * 2019-10-28 2021-08-20 杭州涂鸦信息技术有限公司 Cross-region RPC service calling method and system based on TLS long connection
CN111090534B (en) * 2019-12-24 2023-09-19 天地伟业技术有限公司 Concurrent remote calling system of embedded equipment
CN112565286A (en) * 2020-12-17 2021-03-26 金蝶软件(中国)有限公司 Task response method, device, equipment and storage medium based on RPC access
CN113190292B (en) * 2021-05-26 2023-09-26 的卢技术有限公司 Method and device for remotely executing functions on multiple servers
CN114301896A (en) * 2021-12-31 2022-04-08 高新兴物联科技有限公司 Communication method, communication system, and computer-readable storage medium
CN114347026B (en) * 2022-01-05 2024-01-30 中科开创(广州)智能科技发展有限公司 Robot control method and device based on integrated network and computer equipment
CN116501713B (en) * 2023-06-26 2023-09-22 成都谐盈科技有限公司 Method for realizing distributed file system

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5247676A (en) * 1989-06-29 1993-09-21 Digital Equipment Corporation RPC based computer system using transparent callback and associated method
US5778228A (en) * 1994-08-16 1998-07-07 International Business Machines Corporation Method and system for transferring remote procedure calls and responses over a network
US6237024B1 (en) * 1998-03-20 2001-05-22 Sun Microsystem, Inc. Method and apparatus for the suspension and continuation of remote processes
CN1427361A (en) * 2001-12-17 2003-07-02 北京中视联联合软件有限公司 Method of driving bottom equipment based on customer/service apparatus structure
CN1509434A (en) * 2000-08-07 2004-06-30 国际商业机器公司 Method, system and program for invoking stoved procedures and accessing stroed procedure data

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5247676A (en) * 1989-06-29 1993-09-21 Digital Equipment Corporation RPC based computer system using transparent callback and associated method
US5778228A (en) * 1994-08-16 1998-07-07 International Business Machines Corporation Method and system for transferring remote procedure calls and responses over a network
US6237024B1 (en) * 1998-03-20 2001-05-22 Sun Microsystem, Inc. Method and apparatus for the suspension and continuation of remote processes
CN1509434A (en) * 2000-08-07 2004-06-30 国际商业机器公司 Method, system and program for invoking stoved procedures and accessing stroed procedure data
CN1427361A (en) * 2001-12-17 2003-07-02 北京中视联联合软件有限公司 Method of driving bottom equipment based on customer/service apparatus structure

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101969435A (en) * 2010-09-30 2011-02-09 北京新媒传信科技有限公司 Interaction method and system based on SIP (Session Initiation Protocol)-C protocol
CN101969435B (en) * 2010-09-30 2013-02-20 北京新媒传信科技有限公司 Interaction method and system based on SIP (Session Initiation Protocol)-C protocol

Also Published As

Publication number Publication date
CN1852209A (en) 2006-10-25

Similar Documents

Publication Publication Date Title
CN100401707C (en) Remote process transfering method and system in distribution type control system
CN101409614B (en) Data synchronization method, system and equipment
CN101305551B (en) Method, system, network node and device for the construction and execution of a distributed workflow in a communication system
CN101252471B (en) Distributed automatization test system and method
CN101262486B (en) Modbus bus analysis system based on built-in platform
CN102196039B (en) Cloud-computing-based multi-robot system and implementation method thereof
CN104636868A (en) Application management system for nuclear power station equipment maintenance information and application method thereof
CN102185716B (en) Universal management method and system for communication equipment
CN105760272B (en) Monitoring backstage business customizing method and its system based on plug-in unit
CN105184575B (en) Transaction system construction method, transaction flow control device and third party transaction platform
CN101382893B (en) On-line assembling method for component based on Web service
CN105830052A (en) Method for an integrated data handling for the engineering and operation of a plant
CN104579792A (en) Architecture and method for achieving centralized management of various types of virtual resources based on multiple adaptive modes
CN107807545A (en) The adjustment method and device of a kind of remote control terminal
CN110138876A (en) Task deployment method, apparatus, equipment and platform
CN101795206A (en) Method and device for realizing SNMP agent on distributed equipment
CN107450993A (en) A kind of data interactive method of distributed IEC61850 communication components
CN101909013B (en) Information exchange device capable of dynamic configuration
CN113312059B (en) Service processing system, method and cloud native system
CN103051502A (en) System and method of self-organized networking and flexible accessing of intelligent power equipment in electricity utilization community
CN106095424B (en) The treating method and apparatus for calling of trading in application component
CN102064602A (en) Operating method of B/S framework networked electronic simulation drawing board system
Prist et al. Cyber-physical manufacturing systems: An architecture for sensor integration, production line simulation and cloud services
WO2020156886A1 (en) Dynamic deploying a mom module across a plurality of layers
CN103914339A (en) Server management system and server management method

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
TR01 Transfer of patent right

Effective date of registration: 20211129

Address after: Room 1613, 6 / F, building 1, yard 2, Desheng Middle Road, Beijing Economic and Technological Development Zone, Daxing District, Beijing 100176

Patentee after: Beijing Helishi Control Technology Co.,Ltd.

Address before: 100096, No. 10, building materials Road, Haidian District, Beijing, Xisanqi

Patentee before: BEIJING HOLLYSYS Co.,Ltd.

TR01 Transfer of patent right