Interference signal processing method and interference signal processing device
By detecting the change of signal level state and starting the timer, combined with the judgment of short time threshold and abnormal duration, the problems of slow signal processing response time, poor filtering effect and weak anti-interference ability in the prior art are solved, and the interference signal is quickly identified and filtered, and the efficiency and effect of signal processing are improved.
Patent Information
- Application Number
- CN202411869380.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-18
- Publication Date
- 2025-04-08
AI Technical Summary
In the prior art, the signal processing response time is slow, the filtering effect is poor, and the anti-interference ability is weak, making it difficult to accurately identify and filter interfering signals.
By detecting the change in the level state of the signal, the timer is started. When the signal does not change within the first preset time or the level state changes occur several times in succession, the signal is determined to be an interfering signal. This method uses a short time threshold to improve the response speed and further optimizes the filtering effect by judging the abnormal duration.
It realizes rapid identification and filtering of interfering signals, improves the response speed and filtering effect of signal processing, enhances the anti-interference ability, and avoids the problem of the output signal being affected by accidental level sudden changes.
Smart Images

Figure CN119782992A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of medical devices, and in particular to an interference signal processing method and an interference signal processing device. Background Art
[0002] When a signal is converted from an external environmental signal to an electrical signal, such as an optical signal, an ultrasonic signal, etc., more interference signals will be generated due to the influence of the external environment. Especially in the field of medical device interference signal processing, when the signal is converted from an electrical signal to an environmental signal, and then the external environmental signal is converted into an electrical signal inside the electronic device, more interference information will be received at this time, and the interference information needs to be identified before effective information can be obtained.
[0003] A photoelectric switch is an electronic device that uses the above method to detect objects. It includes a light transmitter for emitting light and a receiver for receiving reflected light. Its working principle is that when an object enters the sensing range of the switch, the light forms a reflected light after contacting the object. The reflected light is transmitted along the reflection direction and is received by the receiver. After receiving the reflected light, the receiver outputs an electrical signal. This electrical signal is the output signal of the photoelectric switch. The signal processing device processes the output signal output by the photoelectric switch to obtain useful information.
[0004] During signal transmission, in order to prevent external interference signals from affecting useful signals, the filtering algorithm used in the prior art determines whether the signal is an interference signal by delaying the output when a signal jump is detected. That is, after the signal jump occurs, the signal after the jump is output by delaying the fixed time threshold. If the jump phenomenon occurs again within the delayed fixed time threshold, it means that the signal is an interference signal. The jump signal is not output until the signal meets the condition of outputting the delayed fixed time threshold. However, when the delay time used as the threshold in the algorithm is long, the reaction time is slow, and when the delay time is short, it cannot filter out larger bands, and the anti-interference ability is weak. Summary of the invention
[0005] In order to overcome the deficiencies of the prior art, the object of the present invention is to provide an interference signal processing method and an interference signal processing device to solve the problems of slow signal processing response time, poor filtering effect and weak anti-interference ability in the prior art.
[0006] In a first aspect, the present invention provides an interference signal processing method, comprising: when a change in the level state of a signal is detected, starting timing; if the signal maintains the current level state without change within a first preset time, the current output level state of the output signal is converted to the current level state of the signal; if the level state of the signal changes again within the first preset time, clearing the timer's timing of the level state of the signal before the level state changes again; when a level state change phenomenon is detected that occurs multiple times in a row within the first preset time, judging that the signal is an interference signal.
[0007] According to the interference signal processing method of the first aspect of the present invention, the method can accurately identify the characteristics of the signal and determine whether it is an interference signal. When the jump signal interval time is less than the first preset time, it may be a mutation signal. The mutation signal does not affect the output process of the output signal. However, if the mutation signal occurs in the first preset time and the time threshold in multiple consecutive cycles, it indicates that it does not meet the normal jump phenomenon. The signal is an interference signal. Compared with the prior art, a relatively shorter time can be used as the time threshold for judging whether the signal is an interference signal. The reaction speed is fast, and it can accurately identify whether it is an interference signal. The filtering effect is good, and the output of the output signal is avoided due to the occasional level mutation. The interference signal processing method can also be used for the rapid identification between normal stable jump signals and interference signals. The corresponding speeds of the two are consistent, and the calculation and judgment are started at the beginning of the interference. Short screening is performed from the band after the interference signal is identified, and the working time with the maximum working time and meeting the short screening conditions is selected for further output, avoiding filtering the effective band.
[0008] In a preferred embodiment of the present invention, if the level state of the signal changes again within the first preset time, the timer for clearing the level state of the signal before the level state changes again further includes: Record the first time that the signal maintains the current state since the start of timing; The method further comprises: When the signal is determined to be an interference signal, calculating the abnormal duration after the level state change phenomenon first occurs within the first preset time; Determining whether the abnormality duration is greater than a second preset time; When the abnormal duration is greater than the second preset time, selecting the level state change phenomenon with the largest first time among the abnormal durations, and determining whether the first time of the level state change phenomenon is greater than a third preset time; If it is greater than, the level state of the level state change phenomenon is output as the output level of the output signal; If it is less than, the output level of the output signal maintains the current output level state.
[0009] In a preferred embodiment of the present invention, the level state of the signal includes a first level state and a second level state, and the level state changes include the following two situations: The level state of the signal changes from a first level state to a second level state; The level state of the signal changes from the second level state to the first level state; The detecting that the level state of the signal changes includes: Reading a current state of a current signal, and determining whether the current state is a first level state or a second level state; When the current state is the first level state, determining whether the level state of the previous signal is the second level state, and if the level state of the previous signal is the second level state, determining whether the level state of the signal has changed; When the current state is the second level state, it is determined whether the level state of the previous signal is the first level state; if the level state of the previous signal is the first level state, it is determined that the level state of the signal has changed.
[0010] In a preferred embodiment of the present invention, the method further comprises: When the current state is the first level state, recording a second time that the signal maintains the first level state from the start of timing; When the current state is the first level state, if the abnormal duration is greater than the second preset time, select the level state change phenomenon with the largest second time among the level state change phenomena that occur multiple times continuously within the first preset time, and determine whether the second time of the level state change phenomenon is greater than a third preset time; If so, updating the second time of the level state change phenomenon to a third preset time; and When the current state is the second level state, recording a third time that the signal maintains the second level state from the start of timing; When the current state is the second level state, if the maximum third time is greater than the third preset time, selecting the level state change phenomenon with the maximum third time among the level state change phenomena that occur multiple times continuously within the first preset time, and determining whether the third time of the level state change phenomenon is greater than the third preset time; If so, the third time of the level state change phenomenon is updated to be the third preset time.
[0011] In a preferred implementation manner of the present invention, an initial value of the third preset time is the first preset time, and the first preset time is smaller than the second preset time.
[0012] In a preferred embodiment of the present invention, the start timing includes: When the current state is the first level state, if the level state of the previous signal is the first level state, the first state time count is increased by one; When the current state is the second level state, if the level state of the previous signal is the second level state, the second state time count is increased by one.
[0013] In a preferred embodiment of the present invention, the timing of the level state of the signal before the level state changes again by the clearing timer includes: When the current state is the first level state, if the level state of the previous signal is the second level state, the second state time count is reset to zero; When the current state is the second level state, if the level state of the previous signal is the first level state, the first state time count is reset.
[0014] In a preferred embodiment of the present invention, when the signal is determined to be an interference signal, calculating the abnormal duration after the level state change phenomenon first occurs within the first preset time includes: From the time when the level state change phenomenon of the signal within the first preset time is first detected, the current state timing number of the signal is added to the abnormal timing number, and the abnormal timing number is the abnormal duration after the level state change phenomenon first occurs within the first preset time; Wherein, when the current state is a first level state, the current state timing number is a first state timing number, and the abnormal timing number is a first abnormal timing number for the first state timing number; When the current state is the second level state, the current state timing number is the second state timing number, and the abnormal timing number is the second abnormal timing number for the second state timing number; When determining whether the abnormal duration is greater than a second preset time, the method includes: Each time a level state change phenomenon of the signal is detected, determining whether the abnormal timing number is greater than a second preset time; When the abnormal time count is greater than a second preset time, the abnormal time count is reset to zero.
[0015] In a preferred embodiment of the present invention, when the abnormal duration is greater than the second preset time, selecting the level state change phenomenon with the largest first time among the level state change phenomena within the abnormal duration, and judging whether the first time of the level state change phenomenon is greater than the third preset time, comprises: When the level state change phenomenon of the signal within the first preset time is detected for the first time, the current state timing number of the signal is assigned to the abnormality duration timing value, wherein the abnormality duration timing value includes a first abnormality duration timing value for the first state timing number and a second abnormality duration timing value for the second state timing number; In the case where the level state change phenomenon is detected to occur multiple times continuously within the first preset time, each time the level state change phenomenon of the signal is detected to occur, it is determined whether the abnormality duration time value is greater than the third preset time.
[0016] In a preferred implementation manner of the present invention, the present invention is applied to an optical module, the signal is output as an optical signal in the optical module, the first level state is a high level, and the second level state is a low level.
[0017] In a second aspect, the present invention provides an interference signal processing device, comprising: an identification module, used to detect a level state change of a signal, and start a timer for timing when a change in the level state of the signal is detected; a processing module, used to summarize the abnormal duration after the level state change phenomenon first occurred within a first preset time according to the identification result of the identification module, and when the abnormal duration is greater than a second preset time, select the level state change phenomenon with the largest first time among the level state change phenomena within the abnormal duration, and if the first time of the level state change phenomenon is greater than a third preset time, output the level state of the signal corresponding to the level state change phenomenon with the largest first time.
[0018] In a third aspect, the present invention provides a computer-readable storage medium having a program stored therein, and a device controls the computer-readable storage medium to execute the method described in the first aspect when the program is executed.
[0019] Other features and advantages of the invention will be described in the following description, and partly become apparent from the description, or understood by implementing the technical solution of the invention. The purpose and other advantages of the invention can be achieved and obtained by the structures and / or processes specifically pointed out in the description, claims and drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] Figure 1 A schematic diagram of the structure of a photoelectric switch provided by one embodiment of the present invention;
[0021] Figure 2 A schematic diagram of the structure of a photoelectric switch provided by another embodiment of the present invention;
[0022] Figure 3 A schematic diagram of partial signal input and output of a signal source provided by an embodiment of the present invention;
[0023] Figure 4 A schematic diagram of partial signal input and output of another signal source provided by an embodiment of the present invention;
[0024] Figure 5 A flowchart of an interference signal processing method provided by an embodiment of the present invention;
[0025] Figure 6 A flowchart of an interference signal processing method provided by an embodiment of the present invention;
[0026] Figure 7 A schematic diagram of the structure of an interference signal processing device provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0027] The following will describe the implementation methods of the present invention in detail in combination with the accompanying drawings and embodiments, so that the implementation process of how the present invention applies technical means to solve technical problems and achieve technical effects can be fully understood and implemented accordingly. It should be noted that these specific descriptions are only for ordinary technicians in this field to understand the present invention more easily and clearly, rather than a restrictive interpretation of the present invention; for example, the first and second mentioned in the embodiments of the present invention do not constitute a limitation thereto, but are only for expressing the serial numbers of multiple identical or similar devices and mechanisms. Ordinary technicians in this field can also readjust these serial numbers for the convenience of expression or in the process of arranging technical solutions; and alternative solutions are described for some mechanisms in different embodiments, and these alternatives can also be applied to other identical or similar devices and mechanisms; and as long as there is no conflict, the various embodiments in the present invention and the various features in each embodiment can be combined with each other, and the technical solutions formed are all within the protection scope of the present invention.
[0028] The technical solution of the present invention is described in detail below through the accompanying drawings and specific embodiments.
[0029] The structure of the photoelectric switch 20 is as follows: Figure 1 and Figure 2As shown, the photoelectric switch 20 includes a transmitter 21 and a receiver 22. The transmitter 21 emits light along a first direction toward a detection position A, wherein the detection position can be set on a conveying device, and is used to detect whether there is an object at the target position on the conveying device to determine whether there is transported goods on the conveying device. Of course, it can also be applied to other places. The application scenarios of the photoelectric switch 20 are not limited here. If there is an object at the detection position, the light is reflected or blocked by the surface of the object when it reaches the object. In one setting method, refer to Figure 1 , the receiver 22 is located in the second direction of the light after being reflected by the object, so that the receiver 22 can receive the light emitted by the object, and when there is no object at the detection position, the light continues to be transmitted along the first direction and cannot be received by the receiver 22; in another configuration, refer to Figure 2 , the receiver 22 is located in the first direction of the transmitter 21. When the transmitter 21 emits light in the first direction, if there is an object at the detection position, the object will block the light from continuing to be transmitted along the first direction, so that the receiver 22 cannot receive the light, and knows that there is an object at the detection position. If there is no object at the detection position, the light continues to be transmitted along the first direction and is finally received by the receiver 22.
[0030] In the actual detection process, since the signal detection method adopted by the photoelectric switch 20 is the photoelectric signal conversion method, and there are many interfering light signals in the external environment, such as natural light or light emitted by some other electrical signal transmitting devices, etc., it will cause the signal received by the receiver 22 to have many interfering signals. If the interfering signals cannot be accurately identified and processed, the accurate detection process of the object cannot be achieved. Therefore, the light emitted by the photoelectric switch 20 is controlled by an electrical signal with a certain pulse width within a fixed period range to have a corresponding emission frequency, and the receiver 22 determines whether it is a signal emitted by the transmitter 21 or an interference signal after signal processing of the level state change of the electrical signal converted from the received optical signal.
[0031] by Figure 3Take the signal output schematic diagram shown in as an example, during the process t1~t2, the signal is output to the transmitter 21 with a period T1 and a pulse width V1, so that the light emitted by the transmitter 21 is an optical signal with a period T1 and a duration of V1 within the period. Then, after the optical signal is received by the receiver 22, it should contain the corresponding electrical signal information with a period of T1, but there may be corresponding interference information. Therefore, it is necessary to input the signal received by the receiver 22 into a signal processing device such as a filter, identify and filter out the interference information, and then identify the effective information of the receiver 22, and form an output signal for the effective information. At this time, the pulse electrical signal is a normal and stable jump signal, and the light emitted by the transmitter 21 is an optical signal with a certain period or stable pulse time. Correspondingly, the signal received by the receiver 22 should also be a normal and stable jump signal corresponding to the optical signal, and a corresponding jump process will occur within the corresponding time period.
[0032] In view of the above-mentioned situation, the present invention proposes an interference signal processing method in a first aspect of an embodiment, so as to solve the problems of slow response time, poor filtering effect and weak anti-interference ability in the prior art.
[0033] Specifically, see Figure 5 , the interference signal processing method includes: S100, when it is detected that the level state of the signal changes, the timing is started; The signal is an unprocessed signal. Taking the above embodiment as an example, the signal is an input signal before being input into the signal processing device, which may contain more interference information. Figure 1 In the photoelectric switch of the embodiment shown, the signal is a level signal converted by the receiver after receiving the light signal, and the level signal is input to a signal processing device such as a filter to become an input signal. After the signal is processed by the signal processing device, it forms an output signal and is output to the next device or data transmission line.
[0034] In S100, when the device detects that the level state of the signal has changed, it starts timing, and the timing start time is the time when the signal level state has changed. Figure 3In the figure, the level state of the signal shown in the figure has a first level state and a second level state. When the level of the signal changes, switching is performed between the two level states, that is, the level state of the signal changes from the first level state to the second level state, or the level state of the signal changes from the second level state to the first level state. In actual application scenarios, taking a photoelectric switch as an example, when the receiver receives an optical signal of corresponding brightness or frequency band, it converts the corresponding optical signal into an electrical signal. At this time, the signal is in a high-level state. When the receiver does not receive an optical signal or does not receive a signal of corresponding brightness or frequency band, the optical signal cannot be converted into an electrical signal. At this time, the signal input by the receiver to the signal processing device is in a low-level state. Based on this, when the receiver does not receive the corresponding optical signal, the level is input to the signal processing device in a low-level state. When the receiver receives an optical signal, the signal switches from a low-level state to a high-level state. At this time, the duration of the received optical signal becomes the duration of the high-level state. After the duration ends, the signal on the receiver is converted from a high-level state to a low-level state and input into the signal processing device. Therefore, in this embodiment, the actual manifestation of the level state change phenomenon should be the moment when the receiver receives the optical signal and the moment when the optical signal is no longer received. However, in actual application, due to the influence of the external environment and the factors of the photoelectric switch itself, the level state change and the reception of the optical signal may not actually correspond one to one. Therefore, it is necessary to set a signal processing device to extract a valid output signal from the signal.
[0035] S200, if the signal maintains the current level state without change within the first preset time, the current output level state of the output signal is changed to the current level state of the signal; S300, if the level state of the signal changes again within the first preset time, clearing the timer for timing the level state of the signal before the level state changes again; S400: When it is detected that the level state changes occur multiple times in a row within a first preset time, the signal is determined to be an interference signal.
[0036] The first level state is a high level state and the second level state is a low level state for detailed description, see Figure 4, the signal is input in a low level state at the initial moment, and at time point t3, the signal level jumps and switches from the low level state to the high level state. This is the first level state change phenomenon in the input signal this time. The timing starts with the time point t3 as the initial moment, and ends when the level state change phenomenon occurs again at a certain time point. The calculated time that the signal remains in the current level state is the first duration. For example, at time point t4 (not shown in the figure), the signal level jumps again and switches from the high level state to the low level state. At this time, the second level state change phenomenon occurs. The timing of the signal before the level state changes again by the timer is cleared, that is, the timing of the first time is cleared, and the timing starts with the time point t3 as the initial moment, thereby calculating the second duration from the second level state change phenomenon to the next level state change phenomenon.
[0037] Among them, when the timer calculates the first duration, if the first duration is less than the first preset time Tm1, it means that the signal may be an interference signal, but it may also be caused by a normal stable jump phenomenon. Therefore, it is necessary to judge again or multiple times whether the jump phenomenon is abnormal.
[0038] In one embodiment, the second duration maintained after the second level state change phenomenon is calculated, and if the second duration is still less than the first preset time and has not reached the preset number of times, the duration of the next level state change phenomenon is continuously monitored until the level state change phenomenon is detected multiple times under the preset number of times, and the signal is judged to be an interference signal, or if the second duration is still less than the first preset time but has reached the preset number of times, that is, two times, the signal is judged to be an interference signal. In this way, the erroneous judgment of the normal and stable jump phenomenon of the signal by the interference signal in the judgment process can be eliminated.
[0039] It should be supplemented that, when the first duration is greater than the first preset time or the remaining durations that do not reach the preset number of times are greater than the first preset time, it means that the signal may be a non-interference signal, and the signal processing device outputs the processed output signal after performing signal processing based on the input signal without filtering the signal.
[0040] In another embodiment, a second duration maintained after the second level state change phenomenon is calculated. If the second duration is still less than the first preset time and has not reached the preset number of times, the duration of the next level state change phenomenon continues to be monitored until it is detected that the sum of the durations in each level state change phenomenon is greater than or equal to the second preset time, indicating that it has exceeded the scope of the normal stable jump phenomenon and the signal is judged to be an interference signal. This implementation can improve the problems of poor interference signal filtering effect and slow response time caused by delayed time threshold in the prior art. The first preset time is used as a smaller time threshold to make a preliminary judgment on the signal jump phenomenon. If it is greater than the threshold of the first preset time, it means that the output signal can be output normally after the signal is input into the device, which corresponds to using a smaller time threshold to filter out a smaller band, and the response speed is fast. If it is less than the threshold of the first preset time and the continuous duration of the level state change phenomenon less than the threshold of the first preset time is greater than the second preset time, it means that the signal is an interference signal, which can correspond to using a larger time threshold to filter out the larger time threshold, so that the method has both the reverse response advantage under a smaller time threshold and the effect of filtering out a larger interference band under a larger time threshold, and the filtering effect is better and the anti-interference ability is strong.
[0041] Further, in the aforementioned embodiment, the duration calculated by the timer after each level state change phenomenon occurs is set as the first time, that is, the first time that the signal maintains the current state from the start of timing. Therefore, based on the above-mentioned first implementation mode, in S300, if the signal changes its level state again within the first preset time, the timer timing of the level state of the signal before the level state changes again is cleared, including: S310, when the signal is determined to be an interference signal, calculating the abnormal duration since the level state change phenomenon first occurred within the first preset time; S320, determining whether the abnormality duration is greater than a second preset time; S330, when the abnormal duration is greater than the second preset time, selecting the level state change phenomenon with the largest first time in the abnormal duration, and determining whether the first time of the level state change phenomenon is greater than a third preset time; S340, if it is greater than, outputting the level state of the level state change phenomenon as the output level of the output signal; S350: If it is less than, the output level of the output signal maintains the current output level state.
[0042] by Figure 4To continue the description of the embodiment, Sg is the input signal of the signal processing device, Sg_f is the output signal of the signal processing device, when the level state change phenomenon occurs three times in a row within the first preset time, the signal is judged as an interference signal, at this time, the initial time of the first jump phenomenon is taken as the starting time, and the abnormal duration of each first time of the consecutive multiple level state change phenomena (including the consecutive multiple level state change phenomena occurring within the first preset time in the interference signal judgment process and the level state change phenomena after the aforementioned consecutive multiple level state change phenomena) is summarized, that is, the duration d1~dn of each level state change phenomenon from the start time of the level state change phenomenon that first occurs within the first preset time is summarized until each duration is When the accumulated abnormal duration D is greater than the second preset time Tm2, the signal segment judged as the interference signal is further identified and processed, and the level state change phenomenon corresponding to the largest first time is selected. At this time, it is determined whether the largest first time dm is greater than the third preset time. If it is greater than the third preset time, it means that the signal may have a normal jump generated by a normal stable jump signal, such as when a conversion change of the cycle or pulse width occurs between two adjacent signal cycles as mentioned in the aforementioned embodiment, or when there is a timing interrupt signal between adjacent cycles, the interval time between the two adjacent cycles is shortened or there is a violent jump phenomenon between adjacent cycles, so that there is an interference signal in this signal segment, and the interference part in the signal needs to be identified and eliminated. Therefore, after selecting the largest first time dm, it is determined whether it is greater than the third preset time. If it is greater, the signal containing the largest first time dm is output, and the level state corresponding to the first time dm is maintained for output.
[0043] For example, Figure 4 During the first interference signal identification process in, when the preset number of times is three, the first signal segment is judged as an interference signal because there are three or more level state change phenomena that are less than the first preset time in a row. At this time, the jump phenomenon of the interference signal is not output, and after being judged as an interference signal and the duration d3 corresponding to the last level state change phenomenon is greater than the third preset time, the level state after the signal jump corresponding to the level state change phenomenon corresponding to the duration d3 greater than the third preset time is used as the level state of the output signal, wherein the output delay time of the output signal corresponds to the third preset time. In addition, in the case of multiple consecutive level state change phenomena, the first time used to judge that it is less than the first preset time is the second time maintained in the first level state, i.e., the high level state, or the third time maintained in the second level state, i.e., the low level state, during the occurrence of each level state change phenomenon. Corresponding to Figure 4In the embodiment, since there is a delayed output between the output signal and the input signal, the time threshold of the delayed output is expressed as a first preset time in this embodiment. Therefore, before the last level state phenomenon of the first signal segment occurs, the first signal segment identified as an interference signal will not affect the output level state of the output signal. After the last level state phenomenon occurs, after judging each first time within the abnormal duration, the signal with the maximum duration is judged to be a valid normal and stable jump signal, thereby changing the level state of the output signal to the first level state after the last level state phenomenon occurs.
[0044] In this embodiment, after the first level state change phenomenon occurs, the signal level remains in a high level state. Therefore, the judgment standard for multiple consecutive level state change phenomena is that the duration of the signal maintained in a high level state after the level state change phenomenon occurs is less than the first preset time. In this case, the signal is judged as an interference signal, but the duration of the level state change phenomenon after the level state change phenomenon occurs multiple times within the first preset time is uncertain. The duration of the level state change phenomenon after the interference signal is judged to be a component of the abnormal duration. Therefore, it is necessary to further judge and output the duration of this part to avoid being ignored because it is judged as an interference signal and is output after the second delay time threshold in this embodiment, that is, the second preset time. At this time, the abnormal duration used for comparison with the second preset time is composed of the first times in each level state change phenomenon, and combined with the above-mentioned embodiment, the first time that the recording signal maintains the current state from the start timing includes the second time that the recording signal maintains the first level state from the start timing and the third time that the recording signal maintains the second level state from the start timing.
[0045] During the second interference signal identification process, the second signal segment is judged as an interference signal because there are three or more level state change phenomena that are less than the first preset time in a row. After the initial level state change phenomenon occurs, the signal level is maintained in the second level state, that is, the low level state. At this time, the duration used to judge that is less than the first preset time is the third time maintained in the second level state and the second time maintained in the first level state during the occurrence of each level state change phenomenon. Because the third time and the second time in each continuous level state change phenomenon are both less than the first preset time and the total number of times is greater than or equal to three times, the signal is judged to be an interference signal, and when summarizing the first time in the continuous level state change phenomenon, the abnormal duration of each first time is greater than the second preset time. Therefore, it is necessary to further judge whether the maximum first time is greater than the third preset time, that is, to judge whether the second time and the third time generated in the second signal segment are greater than the third preset time. Normally, the third preset time is set to be no less than the first preset time. Therefore, when the first times of multiple consecutive level state changes in the interference signal judgment process are all less than the first preset time, it is only necessary to determine whether the remaining first times are greater than the third preset time. If they are greater, it means that the signal level state corresponding to the first time is a valid signal, and the level state corresponding to the valid signal is assigned to the output signal for output. For example, the largest first time is the second time d5, and the level state corresponding to the second time d5 is output as the output level of the output signal, and the remaining signals corresponding to the remaining first times that are not greater than the third preset time are filtered out as interference signals, and the current output level state is maintained for output within the corresponding time period.
[0046] Further, in Figure 4 In the second signal segment, when a first time greater than the third preset time is identified, that is, the second time d5, after the last level state change phenomenon of the multiple consecutive level state change phenomena, the level state corresponding to the second time d5 is output as the output level state and assigned to the output signal, corresponding to Figure 4 In the embodiment, since there is a delayed output between the output signal and the input signal, the time threshold of the delayed output is expressed as the first preset time in this embodiment, and since the level state before the second signal segment occurs is the first level state, the second signal segment identified as the interference signal will not affect the current output level state of the output signal. Therefore, the current state of the output signal after the last level state change phenomenon of the signal at the corresponding moment ends is the first level state. Since the level state corresponding to the second time d5 is also the first level state, the level state continues to be maintained at the first level state after the corresponding moment according to the level state of the second time d5 until the output of the current level state is terminated when the condition for outputting the second level state is met, that is, the interference signal corresponding to the second time d5 is output as the output level state of the output signal.
[0047] In combination with the above-mentioned embodiment, since the level state of the signal includes the first level state and the second level state, the level state changes include the following two situations: The level state of the signal changes from a first level state to a second level state; The level state of the signal changes from the second level state to the first level state.
[0048] exist Figure 4 In the embodiment shown in , when the signal level state changes, the first level state, i.e., high level, changes to the second level state, i.e., low level, or changes from the second level state, i.e., low level, to the first level state, i.e., high level. Of course, the level state can also have other modes, which are not limited here.
[0049] Therefore, the level state of the signal detected in S100 changes, including: S110, reading the current state of the current signal, and determining whether the current state is a first level state or a second level state; S120, when the current state is the first level state, determining whether the level state of the previous signal is the second level state, and if the level state of the previous signal is the second level state, determining whether the level state of the signal changes; S130, when the current state is the second level state, determine whether the level state of the previous signal is the first level state, and if the level state of the previous signal is the first level state, determine whether the level state of the signal changes.
[0050] In one embodiment, according to the embodiment in which the signal has two level states, for the case in which the current state of the output signal is the first level state, the method further includes: S121, when the current state is the first level state, if the abnormality duration is greater than the second preset time, select the level state change phenomenon with the largest second time among the level state change phenomena within the abnormality duration, and determine whether the second time of the level state change phenomenon is greater than the third preset time; S122, if yes, updating the second time of the level state change phenomenon to a third preset time; For the case where the current state of the output signal is the second level state, the method further includes: S131, when the current state is the second level state, recording the third time that the signal maintains the second level state from the start of timing; S132, when the current state is the second level state, if the abnormality duration is greater than the second preset time, select the level state change phenomenon with the largest third time among the level state change phenomena within the abnormality duration, and determine whether the third time of the level state change phenomenon is greater than the third preset time; S133: If yes, then update the third time of the level state change phenomenon to the third preset time.
[0051] Therefore, when the current state of the output signal is the first level state and the current state is the second level state, when the level state change phenomenon occurs, the duration of the other level state of the signal in the current state of the output signal, i.e., the first time, is calculated. Specifically, when the current state is the first level state, the duration of the recorded signal remaining in the current first level state, i.e., the second time, and when the level state change phenomenon occurs and the current state is converted to the second level state, the duration of the recorded signal remaining in the current second level state, i.e., the third time, is used for comparison and judgment of the abnormal duration of the sum of the second time and the third time with the second preset time. If it is greater than the second preset time, it means that there may be corresponding valid signals in the second time and the third time and they are filtered out. Then, the first time with the largest value among the level state change phenomena within the abnormal duration range is further selected to determine whether the first time is greater than the third preset time. If there is a second time or a third time as the first time that is greater than the third preset time, it means that the second time or the third time is filtered out as an interference signal and needs to be re-output after this interference signal.
[0052] In this embodiment, the initial value of the third preset time is the first preset time, and the first preset time is smaller than the second preset time, so that the signal that can be output is larger than the first preset time used as a delay time threshold.
[0053] In one embodiment, based on the existence of a first level state and a second level state in the signal level state, the start timing in S100 includes: S101, when the current state is the first level state, if the level state of the previous signal is the first level state, then the first state time count is increased by one; S102, when the current state is the second level state, if the level state of the previous signal is the second level state, then the second state time count is increased by one.
[0054] Among them, both the signal and the output signal may be timed using a unit timing number, and each unit timing number represents a certain unit time, such as 1ms, etc. Therefore, the signal is divided into small segments with the timing number as the unit during the input process. When the level state changes, it occurs between two adjacent timing numbers, that is, the signal or output signal shows one level state under the previous timing number, and the signal or output signal shows another level state under the other timing number. Therefore, in the continuously input signal, when the level state of the signal is detected to change, the timer starts timing, obtains the time the signal remains in the current state by continuously accumulating the timing number, and ends the timing when the level state changes again to obtain the duration of maintaining the current state, which is the first time, that is, the second time is obtained by the first state timing number in the first level state, and the third time is reached by the second state timing number in the second level state.
[0055] Further, S300 clears the timer to time the level state of the signal before the level state changes again, including: S301, when the current state is the first level state, if the level state of the previous signal is the second level state, clearing the second state time count; S302, when the current state is the second level state, if the level state of the previous signal is the second level state, clearing the first state time count.
[0056] That is, when the level state of the current signal changes, the timing of the original level state is cleared and recorded, and the timing of the next level state is started.
[0057] In another embodiment, when the current signal in S310 is determined to be an interference signal, calculating the abnormal duration after the level state change phenomenon first occurs within the first preset time includes: S311, from the time when the level state change phenomenon of the signal within the first preset time is first detected, the current state timing number of the signal is added to the abnormal timing number, and the abnormal timing number is the abnormal duration after the level state change phenomenon first occurs within the first preset time.
[0058] Among them, when the current state is the first level state, the current state timing number is the first state timing number, and the abnormal timing number is the first abnormal timing number for the first state timing number; when the current state is the second level state, the current state timing number is the second state timing number, and the abnormal timing number is the second abnormal timing number for the second state timing number.
[0059] Therefore, in S320, when determining whether the abnormal duration is greater than the second preset time, the method includes: S321, each time a signal level state change phenomenon is detected, determining whether the abnormal time count is greater than a second preset time; S322, when the abnormality time count is greater than the second preset time, the abnormality time count is reset to zero.
[0060] When judging whether the abnormal duration is greater than the second preset time, the abnormal duration is the sum of the second times and the third times of the first abnormal timing number and the second abnormal timing number. When the abnormal timing number is greater than the second preset time, it is judged whether all the level state change phenomena corresponding to the first times occurring in the abnormal duration of the signal are interference signals. If the largest first time is greater than the third preset time, it means that there is a missing signal that needs to be output. After judging that the abnormal duration is greater than the second preset time, the abnormal timing number is cleared so that when the level state change phenomenon occurs again within the first preset time, the abnormal timing is restarted.
[0061] According to the above description, when the abnormal duration is greater than the second preset time, selecting the level state change phenomenon with the largest first time among the level state change phenomena within the abnormal duration, and judging whether the first time of the level state change phenomenon is greater than the third preset time, includes: S331, when the level state change phenomenon of the signal within the first preset time is detected for the first time, assigning the current state timing number of the signal to the abnormality duration timing value, wherein the abnormality duration timing value includes a first abnormality duration timing value for the first state timing number and a second abnormality duration timing value for the second state timing number; S332, when a level state change phenomenon is detected to occur multiple times within a first preset time, each time a level state change phenomenon of a signal is detected to occur, determining whether the abnormality duration time value is greater than a third preset time.
[0062] The abnormality duration timing value is used to calculate the first time each time a level state change phenomenon occurs after the signal is judged as an interference signal. The abnormality duration timing value includes the first abnormality duration timing value obtained when it is in the first level state, that is, the second time mentioned in the aforementioned embodiment, and includes the second abnormality duration timing value obtained when it is in the second level state, that is, the third time mentioned in the aforementioned embodiment. The abnormality duration timing value is set as a variable value in the present method. After being judged as an interference signal, the first time recorded in each level state change phenomenon is assigned to the abnormality duration timing value for comparison with the third preset time. After the comparison, the level signal of the maximum first time greater than the third preset time is output. Among them, when the level state change phenomenon occurs for the first time within the first preset time, the first time can be assigned to the abnormal duration timing value, so as to perform real-time comparison with the third preset time. After the signal is judged as an interference signal, the first time of each subsequent level state change phenomenon can be assigned to the abnormal duration timing value. When the third preset time is greater than or equal to the first preset time, it does not affect the generation of the judgment result, because when the level state change phenomenon is detected to occur multiple times in a row within the first preset time, the first time before it is judged as an interference signal is less than the first preset time, and thus also less than the third preset time.
[0063] In this embodiment, this method is applied in an optical module, such as a photoelectric switch, and the signal is output as an optical signal in the optical module. The first level state is a high level, and the receiver exhibits a high level after receiving the optical signal. The second level state is a low level, and the receiver exhibits a low level when no optical signal is received.
[0064] Based on the above embodiments, in a specific implementation mode, refer to Figure 6 The control flow of the interference signal processing method provided in the first aspect of the embodiment is as follows: S1, read the current signal Sgn, determine whether the current signal level state is high or low, if it is high, set Tn2=Tn2+1, enter S2; if it is low, set Tn3=Tn3+1, enter S5; S2, determine whether the previous signal Sgn-1 is at a low level. If the previous signal Sgn-1 is at a low level, determine whether the abnormal signal flag m is 1. If m=1, clear the count of the third low-level time Tn3, set m to 0, and enter S3. If m=0, enter S4. If the previous signal Sgn-1 is at a high level, enter S3. S3, determine whether the abnormal time count C is 0, when C=0, enter S31, when C>0, enter S32; S31, determine whether the second time Tn2 is greater than the first preset time Tm1, if Tn2 ≥ Tm1, then output the high level state of the signal, and make m=1, the abnormal timing number C restores the initial value 0, the third preset time Tm3 restores the initial value, and the initial value is equal to Tm1, the second time Tn2 restores the initial value 0, return to S1, otherwise directly enter S1; S32, determine whether the abnormal time count C is greater than the second preset time Tm2, if C≤Tm2, return to S1; if C>Tm2, enter S33; S33, determine whether the second time Tn2 is greater than the third preset time Tm3, if Tn2>Tm3, output the high level state of the signal, set m to 1, the abnormal timing number C is restored to the initial value 0, the third preset time Tm3 is restored to the initial value, and the initial value is equal to Tm1, the second time Tn2 is restored to the initial value 0, and return to S1; if Tn2≤Tm3, directly return to S1; S4, determine whether the third time Tn3 is greater than the third preset time Tm3, if Tn3>Tm3, update Tm3=Tn3; if Tn3≤Tm3, do not update Tm3, and add the third time Tn3 to the abnormal timing number C, so that C=C+Tn3, and clear the timing number of the third time Tn3 in the low level state, and return to S1; S5, determine whether the previous signal Sgn-1 is at a low level. If the previous signal Sgn-1 is at a high level, determine whether the abnormal signal flag m is 1. If m=1, clear the timing number of the second time Tn2 of the high level, set m to 0, and enter S6. If m=0, enter S7; if the previous signal Sgn-1 is at a low level, enter S6; S6, judging whether the abnormal time count C is 0, when C=0, entering S61, when C>0, entering S62; S61, determine whether the third time Tn3 is greater than the first preset time Tm1, if Tn3 ≥ Tm1, then output the low level state of the signal, and make m=1, the abnormal timing number C restores the initial value 0, the third preset time Tm3 restores the initial value, and the initial value is equal to Tm1, the third time Tn3 restores the initial value 0, return to S1, otherwise directly enter S1; S62, determine whether the abnormal time count C is greater than the second preset time Tm2, if C≤Tm2, return to S1; if C>Tm2, enter S63; S63, determine whether the third time Tn3 is greater than the third preset time Tm3, if Tn3>Tm3, output the low level state of the signal, set m to 1, the abnormal timing number C is restored to the initial value 0, the third preset time Tm3 is restored to the initial value, and the initial value is equal to Tm1, the third time Tn3 is restored to the initial value 0, and return to S1; if Tn3≤Tm3, directly return to S1; S7. Determine whether the second time Tn2 is greater than the third preset time Tm3. If Tn2>Tm3, update Tm3=Tn2; if Tn2≤Tm3, do not update Tm3, and add the second time Tn2 to the abnormal timing number C, so that C=C+Tn2, and clear the timing number of the second time Tn2 in the high level state, and return to S1.
[0065] The initial values of the above parameters are C=0, m=0, Tn2=0, Tn3=0, Tm3=Tm1.
[0066] See also Figure 7 In a second aspect, the present invention provides an interference signal processing device, which is used to implement the interference signal processing method of the first aspect embodiment, including: The recognition module is used to detect the level state change of the signal and start the timer to count when the level state change of the signal is detected; a processing module, for summarizing the abnormal duration since the level state change phenomenon first occurred within the first preset time according to the recognition result of the recognition module, and selecting the level state change phenomenon with the largest first time among the level state change phenomena within the abnormal duration, and if the first time of the level state change phenomenon is greater than a third preset time, outputting the level state of the signal of the level state change phenomenon corresponding to the largest first time.
[0067] In a third aspect, an embodiment of the present invention further provides a computer-readable storage medium, the computer-readable storage medium comprising a stored program, wherein when the program is running, the computer-readable storage medium is controlled to execute the method of the embodiment of the first aspect of the present invention on a device.
[0068] The embodiment of the present invention further provides a computer device, the computer device of the embodiment comprises: a processor, a memory, and a computer program stored in the memory and executable on the processor, the computer program when executed by the processor implements the calibration method in the embodiment, to avoid repetition, it is not described one by one here. Alternatively, the computer program when executed by the processor implements the functions of each model / unit of the control device in the embodiment, to avoid repetition, it is not described one by one here.
[0069] Computer devices include, but are not limited to, processors and memories. Those skilled in the art will appreciate that the above are merely examples of computer devices and do not constitute a limitation on computer devices. Computer devices may include more or fewer components than shown in the figure, or may combine certain components, or different components. For example, computer devices may also include input and output devices, network access devices, buses, etc.
[0070] The processor may be a central processing unit 33 (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.
[0071] The memory may be an internal storage unit of a computer device, such as a hard disk or memory of the computer device. The memory may also be an external storage device of the computer device, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the computer device. Furthermore, the memory may include both an internal storage unit of the computer device and an external storage device. The memory is used to store computer programs and other programs and data required by the computer device. The memory may also be used to temporarily store data that has been output or is to be output.
[0072] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions can be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (Digital Subscriber Line, DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server, data center, etc. that contains one or more available media integrated. The available medium may be a magnetic medium (eg, a floppy disk, a hard disk, a magnetic tape), an optical medium (eg, a high-density digital video disc (DVD)), or a semiconductor medium (eg, a solid state disk (SSD)).
[0073] Although some specific embodiments of the present invention have been described in detail by way of example, it will be appreciated by those skilled in the art that the above examples are for illustration only and are not intended to limit the scope of the present invention. It will be appreciated by those skilled in the art that the above embodiments may be modified without departing from the scope and spirit of the present invention. The scope of the present invention is defined by the appended claims.
[0074] Finally, it should be noted that the above description is only the best embodiment of the present invention and does not limit the present invention in any form. Any technician familiar with the art can make many possible changes and simple replacements to the technical solution of the present invention by using the above disclosed practices and technical contents without departing from the scope of the technical solution of the present invention, which all belong to the scope of protection of the technical solution of the present invention.
Claims
1. A method for processing interference signals, characterized in that: include: When a change in the level state of the signal is detected, the timing is started; If the signal maintains the current level state without change within the first preset time, the current output level state of the output signal is changed to the current level state of the signal; If the level state of the signal changes again within the first preset time, clearing the timer's timing of the level state of the signal before the level state changes again; When it is detected that the level state changes occur multiple times continuously within the first preset time, the signal is determined to be an interference signal.
2. The method according to claim 1, characterized in that If the level state of the signal changes again within the first preset time, clearing the timer for timing the level state of the signal before the level state changes again also includes: Record the first time that the signal maintains the current state since the start of timing; The method further comprises: When the signal is determined to be an interference signal, calculating the abnormal duration after the level state change phenomenon first occurs within the first preset time; Determining whether the abnormality duration is greater than a second preset time; When the abnormal duration is greater than the second preset time, selecting the level state change phenomenon with the largest first time among the abnormal durations, and determining whether the first time of the level state change phenomenon is greater than a third preset time; If it is greater than, outputting the level state of the level state change phenomenon as the output level of the output signal; If it is less than, the output level of the output signal maintains the current output level state.
3. The method according to claim 2, characterized in that The level state of the signal includes a first level state and a second level state, and the level state changes include the following two situations: The level state of the signal changes from a first level state to a second level state; The level state of the signal changes from the second level state to the first level state; The detecting that the level state of the signal changes includes: Reading a current state of a current signal, and determining whether the current state is a first level state or a second level state; When the current state is the first level state, determining whether the level state of the previous signal is the second level state, and if the level state of the previous signal is the second level state, determining whether the level state of the signal has changed; When the current state is the second level state, it is determined whether the level state of the previous signal is the first level state; if the level state of the previous signal is the first level state, it is determined that the level state of the signal has changed.
4. The method according to claim 3, characterized in that The method further comprises: When the current state is the first level state, recording a second time that the signal maintains the first level state from the start of timing; When the current state is the first level state, if the abnormal duration is greater than a second preset time, select a level state change phenomenon with a maximum second time among the level state change phenomena within the abnormal duration, and determine whether the second time of the level state change phenomenon is greater than a third preset time; If so, updating the second time of the level state change phenomenon to a third preset time; and When the current state is the second level state, recording a third time that the signal maintains the second level state from the start of timing; When the current state is the second level state, if the abnormality lasts for a second preset time, a level state change phenomenon with a maximum third time among the level state change phenomena within the abnormality lasting time is selected, and it is determined whether the third time of the level state change phenomenon is greater than a third preset time; If so, the third time of the level state change phenomenon is updated to be the third preset time.
5. The method according to claim 4, characterized in that An initial value of the third preset time is the first preset time, and the first preset time is smaller than the second preset time.
6. The method according to claim 3, characterized in that: The start timing includes: When the current state is the first level state, if the level state of the previous signal is the first level state, the first state time count is increased by one; When the current state is the second level state, if the level state of the previous signal is the second level state, the second state time count is increased by one.
7. The method according to claim 6, characterized in that The timing of the level state of the signal before the level state changes again by the clearing timer includes: When the current state is the first level state, if the level state of the previous signal is the second level state, the second state time count is reset to zero; When the current state is the second level state, if the level state of the previous signal is the first level state, the first state time count is reset.
8. The method according to claim 7, characterized in that When the signal is determined to be an interference signal, calculating the abnormal duration after the level state change phenomenon first occurs within the first preset time includes: From the time when the level state change phenomenon of the signal within the first preset time is first detected, the current state timing number of the signal is added to the abnormal timing number, and the abnormal timing number is the abnormal duration after the level state change phenomenon first occurs within the first preset time; Wherein, when the current state is a first level state, the current state timing number is a first state timing number, and the abnormal timing number is a first abnormal timing number for the first state timing number; When the current state is the second level state, the current state timing number is the second state timing number, and the abnormal timing number is the second abnormal timing number for the second state timing number; When determining whether the abnormal duration is greater than a second preset time, the method includes: Each time a level state change phenomenon of the signal is detected, determining whether the abnormal timing number is greater than a second preset time; When the abnormal time count is greater than a second preset time, the abnormal time count is reset to zero.
9. The method according to claim 8, characterized in that When the abnormal duration is greater than the second preset time, selecting the level state change phenomenon with the largest first time among the level state change phenomena within the abnormal duration, and judging whether the first time of the level state change phenomenon is greater than the third preset time, comprises: When the level state change phenomenon of the signal within the first preset time is detected for the first time, the current state timing number of the signal is assigned to the abnormality duration timing value, wherein the abnormality duration timing value includes a first abnormality duration timing value for the first state timing number and a second abnormality duration timing value for the second state timing number; In the case where the level state change phenomenon is detected to occur multiple times continuously within the first preset time, each time the level state change phenomenon of the signal is detected to occur, it is determined whether the abnormality duration time value is greater than the third preset time.
10. The method according to claim 3, characterized in that Applied to an optical module, the signal is output as an optical signal in the optical module, the first level state is a high level, and the second level state is a low level.
11. An interference signal processing device, characterized in that: include: The recognition module is used to detect the level state change of the signal and start the timer to count when the level state change of the signal is detected; A processing module is used to summarize the abnormal duration since the level state change phenomenon first occurred within the first preset time according to the recognition result of the recognition module, and when the abnormal duration is greater than the second preset time, select the level state change phenomenon with the largest first time among the level state change phenomena within the abnormal duration, and if the first time of the level state change phenomenon is greater than the third preset time, output the level state of the signal of the level state change phenomenon corresponding to the largest first time.
12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a program, and when the program runs, the device controls the computer-readable storage medium to execute the method according to any one of claims 1 to 10.
Citation Information
Cited By
Signal processing method and device, equipment, storage medium and computer program product
CN120110384A
Signal processing system and method, and computer readable storage medium
CN121856621A
A signal processing system and method, and a computer-readable storage medium
CN121856621B