This application claims priority to Taiwanese Application Serial No. 107136609, filed on Oct. 17, 2018. The entirety of the above-mentioned patent application is hereby incorporated by reference herein and made a part of this specification.
This disclosure relates to a server and application techniques thereof, and, more particularly, to a server with resource adjustment control and a resource adjustment control method.
Considering more and more equipment connected to the Internet, how to deal with a large amount of data in the face of unexpected hardware resources in the case of limited hardware resources, resource allocation and data processing to reduce the extent of information distortion is becoming an important developing issue.
In addition, in the conventional OPC UA (OPC Unified Architecture) industrial transmission protocol, equipment data can be sampled and stored only the sampler (sampling), deadband filter and queue. The existing data overflow mechanism of the queue is FIFO (First-In-First-Out) or FILO (First-In-Last-Out) method, which is likely to cause blank of data in a certain period time and results in erroneous data determination.
Therefore, how to solve the above challenges has become one of the major research topics for those skilled in the art.
The present disclosure provides a server and a resource adjusting and controlling method that can regulate space or data of at least one queue.
In an embodiment of the present disclosure, a server comprises: a plurality of queues, each of which has its respective queue size; and one or more processors configured for executing a plurality of instructions to perform a resource adjusting and controlling process, including actuating: a plurality of monitoring units, each of which monitors one of a plurality of monitoring tags and corresponds to one of the plurality of queues, wherein each of the plurality of queues is configured for storing data of the plurality of monitoring tags and timestamps of the data; a resource monitoring device configured for monitoring usage statuses of the plurality of queues corresponding to the plurality of monitoring units and determining if one of the monitoring units performs a queue space adjustment based on the usage statuses when new data of the monitored monitoring tags is obtained, wherein the one of the monitoring units adds the obtained new data to a corresponding one of the plurality of queues if the queue space adjustment is not performed; a queue space adjuster is configured for determining whether there is a sufficient space for the queue space adjustment, wherein if the queue space adjustment is performed and one or more of the plurality of queues has a space that is adjustable, the space of the one or more of the queues is adjusted, to enable the obtained new data to be added to the adjusted one or more of the plurality of queues; and a data reducer is configured for reducing data stored in the corresponding one of the queues of the one of the monitoring units, if the queue space adjustment is performed and no space in the queues is adjustable, based on the timestamps of the data stored in the corresponding one of the queues and a position of the data stored in the corresponding one of the queues, to enable the obtained new data to be added to the corresponding one of the queues.
In another embodiment of the present disclosure, a resource adjusting and controlling method comprises: monitoring, by a plurality of monitoring units of a server, one of a plurality of monitoring tags, wherein each of the plurality of monitoring units corresponds to one of a plurality of queues, wherein each of the plurality of queues is used for storing data of the plurality of monitoring tags and timestamps of the data, and each of the plurality of queues has its respective queue size; monitoring, by the server, usage statuses of the plurality of queues corresponding to the plurality of monitoring units, and determining if one of the monitoring units performs a queue space adjustment based on the usage statuses when new data of the monitored monitoring tags is obtained; adding the obtained new data to a corresponding one of the queues of the one of the monitoring units by the server if the queue space adjustment is not performed; adjusting space of the one or more of the plurality of queues if the queue space adjustment is performed and one or more of the plurality of queues have a space that is adjustable, to enable the obtained new data to be added to the adjusted one or more of the plurality of queues; and reducing the data of the corresponding one of the queues of the one of the monitoring units, if the queue space adjustment is performed and no space in the queues is adjustable, based on the timestamps of the data stored in the corresponding one of the queues and a position of the data stored in the corresponding one of the queues o, to enable the obtained new data to be added to the corresponding one of the queues.
The disclosure can be more fully understood by reading the following detailed description of the embodiments, with reference made to the accompanying drawings, wherein:
In the following detailed description, for purposes of explanation, numerous specific details are set forth in order to provide a thorough understanding of the disclosed embodiments. It will be apparent, however, that one or more embodiments may be practiced without these specific details. In other instances, well-known structures and devices are schematically shown in order to simplify the drawing.
The server 1 can be applied to a system having a plurality of monitoring units 20, each of which is used for monitoring a monitoring tag 81. Data of the monitoring tags can be transmitted based on a transmission protocol that conforms to the industry transmission network. The processor 10 can execute a plurality of instructions 11 to perform a resource regulation of each corresponding one of the queues 61 of the one of the monitoring units 20, including actuating the monitoring units 20, the resource monitoring device 30, the queue space adjuster 40 and the data reducer 50 to perform a resource adjusting and controlling process. The queues 61 are used for storing data 62 obtained from the monitoring tags 81 and timestamps 63 of the data 62. The storing device 60 further stores a plurality of instructions 11 executed by the processor 10, variables (e.g., a position 65 of the queue), the corresponding one of the queues 61 of the one of the monitoring units 20, and parameters 64, such as a sampling frequency, a queue size and an issuing time.
The timestamp 63 refers to a sequence of data added by identification words (such as time or date), to ensure that the data updating orders of the local and remote ends are consistent. The timestamp recorded and commonly used on computers is POSIX time, which is a time representation used by UNIX systems. It can record the total number of seconds from 0:00:00 GMT on Jan. 1, 1970 till now, excluding leap seconds. For instance, 2018-06-62 15:30:20 GMT+8, POSIX timestamp can be 1529652620. However, as long as the timestamp 63 can distinguish the time representation of the order, the method of recording is not limited.
The queues 61 have respective queue sizes. Each of the monitoring units 20 monitors one of the monitoring tags 81 (that is, each of the monitoring units 20 monitoring one monitoring tag 81), to transmit the data obtained from the monitoring tags 81. In an embodiment of the present disclosure, the monitoring tags 81 may be a thermometer, a voltmeter, an ammeter, a vibrator, an acoustic sensor, etc., but not limited to these. The monitoring units 20 can be electrically connected to the monitoring tags 81 in a wired or wireless manner to acquire (obtain or receive) the data of the monitoring tags 81. Each of the monitoring units 20 may correspond to a corresponding one of the queues 61. Each of the queues 61 is used for storing the data 62 of the monitoring tags 81 and the timestamps 63 of the data 62.
The resource monitoring device 30 may monitor the usage statuses of the corresponding one of the queues 61 of the one of the monitoring units 20, in order to determine if one of the monitoring units 20 performs a queue space adjustment based on the usage statuses of the corresponding one of the queues 61 when new data of the monitoring tags 81 is obtained. If the resource monitoring device 30 determines that the queue space adjustment is not performed, the one of the monitoring units 20 adds the obtained new data into the corresponding one of the queues 61 of the any monitoring unit 20.
When the resource monitoring device 30 determines that the queue space adjustment is performed, the queue space adjuster 40 will be actuated. The queue space adjuster 40 is used for determining whether there is a space sufficient to perform the queue space adjustment. When the queue space adjustment is performed and one or more queues in the queues 61 have an adjustable space, the obtained new data can be added to the adjusted one or more queues in the plurality of queues 61. When the queue space adjustment is performed and the queues 61 do not have any adjustable space, the resource monitoring device 30 actuates the data reducer 50, and reduces the data 62 stored in the corresponding one of the queues 61 of the one of the monitoring units 20 based on the timestamps 63 of each data 62 stored in the corresponding one of the queues 61 of the one of the monitoring units 20 and a position of each data 62 in the corresponding one of the queues 61 of the one of the monitoring units 20, so that the obtained new data is added to the corresponding one of the queues 61 of the one of the monitoring units 20.
In an embodiment of the present disclosure, the data restorer 70 further included in the server 1 has a data restoring algorithm 71 to restore the data 62 of the corresponding one of the queues 61 of the one of the monitoring units 20. The data restoring algorithm 71 acquires the data 62 of the corresponding one of the queues 61 from the data restorer 70. When the data 62 of the corresponding one of the queues 61 have been sorted based on their respective timestamps 63, the data 62 of the corresponding one of the queues 61 are determined to be restored or do not need to be restored, and a further process is not needed. When the data 62 of the corresponding one of the queues 61 are not sorted based on their respective timestamps 63, the data restorer 70 restores the data 62 of the corresponding one of the queues 61 based on the timestamps 63 of the data of the corresponding one of the queues 61 and the relative sorting position of the data 62 in the corresponding one of the queues 61.
In step S11 of the embodiment of
In step S12 of the embodiment of
In step S13 of the embodiment of
In step S14 of the embodiment of
This embodiment can be further executed in step S15, in which the data restorer 70 of the server 1 acquires the data 62 of the queues 61. When the data 62 of the queues 61 are sorted based on their respective timestamps 63, the data restorer 70 of the server 1 determines that the data 62 of the queues 61 have been restored or do not need to be restored. When the data 62 of the queues 61 are not sorted based on their respective timestamps 63, the data restorer 70 of the server 1 restores the data 62 of the queues 61 through the data restoring algorithm 71 based on the timestamps 63 of the data 62 of the queues 61 and the relative sorting position 65.
Refer to
Refer to
For instance, the sampling frequency 26a of the sampler 26 is set to be one second, the threshold of the filter 27 is set to be five, the issuing time 28a of the issuing device 28 is set to be five seconds, and the space of the queue 61 is set to be five, so that the monitoring unit 20 monitors the monitoring tags 81 once a second (the sampling frequency 26a), if a difference between the value of the data of the monitoring tags 81 and the value of the data recorded last time exceeds the threshold that is five, the value of the data of the monitoring tags 81 will be added to the queue 61, or the value of the data of the monitoring tags 81 will not be recorded (less than the threshold that is five), and the monitoring unit 20 will issue all data of the queue 61 to the receiving end 90 (such as another server) every five seconds (the issuing time 28a), and further clears the data of the queue 61, which are repeated continuously.
For instance, in step S21 the queue space adjuster calculates or determines if a space of a queue is borrowed from a single queue corresponding to a single monitoring unit. If so (can borrow a space of a queue from the corresponding queue of the single monitoring unit), proceed to step S22, in which the queue space adjuster selects and borrows a space of a corresponding queue (a single queue) of a single monitoring unit with the smallest K (i.e., having the smallest amount of borrowed space), wherein K represents the amount of the borrowed space of the corresponding queue of the single monitoring unit; if not (cannot borrow the space of the corresponding queue of the single monitoring unit), proceed to step S23.
In step S23, the queue space adjuster determines the number of monitoring units that correspond to a plurality of queues that have borrowable space. If the amount of the borrowable space of the monitoring units is greater than a demand space, then borrowing the space of the queues corresponding to the monitoring units, and step S24 is executed, in which the queue space adjuster first selects and borrows the monitoring units with the greatest M (i.e., having the greatest amount of space that can be borrowed), wherein M represents the amount of the borrowable space of each queue of the monitoring units. If the borrowable space of all monitoring units is insufficient to store the excess data amount, step S25 is executed, the corresponding one of the queues of the one of the monitoring units have no adjustable space and cannot be borrowed. In another embodiment of the present disclosure, if a single queue 61 cannot be found, the queue space adjuster 40 borrows a space first from the previous borrowable space with the greatest amount, until the borrowable spaces of a plurality of queues 61 are accumulated and are enough for the needed space.
Following step S22 or step S24, in step S26 the queue space adjuster borrows the space of the corresponding queue of the monitoring unit. In step S27, the queue space adjuster adds the new data that obtained by the monitoring tags to the borrowable space of the corresponding queue of the monitoring unit.
For instance, the monitoring unit 20a monitors the monitoring tags 81a and the monitoring unit 20b monitors the monitoring tags 81b. Assuming that the space of the corresponding queue 61a of the monitoring unit 20a is insufficient to accommodate the obtained data, the queue space adjuster 40 actuates the queue dynamic adjustment mechanism (i.e., the queue space adjustment algorithm) and finds “four spaces” having space in the queue 61b of the monitoring unit 20b, the monitoring unit 20b will issue data and empty the queue 61b after 2 seconds, the queue 61a will only add up to 2 more pieces of data, and the monitoring unit 20a will issue data after one second and need to borrow “one space” only. The previously-described two spaces added by the one space is less than the four spaces (i.e., 2+1<4), and the monitoring unit 20a can borrow the space of the queue 61b from the single monitoring unit 20b.
For instance, in an embodiment the monitoring unit 20a monitors the monitoring tags 81a and the monitoring unit 20b monitors the monitoring tags 81b. Assuming that the space of the corresponding queue 61a of the monitoring unit 20a is insufficient to accommodate the obtained data, and the queue space adjuster 40 actuates the queue dynamic adjustment mechanism (i.e., the queue space adjustment algorithm) and finds “four spaces” having space in the queue 61b of the monitoring unit 20b after 2 seconds, the monitoring unit 20b will issue data and empty the queue 61b after 2 seconds, and the queue 61b will only add up to 2 more pieces of data. Although the monitoring unit 20a will not issue data after 3 seconds and need to borrow “three spaces,” the monitoring unit 20b will empty the queue 61b after 2 seconds. Then, the monitoring unit 20b can lend “two spaces” of the queue 61b to the monitoring unit 20a, and the monitoring unit 20b uses “two spaces” of the queue 61b. Two spaces added by two spaces is less than or equal to four spaces (2+2<=4). The monitoring unit 20b has emptied the queue 61b after 3 seconds. Before the monitoring unit 20a issues the data of the queue 61a, the monitoring unit 20b only needs to add data to “one space” of the queue 61b. The previously-described one space added by three spaces is less than five spaces of the queue 61b (i.e., 1+3<5). Therefore, the monitoring unit 20a can borrow the space of the queue 61b from the single monitoring unit 20b.
As shown in
In step S31, the data reducer acquires a pair of data with the smallest difference in the values y, such as a pair of data b and data e shown in
In the first-type of the data reduction algorithm of step S33, when the pair of data b and data e are adjacent, the data reducer removes the data e, moves data after the data e forward, and places latest data at the last end of the queue.
In step S34, when the pair of data b and data e are not adjacent, the data reducer determines whether the timestamp t3 of the data c after data b is greater than and closest to the timestamps t2 of the data b. If so (for example, in
As shown in the embodiment of
In addition, the numerical difference Δyi of two data is the same, the minimum distance difference Δdi of the two data is taken as the replacement target and replaced by the new data. Moreover, the numerical difference Δyi of the two data is the same as the distance difference Δdi, the one that has the former serial number will be replaced by the new data.
As shown in the embodiment of
As shown in the embodiments of
In step S42, it is determined by the data restorer whether the data has been sorted based on the timestamps. If so (the data have been sorted based on the timestamps), proceed to step S43, which indicates that the data can be directly used without being compressed, that is, the data are restored or not required to be restored. If not (the data are not sorted based on the timestamps), proceed to step S44, in which the data restorer finds latest data (e.g., the data g) of the timestamps (e.g., timestamp t7).
In step S45, the data restorer determines if the data g is placed at the last end of the unprocessed data. If so (data g is not placed at the last end of the unprocessed data), proceed to step S46. If not (the data g is placed at the last end of the unprocessed data), proceed to step S50 to exclude the data g.
In step S46, the data restorer divides the data into four portions (data g, a first portion, a second portion and a third portion), and the data restorer acquires the timestamp of the data of the previous position of the data g (e.g., the data b, and the data before the data b is the first portion). In step S47, the data restorer finds the data with a timestamp closest to and greater than the data b (e.g., the data c, the data between the data b and the data c is the second portion, and the data c and the subsequent data are the third portion). In step S48, the data restorer moves all the third portion to the front of the data g, and moves the second portion backward. In step S49, the data restorer moves the data g to the last end of the queue, and enters the value of the duplicate data b between the moved third portion and second portion.
As shown in the embodiment of
When the data are not sorted based on the timestamps, the data restorer finds the data m with the latest timestamps t13, and the data m is not at the very rear end of the queue (a position 3 of the queue). Next, the data restorer fills a position 2 to a position 7 with a value of the position 2 (data b), finds the data c (timestamps t3) after the position 2 (data b) and closest to the position 2 (data b), and inserts all data c (timestamps t3) and the subsequent data (data d, 1 and j) forward from the position 3 and timestamps t13. Then, the data restorer fills the position of the original timestamps t13 with the value of the position 2(data b), and moves the data m of the timestamps t13 to the last end of the queue, and the data m is no longer involves in the subsequent operations.
As shown in the embodiment of
As shown in the embodiment of
As shown in the drawings, compared with the data of
As can be seen from the above, the present disclosure uses a Resources Assignment & Regulation Method (RAR) to operate a queue space adjusting algorithm to adjust the dynamic resources, allocate the space sizes of the queues of different monitoring tags in a limited queue space (hardware resources), retain the important off-peak values of the data and reduce the distortion of the data by the data reduction algorithm. Moreover, the present disclosure effectively allocates and adjusts hardware resources by monitoring the usage rate of the space of each of the monitoring tags, and improves a number of the monitoring tags that are to be monitored. At the same time, the present disclosure uses the data reduction algorithm (or a data screening method) to retain important data and reduce the degree of data distortion, to facilitate the accuracy of data statistics.
In addition, in the application of industrial networks, the present disclosure can increase a number of monitoring tags that a server monitors by more than 30%. For instance, a basic OPC UA server can simultaneously monitor information on 100 monitoring tags, while the present disclosure can monitor at least 130 tags, without increasing an additional cost. Moreover, in the monitoring of the wireless network, the present disclosure can reduce the transmission amount of network packets, and save the battery consumption of equipment. For instance, the present disclosure can send the information of the packets every 10 seconds, and through the present disclosure, more information can be stuffed into the packets, thereby extending the transmission time to save power of the equipment.
It will be cleared to those skilled in the art that various modifications and variations can be made to the disclosed embodiments. It is intended that the specification and examples be considered as exemplary only, with a true scope of the disclosure being indicated by the following claims and their equivalents.
Number | Date | Country | Kind |
---|---|---|---|
107136609 | Oct 2018 | TW | national |