A method for automatic calibration control of a photoelectric sensor

By detecting shading events, constructing an off-light observation segment and dividing the original segments, extracting skeleton segments, and establishing a unified column axis for gate verification, the problem of zero-position calibration deviation of photoelectric sensors under complex working conditions is solved, and more accurate zero-position rewriting and calibration adaptability are achieved.

CN122149553APending Publication Date: 2026-06-05ONN SEMICON SHENZHEN

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
ONN SEMICON SHENZHEN
Filing Date
2026-04-22
Publication Date
2026-06-05

AI Technical Summary

Technical Problem

Existing automated calibration and control methods for photoelectric sensors struggle to finely separate the off-light observation segment when there are continuous shading events, reverse fluctuations within the off-light segment, local swings, short-term overlapping of positions, or parallel interference from multiple events. This results in unclear zero-point sources, ambiguous gate relationships, and inaccurate definition of locked sections, leading to deviations between calibration control and actual output changes.

Method used

By detecting shading events, continuous shading sampling points are merged to form shading event units. The exit boundary is extracted and the light-free observation segment is constructed. Based on the initial direction code and the first reverse turning point, the light-free observation segment is divided into multiple original segments. The skeleton segments are extracted, a unified column axis is established and a gate check is performed, the donated skeleton is screened, and the number of columns of the zero-position delivery segment determines whether to write it into the register area and rewrite the current zero-position reference.

Benefits of technology

It achieves refined identification and segmentation of the output sequence of photoelectric sensors, removes local jitter and short-term repetition, and establishes zero-point rewriting on the common structure between multiple events. The calibration process is more suitable for continuous operation scenarios, reducing the problem of inaccurate zero-point drift identification and rewriting timing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122149553A_ABST
    Figure CN122149553A_ABST
Patent Text Reader

Abstract

The application discloses a kind of photoelectric sensor automation calibration control methods, it is related to sensor calibration control technical field, this method detects shading event in continuous output sequence, merges shading sampling point into shading event unit, extracts exit boundary and constructs light observation section, and generates initial direction code and locates first reverse turning point;Again, light observation section is divided into four original fragments, and forms the skeleton of disturbance acceptance; Establish uniform column axis, the second skeleton fragment and the third skeleton fragment are projected into the third skeleton matrix of over door matrix respectively, scan full-occupancy lock segment and execute over door check;According to the result of over door check, filter donation skeleton, and according to the sampling point in the third skeleton fragment in lock segment column range Extraction forms zero position delivery section, length determination is carried out to zero position delivery section, when meeting the condition, write into register area and rewrite current zero position reference.The method is used for the zero position reference update determination and automatic calibration control of photoelectric sensor under continuous operation state.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of sensor calibration and control technology, specifically to an automated calibration and control method for photoelectric sensors. Background Technology

[0002] Photoelectric sensors are detection devices that convert changes in light-receiving state into electrical signal outputs. They are commonly used in counting, positioning, edge recognition, position determination, and cycle synchronization. During continuous operation, these devices are susceptible to various factors such as installation location, the trajectory of the light-shielding object, ambient light disturbances, device aging, output drift, and mechanical vibration. These factors can cause local fluctuations, edge trailing, short-term bounces, and unstable transitions away from light. To maintain a relatively consistent recognition benchmark in continuous operation, calibration control is typically required based on the changes in the output sequence. This involves determining and adjusting the light-shedding segment after the light shield is removed, the zero-point reference point, and the subsequent benchmark writing process. Therefore, automated calibration control of photoelectric sensors, focusing on segmented recognition, skeleton extraction, latch-up determination, and zero-point rewriting based on continuous output changes, has become a significant technical focus in continuously operating equipment.

[0003] Existing automated calibration control for photoelectric sensors largely relies on single threshold comparisons, fixed-length sampling windows, or relatively direct edge-triggered methods to select the zero point. While these methods are usable when the output sequence is relatively stable, they struggle to refine the analysis of the off-light observation segment when there are consecutive shading events, reverse fluctuations within the off-light segment, local oscillations, short-term overlapping of positions, or parallel interference from multiple events. Furthermore, it is difficult to select a more suitable effective transition segment from multiple adjacent events for the current calibration. Especially during continuous operation, relying solely on the end value of a single event or a single turning point to determine the zero point rewriting can easily lead to problems such as unclear zero point origins, ambiguous gate relationships, inaccurate definition of locked sections, and coarse write conditions in the register area, resulting in discrepancies between calibration control and actual output changes. Summary of the Invention

[0004] To address the shortcomings of existing technologies, this invention provides an automated calibration and control method for photoelectric sensors, which solves the problems mentioned in the background section.

[0005] To achieve the above objectives, the present invention provides the following technical solution: an automated calibration control method for photoelectric sensors, comprising:

[0006] In the continuous output sequence, shading events are detected, continuous shading sampling points are merged to form shading event units, the exit boundary is extracted and the sampling point before the next starting boundary is used to construct the off-light observation segment, and the initial direction code is generated based on the unequal adjacent sampling point pairs and the first reverse turning point is located.

[0007] In the light-removing observation segment, the light-removing observation segment is divided into the first original segment, the second original segment, the third original segment and the fourth original segment according to the first reverse turning point, and the first skeleton segment, the second skeleton segment and the third skeleton segment are extracted respectively and encapsulated into a descrambling and receiving skeleton.

[0008] Establish a unified column axis, and project the second skeleton segment and the third skeleton segment into a gate matrix and a third skeleton occupancy matrix respectively in the unified column axis. Mark the fully occupied locking segment in the third skeleton occupancy matrix, scan the fully occupied locking segment along the column number increment direction and perform gate verification on the previous column.

[0009] Based on the door verification result, a zero-position replacement judgment is triggered, and the donated skeleton is screened when the lock is established. Then, the sampling points of the third skeleton segment are extracted according to the lock segment column range to form the zero-position delivery segment. Based on the number of zero-position delivery segments, it is determined whether to write to the register area and rewrite the current zero-position reference.

[0010] Preferably, the original output value of the photoelectric sensor in continuous operation is merged according to the time sequence of sampling points that are continuously in the shading state to obtain several shading event units, and the exit boundary of each shading event is extracted. Then, the first sampling point after the exit boundary is taken as the starting sampling point, and the sampling point before the next starting boundary is taken as the ending sampling point to construct the off-light observation segment.

[0011] Within the off-light observation section, the first pair of adjacent sampling points with unequal original output values ​​are read and recorded as the initial direction code. The initial direction code includes an upward direction code and a downward direction code. When the value of the subsequent sampling point is greater than the value of the previous sampling point, it is recorded as an upward direction code. When the value of the subsequent sampling point is less than the value of the previous sampling point, it is recorded as a downward direction code. Using the initial direction code as a reference, the sampling point where the direction code is opposite to the initial direction code from the starting sampling point of the off-light observation section is recorded as the first reverse turning point.

[0012] Preferably, within the light-free observation segment, the continuous sampling points from the starting sampling point to the previous sampling point of the first reverse turning point are defined as the first original segment;

[0013] Based on the first reverse turning point, search point by point in chronological order. When there are three consecutive sampling points where the direction codes do not have two adjacent items with opposite directions, the sampling point that first meets the condition is defined as the starting point of the third original segment.

[0014] The continuous sampling points between the first reverse inflection point and the starting point of the third original segment are defined as the second original segment;

[0015] Based on the starting point of the third original segment, the sampling points are searched point by point in chronological order. When the condition that three consecutive sampling points are all in an unshaded state is met for the first time appears, the sampling point that first meets the condition is defined as the starting point of the fourth original segment.

[0016] The continuous sampling points between the start point of the third original segment and the start point of the fourth original segment are defined as the third original segment;

[0017] The continuous sampling points between the starting point of the fourth original segment and the ending point of the off-light observation segment are defined as the fourth original segment.

[0018] Preferably, within the first original segment, the sampling points are queried point by point in chronological order based on the starting sampling point of the first original segment. When three consecutive sampling points are determined to be in a non-shading state, the sampling point that first meets the condition is defined as the first purification start point; otherwise, the starting sampling point of the first original segment is defined as the first purification start point; the continuous sampling points from the first purification start point to the end sampling point of the first original segment are defined as the first skeleton segment.

[0019] Within the second original segment, using the last direction code within the segment as the reference direction code, each direction code is compared sequentially from the sampling point pair corresponding to the reference direction code in reverse chronological order. The comparison stops when a direction code differs from the reference direction code, and the next sampling point after the current direction code is defined as the starting point of the second skeleton. When no direction code differs from the reference direction code is found when comparing each direction code sequentially from the sampling point pair corresponding to the reference direction code to the starting position of the second original segment, the starting sampling point of the second original segment is defined as the starting point of the second skeleton. The continuous sampling points from the starting point of the second skeleton to the ending sampling point of the second original segment are defined as the second skeleton segment.

[0020] Preferably, within the third original segment, the sampling points are queried sequentially according to the starting sampling point of the third original segment. When there are four consecutive sampling points that are adjacent to each other and generate three direction codes, there are no two adjacent direction codes with opposite directions. The sampling point that first meets the condition is taken as the borrowing start point. Otherwise, the starting sampling point of the third original segment is defined as the borrowing start point. The continuous sampling points from the borrowing start point to the ending sampling point of the third original segment are taken as the subsequent segments.

[0021] Within the fourth original segment, starting from the beginning of the fourth original segment, two consecutive sampling points are queried point by point in chronological order and used as the preceding segment; when the number of sampling points in the fourth original segment is less than two, all sampling points in the fourth original segment are used as the preceding segment; the following segment and the preceding segment are spliced ​​together in chronological order to form the third skeleton segment.

[0022] The first skeleton fragment, the second skeleton fragment, and the third skeleton fragment are encapsulated in chronological order to obtain the descrambling and receiving skeleton for each shading event.

[0023] Preferably, the end sampling points of the second skeleton segments in three consecutive descrambling acceptor skeletons are read in chronological order, and the end sampling points are defined as the zero column positions of each descrambling acceptor skeleton. A unified column axis is established based on the zero column positions, wherein the unified column axis covers the column range of all second skeleton segments and third skeleton segments in the three consecutive descrambling acceptor skeletons.

[0024] The third and second skeleton segments of the three consecutive descrambling and receiving skeletons are projected onto a unified column axis to form the third skeleton occupancy matrix and the gate matrix, respectively.

[0025] Preferably, the third skeleton occupancy matrix is ​​scanned along the column number increasing direction of the unified column axis to find the continuous column interval with the smallest starting column number and satisfying that each column in the column segment is occupied by the third skeleton fragment at the same time or the number of consecutive columns in the column segment is not less than nine. This interval is denoted as the fully occupied locking segment. The column axis of the first and last columns in the fully occupied locking segment that meet the conditions is set as the starting column and ending column of the fully occupied locking segment, respectively.

[0026] If no fully occupied blocking segment is found, a blocking takeover unit is generated, and the blocking status of the blocking takeover unit is set to the unlocked state.

[0027] When a fully occupied blocking segment is found, the column preceding the current fully occupied blocking segment in the occupancy matrix is ​​taken as the candidate column for the passage, and the passage candidate column is checked.

[0028] Preferably, the gate verification includes:

[0029] The event column is a placeholder in the candidate column of the gate in the gate matrix;

[0030] The event column is a placeholder at the beginning of the full-occupancy locking segment in the third skeleton placeholder matrix;

[0031] In the descrambling acceptance skeleton corresponding to the event column, the door candidate column corresponds to the occupancy position of the second skeleton segment, the full-occupancy blocking segment start column corresponds to the occupancy position of the third skeleton segment, and the door candidate column and the full-occupancy blocking segment start column are adjacent on the same column axis.

[0032] Event sequences that simultaneously satisfy the above gate validation criteria are categorized as valid event sequences:

[0033] When the number of valid event rows is not less than three columns, the door check is determined to be successful, a locking takeover unit is generated, and the door candidate column, the start column of the full-occupancy locking segment, the full-occupancy locking segment, and the end column of the full-occupancy locking segment are written into the locking takeover unit, and the locking status of the locking takeover unit is set to the locking successful state.

[0034] When the door verification fails, the interlocking control unit is empty and marked as being in a pending verification state.

[0035] Preferably, the locking status of the locking control unit is read, and a zero-position replacement value generation judgment is performed on the current photoelectric sensor calibration cycle based on the locking status, including:

[0036] When the locking state is not locked, the donation skeleton selection is not executed, the zero page generation is not executed, the current zero baseline remains unchanged, and the zero baseline rewriting conclusion is output.

[0037] When the latching state is the waiting state, the current zero reference update process is not performed, the current zero reference remains unchanged, and the zero reference rewriting conclusion is output.

[0038] When the blocking state is the blocking established state, count the number of remaining columns of the third skeleton segment of each descrambled acceptor skeleton before the starting column of the fully occupied blocking segment, count the number of remaining columns of the third skeleton segment of each descrambled acceptor skeleton after the ending column of the fully occupied blocking segment, and add the remaining column numbers to obtain the edge remaining column number. The descrambled acceptor skeleton with the smallest edge remaining column number is taken as the donated skeleton. When there are multiple minimum values, the descrambled acceptor skeleton with the largest event sequence number is taken as the donated skeleton.

[0039] Preferably, the corresponding sampling point sequence is extracted from the third skeleton fragment of the donated skeleton based on the column range of the fully occupied locking segment to form a zero page;

[0040] Take the first two columns of the zero-position page as the gate isolation segment;

[0041] Take the consecutive column segments following the gate isolation segment in the zero-position page as the zero-position delivery segment;

[0042] When the number of consecutive columns in the zero-position projection segment is no less than five, all sampling points of the zero-position projection segment are written into the zero-position page register area in sequence, and the last sampling point of the zero-position projection segment is read and written into the current zero-position reference, and the zero-position reference rewriting conclusion is output.

[0043] When the number of consecutive columns in the zero-position projection segment is less than five, keep the current zero-position reference unchanged and output the zero-position reference rewriting conclusion.

[0044] This invention provides an automated calibration control method for photoelectric sensors. It has the following beneficial effects:

[0045] (1) This method revolves around the detection of shading events, extraction of exit boundaries, and construction of the observation segment after shading in a continuous output sequence. It organizes the originally continuous and mixed sensor outputs into event units with sequential relationships, and uses the initial direction code and the first reverse turning point to refine the identification of the numerical change trend after shading. In this way, the calibration process no longer stops at a single threshold trigger or single-point reading judgment, but includes the transition process after shading exit in the analysis scope, so that the calibration input has clearer time boundaries and change clues. Compared with the current common fixed threshold interception and single-segment sampling methods, this step divides the fluctuation stage after shading exit in more detail, and can see the dynamic trajectory of the output value when returning from the shading state to the non-shading state, which serves the subsequent zero-point determination.

[0046] (2) This method revolves around the segmented processing and skeleton extraction of the detached observation segment. It divides the data into four original segments: the first, second, third, and fourth, and then further extracts the first, second, and third skeleton segments to form a descrambling skeleton. This part is tasked with peeling away layers of local jitter, short-term repetitions, and tail dragging during the detachment process, concentrating the sampling sequence that truly participates in zero-position judgment onto a part closer to the main change pattern. Compared to existing technologies that directly take the mean, extreme values, or fixed window samples of the entire waveform, this skeletonization process is closer to the actual form of the sensor output, ensuring that subsequent judgments are no longer affected by scattered disturbances, and that the calibration conclusions are closer to the true zero-position changes under continuous operation.

[0047] (3) This method revolves around unified column axis projection, full-occupancy locking segment scanning, gate verification, donation skeleton screening, and zero-position page writing. First, three consecutive descrambling receiving skeletons are compared under the same column axis. Then, candidate data that can be used to receive the current zero position are screened based on the locking relationship and gate relationship. Finally, the length of the zero position delivery segment determines whether to rewrite the current zero position reference. This path undertakes four tasks: cross-event comparison, candidate sample identification, zero position replacement decision, and register update. The purpose is to make the rewriting of the zero position reference based on the common structure between consecutive events, rather than relying solely on a single event or single frame sample. Compared with the current techniques that mostly use independent calibration in the current cycle, manual setting of compensation points, or single-event triggering of rewriting, this method incorporates the consistency of multiple events, the receiving relationship, and the column-level correspondence into the same judgment link, making the zero position rewriting more evidence-based, the calibration process more suitable for continuous operation scenarios, and also making up for the shortcomings of existing methods in identifying zero position drift in a less detailed manner and grasping the timing of rewriting under dynamic conditions. Attached Figure Description

[0048] Figure 1 This is a schematic diagram of the steps of an automated calibration and control method for a photoelectric sensor according to the present invention;

[0049] Figure 2 This is a logic block diagram for an automated calibration control method for photoelectric sensors according to the present invention. Detailed Implementation

[0050] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0051] Example 1

[0052] Please see Figure 1 This invention provides an automated calibration control method for photoelectric sensors. To achieve the above objectives, this invention utilizes the following technical solution: including:

[0053] In the continuous output sequence, shading events are detected, continuous shading sampling points are merged to form shading event units, the exit boundary is extracted and the sampling point before the next starting boundary is used to construct the off-light observation segment, and the initial direction code is generated based on the unequal adjacent sampling point pairs and the first reverse turning point is located.

[0054] In the light-removing observation segment, the light-removing observation segment is divided into the first original segment, the second original segment, the third original segment and the fourth original segment according to the first reverse turning point, and the first skeleton segment, the second skeleton segment and the third skeleton segment are extracted respectively and encapsulated into a descrambling and receiving skeleton.

[0055] Establish a unified column axis, and project the second skeleton segment and the third skeleton segment into a gate matrix and a third skeleton occupancy matrix respectively in the unified column axis. Mark the fully occupied locking segment in the third skeleton occupancy matrix, scan the fully occupied locking segment along the column number increment direction and perform gate verification on the previous column.

[0056] Based on the door verification result, a zero-position replacement judgment is triggered, and the donated skeleton is screened when the lock is established. Then, the sampling points of the third skeleton segment are extracted according to the lock segment column range to form the zero-position delivery segment. Based on the number of zero-position delivery segments, it is determined whether to write to the register area and rewrite the current zero-position reference.

[0057] In this embodiment, by identifying shading events in the continuous output sequence, merging shading sampling points, extracting exit boundaries, and constructing an off-light observation segment, and then combining the initial direction code and the first reverse turning point, the output trajectory of the photoelectric sensor after shading exit is sequentially organized, transforming the original signal from a scattered sampling state into event-based data with boundary, direction, and turning point markers. This step undertakes tasks such as event identification, observation window truncation, and off-light stage trend positioning, aiming to limit the data range upon which zero-point calibration depends to a segment that better reflects the actual operating process. Compared to the currently common threshold-triggered point sampling, single-sampling discrimination, or fixed-window truncation methods, this processing path not only focuses on whether the threshold is exceeded but also on the continuous change relationship after exiting, making the subsequent judgment basis more complete, and the reference basis for zero-point determination closer to continuous operating conditions. By dividing the detached observation segment into four segments around the first reverse inflection point, and extracting the first, second, and third skeleton segments from each original segment, a descrambling and continuation skeleton is ultimately encapsulated. This process preserves the main changes during detachment while isolating local jitter, short-term round trips, and tail-end clutter. This step handles sequence segmentation, skeleton extraction, and continuation structure organization, aiming to base subsequent zero-position correlation judgments on a more representative sampling sequence. Compared to existing technologies that directly use the mean, extreme values, or end values ​​of the entire waveform or participate in calibration with a fixed number of samples, this skeletonization process better reflects the sequential connections during detachment, transforming the judgment object from "whole mixed data" to "main data," making zero-position identification more targeted under complex waveforms. By establishing a unified column axis, the second and third skeleton segments are projected into a gate matrix and a third skeleton occupancy matrix, respectively. Combined with full-occupancy locking segment scanning, gate verification, donated skeleton screening, and zero-position delivery segment length determination, a zero-position replacement judgment chain involving multiple events is formed. This part undertakes tasks such as cross-event alignment, column-level occupancy comparison, locking condition screening, candidate skeleton selection, and zero-position benchmark rewriting determination. The aim is to ensure that the rewriting of the current zero-position benchmark is based on the common structure across multiple shading events, rather than relying solely on a single event or instantaneous value. Compared to current techniques that often employ single-cycle independent calibration, manually set compensation points, and direct rewriting of single events, this method is more refined in terms of rewriting timing, rewriting objects, and rewriting conditions. It can clearly see the correspondence between consecutive events and ensure that the zero-position register writing is consistent with the actual trajectory acceptance state, making the calibration process smoother in continuous operation scenarios, and ensuring that zero-position drift identification and benchmark updates are systematic.

[0058] Imagine this scenario: In the first step, on the conveyor line, a photoelectric sensor continuously detects passing sheet-like workpieces. When unobstructed, the initial output value is approximately 820. After the workpiece blocks the light path, the output value drops to around 120. Once the workpiece leaves, the value begins to rise again, but this rise is accompanied by mechanical vibrations, edge burrs, and ambient light disturbances. The sequence might appear as 120, 180, 260, 410, 530, 505, 548, 590, 610, 608, and 615. Simply observing whether a single point crosses the threshold often only indicates that "the light blocking has ended," without revealing the transitional state after exiting the light blocking. Here, we first group the sampling points continuously in the light-blocking state into a single light-blocking event unit, then take the exit boundary of that event, and extract the entire data segment up to the start of the next light blocking as the off-light observation segment. Then, by comparing adjacent sampling points to determine whether they rise or fall, a direction is established. For example, 180 to 260 is recorded as an increase, and 530 to 505 as a decrease. The first point where the trend changes from "rising" to "falling" can be considered the first reversal turning point. After this processing, what we get is no longer a series of random readings, but a segment of observation data with a start point, end point, trend direction, and inflection point markings. The object of calibration changes from "a single value" to "a structured light-removal process." In the second part, the light-removal observation segment is further broken down around this reversal turning point, cutting the entire data segment into several clearly connected parts, and then extracting the truly representative framework from them. Taking the transport line example again, the first segment after light removal often has a trailing effect from when the light-blocking has just exited, followed by a relatively consistent upward trend, then a small oscillation area, and finally a stabilizing area. If all these data of different properties are mixed together for zero-point judgment, it is easy to mistake temporary fluctuations for calibration criteria. Therefore, the observation segment is first divided into four original segments, and then the parts unsuitable for direct judgment are filtered out within each segment. For example, if the first three points in the first original segment are continuously in an unshaded state, this is taken as the starting point of the first skeleton segment; the second original segment is traced back from the end to find the segment where the direction becomes consistent again, which is taken as the second skeleton segment; the third original segment is then spliced ​​together with the beginning of the fourth original segment to obtain the third skeleton segment. The first, second, and third skeleton segments extracted in this way actually correspond to the purified front segment after leaving the shading, the main variable segment that can be received, and the subsequent segment that approaches the stable zero position. After the three segments are encapsulated in chronological order, the descrambling and receiving skeleton is obtained. In layman's terms, it is to organize an output waveform that originally had jagged edges, swings, and tail drags into a main trajectory that is more suitable for comparison and continuation. In the third and fourth steps, instead of looking at a single event, the descrambling and receiving skeletons of three consecutive events are read simultaneously, they are aligned column by column under the same column axis, and then it is determined which column intervals belong to the stable receiving area shared by all three events.To give a more concrete example, suppose that after three consecutive workpieces pass through, each forming its own second and third skeleton segments. The system projects the second skeleton segment into a gate matrix and the third skeleton segment into a placeholder matrix. If it is found that the third skeleton segments of the three events occupy positions simultaneously in columns 6 to 15, then this segment can be considered a fully occupied locked segment. Next, it checks whether the column before the locked segment meets the gate condition, that is, whether the three events all have a column-level connection relationship of "the second skeleton is exactly connected to the third skeleton". If the gate relationship is valid, it means that these events exhibit similar connection patterns in the latter half of the light-removing segment. At this point, the skeleton with the smallest number of remaining columns at the edge is selected as the donor skeleton. The corresponding sampling points are extracted according to the column range of the locked segment to form a zero-position page. Then, the gate isolation segments of the first two columns are removed to obtain the zero-position delivery segment that actually participates in the writing. If the zero-position projection segment is long enough, such as five columns or more, this segment is written into the register area, and the last sampling point is written as the current zero-position reference. If the length is insufficient, the original zero-position reference is retained. Compared with common practices, many existing solutions tend to focus on single events, single thresholds, and single triggers. When a waveform appears to return to the normal range, the zero position is directly rewritten. This can easily lead to zero-position fluctuations when vibration, dirt, edge gaps, and installation offsets coexist. The processing path here is to first perform event-based decomposition, then skeleton-based filtering, then three-event alignment verification, and finally decide whether to write to the zero position. Therefore, the correspondence between calibration actions and the actual light trajectory is clearer, and the zero-position drift, short-term false return, and local false stability phenomena in continuously operating equipment are observed in greater detail.

[0059] Example 2

[0060] Please refer to Figure 2 Specifically: for the raw output value of the photoelectric sensor in continuous operation, the sampling points that are continuously in the shading state are merged according to the time sequence to obtain several shading event units, and the exit boundary of each shading event is extracted. Then, the first sampling point after the exit boundary is taken as the starting sampling point, and the sampling point before the next starting boundary is taken as the ending sampling point to construct the off-light observation segment.

[0061] Within the off-light observation section, the first pair of adjacent sampling points with unequal original output values ​​are read and recorded as the initial direction code. The initial direction code includes an upward direction code and a downward direction code. When the value of the subsequent sampling point is greater than the value of the previous sampling point, it is recorded as an upward direction code. When the value of the subsequent sampling point is less than the value of the previous sampling point, it is recorded as a downward direction code. Using the initial direction code as a reference, the sampling point where the direction code is opposite to the initial direction code from the starting sampling point of the off-light observation section is recorded as the first reverse turning point.

[0062] In practical implementation, this embodiment is applied to continuous operation scenarios where sheets, bottle caps, or electronic components on a conveyor line pass through the detection optical path. The control unit continuously reads the original output value of the photoelectric sensor according to the sampling cycle, and first merges the sampling points that are continuously in the light-blocking state according to the time sequence, and recognizes the same continuous light-blocking interval as a light-blocking event unit. When a workpiece leaves the optical path, the end of the light-blocking event is taken as the exit boundary, and the first sampling point after the exit boundary is taken as the starting point of the light-blocking observation segment. The sampling point before the starting boundary of the next light-blocking event is taken as the end point of the light-blocking observation segment, thereby extracting the complete light-blocking process after the end of a single light-blocking. For example, in a packaging and conveying scenario, after a workpiece leaves the inspection area, the output sequence may appear sequentially as 120, 165, 230, 318, 402, 396, 421, and 438. At this time, in the off-light observation section, the first pair of adjacent sampling points with unequal values, 120 and 165, are read. Since the latter sampling point is greater than the former sampling point, it can be recorded as the upward direction code. Subsequently, adjacent sampling point pairs are read in chronological order. When the pair of 402 and 396 appears, the direction changes from upward to downward. The position corresponding to 396 is then identified as the first reverse turning point. Through this implementation method, the original continuous output values ​​are organized into a sequential processing chain of "shading event recognition - exit boundary extraction - off-light observation segment construction - direction code interpretation - reverse turning point positioning". The purpose is to separate the recovery trajectory after the shading exit and establish a clear discrimination boundary between the initial off-light segment and the initial swing point. This ensures that subsequent original segment division, skeleton extraction, locked scanning, and zero-position placement determination are all based on data with directional meaning and turning point markers. Compared with existing methods that use single-point threshold triggering, fixed window interception, or single-time return reading discrimination, this processing method can distinguish the fluctuations, swings, and glitches in the off-light stage from the true regression trend, suppress misjudgments caused by short-term jitter, and make the selection of calibration starting point, observation segment limitation, and subsequent zero-position determination continuous, systematic, and scene-corresponding.

[0063] Example 3

[0064] Please refer to Figure 2 Specifically: within the light-free observation segment, the continuous sampling points from the starting sampling point to the sampling point preceding the first reverse turning point are defined as the first original segment;

[0065] Based on the first reverse turning point, search point by point in chronological order. When there are three consecutive sampling points where the direction codes do not have two adjacent items with opposite directions, the sampling point that first meets the condition is defined as the starting point of the third original segment.

[0066] The continuous sampling points between the first reverse inflection point and the starting point of the third original segment are defined as the second original segment;

[0067] Based on the starting point of the third original segment, the sampling points are searched point by point in chronological order. When the condition that three consecutive sampling points are all in an unshaded state is met for the first time appears, the sampling point that first meets the condition is defined as the starting point of the fourth original segment.

[0068] The continuous sampling points between the start point of the third original segment and the start point of the fourth original segment are defined as the third original segment;

[0069] The continuous sampling points between the starting point of the fourth original segment and the ending point of the off-light observation segment are defined as the fourth original segment.

[0070] Within the first original segment, the sampling points are queried sequentially according to the starting sampling point of the first original segment. When three consecutive sampling points are determined to be in an unshaded state, the sampling point that first meets the condition is defined as the first purification start point. Otherwise, the starting sampling point of the first original segment is defined as the first purification start point. The continuous sampling points from the first purification start point to the end sampling point of the first original segment are defined as the first skeleton segment.

[0071] Within the second original segment, using the last direction code within the segment as the reference direction code, each direction code is compared sequentially from the sampling point pair corresponding to the reference direction code in reverse chronological order. The comparison stops when a direction code differs from the reference direction code, and the next sampling point after the current direction code is defined as the starting point of the second skeleton. When no direction code differs from the reference direction code is found when comparing each direction code sequentially from the sampling point pair corresponding to the reference direction code to the starting position of the second original segment, the starting sampling point of the second original segment is defined as the starting point of the second skeleton. The continuous sampling points from the starting point of the second skeleton to the ending sampling point of the second original segment are defined as the second skeleton segment.

[0072] Within the third original segment, the sampling points are queried sequentially according to the starting sampling point of the third original segment. When there are four consecutive sampling points that are adjacent to each other and generate three direction codes, there are no two adjacent direction codes with opposite directions. The sampling point that first meets the condition is taken as the borrowing start point. Otherwise, the starting sampling point of the third original segment is defined as the borrowing start point. The continuous sampling points from the borrowing start point to the ending sampling point of the third original segment are taken as the subsequent segments.

[0073] Within the fourth original segment, starting from the beginning of the fourth original segment, two consecutive sampling points are queried point by point in chronological order and used as the preceding segment; when the number of sampling points in the fourth original segment is less than two, all sampling points in the fourth original segment are used as the preceding segment; the following segment and the preceding segment are spliced ​​together in chronological order to form the third skeleton segment.

[0074] The first skeleton fragment, the second skeleton fragment, and the third skeleton fragment are encapsulated in chronological order to obtain the descrambling and receiving skeleton for each shading event.

[0075] In this embodiment, during the light-free observation segment formed after each light-blocking event ends, the first original segment is determined by the continuous sampling points between the starting sampling point and the sampling point before the first reverse turning point. Then, the position where the direction code corresponding to three consecutive sampling points has no opposite adjacent items is searched in chronological order from the first reverse turning point, and the sampling point that first meets the condition is set as the starting point of the third original segment, and the second original segment is defined accordingly. Subsequently, the position where three consecutive sampling points are in a non-light-blocking state for the first time is searched from the starting point of the third original segment, and this position is set as the starting point of the fourth original segment, thus obtaining the third original segment and the fourth original segment in sequence. Based on this, three consecutive unshaded sampling points are found for the first original segment, and the position that first meets the conditions is taken as the first purification starting point to extract the first skeleton segment. For the second original segment, the rear direction code is used as a reference for reverse comparison, and the end segment with the same direction is extracted as the second skeleton segment. For the third original segment, the position where there are no adjacent items with opposite directions among the three direction codes formed by four consecutive sampling points is taken as the borrowing starting point and the subsequent segment is extracted. Then, the two consecutive sampling points at the beginning of the fourth original segment are taken as the attachment front segment and spliced ​​with the subsequent segment to form the third skeleton segment. Finally, the first skeleton segment, the second skeleton segment, and the third skeleton segment are encapsulated in chronological order to form a descrambling and receiving skeleton. Through the above implementation method, the front swing, middle fluctuation, and rear stabilization in the off-light observation segment are separated and processed. The scattered disturbances, short-term bounces, and tail drags mixed in the original sequence are separated out. The data on which the calibration judgment is based is transformed from the whole mixed waveform into a skeleton sequence with a sequential relationship. The purpose is to establish a unified data foundation for subsequent column axis projection, locking identification, donation skeleton screening, and zero-position delivery segment extraction. Compared to the processing method of directly participating in the zero-position determination based on single-point thresholds, fixed windows, or the entire original sequence, this section can clearly express the structural boundaries, directional transitions, and continuity relationships during the light removal process. This provides a clear basis for the source, truncation range, and sequence of zero-position candidate data, and the determination landing point, continuity zone identification, and zero-position writing conditions during the calibration process also have a consistent sequence basis.

[0076] Example 4

[0077] Please refer to Figure 2 Specifically: Read the end sampling point of the second skeleton segment in three consecutive descrambling acceptor skeletons in chronological order, and define the end sampling point as the zero column position of each descrambling acceptor skeleton. Establish a unified column axis based on the zero column position. The unified column axis covers the column range of all second skeleton segments and third skeleton segments in three consecutive descrambling acceptor skeletons.

[0078] The third and second skeleton segments of the three consecutive descrambling and receiving skeletons are projected onto a unified column axis to form the third skeleton occupancy matrix and the gate matrix, respectively.

[0079] Scan along the column number increasing direction of the unified column axis on the third skeleton occupancy matrix to find the continuous column interval with the smallest starting column number that satisfies that each column in the column segment is simultaneously occupied by the third skeleton fragment or the number of consecutive columns in the column segment is not less than nine. This interval is denoted as the fully occupied locking segment. The column axis of the first and last columns in the fully occupied locking segment that meet the conditions is set as the starting column and ending column of the fully occupied locking segment, respectively.

[0080] If no fully occupied blocking segment is found, a blocking takeover unit is generated, and the blocking status of the blocking takeover unit is set to the unlocked state.

[0081] When a fully occupied blocking segment is found, the column preceding the current fully occupied blocking segment in the occupancy matrix is ​​taken as the candidate column for the passage, and the passage candidate column is checked.

[0082] The gate verification includes:

[0083] The event column is a placeholder in the candidate column of the gate in the gate matrix;

[0084] The event column is a placeholder at the beginning of the full-occupancy locking segment in the third skeleton placeholder matrix;

[0085] In the descrambling acceptance skeleton corresponding to the event column, the door candidate column corresponds to the occupancy position of the second skeleton segment, the full-occupancy blocking segment start column corresponds to the occupancy position of the third skeleton segment, and the door candidate column and the full-occupancy blocking segment start column are adjacent on the same column axis.

[0086] Event sequences that simultaneously satisfy the above gate validation criteria are categorized as valid event sequences:

[0087] When the number of valid event rows is not less than three columns, the door check is determined to be successful, a locking takeover unit is generated, and the door candidate column, the start column of the full-occupancy locking segment, the full-occupancy locking segment, and the end column of the full-occupancy locking segment are written into the locking takeover unit, and the locking status of the locking takeover unit is set to the locking successful state.

[0088] When the door verification fails, the interlocking control unit is empty and marked as being in a pending verification state.

[0089] In this embodiment, three consecutive descrambling acceptor skeletons are selected in chronological order. The end sampling point of the second skeleton segment of each skeleton is read and defined as the zero column position of the corresponding skeleton. A unified column axis is then established by aligning the three zero column positions, so that the unified column axis covers the column range of all second and third skeleton segments in the three skeletons. Subsequently, the second skeleton segments in the three skeletons are mapped column by column to the unified column axis to form a gate matrix. The third skeleton segments in the three skeletons are mapped column by column to the unified column axis to form a third skeleton occupancy matrix. Each row of the matrix corresponds to a descrambling acceptor skeleton, and each column corresponds to a column number in the unified column axis. Occupancy indicates that the skeleton has a corresponding sampling point in that column. Unoccupied space indicates that the skeleton has an unoccupied space. This indicates that there is no corresponding sampling point in this column. Based on this, the third skeleton occupancy matrix is ​​scanned along the unified column axis in ascending order of column number. The search is conducted for consecutive column intervals with the smallest starting column number where each column is simultaneously occupied by three third skeleton segments, or where the number of consecutive columns reaches nine or more. This interval is recorded as a fully occupied locking segment, and the starting and ending columns of this interval are also recorded. If no fully occupied locking segment is found during the scan, a locking takeover unit is generated, and the locking state is recorded as unlocked, indicating that no common column segment suitable for zero-position reception has yet been formed among the three events. If a fully occupied locking segment is found, the column preceding this locking segment is taken as a candidate threshold column, and threshold verification is performed on each of the three events. The verification includes: the candidate threshold column of the event in the threshold matrix. If a second skeleton segment occupies a position in a column, and a third skeleton segment occupies a position in the starting column of the full-occupancy locking segment of the third skeleton segment matrix, and the second and third skeleton segment occupies positions in the event are adjacent end-to-end on the same column axis, this confirms whether the event has a continuous succession relationship from the second skeleton segment to the third skeleton segment. Events that simultaneously meet the above conditions are recorded as events that pass the gate check. When the number of events that pass the gate check reaches three, the gate candidate column, the starting column of the full-occupancy locking segment, the full-occupancy locking segment, and the ending column of the full-occupancy locking segment are written into the locking takeover unit, and the locking status is recorded as locking established. This indicates that three consecutive events have formed a shared succession interval on the same column axis, which can be used as subsequent... The structural basis for zero-position replacement judgment: When the number of events that pass the gate check is less than three, the locking takeover unit is recorded as empty and the locking state is recorded as pending verification, indicating that although there is a local common occupation, it is not enough to support the takeover judgment; The purpose of this implementation is to put the third skeleton connection relationship that was originally scattered in three independent events into the same column axis for unified comparison, so that the zero-position replacement judgment is based on the common connection structure of continuous events, rather than on a single fluctuation of a single event. Its beneficial effects are reflected in: First, through zero column alignment and unified column axis projection, the column positions of different events are comparable; Second, through full occupation locking segment screening, the common stable interval in the third skeleton segment can be identified separately.Third, the transition relationship between the second and third skeleton segments is confirmed column by column through the gate check. The zero-position replacement is based not only on overlapping occupancy but also on the order of succession. Fourth, the three states of locking (established, pending verification, and not locked) provide a hierarchical entry point for subsequent zero-position processing. As for the full-occupancy locking segment using no fewer than nine consecutive columns, this segment is responsible for determining the "common succession interval." If the number of columns is too short, accidental overlaps in the third skeleton segment caused by edge trailing, single jitter, or short-term edge contact may be mistakenly recorded as locking intervals. The length of nine columns can cover a complete continuous occupancy process, giving the locking segment continuity and observation span. If the number of columns is too large, common intervals that already have succession significance but whose length is limited by the event cycle will not be able to enter the locking determination, and the column segment selection will be too stringent. Therefore, no fewer than nine columns are used as the continuous length threshold for the locking segment. The requirement of at least three events passing the threshold verification is because this step consistently reads three consecutive descrambling and connection skeletons. Only when all three events satisfy the adjacent connection relationship at the threshold candidate column and the locking start column does it indicate that the locking segment is not a separate trajectory of individual events, but rather a column-level continuation structure shared by three consecutive events. If only one or two events are used as the basis for validity, it only indicates local consistency and does not prove that the structure has formed a unified connection basis in this round of consecutive events. Therefore, at least three events are set, and no other number is used.

[0090] Example 5

[0091] Please refer to Figure 2 Specifically: The locking status of the locking control unit is read, and based on the locking status, a zero-position replacement value generation judgment is performed for the current photoelectric sensor calibration cycle, including:

[0092] When the locking state is not locked, the donation skeleton selection is not executed, the zero page generation is not executed, the current zero baseline remains unchanged, and the zero baseline rewriting conclusion is output.

[0093] When the latching state is the waiting state, the current zero reference update process is not performed, the current zero reference remains unchanged, and the zero reference rewriting conclusion is output.

[0094] When the blocking state is the blocking established state, count the number of remaining columns of the third skeleton segment of each descrambled acceptor skeleton before the starting column of the fully occupied blocking segment, count the number of remaining columns of the third skeleton segment of each descrambled acceptor skeleton after the ending column of the fully occupied blocking segment, and add the remaining column numbers to obtain the edge remaining column number. The descrambled acceptor skeleton with the smallest edge remaining column number is taken as the donated skeleton. When there are multiple minimum values, the descrambled acceptor skeleton with the largest event sequence number is taken as the donated skeleton.

[0095] Based on the column range of the fully occupied locking segment, the corresponding sampling point sequence is extracted from the third skeleton fragment of the donated skeleton to form a zero page;

[0096] Take the first two columns of the zero-position page as the gate isolation segment;

[0097] Take the consecutive column segments following the gate isolation segment in the zero-position page as the zero-position delivery segment;

[0098] When the number of consecutive columns in the zero-position projection segment is no less than five, all sampling points of the zero-position projection segment are written into the zero-position page register area in sequence, and the last sampling point of the zero-position projection segment is read and written into the current zero-position reference, and the zero-position reference rewriting conclusion is output.

[0099] When the number of consecutive columns in the zero-position projection segment is less than five, keep the current zero-position reference unchanged and output the zero-position reference rewriting conclusion.

[0100] In this embodiment, the locking status of the locking takeover unit is read and used as the entry point for determining whether a zero-position replacement value is generated in the current calibration round. When the locking status is not locked, it means that no fully occupied locking segment has been formed in the third skeleton occupancy matrix. At this time, the donation skeleton screening process is not entered, and no zero-position page is generated. The current zero-position benchmark continues to be used, and the conclusion that the zero-position benchmark is not rewritten in this round is output. When the locking status is pending verification, it means that the gate verification of the column before the fully occupied locking segment has failed, the locking takeover unit is empty, and although there are signs of locking candidates in the current round, no column-level correspondence that can be directly connected has been formed between the second skeleton segment and the third skeleton segment. Therefore, the current zero-position benchmark is not updated, the original zero-position benchmark is maintained, and the conclusion that it is not rewritten is output. When the locking status is locked, the third skeleton segment of each descrambling takeover skeleton participating in the comparison is counted one by one. The remaining column counts before the start column of the full-occupancy blocking segment and after the end column of the full-occupancy blocking segment are added together to obtain the edge remaining column count. The descrambling acceptor skeleton with the smallest edge remaining column count is used as the donation skeleton. If multiple minimum values ​​exist, the descrambling acceptor skeleton with the largest event sequence number is selected. Then, based on the column range of the full-occupancy blocking segment, the corresponding sampling point sequence is extracted from the third skeleton segment of the donation skeleton to form a zero-position page. The first two columns of the zero-position page are designated as a threshold isolation segment, and the continuous column segments after the threshold isolation segment are designated as zero-position delivery segments. When the number of continuous columns in the zero-position delivery segment is not less than five, all sampling points in the zero-position delivery segment are written sequentially to the zero-position page register area. Then, the last sampling point of the zero-position delivery segment is written to the current zero-position reference, and the zero-position reference rewriting conclusion is output. When the number of continuous columns in the zero-position delivery segment is less than five, no register writing or zero-position reference rewriting is performed, and the current zero-position reference remains unchanged. Following this path, the locking state reading, donation skeleton screening, zero-position page construction, gate isolation, zero-position delivery, and zero-position baseline writing are connected into a complete processing flow. The purpose is to limit the zero-position rewriting action to the conditions of "locking relationship established, gate relationship clear, and delivery segment length sufficient", so that the zero-position replacement value comes from the third skeleton segment that can be accepted, rather than from single-point fluctuations or short-segment temporary data. The corresponding benefits are that the three states of non-locked, pending verification, and locked state each have separate exits, the processing boundaries in the calibration rounds are clear, the triggering conditions, data sources, and writing timing of zero-position rewriting have clear basis, and the zero-position processing order in continuous operation scenarios also tends to be stable.The reason for setting the zero-position delivery segment to no less than five columns, rather than three, four, or other shorter columns, is that the first two columns of the zero-position page have already been designated as threshold isolation segments. If the number of remaining columns is too small, only a very short receiving sample will be retained after the locking segment, making it difficult to reflect the continuous extension state of the third skeleton segment after the locking interval, and also difficult to distinguish from instantaneous swing and edge trailing. Setting the threshold at five columns means that after deducting the first two isolation columns, at least three continuous delivery columns are still retained. This can cover the actual receiving interval after the locking and avoid using excessively short columns directly for zero-position reference rewriting. If the threshold is further set to six, seven, or longer, it will compress the range of acceptable locking samples, preventing some zero-position pages that already meet the conditions for continuous receiving from entering the registration process. Therefore, five columns correspond to the value limit between threshold isolation requirements and subsequent receiving length.

[0101] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the appended technical solutions and their equivalents.

Claims

1. An automated calibration control method for photoelectric sensors, characterized in that, include: In the continuous output sequence, shading events are detected, continuous shading sampling points are merged to form shading event units, the exit boundary is extracted and the sampling point before the next starting boundary is used to construct the off-light observation segment, and the initial direction code is generated based on the unequal adjacent sampling point pairs and the first reverse turning point is located. In the light-removing observation segment, the light-removing observation segment is divided into the first original segment, the second original segment, the third original segment and the fourth original segment according to the first reverse turning point, and the first skeleton segment, the second skeleton segment and the third skeleton segment are extracted respectively and encapsulated into a descrambling and receiving skeleton. Establish a unified column axis, and project the second skeleton segment and the third skeleton segment into a gate matrix and a third skeleton occupancy matrix respectively in the unified column axis. Mark the fully occupied locking segment in the third skeleton occupancy matrix, scan the fully occupied locking segment along the column number increment direction and perform gate verification on the previous column. Based on the door verification result, a zero-position replacement judgment is triggered, and the donated skeleton is screened when the lock is established. Then, the sampling points of the third skeleton segment are extracted according to the lock segment column range to form the zero-position delivery segment. Based on the number of zero-position delivery segments, it is determined whether to write to the register area and rewrite the current zero-position reference.

2. The automated calibration control method for a photoelectric sensor according to claim 1, characterized in that, For the raw output value of the photoelectric sensor in continuous operation, the sampling points that are continuously in the shading state are merged according to the time sequence to obtain several shading event units. The exit boundary of each shading event is extracted, and the first sampling point after the exit boundary is taken as the starting sampling point, and the sampling point before the next starting boundary is taken as the ending sampling point to construct the off-light observation segment. Within the off-light observation section, the first pair of adjacent sampling points with unequal original output values ​​are read and recorded as the initial direction code. The initial direction code includes an upward direction code and a downward direction code. When the value of the subsequent sampling point is greater than the value of the previous sampling point, it is recorded as an upward direction code. When the value of the subsequent sampling point is less than the value of the previous sampling point, it is recorded as a downward direction code. Using the initial direction code as a reference, the sampling point where the direction code is opposite to the initial direction code from the starting sampling point of the off-light observation section is recorded as the first reverse turning point.

3. The automated calibration control method for a photoelectric sensor according to claim 2, characterized in that, Within the light-free observation segment, the consecutive sampling points from the starting sampling point to the previous sampling point of the first reverse inflection point are defined as the first original segment; Based on the first reverse turning point, search point by point in chronological order. When there are three consecutive sampling points where the direction codes do not have two adjacent items with opposite directions, the sampling point that first meets the condition is defined as the starting point of the third original segment. The continuous sampling points between the first reverse inflection point and the starting point of the third original segment are defined as the second original segment; Based on the starting point of the third original segment, the sampling points are searched point by point in chronological order. When the condition that three consecutive sampling points are all in an unshaded state is met for the first time appears, the sampling point that first meets the condition is defined as the starting point of the fourth original segment. The continuous sampling points between the start point of the third original segment and the start point of the fourth original segment are defined as the third original segment; The continuous sampling points between the starting point of the fourth original segment and the ending point of the off-light observation segment are defined as the fourth original segment.

4. The automated calibration control method for a photoelectric sensor according to claim 3, characterized in that, Within the first original segment, the sampling points are queried sequentially according to the starting sampling point of the first original segment. When three consecutive sampling points are determined to be in an unshaded state, the sampling point that first meets the condition is defined as the first purification start point. Otherwise, the starting sampling point of the first original segment is defined as the first purification start point. The continuous sampling points from the first purification start point to the end sampling point of the first original segment are defined as the first skeleton segment. Within the second original segment, the last direction code within the second original segment is used as the reference direction code. Starting from the sampling point pair corresponding to the reference direction code, each direction code is compared in reverse chronological order. When a direction code is found to be different from the reference direction code, the comparison stops, and the next sampling point of the current direction code is defined as the starting point of the second skeleton. When no direction code different from the reference direction code is found in the sampling point pair corresponding to the reference direction code after comparing each direction code in reverse chronological order up to the starting position of the second original segment, the starting sampling point of the second original segment is defined as the starting point of the second skeleton. The continuous sampling points from the starting point of the second skeleton to the ending sampling point of the second original segment are defined as the second skeleton segment.

5. The automated calibration control method for a photoelectric sensor according to claim 4, characterized in that, Within the third original segment, the sampling points are queried sequentially according to the starting sampling point of the third original segment. When there are four consecutive sampling points that are adjacent to each other and generate three direction codes, there are no two adjacent direction codes with opposite directions. The sampling point that first meets the condition is taken as the borrowing start point. Otherwise, the starting sampling point of the third original segment is defined as the borrowing start point. The continuous sampling points from the borrowing start point to the ending sampling point of the third original segment are taken as the subsequent segments. Within the fourth original segment, starting from the beginning of the fourth original segment, two consecutive sampling points are queried point by point in chronological order and used as the preceding segment; when the number of sampling points in the fourth original segment is less than two, all sampling points in the fourth original segment are used as the preceding segment; the following segment and the preceding segment are spliced ​​together in chronological order to form the third skeleton segment. The first skeleton fragment, the second skeleton fragment, and the third skeleton fragment are encapsulated in chronological order to obtain the descrambling and receiving skeleton for each shading event.

6. The automated calibration control method for a photoelectric sensor according to claim 5, characterized in that, Read the end sampling point of the second skeleton segment in three consecutive descrambling acceptor skeletons in chronological order, and define the end sampling point as the zero column position of each descrambling acceptor skeleton. Establish a unified column axis based on the zero column position. The unified column axis covers the column range of all second skeleton segments and third skeleton segments in three consecutive descrambling acceptor skeletons. The third and second skeleton segments of the three consecutive descrambling and receiving skeletons are projected onto a unified column axis to form the third skeleton occupancy matrix and the gate matrix, respectively.

7. The automated calibration control method for a photoelectric sensor according to claim 6, characterized in that, Scan along the column number increasing direction of the unified column axis on the third skeleton occupancy matrix to find the continuous column interval with the smallest starting column number that satisfies that each column in the column segment is simultaneously occupied by the third skeleton fragment or the number of consecutive columns in the column segment is not less than nine. This interval is denoted as the fully occupied locking segment. The column axis of the first and last columns in the fully occupied locking segment that meet the conditions is set as the starting column and ending column of the fully occupied locking segment, respectively. If no fully occupied blocking segment is found, a blocking takeover unit is generated, and the blocking status of the blocking takeover unit is set to the unlocked state. When a fully occupied blocking segment is found, the column preceding the current fully occupied blocking segment in the occupancy matrix is ​​taken as the candidate column for the passage, and the passage candidate column is checked.

8. The automated calibration control method for a photoelectric sensor according to claim 7, characterized in that, The gate verification includes: The event column is a placeholder in the candidate column of the gate in the gate matrix; The event column is a placeholder at the beginning of the full-occupancy locking segment in the third skeleton placeholder matrix; In the descrambling acceptance skeleton corresponding to the event column, the door candidate column corresponds to the occupancy position of the second skeleton segment, the full-occupancy blocking segment start column corresponds to the occupancy position of the third skeleton segment, and the door candidate column and the full-occupancy blocking segment start column are adjacent on the same column axis. Event sequences that simultaneously satisfy the above gate validation criteria are categorized as valid event sequences: When the number of valid event rows is not less than three columns, the door check is determined to be successful, a locking takeover unit is generated, and the door candidate column, the start column of the full-occupancy locking segment, the full-occupancy locking segment, and the end column of the full-occupancy locking segment are written into the locking takeover unit, and the locking status of the locking takeover unit is set to the locking successful state. When the door verification fails, the interlocking control unit is empty and marked as being in a pending verification state.

9. The automated calibration control method for a photoelectric sensor according to claim 8, characterized in that, Read the locking status of the locking control unit, and based on the locking status, determine the zero-point replacement value generation for the current photoelectric sensor calibration cycle, including: When the locking state is not locked, the donation skeleton selection is not executed, the zero page generation is not executed, the current zero baseline remains unchanged, and the zero baseline rewriting conclusion is output. When the latching state is the waiting state, the current zero reference update process is not performed, the current zero reference remains unchanged, and the zero reference rewriting conclusion is output. When the blocking state is the blocking established state, count the number of remaining columns of the third skeleton segment of each descrambled acceptor skeleton before the starting column of the fully occupied blocking segment, count the number of remaining columns of the third skeleton segment of each descrambled acceptor skeleton after the ending column of the fully occupied blocking segment, and add the remaining column numbers to obtain the edge remaining column number. The descrambled acceptor skeleton with the smallest edge remaining column number is taken as the donated skeleton. When there are multiple minimum values, the descrambled acceptor skeleton with the largest event sequence number is taken as the donated skeleton.

10. The automated calibration control method for a photoelectric sensor according to claim 9, characterized in that, Based on the column range of the fully occupied locking segment, the corresponding sampling point sequence is extracted from the third skeleton fragment of the donated skeleton to form a zero page; Take the first two columns of the zero-position page as the gate isolation segment; Take the consecutive column segments following the gate isolation segment in the zero-position page as the zero-position delivery segment; When the number of consecutive columns in the zero-position projection segment is no less than five, all sampling points of the zero-position projection segment are written into the zero-position page register area in sequence, and the last sampling point of the zero-position projection segment is read and written into the current zero-position reference, and the zero-position reference rewriting conclusion is output. When the number of consecutive columns in the zero-position projection segment is less than five, keep the current zero-position reference unchanged and output the zero-position reference rewriting conclusion.