A method for collecting data from a pharmaceutical production line
Through the detailed classification of photoelectric data and the application of sliding window technology, combined with the correction of the LOF algorithm, the problem of reduced detection sensitivity of photoelectric sensors on the drug production line is solved, and the accurate collection of drug production quantity and inventory management are achieved.
Patent Information
- Application Number
- CN202510502319.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-22
- Publication Date
- 2025-06-17
- Estimated Expiration
- 2045-04-22
AI Technical Summary
When the photoelectric sensors operate on the drug production line for a long time, they are susceptible to dust and mechanical vibrations, resulting in reduced detection sensitivity and false triggering or missed detection, which affects the precise collection of drug production quantities and inventory management.
By obtaining the photoelectric data on the drug packaging production line, it is divided into high-level data, low-level data and jump data, the sliding window technology is used to determine the jump length and vibration vector, calculate the status outlier value, and modify the local outlier factor in combination with the LOF algorithm to achieve accurate collection of drug production line data.
It improves the accuracy of data collection and anti-interference ability, reduces counting errors, ensures accurate recording of drug production quantities, and improves the effectiveness of inventory management and the degree of automation of production lines.
Smart Images

Figure CN120030293B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data processing. More specifically, the present invention relates to a method for collecting data on a pharmaceutical production line. Background Art
[0002] In the pharmaceutical production process, the scientific management of the pharmaceutical production line occupies a core position. Its management effectiveness is directly related to the quality and efficiency of pharmaceutical production. If the production line is not properly controlled, it will have a negative impact on the inventory management link of pharmaceuticals, and then lead to waste in multiple aspects such as materials, manpower, and time, increasing the production cost of pharmaceuticals.
[0003] The currently commonly used solution is to arrange photoelectric sensors on the pharmaceutical packaging production line to collect the quantity of pharmaceuticals. By monitoring the pharmaceutical flow rate, the overall efficiency of pharmaceutical production is dynamically adjusted, and at the same time, the inventory management of pharmaceuticals is optimized. The quantity collection on the pharmaceutical production line is achieved by the photoelectric sensor receiving the emitted light. When the medicine box moves along the production line and passes through the detection area of the photoelectric sensor, it will block the light propagation path, causing the light signal received by the originally continuously receiving optical signal receiver to be interrupted instantaneously. This interruption change of the light signal will be captured by the system, thereby triggering a count, and thus realizing the successive cumulative statistics of the quantity of pharmaceuticals.
[0004] However, in the actual production environment, the long-term operation of photoelectric sensors will face the following technical challenges: 1) The dust gradually accumulating on the surface of the sensor optical path system (including the light source emitter and the photosensitive receiver) will reduce the light transmittance; 2) The mechanical vibration of the equipment may cause the optical path to shift. These factors will significantly affect the detection sensitivity of the sensor, and then cause false triggering or missed detection phenomena, ultimately resulting in the distortion of the pharmaceutical count data and affecting the accuracy of the pharmaceutical production plan and the effectiveness of inventory management. Summary of the Invention
[0005] In order to solve the problem that due to the influence of dust on the surface of the light source or receiver and the mechanical vibration of the production line equipment on the photoelectric sensor, the detection sensitivity is reduced, resulting in counting errors, leading to errors in the collection of the quantity of pharmaceuticals produced, and affecting the accuracy of the pharmaceutical production plan and the effectiveness of inventory management, the present invention proposes a method for collecting data on a pharmaceutical production line, and the method includes the following steps:
[0006] Obtain the optoelectronic data at each position on the drug packaging production line at each training moment and each transportation moment; Denote any position as the target position, and based on the magnitude of the optoelectronic data within the sliding window at each moment of the target position, divide the optoelectronic data into high-level data, low-level data, and jump data. Based on the category of the optoelectronic data between adjacent jump data within the sliding window, obtain multiple segments to be detected within the sliding window; According to the length of each segment to be detected within the sliding window at each training moment of the target position, determine the jump length of the target position at each training moment; Take the mode of the non-zero jump lengths of the target position at all training moments as the length of the jump window at each moment of the target position; Based on the jump window, obtain the vibration vector of the target position at each moment, and multiple reference vectors among the vibration vectors at the training moments in each moment; According to the similarity between the vibration vector of the target position at each transportation moment and all reference vectors, determine the state outlier value of the target position at each transportation moment; Construct each segment to be detected within the sliding window at each transportation moment of the target position into a data point of the target position. According to the length of the jump window, the length of the segment to be detected corresponding to each data point of the target position, and the mean value of the state outlier values of all optoelectronic data corresponding to the transportation moments within the segment to be detected corresponding to each data point, correct the local outlier factor of each data point of the target position obtained by using the LOF algorithm, and collect the data of the drug production line according to the corrected outlier factor.
[0007] Through the detailed classification of optoelectronic data and the sliding window technology, the present invention can more accurately capture the real production state and reduce misjudgments caused by environmental factors; The use of the mode at the training moment to determine the length of the jump window makes data collection more stable, reduces data deviation caused by abnormal states, and ensures the accurate recording of drug production quantities; By comparing the similarity with the reference vector, the state of the production line can be monitored in real time and abnormal situations can be automatically identified, and measures can be taken in a timely manner to ensure smooth production; The combination of the LOF algorithm and the state outlier value enables the noise and abnormal data in the data collection process to be effectively corrected, ensuring the true reliability of the data; With the help of accurate data collection methods, the formulation and adjustment of drug production plans can be effectively supported, the effectiveness of inventory management can be improved, and inventory shortages or surpluses caused by data errors can be avoided; By reducing manual intervention through automated monitoring and exception handling, the automation level of the drug production line is improved, and the overall production efficiency is increased.
[0008] Further, the dividing of the optoelectronic data into high-level data, low-level data, and jump data includes: recording the mean value of all the optoelectronic data within the sliding window at each moment as the division threshold at each moment; for any moment, recording the optoelectronic data within the sliding window at that moment that is less than the division threshold at that moment as low-level data, and the remaining optoelectronic data as high-level data; for any high-level data, when the optoelectronic data on either side of the high-level data is low-level data, recording the high-level data as jump data.
[0009] Further, the obtaining of multiple segments to be detected within the sliding window includes: for any two adjacent jump data within the sliding window at any moment of the target position, in response to there being no low-level data between the two adjacent jump data, forming a segment to be detected from the two adjacent jump data and all the high-level data therebetween.
[0010] Further, the jump length satisfies:
[0011] ; where is the jump length at the training moment of the target position , is the number of segments to be detected within the sliding window at the training moment of the target position , is the length of the th segment to be detected within the sliding window at the training moment of the target position , is the mean value of the lengths of all the segments to be detected within the sliding window at the training moment of the target position , is the number of high-level data within the sliding window at the training moment of the target position , is function, is the ceiling symbol.
[0012] By comprehensively considering the lengths of each segment to be detected and the number of high-level data, the calculation of the jump length enables the present invention to more dynamically adapt to different production environments and conditions, improving the flexibility of detection; the definition of the jump length integrates the characteristics of different segments to be detected, considering their mean value and distribution, such that the obtained jump length can more comprehensively reflect the actual state of the target position, reducing errors caused by a single data segment.
[0013] Further, the method for obtaining the vibration vector is: obtaining the vibration data at each position on the pharmaceutical packaging production line at each training moment and each transportation moment, and recording the time series sequence formed by all the vibration data within the jump window at each moment of the target position as the vibration vector of the target position at each moment.
[0014] Further, the method for obtaining the reference vector is as follows: for the vibration vectors at each training moment among all moments, the vibration vectors that do not contain abnormal vibration data in the vibration vectors are denoted as reference vectors.
[0015] Further, the state outlier value satisfies:
[0016] ; where is the state outlier value of the target position at the transportation moment , is the vibration vector of the target position at the transportation moment , is the th reference vector of the target position, is the number of reference vectors of the target position, is the natural exponential function, is the cosine similarity function, is the maximum value function.
[0017] By calculating the cosine similarity between the current state and multiple reference vectors, the present invention can effectively quantify the difference between the normal state and the abnormal state of the target position at the transportation moment, improving the accuracy of anomaly detection; by converting the cosine similarity into an exponential form, it can effectively suppress the noise with a large difference from the reference state, thereby emphasizing the state of real anomalies and reducing the probability of false alarms.
[0018] Further, constructing each detection segment within the sliding window of the target position at each transportation moment into a data point of the target position includes: for each detection segment, taking the mean value of all corresponding optoelectronic data at the transportation moments within the detection segment as the coordinate of the first dimension, and taking the mean value of all corresponding state outlier values at the transportation moments within the detection segment as the coordinate of the second dimension, and constructing it into a data point of the target position.
[0019] Further, the corrected outlier factor satisfies:
[0020] ; where is the corrected outlier factor of the th data point of the target position, is the local outlier factor of the th data point of the target position, is the length of the detection segment corresponding to the th data point of the target position, is the length of the jump window of the target position at each moment, is the The mean of the state outliers corresponding to the transportation moments of all optoelectronic data within the segment to be detected for each data point. Is the absolute value symbol.
[0021] The present invention combines the local outlier factor and the mean of the state outliers to more comprehensively evaluate the outlier property of data points, ensuring that the result of the outlier factor can more truly reflect the actual state of the data; the relationship between the length of the segment to be detected and the length of the jump window is considered in the correction factor, making the data analysis more flexible and targeted, capable of adapting to data segments of different lengths, and enhancing the adaptability of the system; by introducing the mean of the state outliers, the calculation error of the outlier factor caused by random noise can be effectively suppressed, thereby enhancing the robustness of the overall data.
[0022] Further, the acquisition of the pharmaceutical production line data according to the corrected local outlier factor includes: for any data point at the target position, in response to the corrected outlier factor of the data point being less than the preset outlier threshold, determining that the data point is a normal data point and performing real-time counting to obtain the quantity of pharmaceutical production at the target position, thereby completing the acquisition of the pharmaceutical production line data.
[0023] The present invention can quickly identify and process abnormal data points by real-time monitoring of the corrected outlier factor of each data point, improving the real-time performance and accuracy of data acquisition, thereby contributing to the timely discovery and response to problems in the production process; when the outlier factor is lower than the preset outlier threshold, it can be confirmed that the data point is a normal data point, ensuring that only reliable data is counted, greatly reducing the counting errors caused by noise and abnormal interference.
[0024] The present invention has the following beneficial effects:
[0025] (1) By carefully dividing the optoelectronic data and determining the jump length and jump window based on methods such as a sliding window, the present invention can effectively eliminate the interference of abnormal optoelectronic data caused by dust on the surface of the light source or receiver, improve the anti-interference ability of data acquisition, avoid the decrease in detection sensitivity caused by dust, thereby reducing the occurrence of counting errors and enhancing the accuracy of the acquisition of the quantity of pharmaceutical production.
[0026] (2) Using the obtained vibration vector and reference vector, the state outliers are determined by calculating the similarity, accurately identifying the influence of the mechanical vibration of the production line equipment on the optoelectronic sensor, timely discovering possible abnormal states, enabling the data acquisition process of the pharmaceutical production line to better adapt to the vibration conditions of the equipment, and ensuring the reliability of the data.
[0027] (3)The operation of correcting the local outlier factor fully considers various factors such as the jump window length, the length of the segment to be detected, and the state outliers, making the judgment of outlier data more accurate, avoiding misjudgment and missed judgment, further improving the quality of data collection, and providing solid data support for the accuracy of drug production plans and the effectiveness of inventory management.
[0028] (4)This data collection method comprehensively considers various factors affecting the detection sensitivity of photoelectric sensors, processes and analyzes the data through a series of scientific and reasonable steps, forms a complete and effective data collection mechanism, has strong practicability and operability, can be widely applied in drug production lines, and improves the production management level and efficiency of drug production enterprises. Description of the Drawings
[0029] Figure 1 is a flowchart of the steps of a data collection method for a drug production line according to an embodiment of the present invention.
[0030] Figure 2 is a schematic diagram of a segment to be detected in a data collection method for a drug production line according to an embodiment of the present invention; in the figure, 1 represents high-level data and 0 represents low-level data. Detailed Embodiments
[0031] The technical solutions in the embodiments of the present invention will be clearly and completely described below. The described embodiments are part of the embodiments of the present invention. All other embodiments obtained by those of ordinary skill in the art without creative efforts based on the embodiments of the present invention belong to the scope of protection of the present invention.
[0032] The following will describe in detail the specific embodiments of the present invention with reference to the accompanying drawings.
[0033] Please refer to Figure 1 , which shows a flowchart of the steps of a data collection method for a drug production line provided by an embodiment of the present invention. The method includes the following steps:
[0034] S1: Obtain the photoelectric data at each position on the drug packaging production line at each training moment and each transportation moment.
[0035] It should be noted that when the materials pass through the optoelectronic sensor on the drug packaging production line, they will block the light emitted by the light source. As a result, the optical signal detected by the receiver will change, and further the electrical signal (voltage) converted from the optical signal will also change. The production count of drugs can be carried out through the change of the electrical signal output by the optoelectronic sensor. Therefore, the present invention obtains the output data of the optoelectronic sensors at each position (such as the drug plate feeding position, the instruction manual feeding position, the box loading position, the drug box sealing position, the box out commutation position, etc.) on the drug packaging production line at each moment, that is, the optoelectronic data; among them, the training moment is the pre-preparation stage of the present invention, and the transportation moment is the normal drug production stage.
[0036] The implementer can set the acquisition frequency of the optoelectronic data according to the specific implementation situation. For example, 50Hz.
[0037] S2: Classify the optoelectronic data and obtain the segments to be detected within the sliding window at each moment.
[0038] Denote any position as the target position, and based on the magnitude of the optoelectronic data within the sliding window at each moment for the target position, classify the optoelectronic data into high-level data, low-level data, and jump data.
[0039] The implementer can set the size of the sliding window according to the specific implementation situation. For example, it is the same as the acquisition frequency, both being 50.
[0040] Specifically, the classification of the optoelectronic data into high-level data, low-level data, and jump data includes:
[0041] Denote the mean value of all the optoelectronic data within the sliding window at each moment as the classification threshold at each moment;
[0042] For any moment, denote all the optoelectronic data within the sliding window at this moment that are less than the classification threshold at this moment as low-level data, and the remaining optoelectronic data as high-level data;
[0043] Please refer to Figure 2 , for any high-level data, when the optoelectronic data on either side of this high-level data is low-level data, denote this high-level data as jump data.
[0044] Based on the category of the optoelectronic data between adjacent jump data within the sliding window, obtain multiple segments to be detected within the sliding window.
[0045] Specifically, the obtaining of multiple segments to be detected within the sliding window includes:
[0046] Please refer to Figure 2, for any two adjacent jump data within the sliding window at any moment of the target position, in response to the absence of low-level data between the two adjacent jump data, the two adjacent jump data and all high-level data therebetween form a segment to be detected.
[0047] S3: Determine the jump length at each position at each training moment.
[0048] It should be noted that on the pharmaceutical packaging production line, different positions play different roles in pharmaceutical packaging. For example, at the medicine board conveying station, it plays the role of conveying the medicine board, at the medicine box filling station, it plays the function of loading the medicine board and the instruction manual into the medicine box, and at the packaging sealing station, it plays the role of sealing the medicine box. The realization of the functions of different positions requires different times. Therefore, when the medicine passes through the photoelectric sensors at different positions, the duration of light occlusion is also different. In order to comprehensively collect the quantity of medicines by using the photoelectric sensors at various positions on the pharmaceutical packaging production line, the present invention calculates the jump length of the photoelectric sensor at each position at each training moment according to the output data of the photoelectric sensors at various positions on the pharmaceutical packaging production line, and then obtains the length of the jump window of the photoelectric sensor at each position, that is, the length of the jump window at each position at each moment (the length of the jump window at each position at each moment is the same).
[0049] Determine the jump length of the target position at each training moment according to the length of each segment to be detected within the sliding window at each training moment of the target position.
[0050] Specifically, the jump length satisfies:
[0051] ;
[0052] In the formula, is the jump length of the target position at the training moment , is the number of segments to be detected within the sliding window of the target position at the training moment , is the length of the -th segment to be detected within the sliding window of the target position at the training moment , is the mean value of the lengths of all segments to be detected within the sliding window of the target position at the training moment , is the number of high-level data within the sliding window of the target position at the training moment , is function, is the ceiling symbol.
[0053] Among them, the output of the function is a sequence, that is It represents the value obtained after processing by the function in the sequence. On the pharmaceutical packaging production line, when the material does not pass through the photoelectric sensor, the light beam is not blocked, the receiver receives the optical signal, and the data output by the photoelectric sensor will be low-level data. When the material passes through the photoelectric sensor, the receiver detects the interruption of the optical signal, and the photoelectric data output by the photoelectric sensor will be high-level data. Therefore, can represent the time when the material passes through the photoelectric sensor. Based on , the jump length is calculated. The jump length represents the length of the data generated during the normal process of the medicine box passing through the sensor. However, during long-term use, affected by factors such as dust and vibration on the light source or the surface of the receiver of the photoelectric sensor, there will be short jumps in the data output by the sensor, forming short jump intervals. This data jump is not caused by the medicine box passing through the sensor. Therefore, the influence of the jump interval generated in this case on the jump length should be reduced. Therefore, is used as weight to calculate the jump length. The larger it is, the more it indicates that is more likely to be generated by material transportation. Then, when calculating the jump length, should have a larger weight; The smaller it is, the more it indicates that is more likely to be caused by the occlusion of factors such as dust. Then, when calculating the jump length, should have a smaller weight. Here, for the convenience of calculation, is normalized by dividing by , and function is used to convert into weight.
[0054] It should be noted that due to the abnormal vibration of the components on the production line, the emission direction of the light source of the photoelectric sensor may deviate or the receiver may deviate from the light emission position. Therefore, vibration sensors are arranged at each photoelectric sensor to analyze the vibration conditions at each position. The acquisition frequency of the vibration data needs to be synchronized with the acquisition frequency of the photoelectric sensor.
[0055] The mode of the non-zero jump lengths at all training times of the target position is used as the length of the jump window of the target position at each time; based on the jump window, the vibration vector of the target position at each time and multiple reference vectors in the vibration vectors of the training times at each time are obtained.
[0056] It should be noted that the implementer can set the duration of the training moment according to the specific implementation situation. For example, it can be 10 minutes, or it can be the time length for packaging a specified number of drugs. However, it is necessary to ensure that at least all the reference vectors contain all the vectors corresponding to the complete process of handling one material.
[0057] Specifically, the method for obtaining the vibration vector is as follows:
[0058] Obtain the vibration data at each position on the drug packaging production line at each training moment and each transportation moment. Denote the time series formed by all the vibration data within the jump window at each moment of the target position as the vibration vector of the target position at each moment.
[0059] Specifically, the method for obtaining the reference vector is as follows:
[0060] For the vibration vector at each training moment among all moments, denote the vibration vector that does not contain abnormal vibration data as the reference vector. The method for judging abnormal vibration data can be selected according to the actual situation. For example, through manual monitoring, it is determined that no abnormal vibration occurs within the segment jump window time.
[0061] S4: Determine the state anomaly value at each position at each transportation moment.
[0062] It should be noted that counting through the photoelectric sensor is achieved by the receiver of the photoelectric sensor receiving the change of the light source. If abnormal vibration occurs on the production line, it will affect the photoelectric sensor's reception of the optical signal, thereby affecting the collection of the number of drugs on the drug production line. Therefore, vibration data is required to assist in the collection of the number of drugs. However, the functions of each station on the drug packaging production line are realized through mechanical structures. Under normal circumstances, the operation of the mechanical mechanism will also cause certain vibrations. In order to analyze the cause of the vibration and make the collection of the number of drugs on the drug packaging production line more accurate, the present invention calculates the state anomaly value of the photoelectric sensor at each position through the length of the jump window of the photoelectric sensor and the vibration vector.
[0063] Determine the state anomaly value at each transportation moment of the target position according to the similarity between the vibration vector of the target position at each transportation moment and all the reference vectors.
[0064] Specifically, the state anomaly value satisfies:
[0065] ;
[0066] In the formula, is the state anomaly value of the target position at the transportation moment , is the vibration vector of the target position at the transportation moment , is the a reference vector, is the number of reference vectors for the target position, is the natural exponential function, is the cosine similarity function, is the maximum value function.
[0067] Wherein, represents the vibration vector at the transportation moment and the th reference vector, the larger this value, the more similar it indicates and are. Since represents the vibration characteristics under normal conditions at the target position, therefore the larger it is, the more likely the state at the target position is normal, and the smaller the state anomaly value of the optoelectronic sensor at the target position; the smaller this value, the greater the difference between and . Since represents the vibration characteristics under normal conditions at the target sensor, therefore the smaller it is, the more likely the state at the target position is abnormal, and the larger the state anomaly value of the optoelectronic sensor at the target position; at the same time, for the convenience of subsequent calculations, here is normalized by adding 1 and dividing by 2. Since all reference vectors contain the vibration data of the optoelectronic sensor at the target position under various states under normal conditions, the vibration vector under normal conditions is not similar to all reference vectors in the reference vector set. Therefore, only the vector in the reference vector set that is most similar to the vibration vector needs to be found to calculate the real-time state anomaly value of the optoelectronic sensor at the target position. When the cosine similarity between the vibration vector and the reference vector most similar to it is at a relatively low level, it means that the optoelectronic sensor at the target position is more likely to be in an abnormal vibration state. Therefore, is used to calculate the real-time state anomaly value of the target position.
[0068] S5: Construct data points at each position and determine the corrected outlier factor of each data point at each position.
[0069] Each detection segment within the sliding window at the target position at each transportation moment is constructed as a data point of the target position.
[0070] Specifically, the step of constructing each detection segment within the sliding window at the target position at each transportation moment as a data point of the target position (each data point is detected only once. Assume that there is a data point constructed from a detection segment within a certain sliding window. If the detection segment still exists in the sliding window at the next moment, but the data point constructed from this detection segment has already been detected, so there is no need to detect it repeatedly) includes:
[0071] For each segment to be detected, the mean value of the optoelectronic data corresponding to all the transport times within the segment to be detected is used as the coordinate of the first dimension, and the mean value of the status outliers corresponding to all the transport times within the segment to be detected is used as the coordinate of the second dimension, and a data point of the target position is constructed.
[0072] It should be noted that the light source or receiver of the optoelectronic sensor will be affected by factors such as dust and vibration on the surface, resulting in counting errors, thus causing errors in the collection of the production quantity of drugs and affecting the production management of the drug production line. Therefore, the corrected outlier factor is calculated through the status outliers corresponding to all the optoelectronic data corresponding to the transport times within the segment to be detected corresponding to each data point of the position.
[0073] According to the length of the jump window, the length of each segment to be detected corresponding to each data point of the target position, and the mean value of the status outliers corresponding to all the optoelectronic data corresponding to the transport times within each segment to be detected corresponding to each data point, the local outlier factors of each data point of the target position obtained by using the LOF algorithm are corrected to obtain the corrected outlier factor of each data point of the target position.
[0074] Specifically, the corrected outlier factor satisfies:
[0075] ;
[0076] In the formula, is the corrected outlier factor of the th data point of the target position, is the local outlier factor of the th data point of the target position, is the length of the segment to be detected corresponding to the th data point of the target position, is the length of the jump window at each moment of the target position, is the mean value of the status outliers corresponding to all the optoelectronic data corresponding to the transport times within the segment to be detected corresponding to the th data point of the target position, is the absolute value symbol.
[0077] Among them, The larger it is, the more outlier the data point is, the more likely the data point is collected under the abnormal state of the optoelectronic sensor, and the less likely it is caused by the passage of drug materials through the sensor. The corrected outlier factor of this data point should be larger; The smaller it is, the more likely the data point is in the dense position of the data set, the more likely the data point is collected under the normal state of the sensor, and the more likely it is caused by the passage of drug materials through the sensor. The corrected outlier factor of this data point should be smaller. represents the gap between the length of the segment to be detected of the data point and the length of the jump window. Since the length of the jump window represents the length of the continuous high-level data generated by the material passing through the sensor when the photoelectric sensor is in a normal state, therefore The larger it is, the more likely it is that this data point is collected under the abnormal state of the photoelectric sensor and is less likely to be generated by the drug material passing through the sensor. The corrected outlier factor of this data point should be larger; The smaller it is, the more likely it is that this data point is in a dense position in the data set, the more likely it is that this data point is collected under the normal state of the photoelectric sensor, and the more likely it is to be generated by the drug material passing through the sensor. The corrected outlier factor of this data point should be smaller. At the same time, The larger it is, the more likely it is that this data point is collected under the abnormal state of the photoelectric sensor and is less likely to be generated by the drug material passing through the photoelectric sensor. The corrected outlier factor of this data point should be larger; The smaller it is, the more likely it is that this data point is in a dense position in the data set, the more likely it is that this data point is collected under the normal state of the photoelectric sensor, and the more likely it is to be generated by the drug material passing through the photoelectric sensor. The corrected outlier factor of this data point should be smaller.
[0078] S6: Collect the data of the drug production line according to the corrected outlier factor.
[0079] Specifically, the collection of the data of the drug production line according to the corrected local outlier factor includes:
[0080] For any data point at the target position, in response to the corrected outlier factor of this data point being less than the preset abnormal threshold, it is determined that this data point is a normal data point, and real-time counting is performed to obtain the drug production quantity at the target position, completing the collection of the data of the drug production line.
[0081] The implementer can set the abnormal threshold according to the specific implementation situation. For example, 0.5.
[0082] The above are only the preferred embodiments of the present invention and are not intended to limit the present invention. Any modifications, equivalent replacements, improvements, etc. made within the principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A method for collecting data from a pharmaceutical production line, characterized in that: include: Obtain photoelectric data of each position on the pharmaceutical packaging production line at each training time and each transportation time; Record any position as the target position, divide the photoelectric data into high-level data, low-level data and transition data based on the size of the photoelectric data in the sliding window at each moment of the target position, and obtain multiple segments to be detected in the sliding window based on the categories of the photoelectric data between adjacent transition data in the sliding window; Determine the jump length of the target position at each training moment according to the length of each to-be-detected segment in the sliding window of the target position at each training moment; take the mode of the non-zero jump lengths of the target position at all training moments as the length of the jump window of the target position at each moment; based on the jump window, obtain the vibration vector of the target position at each moment, and multiple reference vectors in the vibration vector of the training moment at each moment; According to the similarity between the vibration vector of the target position at each transportation moment and all reference vectors, the state outlier value of the target position at each transportation moment is determined; each to-be-detected segment in the sliding window of the target position at each transportation moment is constructed as a data point of the target position, and according to the length of the jump window, the length of the to-be-detected segment corresponding to each data point of the target position, and the mean of the state outlier value at the transportation moment corresponding to all photoelectric data in the to-be-detected segment corresponding to each data point, the local outlier factor of each data point of the target position obtained by using the LOF algorithm is corrected, and the drug production line data is collected according to the corrected outlier factor.
2. A pharmaceutical production line data collection method according to claim 1, characterized in that: The step of dividing the photoelectric data into high level data, low level data and transition data includes: The mean value of all photoelectric data in the sliding window at each moment is recorded as the division threshold at each moment; At any moment, all photoelectric data within the sliding window at that moment that are less than the division threshold at that moment are recorded as low-level data, and the remaining photoelectric data are recorded as high-level data; For any high-level data, when the photoelectric data on either side of the high-level data is low-level data, the high-level data is recorded as transition data.
3. A drug production line data collection method according to claim 1, characterized in that: The step of obtaining a plurality of segments to be detected within the sliding window includes: For any two adjacent transition data in the sliding window of the target position at any time, in response to the absence of low-level data between the two adjacent transition data, the two adjacent transition data and all high-level data therebetween constitute a segment to be detected.
4. A pharmaceutical production line data collection method according to claim 1, characterized in that: The jump length satisfies: ; In the formula, is the target position at the training time The jump length is is the target position at the training time The number of segments to be detected in the sliding window, is the target position at the training time The sliding window of The length of the segment to be detected, is the target position at the training time The average length of all segments to be detected in the sliding window of is the target position at the training time The number of high-level data in the sliding window, for function, The symbol for rounding up.
5. A drug production line data collection method according to claim 1, characterized in that: The method for obtaining the vibration vector is: The vibration data of each position on the pharmaceutical packaging production line at each training moment and each transportation moment are obtained, and the time series consisting of all vibration data in the jump window of the target position at each moment is recorded as the vibration vector of the target position at each moment.
6. A drug production line data collection method according to claim 5, characterized in that: The method for obtaining the reference vector is: For the vibration vector at each training moment in each moment, a vibration vector that does not contain abnormal vibration data is recorded as a reference vector.
7. A drug production line data collection method according to claim 1, characterized in that: The abnormal state value satisfies: ; In the formula, The target location at the time of transport The abnormal value of the state, The target location at the time of transport The vibration vector of The target position A reference vector, is the number of reference vectors at the target position, is the natural exponential function, is the cosine similarity function, is the maximum value function.
8. A drug production line data collection method according to claim 1, characterized in that: The step of constructing each to-be-detected segment of the target location within the sliding window at each transport time as a data point of the target location includes: For each segment to be detected, the mean of the photoelectric data of all corresponding transportation moments in the segment to be detected is used as the coordinate of the first dimension, and the mean of the state anomaly values of all corresponding transportation moments in the segment to be detected is used as the coordinate of the second dimension to construct a data point of the target position.
9. A drug production line data collection method according to claim 1, characterized in that: The modified outlier factor satisfies: ; In the formula, The target position The corrected outlier factor for data points is The target position The local outlier factor of the data point is The target position The data points correspond to the length of the segment to be detected. The length of the jump window of the target position at each moment, The target position The data point corresponds to the mean of the state anomaly values of the transportation time corresponding to all the photoelectric data in the section to be detected, is the absolute value symbol.
10. A drug production line data collection method according to claim 1, characterized in that: The collecting of drug production line data according to the corrected local outlier factor includes: For any data point at the target location, in response to the corrected outlier factor of the data point being less than the preset abnormal threshold, the data point is identified as a normal data point, and real-time counting is performed to obtain the drug production quantity at the target location, thereby completing the drug production line data collection.
Citation Information
Patent Citations
Aero-engine data anomaly detection method and system
CN118468199A
Self-adaptive control method for full-automatic packaging equipment based on dynamic data acquisition
CN119329856A