Abstract:
An automatic control system includes a host, a network gateway operatively connected to the host, and a plurality of programmable logic controllers (PLC) operatively connected to the network gateway. The network gateway includes a controller and registers. The controller backups data from specific addresses in the PLC to the registers sequentially for each predetermined time period. When the controller receives an accessing command from the host and the accessing command designates the specific addresses, the controller sends the data, which is corresponding to the designated address and already stored in the registers, to the host. The accessing efficiency can be enhanced because part of data in the PLC is cached in the network gateway.

Description:
BACKGROUND OF THE INVENTION 
       [0001]    1. Field of the Invention 
         [0002]    The present invention relates to an automatic control system, especially to an automatic control system with network gateway and method for operating the same. 
         [0003]    2. Description of Prior Art 
         [0004]    The conventional electrical control system generally uses relay as control switch. However, the system need re-manufacture when the design is changed. Moreover, the relay-based control system has the problems of poor contact, abrasion, and bulky size. Therefore, the relay-based control system has high cost, low reliability and maintenance difficulty. To overcome above drawbacks, DEC proposed the concept of Programmable logic controller (PLC) in 1969 to replace the logic function, timing function and counting function in relay control. Moreover, PLC has the additional advantages of versatile control, expansion ability and easy maintenance. 
         [0005]    The basic internal components of PLC include CPU module, input module and output module. The CPU of PLC reads input signals from the input module, fetches control commands from memory thereof and performs the control commands by ALU therein. Afterward, the PLC outputs control signals through the output module to external devices to control the external devices. 
         [0006]    As the fast development of network technology and computer hardwire, in current automatic control system, a host computer can operate or access data in a PLC through a broad-band network such as a broad-band Internet. 
         [0007]      FIG. 1  shows the schematic view of a related art automatic control system, wherein user operates a host computer  10   a  to access data in a PLC  30   a  through a network gateway  20   a . The host computer  10   a  can reach the network gateway  20   a  through high speed network such as ADSL or T1 network. The network gateway  20   a  accesses the PLC  30   a  through low speed interface such as RS-232C, RS-422, or RS-485). In other word, the PLC is generally connected to the network gateway  20   a  through legacy low speed serial network. Therefore, network congestion is liable to occur when the host computer  10   a  wants to access lots of PLCs. In a related art system, Anybus provides a memory region in the network gateway  20   a , which has data exchange with devices in sub-network, namely, the PLCs. However, the host computer needs to know the mapping relationship between the address in the network gateway and the address of data in the PLC  30   a . It is complicated for the user of the host computer  10   a  to know the setting. 
         [0008]    US patent publication 2006/0041630 discloses a network gateway between an Ethernet and low speed serial network. The network gateway is used to scan the input and output status of the PLCs at remote sides and cannot enhance data accessing efficiency. 
       SUMMARY OF THE INVENTION 
       [0009]    It is an object of the present invention to provide an automatic control system with network gateway to enhance data accessing efficiency and method for operating the same. 
         [0010]    Accordingly, the present invention provides an automatic control system, which includes a host, a network gateway operatively connected to the host, and a plurality of programmable logic controllers (PLC) operatively connected to the network gateway. The network gateway includes a controller and registers. The controller backup data from specific addresses in the PLC to the registers sequentially for each predetermined time period. When the controller receives an accessing command from the host and the accessing command designates the specific addresses, the controller sends the data, which is corresponding to the designated address and already stored in the registers, to the host. The accessing efficiency can be enhanced because part of data in the PLC is cached in the network gateway. 
     
    
     
       BRIEF DESCRIPTION OF DRAWING 
         [0011]    The features of the invention believed to be novel are set forth with particularity in the appended claims. The invention itself however may be best understood by reference to the following detailed description of the invention, which describes certain exemplary embodiments of the invention, taken in conjunction with the accompanying drawings in which: 
           [0012]      FIG. 1  shows the schematic view of a related art automatic control system. 
           [0013]      FIG. 2  shows a schematic view of the automatic control system according to a preferred embodiment of the present invention. 
           [0014]      FIG. 3A  shows the flowchart of data refreshing operation performed by the controller. 
           [0015]      FIG. 3B  shows the flowchart of data accessing operation performed by the controller. 
           [0016]      FIGS. 4A and 4B  show the arrangement of registers in the network gateway. 
           [0017]      FIG. 5  demonstrates the operation flow of the method of the present invention for operating a network gateway in an automatic control system. 
       
    
    
     DETAILED DESCRIPTION OF THE INVENTION 
       [0018]      FIG. 2  shows a schematic view of the automatic control system according to a preferred embodiment of the present invention. The automatic control system comprises a host computer  10 , a network gateway  20  and a plurality of PLCs  30 A- 30 N. The host computer  10  is operatively connected to the network gateway  20  through a high speed network such as ADSL or T1 network. The network gateway  20  is operatively connected to the plurality of PLCs  30 A- 30 N through low speed serial interfaces such as RS-232C, RS-422, or RS-485. The network gateway  20  comprises a controller  200 , a high-speed network port  202 , a low-speed network port  204  and a set of registers  40  (only one is shown), wherein the high-speed network port  202 , the low-speed network port  204  and the registers  40  are electrically connected to the controller  200 . The PLCs  30 A- 30 N can control peripheral elements such as sensor and store sensed parameters in specific memory thereof. The host computer  10  fetches the sensed parameters of the PLCs  30 A- 30 N through the network gateway  20 . The host computer  10  generally has better processing ability and can perform process on the fetched sensed parameters. 
         [0019]    The controller  200  is adapted to perform a data refreshing and accessing process. In the data refreshing process, the controller  200  sequentially updates data in specific memory of the PLCs  30 A- 30 N to specific addresses in the registers  40  for every first predetermined time interval (for example, 30 ms). In the data accessing process, the controller  200  further checks whether the host computer  10  has issued accessing command for every second predetermined time interval (for example, 1 ms). 
         [0020]      FIG. 3A  shows the flowchart of data refreshing operation performed by the controller  200 . 
         [0021]      FIG. 3B  shows the flowchart of data accessing operation performed by the controller  200 . As shown in  FIG. 3A , the controller  200  performs the data refreshing operation for every first predetermined time interval (for example, 30 ms) in step S 10 , and the controller  200  fetches data from specific memory in the PLCs  30 A- 30 N in step S 12 . Afterward, the controller  200  updates the registers  40  thereof corresponding to the fetched data in step S 14 . As shown in  FIG. 3B , the controller  200  performs the data accessing operation and checks whether the host computer  10  has issued an accessing command for every second predetermined time interval (for example, 1 ms) in step S 20 . If the controller  200  detects that the host computer  10  has issued an accessing command in step S 20 , then the controller  200  checks whether the accessing commands is for accessing internal register within the network gateway  20  in step S 22 . If the accessing commands is for accessing internal register within the network gateway  20  in step S 22 , then data associated with the accessing command is sent to the host trough the high speed network in step S 28 . If the accessing commands is not for accessing internal register within the network gateway  20  in step S 22 , then the controller  200  checks whether the data to be accessed is already stored in the register  40  in step S 24 . If true, then the data associated with the accessing command is sent to the host trough the high speed network in step S 28 . If false, then the controller  200  fetches the data corresponding to the accessing command and intended to access the PLC from one of the PLC  30 A- 30 N in step S 26 . Afterward, the fetched data is sent to the host trough the high speed network in step S 28 . 
         [0022]      FIGS. 4A and 4B  show the arrangement of registers  40  in the network gateway  20 . According to the present invention, the register  40  can be classified as bit register MB and word register MW, which monitor the data of bit element and word element, respectively. 
         [0023]    As shown in  FIG. 4A , the bit registers MB mainly comprises four sections: the first monitoring number storage  40 A (including register MB 0 ), the first station number storage  40 B (including registers MB 1 -MB 200 ), the first monitoring value storage  40 C (including registers MB 201 -MB 213 ), and the first monitoring status storage  40 D (including registers MB 214 -MB 226 ). 
         [0024]    The first monitoring number storage  40 A is used to record the number of PLC under monitoring (refreshing) and the option for enabling cache function. When bit  15  in the register MB 0  of the first monitoring number storage  40 A is logical one, the cache mode is enabled. When cache mode is enabled, the controller  200  checks whether the data corresponding to the accessing command is already present in the bit register MB, namely, the step S 24  is performed. When bit  15  in the register MB 0  of the first monitoring number storage  40 A is logical zero, the cache mode is disabled. When cache mode is disabled, the controller  200  does not check whether the data corresponding to the accessing command is already present in the bit register MB, namely, the step S 24  is not performed. Moreover, when the number of monitored PLC stored in the first monitoring number storage  40 A exceeds a predetermined range, the cache mode is automatically disabled. For example, if the number of monitored PLC is set to be 1 to 16 units, then the cache mode is automatically disabled when the actual number of monitored PLCs is less than one or larger than sixteen. 
         [0025]    The first station number storage  40 B is used to store the station number of a PLC under monitoring; and the memory address for a monitored device associated with the PLC with specific station number. For example, the registers of odd number in the first station number storage  40 B can be used to record the station number of a PLC. The registers of even number in the first station number storage  40 B can be used to record the memory address in a PLC with specific station number, wherein the memory address is used to store information from a sensor device controlled by the PLC. 
         [0026]    The first monitor value storage  40 C is used to store the data (sensed parameter) of a sensor device controlled by a PLC. The first monitor status storage  40 D is used to store the monitoring status such as whether refreshing operation is successful. 
         [0027]    As shown in  FIG. 4B , the word register MW mainly comprises four sections: the second monitoring number storage  40 E (including register MW 0 ), the second station number storage  40 F (including registers MW 1 -MW 200 ), the second monitoring value storage  40 G (including registers MW 201 -MW 213 ), and the second monitoring status storage  40 H (including registers MW 214 -MW 226 ). 
         [0028]    The second monitoring number storage  40 E is used to record the number of PLC under monitoring and the option for enabling cache function. When bit  15  in the register MW 0  of the second monitoring number storage  40 E is logical one, the cache mode is enabled. When cache mode is enabled, the controller  200  checks whether the data corresponding to the accessing command is already present in the word register MW, namely, the step S 24  is performed. When bit  15  in the register MW 0  of the first monitoring number storage  40 E is logical zero, the cache mode is disabled. When cache mode is disabled, the controller  200  does not check whether the data corresponding to the accessing command is already present in the word register MW, namely, the step S 24  is not performed. Moreover, when the number of monitored PLC stored in the second monitoring number storage  40 E exceeds a predetermined range, the cache mode is automatically disabled. For example, if the number of monitored PLC is set to be 1 to 16 units, then the cache mode is automatically disabled when the actual number of monitored PLCs is less than one or larger than sixteen. 
         [0029]    The second station number storage  40 F is used to store the station number of a PLC under monitoring; and the memory address for a monitored device associated with the PLC with specific station number. For example, the registers of odd number in the second station number storage  40 F can be used to record the station number of a PLC. The registers of even number in the second station number storage  40 F can be used to record the memory address in a PLC with specific station number, wherein the memory address is used to store information from a sensor device controlled by the PLC. 
         [0030]    The second monitor value storage  40 G is used to store the data (sensed parameter) of a sensor device controlled by a PLC. The second monitor status storage  40 H is used to store the monitoring status such as whether refreshing operation is successful. 
         [0031]      FIG. 5  demonstrates the operation flow of the method of the present invention for operating a network gateway in an automatic control system. With reference to  FIG. 4A  and the right portion of  FIG. 5 , the network gateway  20  sequentially updates the content in the bit registers MB according to the station number and the device address stored in the first station number storage  40 B. As shown in  FIG. 5 , each of the registers MB 001 , MB 003 , and MB 005  has the stored value of 0x0001, which indicates the station number 0x0001 and is associated with PLC  30 A. The contents of the registers MB 002 , MB 004 , and MB 006  are 0x1000, 0x1001 and 0x1002, respectively. It means that the addresses 0x1000, 0x1001 and 0x1002 in the PLC  30 A need refreshing operation to store in corresponding portion in the bit registers MB (namely updating the contents in the bit registers MB). 
         [0032]    With reference to the left portion of  FIG. 5 , the commands issued from the host computer  10  is processed individually. The first command is intended to access the address 0x000 in the PLC  30 A under monitoring (with station number 0001). The address 0x000 in the PLC  30 A is subjected to refreshing operation by the network gateway  20 , and the data in the address 0x1000 in the PLC  30 A is already refreshed in previously fetching operation (see the top right part of  FIG. 5 ). Therefore, as shown in  FIG. 4A , the new data 0x0001 is stored in corresponding register MB 201 . 
         [0033]    With reference again to the left portion of  FIG. 5 , the third accessing command issued from the host computer  10  is intended to access the address 0x20FF of the PLC  30 A (with station number 0001). The address 0x20FF of the PLC  30 A is not under refreshing operation according to the record in the bit registers MB. Therefore, the network gateway  20  firstly reads the data in the address 0x20FF of the PLC  30 A, namely, the data 0x5124, through low speed interface, and then sends the data 0x5124 to the host computer  10  through high speed network. 
         [0034]    As shown in  FIG. 5 , the network gateway  20  sequentially updates the registers thereof by reading data from specific addresses of specific PLCs, where the information of the specific addresses and the specific PLCs is recorded in the registers MB (corresponding to bit element) or registers MW (corresponding to word element). When the host computer  10  is intended to access the PLC, the network gateway  20  checks whether the data is already stored therein. When the desired data is already present in the registers of the network gateway  20 , the network gateway  20  sends the data to the host computer  10  through high speed network and the data fetching operation from low speed interface can be eliminated. Therefore, the network monitoring efficiency can be enhanced. 
         [0035]    Although the present invention has been described with reference to the preferred embodiment thereof, it will be understood that the invention is not limited to the details thereof. Various substitutions and modifications have suggested in the foregoing description, and other will occur to those of ordinary skill in the art. Therefore, all such substitutions and modifications are intended to be embraced within the scope of the invention as defined in the appended claims.