A Fast Light Search Method Based on Binary Search
By using binary search to update the search range of lamps in the fire emergency lighting system, the problem of quickly and accurately searching the numbers and quantities of fire emergency lamps is solved, efficient and accurate lamp search is achieved, and workers' installation and debugging time is saved.
Patent Information
- Application Number
- CN202310113287.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-15
- Publication Date
- 2025-10-28
- Estimated Expiration
- 2043-02-15
AI Technical Summary
In existing fire emergency lighting systems, methods for quickly and accurately searching for the numbers, total quantity, and quantity of each type of fire emergency lighting fixtures suffer from long search times and the possibility of missing equipment.
A fast lamp search method based on binary search is adopted. The lamp search range is set through the controller, and the current lamp search range is updated using binary search. The lamp code and category number are recorded, and the binary search range is narrowed using binary search to avoid misjudgment or omission.
It significantly reduced search time, improved search efficiency, ensured data accuracy, saved workers' installation and debugging time, and enhanced the functionality of the emergency lighting system.
Smart Images

Figure CN116108243B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of light search, and more particularly to a fast light search method based on the binary search method. Background Technology
[0002] With technological advancements leading to product innovation, the requirements for intelligent integration and automation in buildings are constantly increasing. People's safety awareness is also strengthening, and fire emergency lighting systems are becoming increasingly popular, with their development becoming more rational and standardized. However, as these systems develop, during installation and construction, after the placement of fire emergency lighting fixtures and other equipment, it is crucial to quickly and accurately locate the numbers, total quantity, and corresponding quantities of each type of fire emergency lighting fixture connected to the emergency lighting distribution box (hereinafter referred to as the distribution box) to save workers' installation and debugging time. Previous methods for searching equipment in similar systems generally suffered from long search times and missed equipment. Summary of the Invention
[0003] To achieve rapid and accurate searching of the numbers, total quantity, and quantity of fire emergency lights connected to the emergency lighting distribution box, as well as the quantity of each type of fire emergency light connected to the distribution box, this invention proposes a rapid light search method based on binary search, applied to a fire emergency lighting system. The fire emergency lighting system includes a controller, a distribution box, and fire emergency lights. The controller sets the total search range for the lights and, after initiating the search, uses binary search to obtain the current search range based on the total search range, and then obtains the connection data between the fire emergency lights and the distribution box based on the current search range. The fire emergency lights include multiple categories, identified by numbers in the light fixture codes. The connection data includes: the total quantity (Num) of fire emergency lights connected to the distribution box, the light fixture code, and the quantity of each type of fire emergency light connected to the distribution box, i.e., the quantity of lights in each category (Numz). The rapid light search method includes the following steps:
[0004] S01: Initialize lamp search parameters, which include: lamp search range;
[0005] S02: Obtain the real-time value of the lamp search parameters, end the lamp search based on the real-time value of the lamp search parameters or search for lamps within the current lamp search range to obtain the lamp search state i, and update the current lamp search range based on the lamp search state i using the binary search method.
[0006] S03: Based on the upper and lower limits of the current lamp search range, proceed to step S04 or S05;
[0007] S04: Search for lights within the current light fixture search range. Based on the light fixture search status i, record the light fixture code of the currently searched light fixture, update the number of single-category lights Numz corresponding to the currently searched light fixture category, and update the total number Num; return to step S02.
[0008] S05: Search for lights within the current light search range and determine whether the light search status i is equal to 1. If yes, it means that there are fire emergency lights and proceed to step S07; otherwise, proceed to step S06.
[0009] S06: Update the current lamp search range: Discard the interval of the current lamp search range, use the upper limit of the current lamp search range as the lower limit of the updated lamp search range, and set the upper limit of the updated lamp search range based on the binary search method; return to step S03;
[0010] S07: Based on the upper and lower limits of the current lamp search range, proceed to step S08 or S09;
[0011] S08: Update the current lamp search range: The lower limit of the current lamp search range remains unchanged. The upper limit of the updated lamp search range is set based on the binary search method, and the process returns to step S03.
[0012] S09: Search for lights within the current light fixture search range. Based on the search status of the lights, record the light fixture code of the currently searched lights, update the number of lights in a single category Numz corresponding to the currently searched lights, and update the total number Num; return to step S02.
[0013] Furthermore, in step S01, the search parameters specifically include:
[0014] Intermediate variable k, total quantity Num, number of lamps in a single category Numz, number of times to search for lamps in a loop, number of search errors SEtimes, and the start and end positions of the lamp search range NumStart and NumEnd;
[0015] The initialization of the search lamp parameters in step S01 is specifically as follows:
[0016] Set k=0, Num=0, Numz=0, number of loop searches = preset number of loops, SEtimes=0, NumStart = lower limit of the total range of lamp searches, NumEnd = upper limit of the total range of lamp searches.
[0017] Further, step S02 specifically includes:
[0018] S21: Determine if the number of search errors is greater than the set value. If yes, proceed to the next step. If no, determine if Num is greater than or equal to the preset total number of lamps. If yes, proceed to the next step. If no, jump to step S23.
[0019] S22: End the light search;
[0020] S23: Search for lights within the current light search range. If fire emergency lights are found, set the light search status i=1; otherwise, set i=0.
[0021] S24: Determine if i equals 1. If yes, initialize the number of light searches ST to 0. Set: intermediate variables x1=NumStart, y1=NumEnd, lower limit of the current light search range x=x1, and upper limit of the current light search range. If not, proceed to step S03; otherwise, set k=k+1 and determine if k is greater than or equal to the number of times the light is searched in a loop. If yes, return to step S22; otherwise, return to step S21.
[0022] Furthermore, step S03 specifically includes:
[0023] S31: Set ST = ST + 1;
[0024] S32: Determine whether ST is greater than or equal to the preset limit. If yes, set SEtimes = SEtimes + 1 and return to step S21; otherwise, proceed to the next step.
[0025] S33: Determine if x is equal to y. If yes, return to step S21. If no, proceed to the next step.
[0026] S34: Obtain the difference between y and x, and determine whether the difference is equal to 1. If yes, proceed to step S04; otherwise, proceed to step S05.
[0027] Furthermore, step S04 specifically includes:
[0028] S41: Initialize variable n = 0;
[0029] S42: Update the current lamp search range: Set the lower limit of the current lamp search range x=x+n and the upper limit y=x+n+1, and search for lamps within the updated lamp search range. If there are fire emergency lamps, set the lamp search status i=1; otherwise, set i=0.
[0030] S43: Determine if i is equal to 1. If yes, record the lamp code of the currently searched lamp, set the number of lamps in the single category corresponding to the currently searched lamp Numz=Numz+1, set the total number Num=Num+1, and set SEtimes=0; return to step S21; if no, proceed to the next step.
[0031] S44: Determine if n is equal to 2. If yes, return to step S21; otherwise, set n = n + 1 and return to step S42.
[0032] Furthermore, step S06 specifically includes:
[0033] S61: Set intermediate variables t=y, y2=y+(yx) / 2+(yx)%2, x2=t;
[0034] S62: Set the lower limit x=x2 and the upper limit y=y2 of the current lamp search range; return to step S31.
[0035] Furthermore, step S07 specifically includes:
[0036] S71: Determine whether the difference between y and x is less than or equal to 3. If not, proceed to step S08; if yes, proceed to step S09.
[0037] Furthermore, step S08 specifically includes:
[0038] S81: Set intermediate variables x2=x, y2=x+(yx) / 2+(yx)%2, and return to step S62.
[0039] Furthermore, step S09 specifically includes:
[0040] S91: Initialize intermediate variable n=0;
[0041] S92: Update the current lamp search range: Set the lower limit of the current lamp search range x=x+n and the upper limit y=x+n+1, and search for lamps within the updated lamp search range. If there are fire emergency lamps, set the lamp search status i=1; otherwise, set i=0.
[0042] S93: Determine if i is equal to 1. If yes, record the lamp code of the currently searched lamp, set the number of lamps in the single category corresponding to the currently searched lamp Numz=Numz+1, set the total number Num=Num+1, set SEtimes=0, and proceed to the next step; if no, proceed to the next step.
[0043] S94: Set n = n + 1;
[0044] S95: Determine if n is less than 2. If yes, return to step S92. If no, proceed to the next step.
[0045] S96: Determine if n is equal to 2. If not, return to step S21. If yes, proceed to the next step.
[0046] S97: Determine if the difference between y and x is greater than 2. If yes, return to step S92; otherwise, return to step S21.
[0047] Compared with the prior art, the present invention has at least the following beneficial effects:
[0048] (1) Based on the search status of the lamps, the present invention uses a binary search method to cyclically update the search range of the current lamps. In step S05, when there are no fire emergency lamps, the current lamp search range is discarded, and the upper limit of the current lamp search range is used as the lower limit of the updated lamp search range. The upper limit of the updated lamp search range is set based on the binary search method. When there are fire emergency lamps, the current lamp search range is updated according to the upper and lower limits of the current lamp search range: the lower limit of the current lamp search range remains unchanged, and the upper limit of the updated lamp search range is set based on the binary search method. The value is used to search for lights within the current search range. Based on the search status of the lights, the light code of the currently searched lights is recorded, the number of lights in a single category corresponding to the currently searched lights (Numz) is updated, and the total number (Num) is updated. Compared with the time complexity of traditional exhaustive search (O(N)), the time complexity of binary search for target elements is only O(log2N). In the method of this invention, the search range of lights is continuously re-divided using binary search through the judgment conditions in the loop, which greatly reduces the search time and saves the time of workers for installation and debugging.
[0049] (2) In step S03 of this invention, the lower limit value x of the current lamp search range and the upper limit value x of the current lamp search range are... They are not equal, and When the difference between x and y is equal to 1, update the current lamp search range: set the lower limit of the current lamp search range x=x+n and the upper limit y=x+n+1, and search for lamps within the updated lamp search range. In step S04 (S41-S44), n+1 represents the adjacent lamp code. The purpose of setting n is to make the upper and lower limits of the search range have a data difference to ensure the accuracy of the data and prevent misjudgment or omission within (n,n+1), (n+1,n+2), and (n+2,n+3).
[0050] (3) Compared with the traditional exhaustive search method, the fast lamp search method based on the binary search method in this invention can discard half of the values each time, continuously narrowing the search range, which greatly improves the search efficiency. Moreover, the more lamps there are, the higher the efficiency, thus achieving the requirement of fast lamp search.
[0051] (4) The rapid light search method proposed in this invention improves the completeness of the emergency lighting evacuation indication system, greatly improves the efficiency of light search, and thus saves a lot of human resources. Attached Figure Description
[0052] Figure 1 This is a flowchart illustrating an example of a fast light search method based on binary search. Detailed Implementation
[0053] The following are specific embodiments of the present invention, which are described in conjunction with the accompanying drawings. However, the present invention is not limited to these embodiments.
[0054] Example 1
[0055] Complexity is an important factor in measuring program efficiency. Compared to the time complexity of traditional exhaustive search (O(N), the time complexity of binary search for the target element is only O(log₂N). To achieve the requirement of fast lamp search, such as... Figure 1 As shown, this invention proposes a rapid lamp search method based on binary search, applied to a fire emergency lighting system. The fire emergency lighting system includes a controller, a distribution box, and fire emergency lamps. The controller is used to set the total search range for the lamps. After initiating the lamp search, it uses binary search to obtain the current lamp search range based on the total search range, and obtains the connection data between the fire emergency lamps and the distribution box based on the current lamp search range. The fire emergency lamps include multiple lamp categories, identified by numbers in the lamp codes. The connection data includes: the total number of fire emergency lamps connected to the distribution box (Num), the lamp codes, and the number of fire emergency lamps corresponding to each lamp category connected to the distribution box (Numz, the number of lamps in a single category).
[0056] This embodiment uses a maximum of 200 lights per distribution box (or EPS) as a baseline. One distribution box and 200 emergency lighting fixtures are prepared for the experiment. In the entire emergency lighting system, each light fixture has its own unique code, consisting of 6 digits. Different types of lights have different starting digits, and lights under the same EPS cannot have duplicate numbers. Among these 200 lights, 'z' represents the starting digit to distinguish different categories. For example, lighting fixtures start with the number 1, two-way indicator lights with the number 2, double-headed lights with the number 3, and one-way indicator lights with the number 7. The range of the light fixture code is set to 6 digits, and the formula for the light fixture number is: Light fixture code = z * 100000 + a, where 'a' ranges from [0, 8191], such as 100066, 300696, etc.
[0057] The rapid light search method includes the following steps:
[0058] S01: Initialize lamp search parameters, which include: lamp search range;
[0059] In step S01, the search parameters specifically include:
[0060] Intermediate variable k, total quantity Num, number of lamps in a single category Numz, number of times to search for lamps in a loop, number of search errors SEtimes, and the start and end positions of the lamp search range NumStart and NumEnd;
[0061] The initialization of the search lamp parameters in step S01 is specifically as follows:
[0062] Set k=0, Num=0, Numz=0, number of cycles for searching lights = preset number of cycles (3 in this embodiment), SEtimes=0, NumStart=lower limit of the total range of light search, NumEnd=upper limit of the total range of light search.
[0063] S02: Obtain the real-time value of the lamp search parameters, end the lamp search based on the real-time value of the lamp search parameters or search for lamps within the current lamp search range to obtain the lamp search state i, and update the current lamp search range based on the lamp search state i using the binary search method.
[0064] Step S02 specifically includes:
[0065] S21: Determine whether the number of search errors is greater than the set value (3 in this embodiment). If yes, proceed to the next step; if no, determine whether Num is greater than or equal to the preset total number of lamps (200 in this embodiment). If yes, proceed to the next step; if no, jump to step S23.
[0066] S22: End the light search;
[0067] S23: Search for lights within the current light search range. If fire emergency lights are found, set the light search status i=1; otherwise, set i=0.
[0068] S24: Determine if i equals 1. If yes, initialize the number of light searches ST to 0. Set: intermediate variables x1=NumStart, y1=NumEnd, lower limit of the current light search range x=x1, and upper limit of the current light search range. If not, proceed to step S03; otherwise, set k=k+1 and determine if k is greater than or equal to the number of times the light is searched (if no light is found in 3 times, the light search ends). If yes, return to step S22; otherwise, return to step S21.
[0069] S03: Based on the upper and lower limits of the current lamp search range, proceed to step S04 or S05;
[0070] The S03 step specifically includes:
[0071] S31: Set ST = ST + 1;
[0072] S32: Determine whether ST is greater than or equal to a preset limit (16 in this embodiment). If yes, set SEtimes=SEtimes+1 and return to step S21; otherwise, proceed to the next step.
[0073] S33: Determine if x is equal to y. If yes, return to step S21. If no, proceed to the next step.
[0074] S34: Obtain the difference between y and x, and determine whether the difference is equal to 1. If yes, proceed to step S04; otherwise, proceed to step S05.
[0075] S04: Search for lights within the current light fixture search range. Based on the light fixture search status i, record the light fixture code of the currently searched light fixture, update the number of single-category lights Numz corresponding to the currently searched light fixture category, and update the total number Num; return to step S02.
[0076] The S04 step specifically includes:
[0077] S41: Initialize variable n = 0;
[0078] S42: Update the current lamp search range: Set the lower limit of the current lamp search range x=x+n and the upper limit y=x+n+1, and search for lamps within the updated lamp search range. If there are fire emergency lamps, set the lamp search status i=1; otherwise, set i=0.
[0079] S43: Determine if i equals 1. If yes, record the lamp code of the currently searched lamp, set the single-category lamp quantity Numz = Numz + 1 (i.e., if the lamp exists, reply with the lamp category (set the corresponding single-category lamp quantity value according to the lamp category) plus the lower four digits of the lamp code; in this invention, after the lamp is replied, the lamp that has been replied will not be replied again in the next search), set the total quantity Num = Num + 1, set SEtimes = 0; return to step S21; if no, proceed to the next step.
[0080] S44: Determine if n is equal to 2. If yes, return to step S21; otherwise, set n = n + 1 and return to step S42.
[0081] In step S03 of this invention, the lower limit value x of the current lamp search range and the upper limit value x of the current lamp search range are... They are not equal, and When the difference between x and y equals 1, update the current lamp search range: set the lower limit of the current lamp search range to x = x + n and the upper limit to y = x + n + 1, and search for lamps within the updated lamp search range. In step S04 (S41-S44), n + 1 represents the adjacent lamp code. The purpose of setting n is to make the upper and lower limits of the search range have a data difference to ensure the accuracy of the data and prevent misjudgment or omission within (n, n + 1), (n + 1, n + 2), and (n + 2, n + 3).
[0082] S05: Search for lights within the current light search range and determine whether the light search status i is equal to 1. If yes, it means that there are fire emergency lights and proceed to step S07; otherwise, proceed to step S06.
[0083] It should be noted that in step S05, the range of the lamps that exist is determined based on the value of the obtained lamp search status variable i, and the search range is then selected accordingly.
[0084] S06: Update the current lamp search range: Discard the interval of the current lamp search range, use the upper limit of the current lamp search range as the lower limit of the updated lamp search range, and set the upper limit of the updated lamp search range based on the binary search method; return to step S03;
[0085] The S06 step specifically includes:
[0086] S61: Set intermediate variables t=y, y2=y+(yx) / 2+(yx)%2, x2=t;
[0087] S62: Set the lower limit x=x2 and the upper limit y=y2 of the current lamp search range; return to step S31.
[0088] S07: Based on the upper and lower limits of the current lamp search range, proceed to step S08 or S09;
[0089] The S07 step specifically includes:
[0090] S71: Determine whether the difference between y and x is less than or equal to 3. If not, proceed to step S08; if yes, proceed to step S09.
[0091] S08: Update the current lamp search range: The lower limit of the current lamp search range remains unchanged. The upper limit of the updated lamp search range is set based on the binary search method, and the process returns to step S03.
[0092] The S08 step specifically includes:
[0093] S81: Set intermediate variables x2=x, y2=x+(yx) / 2+(yx)%2, and return to step S62.
[0094] S09: Search for lights within the current light fixture search range. Based on the search status of the lights, record the light fixture code of the currently searched lights, update the number of lights in a single category Numz corresponding to the currently searched lights, and update the total number Num; return to step S02.
[0095] The S09 step specifically includes:
[0096] S91: Initialize intermediate variable n=0;
[0097] S92: Update the current lamp search range: Set the lower limit of the current lamp search range x=x+n and the upper limit y=x+n+1, and search for lamps within the updated lamp search range. If there are fire emergency lamps, set the lamp search status i=1; otherwise, set i=0.
[0098] S93: Determine if i is equal to 1. If yes, record the lamp code of the currently searched lamp, set the number of lamps in the single category corresponding to the currently searched lamp Numz=Numz+1, set the total number Num=Num+1, set SEtimes=0, and proceed to the next step; if no, proceed to the next step.
[0099] S94: Set n = n + 1;
[0100] S95: Determine if n is less than 2. If yes, return to step S92. If no, proceed to the next step.
[0101] S96: Determine if n is equal to 2. If not, return to step S21. If yes, proceed to the next step.
[0102] S97: Determine if the difference between y and x is greater than 2. If yes, return to step S92; otherwise, return to step S21.
[0103] Compared to the traditional exhaustive search method, the fast lamp search method based on binary search in this invention can discard half of the values each time, continuously narrowing the search range, which greatly improves the search efficiency. Moreover, the more lamps there are, the higher the efficiency, thus achieving the requirement of fast lamp search.
[0104] Compared to the traditional exhaustive search method, which takes 170 minutes to poll and search for 200 lamps, this embodiment, taking 200 lamps as an example, only takes 5 minutes to run the fast lamp search method of the present invention, which improves the search efficiency by 34 times.
[0105] This invention, based on the search status of lighting fixtures, uses a binary search method to iteratively update the search range of the current lighting fixtures. In step S05, when no fire emergency lighting fixtures exist, the current search range is discarded, and the upper limit of the current search range is used as the lower limit of the updated search range. The upper limit of the updated search range is then set based on the binary search method. When fire emergency lighting fixtures exist, the current search range is updated according to its upper and lower limits: the lower limit remains unchanged, and the upper limit of the updated search range is set based on the binary search method. Alternatively, a search can be conducted within the current lamp search range. Based on the search status of the lamps, the lamp code of the currently searched lamp is recorded, the number of lamps in the single category corresponding to the currently searched lamp (Numz) is updated, and the total number (Num) is updated. Compared to the time complexity of traditional exhaustive search (O(N), the time complexity of binary search for the target element is only O(log2N). In the method of this invention, the search range of lamps is continuously re-divided using binary search through the judgment conditions in the loop, which greatly reduces the search time and saves the time of workers for installation and debugging.
[0106] It should be noted that all directional indications (such as up, down, left, right, front, back, etc.) in the embodiments of the present invention are only used to explain the relative positional relationship and movement of the components in a specific posture (as shown in the attached figures). If the specific posture changes, the directional indication will also change accordingly. Furthermore, descriptions involving "first," "second," or "a" in the present invention are for descriptive purposes only and should not be construed as indicating or implying their relative importance or implicitly specifying the number of technical features indicated. Therefore, features defined with "first" or "second" may explicitly or implicitly include at least one of those features. In the description of the present invention, "multiple" means at least two, such as two, three, etc., unless otherwise explicitly defined. In the present invention, unless otherwise explicitly specified and defined, the terms "connection," "fixed," etc., should be interpreted broadly. For example, "fixed" can be a fixed connection, a detachable connection, or an integral part; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium; it can be the internal communication of two components or the interaction between two components, unless otherwise explicitly defined. For those skilled in the art, the specific meanings of the above terms in this invention can be understood according to the specific circumstances. Furthermore, the technical solutions of the various embodiments of this invention can be combined with each other, but only on the basis that those skilled in the art can implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be considered that such a combination of technical solutions does not exist and is not within the scope of protection claimed by this invention.
Claims
1. A rapid light search method based on binary search, applied to a fire emergency lighting system, characterized in that, The fire emergency lighting system includes: a controller, a distribution box, and fire emergency lights; the controller is used to set the total search range for the lights, and after starting the light search, it uses a binary search method to obtain the current search range based on the total search range, and obtains the connection data between the fire emergency lights and the distribution box based on the current search range; the fire emergency lights include multiple light categories, which are identified by numbers in the light fixture codes; the connection data includes: the total number Num of fire emergency lights connected to the distribution box, the light fixture code, and the number of fire emergency lights corresponding to each light category connected to the distribution box, i.e., the number of lights in a single category Numz; the rapid light search method includes the following steps: S01: Initialize lamp search parameters, which include: lamp search range; S02: Obtain the real-time value of the lamp search parameters, end the lamp search based on the real-time value of the lamp search parameters or search for lamps within the current lamp search range to obtain the lamp search state i, and update the current lamp search range based on the lamp search state i using the binary search method. S03: Based on the upper and lower limits of the current lamp search range, proceed to step S04 or S05; S04: Search for lights within the current light fixture search range. Based on the light fixture search status i, record the light fixture code of the currently searched light fixture, update the number of single-category lights Numz corresponding to the currently searched light fixture category, and update the total number Num; return to step S02. S05: Search for lights within the current light search range and determine whether the light search status i is equal to 1. If yes, it means that there are fire emergency lights and proceed to step S07; otherwise, proceed to step S06. S06: Update the current lamp search range: Discard the interval of the current lamp search range, use the upper limit of the current lamp search range as the lower limit of the updated lamp search range, and set the upper limit of the updated lamp search range based on the binary search method; return to step S03; S07: Based on the upper and lower limits of the current lamp search range, proceed to step S08 or S09; S08: Update the current lamp search range: The lower limit of the current lamp search range remains unchanged. The upper limit of the updated lamp search range is set based on the binary search method, and the process returns to step S03. S09: Search for lights within the current light fixture search range. Based on the search status of the lights, record the light fixture code of the currently searched lights, update the number of lights in a single category Numz corresponding to the currently searched lights, and update the total number Num; return to step S02.
2. The fast light search method based on the binary search method according to claim 1, characterized in that, In step S01, the search parameters specifically include: Intermediate variable k, total quantity Num, number of lamps in a single category Numz, number of times to search for lamps in a loop, number of search errors SEtimes, and the start and end positions of the lamp search range NumStart and NumEnd; The initialization of the search lamp parameters in step S01 is specifically as follows: Set k=0, Num=0, Numz=0, number of loop searches = preset number of loops, SEtimes=0, NumStart = lower limit of the total range of lamp searches, NumEnd = upper limit of the total range of lamp searches.
3. The fast light search method based on the binary search method according to claim 2, characterized in that, Step S02 specifically includes: S21: Determine if the number of search errors is greater than the set value. If yes, proceed to the next step. If no, determine if Num is greater than or equal to the preset total number of lamps. If yes, proceed to the next step. If no, jump to step S23. S22: End the light search; S23: Search for lights within the current light search range. If fire emergency lights are found, set the light search status i=1; otherwise, set i=0. S24: Determine if i equals 1. If yes, initialize the number of light searches ST to 0. Set: intermediate variables x1=NumStart, y1=NumEnd, lower limit of the current light search range x=x1, and upper limit of the current light search range. If not, proceed to step S03; otherwise, set k=k+1 and determine if k is greater than or equal to the number of times the light is searched in a loop. If yes, return to step S22; otherwise, return to step S21.
4. The fast light search method based on the binary search method according to claim 3, characterized in that, The S03 step specifically includes: S31: Set ST = ST + 1; S32: Determine whether ST is greater than or equal to the preset limit. If yes, set SEtimes = SEtimes + 1 and return to step S21; otherwise, proceed to the next step. S33: Determine if x is equal to y. If yes, return to step S21. If no, proceed to the next step. S34: Obtain the difference between y and x, and determine whether the difference is equal to 1. If yes, proceed to step S04; otherwise, proceed to step S05.
5. The fast light search method based on the binary search method according to claim 4, characterized in that, The S04 step specifically includes: S41: Initialize variable n = 0; S42: Update the current lamp search range: Set the lower limit of the current lamp search range x=x+n and the upper limit y=x+n+1, and search for lamps within the updated lamp search range. If there are fire emergency lamps, set the lamp search status i=1; otherwise, set i=0. S43: Determine if i is equal to 1. If yes, record the lamp code of the currently searched lamp, set the number of lamps in the single category corresponding to the currently searched lamp Numz=Numz+1, set the total number Num=Num+1, and set SEtimes=0; return to step S21; if no, proceed to the next step. S44: Determine if n is equal to 2. If yes, return to step S21; otherwise, set n = n + 1 and return to step S42.
6. The fast light search method based on the binary search method according to claim 5, characterized in that, The S06 step specifically includes: S61: Set intermediate variables t=y, y2=y+(yx) / 2+(yx)%2, x2=t; S62: Set the lower limit x=x2 and the upper limit y=y2 of the current lamp search range; return to step S31.
7. The fast light search method based on the binary search method according to claim 6, characterized in that, The S07 step specifically includes: S71: Determine whether the difference between y and x is less than or equal to 3. If not, proceed to step S08; if yes, proceed to step S09.
8. The fast light search method based on the binary search method according to claim 7, characterized in that, The S08 step specifically includes: S81: Set intermediate variables x2=x, y2=x+(yx) / 2+(yx)%2, and return to step S62.
9. A fast light search method based on binary search as described in claim 8, characterized in that, The S09 step specifically includes: S91: Initialize intermediate variable n=0; S92: Update the current lamp search range: Set the lower limit of the current lamp search range x=x+n and the upper limit y=x+n+1, and search for lamps within the updated lamp search range. If there are fire emergency lamps, set the lamp search status i=1; otherwise, set i=0. S93: Determine if i is equal to 1. If yes, record the lamp code of the currently searched lamp, set the number of lamps in the single category corresponding to the currently searched lamp Numz=Numz+1, set the total number Num=Num+1, set SEtimes=0, and proceed to the next step; if no, proceed to the next step. S94: Set n = n + 1; S95: Determine if n is less than 2. If yes, return to step S92. If no, proceed to the next step. S96: Determine if n is equal to 2. If not, return to step S21. If yes, proceed to the next step. S97: Determine if the difference between y and x is greater than 2. If yes, return to step S92; otherwise, return to step S21.
Citation Information
Patent Citations
Quantized global gain sequence number searching method and system for optimizing LC3 encoder
CN111951815A
Multi-target quick search method for fire emergency lighting and evacuation indication system
CN113382510A