A method for collecting and storing data

Abstract: A data collection and storage method is disclosed wherein data is stored in a sequence of files (42) in time-serial fashion. Data is first stored in a temporary file (40) following which the temporary file (40) is redesignated so as to receive the name of one (n) of a series of permanent storage files (42). This arrangement allows the permanent storage files (42) to be read out while data continues to be collected, eliminating the bottleneck which heretofore existed in the art.

Description: The present invention relates to a method of storing data employing an auxiliary storage of the type having a comparatively small capacity. In a conventional programmable controller (referred to as a PC hereinafter) monitoring equipment is generally used to monitor a controlled object device and collect input/output data flowing between the PC and the control device which data is related to the control process. The collected data is inputted to the monitoring equipment from or via the PC and stored in an auxiliary storage. The document EP-A-0 059 829 presents a data storage transfer system using buffer storage for controlling the flow of data. It also shows the method of recovering storage space using a least recently used algorithm. Another prior art document EP-A-0 166 402 shows an input/output system for an industrial control system where input data from I/O modules is pushed around an I/O ring and subsequently into the processor controlling the system. Fig. 5 is a block diagram showing the set-up of a PC and its monitoring equipment. In Fig. 5, numeral 1 designates the PC, which comprises a central processing unit (CPU) 2, a communication interface (I/F) unit 3, an input unit 4 and an output unit 5. Numeral 6 designates an object device to be controlled by means of PC 1 and which is connected to the PC 1 by a cable. Numeral 8 designates the monitoring equipment; 9 a communication means; 10 a CPU; 11 an operation range memory; 12 a system program memory; 13 a time measuring means; 14 an auxiliary storage; 15 a keyboard used as an input means, and 16 a display unit. The monitoring equipment 8 comprising the aforementioned elements 9-16 is connected to the PC 1 by a connecting cable 17. Fig. 6 is a flow chart showing the schema of the system program of the monitoring equipment 8, which flow chart is performed by the CPU 10, which accesses the system program stored in the system memory 12 shown in Fig. 5. The system program performs the collection and compilation of the input/output data related to the control process at the time of monitoring the object device 6 by means of the monitoring equipment. Figs. 7 and 8 are flow charts showing in detail the processing steps of data collection and file compilation in the flow chart shown in Fig. 6. Fig. 9 is a diagram showing the relation of the respective files stored in the auxiliary storage 14 of Fig. 5. In Fig. 9, 43 designates a collected data storage file which stores in a time series manner data collected at predetermined times. In each file 43, the data 45 indicates the collection time and 46 indicates the collected data obtained through the PC 1 and stored in order of collection. Numeral 44 designates a compilation file in which data extracted from the files 43 is stored. In the compilation file 44, data 45 indicating the collection time and the collected data 46 obtained through the PC are stored. The operation of this system will now be explained. In Fig. 5 the PC 1 computes input information concerning the object device 6, which has been input via the input unit 4, by means of the CPU unit 2 and controls the object device 6 via the output unit 5 according to the computed results. The results obtained by the computation of the CPU unit 2 are transmitted to the communication means 9 of the monitoring equipment 8 through the communication I/F unit 3 and the connection cable 17. The monitoring equipment 8 writes the data received through the communications means 9 in the operating range memory 11 and sequentially processes the data by means of the CPU 10 according to the system program stored in the system program memory 12. In Fig. 6 the first step in the procedure is the setting of the conditions (timing, a certain data value, etc.) which will trigger data collection or designate the data which will be collected. Then, in step 201, data output via interface 3 is received and written in the work area memory 11 through the communication means 9. In step 202, it is decided whether the trigger condition(s) of data collection are established or not, for example whether the time measuring means 13 reaches a given time or not, whether certain conditions on the PC data are met or not and so on. If so, the process of data collection is started in step 203. Step 203 is shown in detail in Fig. 7. When started in step 203, the process of reading out the appointed data from the PC is performed in step 204 and it is decided in step 205 whether it is possible to carry out file access to the collected data storage file 43 stored in the auxiliary storage 14. For example, if the collected data storage file 43 is not then being read out, file access is judged to be possible and the collected data storage file 43 is accessed so as to write the read out data 46 together with the collection time data thereinto. As shown in Fig. 9, the collection time data 45 and the read out collected data 46 are written and stored in the storage file 43 in a time serial manner. Then in step 207, it is decided whether a writing error was generated owing to, for example, lack of capacity in the auxiliary storage 14 at the time of file writing. If writing cannot be performed owing to lack of capacity, it is necessary for the operator to delete a portion of collected data storage files 43. If the given conditions are not established in the respective decisions of steps 205 and 207, an error process is performed in step 208 and the start step 203 for the data collection process is completed in step 209. Then in step 210, it is decided whether file compilation is required with respect to the collected data storage files 43, by checking the input means 15. When it is , the process of file compilation is started in step 211. Step 211 is the process of file compilation, shown in detail in Fig. 8. Upon starting this process in step 211, range setting is performed in step 212 so as to set the extent to which the content of the collected data storage file 43 will be stored as a compilation file 44. This is carried out by, for example, appointing the start and end collection times. A search for the conditions set by the range setting process is performed in step 213. Subsequently, step 214 performs the read process for reading out data from the collected data storage file 43, and step 215 performs the writing process to write the data read out in step 215 to form the compilation file 44 so as to complete the file compilation process. It is decided in step 217 whether monitoring is completed or not. In case the completion condition is not established, the collected data is displayed by the display unit 16 in step 218 and the process returns to step 201 again so as to repeat the operation, starting from the process of reading out the data received from PC 1 in the operating range. If the completion condition is established in step 217, the monitoring completion process is performed in step 219 so as to complete the series of processes in step 220. In the conventional data collection method, problems arise because the size of the collected data storage files 43 is increased by carrying out additional writing every time data is collected. It is necessary for the operator to know the residual storage capacity of the auxiliary storage 14 which stores the above-mentioned collected data storage files and to carry out file deletion when residual capacity becomes small. Also, it is impossible to write the collected data into a collected data storage file when making up a compilation file because the collected data storage file is being read out when the compilation file is being made up. The present invention is intended to solve the aforementioned problems and has as its object the provision of a data collection method capable of collecting data without the need for concern about the lack of capacity of an auxiliary storage and capable of collecting and storing data even while a compilation file is being made up. According to the present invention there is provided a method of collecting and storing data comprising the provision of a storage means with a storage capacity corresponding to a predetermined number of data storage files, and characterised in that a series of data files are created by first storing collected data in a temporary file when data collection is carried out followed by changing the temporary file into one of said storage files by a renaming process; and in that said series of data files is renewed by deleting the files of said series in order from the oldest file each time data collection is carried out once said data storage files have reached said predetermined number. Preferably, the deleted file is designated as the next temporary file. In the invention, a storage means is provided with a storage capacity corresponding to a predetermined number of collected data storage files, and capable of storing collected data. A temporary file is made up to store temporarily the collected data whenever the aforementioned data is collected. The temporary file is subsequently changed into a collected data storage file, so as to create a series of collected data storage files. When the collected data storage files reach the predetermined number, the file contents are deleted, in order, from the oldest data file every time data collection is carried out so as to renew the series of files. The temporary file storing the newest collected data is changed to the data storage file. The present invention will now be described by way of example with reference to the accompanying drawings, in which: Fig. 1 is a schematic flow chart of a system program for a PC monitor, illustrating one embodiment of a data collection method according to the present invention; Fig. 2 is a flow chart of a data collection process shown in Fig. 1; Fig. 3 is a flow chart of a file compilation process shown in Fig. 1; Fig. 4 is a diagram showing the relationship between respective files stored in an auxiliary storage, according to one embodiment of the present invention; Fig.5 is a block diagram showing the construction of monitoring equipment for the PC, the hardware being common to both the present invention and conventional methods; Fig. 6 is a schematic flow chart of the system program of a conventional monitor; Fig. 7 is a flow chart of a data collection process shown in Fig. 6; Fig. 8 is a schematic flow chart of a file operation process shown in Fig. 7; and Fig. 9 is a diagram showing the relationship between respective files stored in auxiliary storage. One embodiment of a method according to the present invention will be explained with reference to the drawings. In this embodiment, since the hardware of the PC 1 and the monitoring equipment 8 is similar to the conventional structures shown in Fig. 5, a detailed explanation thereof will be omitted. Components designated by the same symbols as in the prior art arrangement represent the same or corresponding elements. Fig. 1 is a flow chart showing the schema of a system program for the monitoring equipment 8 employing the method of the present invention. In Fig. 1, the collection and compilation of input/output data related to control processes of the object device 6 controlled by the PC 1 are carried out. Fig. 2 and Fig. 3 are flow charts showing in detail the process steps of the data collection process and the compilation process in the flow chart shown in Fig. 1, respectively. Fig. 4 is a diagram showing the respective files and the relationship therebetween, which files are stored in the auxiliary storage 14 of the monitoring equipment 8 shown in Fig. 5. In Fig. 4 symbol 40 designates a temporary file, symbol 41 indicates a series of files comprising "N" collected data storage files 42, and symbol 44 is a compilation file made up from all or part of the series of the collected data storage files 41, allowing for the keeping or reusing of the data. The temporary file 40 and the collected data storage files 42 of N in number are capable of storing data to be collected at a given time, and the number N is suitably selected such that the required memory space does not exceed the range of the storage capacity of the auxiliary storage 14. The collected data comprises the input/output data 46 of the control process for the controlled object device 6, transmitted from the PC 1 and collected, along with data showing the collection time. The operation of this system will now be explained. In Fig. 5 the whole of the output information sent from the PC 1 to the object device 6 and the input information sent from the object device 6 to the PC are transmitted from the PC to the monitoring equipment 8. The processing procedures before the monitoring equipment receives this information are the same as in the conventional system. In the method of the present invention, as shown in Fig. 4, the auxiliary storage 14 is provided in advance with storage files 42 numbering N together with one temporary file 40, which all hold dummy data. The collected data storage files 42 are numbered n = 1 through N. The collected data 46 (the information transmitted from the PC 1) is supplemented by data obtained from the time measuring means 13 to indicate the time when the aforementioned data is transmitted and stored in the temporary file 40. Since transmission of data from the PC to the monitoring equipment 8 is carried out intermittently, the temporary file 40 will be made to store the data of one transmission. Subsequently, the dummy content of the n = 1 file is deleted and the temporary file 40 is changed to, i.e. becomes, the n = 1 data storage file by changing its file name. A new temporary file 40 is designated and stands by for the next data transmission from the PC. By repeating the above-mentioned operations every time data is transmitted from the PC, a portion of the dummy data is deleted (eventually it is all deleted) and the then temporary file 40 is changed into one of the collected data files 42, so as to make up a series of files. When the number of collected data storage files 42 reaches N, the operation is returned to the first of the series of files 41 and the previously collected data starts to be deleted in order from the top of the file (the oldest data). The deleted file's name is then used to designate the temporary file, whereby the series of files 41 is renewed. If the stored collected data 46 is read out for reuse and compiled, the numbers of the first and final collected data storage files 42 storing the desired data are searched out and the data is read out and stored in a compilation file 44. The compilation file 44 can be freely located in either the auxiliary storage 14 or in another storage means. The operations described above will now be explained in detail with reference to the flow charts shown in Figs. 1 through 3. In Fig. 1, step 100 starts the operation and in step 101, the value "n" is set to the number of the collected data storage file in which writing was carried out in the last operation, assuming that there was one, during the initial process carried out when the system program for the monitoring equipment 8 is initiated. File capacity is also secured during this step. When data is to be collected for the first time, one temporary file 40 and collected data storage files numbering N are made up with dummy information in the auxiliary storage 14. The data storage files are numbered from n = 1 to N so as to make up a series of files 41. As an initial value, the number n = 0 is set. At step 100A, data collection trigger conditions are set. These conditions may include, for example, specific data values, specific time windows, and other data or memory-specific events. At step 102, the data transmitted from the PC 1 and received by the monitoring equipment 8 in the work area memory 11 is read and step 103 judges whether the trigger condition(s) for data collection are established or not. As mentioned above, the trigger conditions may include whether the time measuring means 13 reaches an appointed time, whether read-out conditions for the data of the PC read into the operating range memory 11 are established, and so on. If the trigger conditions for data collection are established, step 104 decides whether n = N, namely, whether collected data has been stored in the final file 42 of the series. If n = N is not established, step 105 carries out an increment process (n = n + 1). If n = N step 106 sets n = 1 and performs an initialization process so that the next batch of collected data will be stored at the leader position in the series of files. Step 107 starts the data collection process and is shown in Fig.2 in detail. When starting step 107, step 108 performs the reading out of the appointed data from the PC and step 109 performs the writing process for writing the collected data, which comprises the read out data 46 and data 45 indicating the collection time, into a temporary file 40. In step 110 it is decided whether data storage file No. n is currently being read out , e.g. to form part of a compilation file 43. If storage file n is currently in the read-out mode, step 111 inserts a waiting period following which the operation returns to step 110. Generally, since the file reading process is faster than the writing process, the monitoring equipment is not adversely affected by the short wait. When step 110 judges that the given file is not being read-out, step 112 deletes the collected data (either dummy data or previously collected data) of storage file n and changes the file name of the temporary file 40 to that of the data storage file n. The operation then advances via end step 113 to step 114, (Fig. 1). In step 114 it is decided whether file compilation is required or not by checking the inputs from input means (Keyboard) 15. If required, step 115 starts the file compilation process. The file compilation process, is shown in detail in Fig. 3. In Fig. 3 on starting the process in step 115, step 116 determines the range of the data (i.e. the range of file numbers from which to obtain data) to be collected and stored in a compilation file 44. For example, the range setting process may determine the first and last collection time of interest, and the corresponding file numbers. Then steps 118 through 120 perform a search process to locate and read data from the first through to the final file (whose numbers are between 1 and N) which define the determined range. That is, step 118 sets the desired leading or starting data storage file number equal to a variable m, and subsequently step 119 decides whether the variable m is larger than the final number. If the variable m is smaller then the final number, step 120 performs a read-out process to read out collected data storage file m, and subsequently step 121 performs a write process to write the read out data into compilation file 44. Thereafter, in step 122 an incrementation process m = m + 1 is performed, and the process returns to step 119 so as to judge again whether variable m is larger than the final number. When m is finally larger than the final number in step 119, the operation is completed (step 123) and the flow advances to step 124 in Fig. 1. Step 124 decides whether monitoring is completed. If completion conditions are not established, step 125 causes the display of the collected data on the display unit and the operation returns to step 102 so as to repeat the above processes. If monitoring completion conditions are established in step 124, step 126 performs monitoring completion processes and the operation is terminated in step 127. As noted above, according to the invention the storage means is provided with a storage capacity corresponding to a predetermined number of collected data storage files, and a series of files is made up by first making a temporary file, storing the collected data, and then changing the temporary file to a collected data storage file, by changing the file designation. The series of files are renewed in order from the oldest file after the collected data storage files reach the predetermined number. Advantageously, the compilation of collected data can be carried out while data collection is carried out and a data storage method can be obtained in which data collection is never adversely affected by the lack of storage capacity.

Claims: A method of collecting and storing data, comprising the provision of a storage means (14) with a storage capacity corresponding to a predetermined number N of data storage files and characterised in that a series of data files (42) is created by first storing collected data in a temporary file (40) when data collection is carried out followed by changing the temporary file (40) into one (n) of said storage files (42) by a renaming process; and in that said series of data files (42) is renewed by deleting the files (42) of said series in order from the oldest file each time data collection is carried out once said data storage files (42) have reached said predetermined number N. A method as claimed in Claim 1, characterised in that the deleted file is designated as the next temporary file (40). A method as claimed in Claim 1 or Claim 2, characterised in that the storage means (14) is capable of storing data collected at predetermined times. A method as claimed in any one of Claims 1 to 3, characterised in that the read-out status of one of said data storage files is checked before changing the name of said temporary file (40) to that of said one data storage file (n), and in that a waiting period is allowed if said one data storage file (n) is currently being read out. A method as claimed in any one of Claims 1 to 4, characterised in that the temporary file (40) is changed into a data storage file by a renaming process after deleting the contents of the data storage file. A method as claimed in any one of Claims 2 to 4 when dependent on Claim 2, characterised in that the temporary file (40) is changed into a data storage file (42) by a renaming process after checking the read-out status of the data storage file (n) whose name will be assumed by the temporary file and deleting the contents of this file. A monitoring system for an object device collecting and storing data comprising a central processing unit (10) and a storage unit (14) with a storage capacity corresponding to a predetermined number N of data storage files, and characterised in that the central processing unit (10) is set up to operate by creating a series of data files (42) in the storage unit by first storing collected data in a temporary file (40) when data collection is carried out followed by changing the temporary file (40) into one of said storage files (42) by a renaming process; and in that said series of data files (42) is renewed by deleting the files (42) of said series in order from the oldest file each time data collection is carried out once said data storage files (42) have reached said predetermined number N.

Inventors: ITO TOSHIRO C O MITSUBISHI DEN, ITO, TOSHIRO, C/O MITSUBISHI DENKI MEKATORONIKUSU
Applicants: MITSUBISHI ELECTRIC CORP, MITSUBISHI DENKI KABUSHIKI KAISHA
Application year: 1990
Main classification: G06F5
IPC codes: G05B19, G06F17