Photoelectric direct-reading water meter error self-checking method and system and storage medium
By obtaining the timestamp of the data reading command in the photoelectric direct-reading water meter, starting the self-test program, reading the sampling values of the photosensitive device and the light-emitting device, and judging the device status and environmental status, the problem of incorrect readings during the operation of the photoelectric direct-reading water meter is solved. problem, achieving the accuracy of data collection and rapid error location.
Patent Information
- Application Number
- CN202410632412.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-21
- Publication Date
- 2024-09-03
AI Technical Summary
During the operation of photoelectric direct-reading water meters, reading errors caused by hardware failures, environmental factors and software defects are difficult to effectively solve with existing technology, resulting in inaccurate data collection.
By obtaining the timestamp of the data reading command, start the photoelectric direct reading meter reading and self-test program, turn off and light the light-emitting device, read the sampling value of the photosensitive device and compare it with the preset value, judge the device status and environmental status, and pass The comparison result queries the binary character wheel table to generate actual digital data, combines the time stamp comparison to determine the total self-test status, and outputs the final self-test result.
It improves the accuracy of data collection, can quickly locate the cause of errors, and ensures the rationality and accuracy of the data.
Smart Images

Figure CN118583255A
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of data acquisition self-checking, and in particular to a photoelectric direct-reading water meter error self-checking method, system and storage medium. Background Art
[0002] During the operation of the photoelectric direct reading water meter system, there are reading errors caused by various abnormalities, such as the following reasons:
[0003] Hardware problem: The hardware part of the photoelectric direct reading water meter may fail or be damaged, resulting in reading errors. This may be due to the failure of the light-emitting device, photosensitive device or unreasonable installation, which may cause the original data error.
[0004] Environmental issues: The operating environment of the photoelectric direct-reading water meter may have unfavorable factors, resulting in deviations in the reading data. This may be due to strong light interference or long-term accumulation of impurities in the water causing errors in data collection.
[0005] Software problem: The software reading system of the photoelectric direct-reading water meter may have loopholes or defects, resulting in the output of erroneous data during the data reading process. This may be due to the unreasonable design of the data self-checking system, insufficient consideration, and other reasons that cause data anomalies.
[0006] In view of the above problems, effective technical solutions are urgently needed. Summary of the invention
[0007] The purpose of the present application is to provide a photoelectric direct-reading water meter error self-detection method, system and storage medium, which can improve the accuracy of data collection and quickly locate the cause of the error in the event of abnormal data.
[0008] In a first aspect, the present application provides a photoelectric direct-reading water meter error self-detection method, the method comprising:
[0009] Obtaining a data reading command, determining a timestamp of the data reading command, and starting a photoelectric direct-reading meter reading and self-testing program;
[0010] Turn off all light-emitting devices, read the sampling value of each photosensitive device in turn, compare the first sampling value of the photosensitive device with a preset value to obtain a first comparison result, and record the self-test state of the photosensitive device and the environmental self-test state according to the first comparison result;
[0011] Lighting up the light-emitting devices in sequence, reading the sampling value of each light-emitting device, comparing the sampling value of the light-emitting device with a preset value to obtain a second comparison result, and recording the self-test state of the light-emitting device and the self-test state of the optical path according to the second comparison result;
[0012] Turn off all light-emitting devices, light up the light-emitting devices in turn, and read the second sampling value of the photosensitive device corresponding to each light-emitting device;
[0013] Compare the second sampling value with the third threshold and the fourth threshold, and query the preset binary word wheel table according to the comparison result to generate actual digital data;
[0014] Get the timestamp and corresponding data stored in the last data read command, compare with the data of the current timestamp to get the total self-test status, and output the final self-test result.
[0015] In this solution, the first sampling value of the photosensitive device is compared with a preset value to obtain a first comparison result, and the self-test state of the photosensitive device and the self-test state of the environment are recorded according to the first comparison result, including:
[0016] If the first sampling value of the photosensitive device is greater than or equal to the preset value, it is determined that the photosensitive device N is faulty or there is strong light interference, and the self-test state of the photosensitive device N is recorded as a fault state; and the environmental self-test state is strong light interference;
[0017] If the first sampling value of the photosensitive device is less than the preset value, the photosensitive device is in a normal state and the environmental self-test state is normal.
[0018] In this solution, the sampling value of each light emitting device is read, the sampling value of the light emitting device is compared with a preset value to obtain a second comparison result, and the self-test state of the light emitting device and the self-test state of the optical path are recorded according to the second comparison result, including:
[0019] If the sampling value of the light emitting device is less than the preset value of the light emitting device, the self-test state of the light emitting device is a fault state, and the self-test state of the optical path is set to an optical path fault;
[0020] If the sampling value of the light emitting device is greater than or equal to the preset value of the light emitting device, the self-test state of the light emitting device is normal, and the self-test state of the optical path is set to be normal.
[0021] In this solution, the second sampling value is compared with the third threshold value and the fourth threshold value, and the preset binary word table is queried according to the comparison result to obtain the actual digital data, including:
[0022] The second sampling value is compared with the third threshold and the fourth threshold, the comparison result is converted into a binary word wheel state X, and the word wheel state X is queried in a preset binary word wheel table to generate actual digital data.
[0023] In this solution, if there is no corresponding result in the preset binary word wheel table, the light path state is set according to the value of X. When X=0, the light path state is that there is a light path fault problem; if X=A, the light path state is that there is strong light interference.
[0024] This solution also includes: continuously acquiring actual digital data N times, judging the error through the average value, and recording the total self-check state according to the error.
[0025] In this scheme, the actual digital data is obtained N times continuously, and the average value of the actual digital data is calculated. If the difference between the actual digital data and the average value for N consecutive times is within the preset error range, the overall self-test status is normal. If there is one time when the difference between the actual digital data and the average value is not within the preset error range, the overall self-test status is abnormal.
[0026] In this solution, the timestamp and corresponding data stored in the last data read command are obtained, and the overall self-test status is obtained by comparing with the data of the current timestamp, including:
[0027] Get the timestamp Time_last and corresponding data Data_last stored in the last data read command.
[0028] Current timestamp Time, the flow data Data corresponding to the timestamp at that time, calculate the theoretical maximum change Data_change = (Time-Time_last)*Data_change_Max;
[0029] If Data-Data_last>Data_change, the actual digital data generated this time is incorrect and the total self-check status is abnormal.
[0030] The second aspect of the present application provides a photoelectric direct-reading water meter error self-checking system, the photoelectric direct-reading water meter error self-checking system comprising: a memory and a processor, the memory comprising a program of a photoelectric direct-reading water meter error self-checking method, the program of the photoelectric direct-reading water meter error self-checking method being executed by the processor to implement the following steps:
[0031] Obtaining a data reading command, determining a timestamp of the data reading command, and starting a photoelectric direct-reading meter reading and self-testing program;
[0032] Turn off all light-emitting devices, read the sampling value of each photosensitive device in turn, compare the first sampling value of the photosensitive device with a preset value to obtain a first comparison result, and record the self-test state of the photosensitive device and the environmental self-test state according to the first comparison result;
[0033] Lighting up the light-emitting devices in sequence, reading the sampling value of each light-emitting device, comparing the sampling value of the light-emitting device with a preset value to obtain a second comparison result, and recording the self-test state of the light-emitting device and the self-test state of the optical path according to the second comparison result;
[0034] Turn off all light-emitting devices, light up the light-emitting devices in turn, and read the second sampling value of the photosensitive device corresponding to each light-emitting device;
[0035] Compare the second sampling value with the third threshold and the fourth threshold, and query the preset binary word wheel table according to the comparison result to generate actual digital data;
[0036] Get the timestamp and corresponding data stored in the last data read command, compare with the data of the current timestamp to get the total self-test status, and output the final self-test result.
[0037] The third aspect of the present invention provides a computer-readable storage medium, which includes a photoelectric direct-reading water meter error self-detection method program. When the photoelectric direct-reading water meter error self-detection method program is executed by a processor, the steps of the photoelectric direct-reading water meter error self-detection method are implemented.
[0038] As can be seen from the above, the photoelectric direct-reading water meter error self-check method, system and storage medium provided by the present application first obtain a data reading command, determine the timestamp of the data reading command, and start the photoelectric direct-reading meter reading and self-checking program; turn off all light-emitting devices, read the sampling value of each photosensitive device in turn, compare the first sampling value of the photosensitive device with a preset value, obtain a first comparison result, and record the self-checking state of the photosensitive device and the self-checking state of the environment according to the first comparison result; light up the light-emitting devices in turn, read the sampling value of each light-emitting device, compare the sampling value of the light-emitting device with a preset value to obtain a second comparison result, and record the self-checking state of the light-emitting device and the self-checking state of the optical path according to the second comparison result;
[0039] Turn off all light-emitting devices, light up the light-emitting devices in turn, read the second sampling value of the photosensitive device corresponding to each light-emitting device; compare the second sampling value with the third threshold value and the fourth threshold value, query the preset binary word wheel table according to the comparison result to generate the actual digital data; obtain the timestamp and corresponding data stored in the last data read command, compare with the data of the current timestamp to obtain the total self-test status, and output the final self-test result. This application reads the sampling values of the photosensitive device and the light-emitting device respectively, compares them with the preset values to determine whether there is a fault, and compares the data corresponding to the timestamp stored in the last data read command with the data of the current timestamp to determine the rationality of the data and improve the accuracy of data collection.
[0040] Other features and advantages of the present application will be described in the following description, and partly become apparent from the description, or be understood by practicing the embodiments of the present application. The purpose and other advantages of the present application can be realized and obtained by the structures specifically pointed out in the written description, claims, and drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments of the present application will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0042] Figure 1 A flow chart of a photoelectric direct-reading water meter error self-checking method provided in an embodiment of the present application;
[0043] Figure 2 A block diagram of a photoelectric direct-reading water meter error self-checking system provided in an embodiment of the present application; DETAILED DESCRIPTION
[0044] The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all of the embodiments. The components of the embodiments of the present application described and shown in the drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present application.
[0045] It should be noted that similar reference numerals and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings. At the same time, in the description of this application, the terms "first", "second", etc. are only used to distinguish the description and cannot be understood as indicating or implying relative importance.
[0046] Please refer to Figure 1 , is a flow chart of a photoelectric direct-reading water meter error self-checking method in some embodiments of the present application. The photoelectric direct-reading water meter error self-checking method is used for error self-checking of photoelectric direct-reading meters, and can be photoelectric direct-reading water meters, electricity meters, gas meters, etc. The photoelectric direct-reading water meter error self-checking method includes the following steps:
[0047] S101, obtaining a data reading command, determining a timestamp of the data reading command, and starting a photoelectric direct reading meter reading and self-test program;
[0048] S102, turning off all light-emitting devices, reading the sampling value of each photosensitive device in turn, comparing the first sampling value of the photosensitive device with a preset value to obtain a first comparison result, and recording the self-test state of the photosensitive device and the self-test state of the environment according to the first comparison result;
[0049] S103, lighting up the light-emitting devices in sequence, reading the sampling value of each light-emitting device, comparing the sampling value of the light-emitting device with a preset value to obtain a second comparison result, and recording the self-test state of the light-emitting device and the self-test state of the optical path according to the second comparison result;
[0050] S104, turning off all light-emitting devices, lighting up the light-emitting devices in turn, and reading the second sampling value of the photosensitive device corresponding to each light-emitting device;
[0051] S105, comparing the second sampling value with the third threshold and the fourth threshold, and querying a preset binary word table according to the comparison result to generate actual digital data;
[0052] S106, obtaining the timestamp and corresponding data stored in the last data read command, obtaining the total self-test status by comparing with the data of the current timestamp, and outputting the final self-test result.
[0053] It should be noted that in the present application, a data reading command is first obtained, the timestamp of the data reading command is determined, and the photoelectric direct-reading meter reading and self-test program is started; all light-emitting devices are turned off, and the sampling values of each photosensitive device are read in turn, and the first sampling value of the photosensitive device is compared with the preset value to obtain a first comparison result, and the self-test state of the photosensitive device and the environmental self-test state are recorded according to the first comparison result; the light-emitting devices are lit in turn, and the sampling value of each light-emitting device is read, and the sampling value of the light-emitting device is compared with the preset value to obtain a second comparison result, and the self-test state of the light-emitting device and the self-test state of the optical path are recorded according to the second comparison result; the light-emitting devices are lit in turn, and the second sampling value of the corresponding photosensitive device is read; the second sampling value is compared with the third threshold value and the fourth threshold value, and the preset binary word wheel table is queried according to the comparison result to obtain the actual digital data generated; the timestamp and corresponding data stored in the last data reading command are obtained, and the total self-test state is obtained by comparing with the data of the current timestamp, and the final self-test result is output.
[0054] It should be noted that after starting the photoelectric direct reading meter reading and self-test program, the photosensitive device and the light-emitting device are first self-tested, and the sampling data of each photosensitive device is read and compared with the preset value (i.e. the theoretical value) to determine whether there is a sampling abnormality caused by hardware or environmental problems. Then, each light-emitting device is turned on in turn and the sampling value of the photosensitive device is read to read the word wheel data. During this period, each sampling value read will be tested, and the legitimacy of the data will be determined by comparing it with the preset value.
[0055] In addition, by obtaining the timestamp and corresponding data stored in the last data read command and comparing them with the data of the current timestamp, the legality of the change during the period is compared to check whether the data is reasonable.
[0056] According to an embodiment of the present invention, the first sampling value of the photosensitive device is compared with a preset value to obtain a first comparison result, and the self-test state of the photosensitive device and the self-test state of the environment are recorded according to the first comparison result, including:
[0057] If the first sampling value of the photosensitive device is greater than or equal to the preset value, it is determined that the photosensitive device N is faulty or there is strong light interference, and the self-test state of the photosensitive device N is recorded as a fault state; and the environmental self-test state is strong light interference;
[0058] If the first sampling value of the photosensitive device is less than the preset value, the photosensitive device is in a normal state and the environmental self-test state is normal.
[0059] It should be noted that, in a specific embodiment, the first sampling value of the photosensitive device is recorded as RX_OFF_AD N, The preset value of the photosensitive device is RX_OFF_AD Max, That is, the theoretical value without light. If RX_OFF_AD N >=RX_OFF_AD Max , it is judged that the photosensitive device N is faulty or there is strong light interference, and the self-test state of the photosensitive device N is recorded as the fault state ST_RX N = err, and the environment self-check status is strong light interference ST_ENV = err. N <RX_OFF_AD Max , then the self-test status of the photosensitive device is normal ST_RX N =0, the environmental self-test status is normal ST_ENV=0.
[0060] According to an embodiment of the present invention, reading a sampling value of each light-emitting device, comparing the sampling value of the light-emitting device with a preset value to obtain a second comparison result, and recording a self-test state of the light-emitting device and a self-test state of the optical path according to the second comparison result, includes:
[0061] If the sampling value of the light emitting device is less than the preset value of the light emitting device, the self-test state of the light emitting device is a fault state, and the self-test state of the optical path is set to an optical path fault;
[0062] If the sampling value of the light emitting device is greater than or equal to the preset value of the light emitting device, the self-test state of the light emitting device is normal, and the self-test state of the optical path is set to be normal.
[0063] It should be noted that, in a specific embodiment, the sampled value TX_AD of each light emitting device is read. N, If the sampling value TX_AD of the light emitting device N Less than the preset value TX_AD of the light emitting device Min , that is, the self-test state of the light-emitting device is a fault state ST_TX N= err, set the optical path self-test state to optical path fault ST_GL = err;
[0064] If the sampling value of the light emitting device is greater than or equal to the preset value of the light emitting device, the self-test state of the light emitting device is normal, and the self-test state of the optical path is set to be normal.
[0065] According to an embodiment of the present invention, the second sampling value is compared with the third threshold value and the fourth threshold value, and a preset binary word wheel table is queried according to the comparison result to obtain the actual digital data, including:
[0066] The second sampling value is compared with the third threshold and the fourth threshold, the comparison result is converted into a binary word wheel state X, and the word wheel state X is queried in a preset binary word wheel table to generate actual digital data.
[0067] It should be noted that the third threshold is a 1 threshold RX_HIGN, and the fourth threshold is a 0 threshold RX_LOW, that is, if the second sampling value is greater than the third threshold, the value of X is 1, and if the second sampling value is less than the fourth threshold, the value of X is 0.
[0068] According to an embodiment of the present invention, if there is no corresponding result in the preset binary word wheel table, the optical path state is set according to the value of X. When X=0, the optical path state is that there is an optical path fault problem; if X=A, the optical path state is that there is strong light interference.
[0069] According to an embodiment of the present invention, it also includes: continuously acquiring actual digital data N times, judging the error by the average value, and recording the total self-check state according to the error.
[0070] It should be noted that, in a specific embodiment, interference is eliminated, actual digital data is obtained three times in succession, and the error is determined by the average value, and the total self-test status is recorded according to the error.
[0071] According to an embodiment of the present invention, actual digital data is obtained N times continuously, and an average value of the actual digital data is calculated. If the difference between the actual digital data and the average value for N consecutive times is within a preset error range, the overall self-test state is normal. If there is one time when the difference between the actual digital data and the average value is not within the preset error range, the overall self-test state is abnormal.
[0072] For example, actual digital data is obtained three times in succession, and the average value Data_ave of the actual digital data is calculated for the three times. If the difference between the actual digital data and the average value Data_ave for N consecutive times is within the preset error range, the overall self-test status is normal. If there is one time when the difference between the actual digital data and the average value Data_ave is not within the preset error range, the overall self-test status is abnormal, and the overall self-test status is marked with an error flag ST=err.
[0073] According to an embodiment of the present invention, obtaining the timestamp and corresponding data stored in the last data read command, and obtaining the overall self-test status by comparing with the data of the current timestamp, includes:
[0074] Get the timestamp Time_last and corresponding data Data_last stored in the last data read command;
[0075] Current timestamp Time, the flow data Data corresponding to the timestamp at that time, calculate the theoretical maximum change Data_change = (Time-Time_last)*Data_change_Max;
[0076] If Data-Data_last>Data_change, the actual digital data generated this time is incorrect and the total self-check status is abnormal.
[0077] It should be noted that the final self-test results outputted in the present invention include: final self-test results ST, photosensitive device self-test results ST_RXN, light-emitting device self-test results ST_TXN, environmental self-test results ST_ENV, and optical path self-test results ST_GL.
[0078] Figure 2 A block diagram of a photoelectric direct-reading water meter error self-checking system is shown.
[0079] The second aspect of the present application provides a photoelectric direct-reading water meter error self-checking system, the photoelectric direct-reading water meter error self-checking system comprising: a memory 201 and a processor 202, the memory comprising a program of a photoelectric direct-reading water meter error self-checking method, the program of the photoelectric direct-reading water meter error self-checking method being executed by the processor to implement the following steps:
[0080] S101, obtaining a data reading command, determining a timestamp of the data reading command, and starting a photoelectric direct reading meter reading and self-test program;
[0081] S102, turning off all light-emitting devices, reading the sampling value of each photosensitive device in turn, comparing the first sampling value of the photosensitive device with a preset value to obtain a first comparison result, and recording the self-test state of the photosensitive device and the self-test state of the environment according to the first comparison result;
[0082] S103, lighting up the light-emitting devices in sequence, reading the sampling value of each light-emitting device, comparing the sampling value of the light-emitting device with a preset value to obtain a second comparison result, and recording the self-test state of the light-emitting device and the self-test state of the optical path according to the second comparison result;
[0083] S104, turning off all light-emitting devices, lighting up the light-emitting devices in turn, and reading the second sampling value of the photosensitive device corresponding to each light-emitting device;
[0084] S105, comparing the second sampling value with the third threshold and the fourth threshold, and querying a preset binary word table according to the comparison result to generate actual digital data;
[0085] S106, obtaining the timestamp and corresponding data stored in the last data read command, obtaining the total self-test status by comparing with the data of the current timestamp, and outputting the final self-test result.
[0086] It should be noted that in the present application, a data reading command is first obtained, the timestamp of the data reading command is determined, and the photoelectric direct-reading meter reading and self-test program is started; all light-emitting devices are turned off, and the sampling values of each photosensitive device are read in turn, and the first sampling value of the photosensitive device is compared with the preset value to obtain a first comparison result, and the self-test state of the photosensitive device and the environmental self-test state are recorded according to the first comparison result; the light-emitting devices are lit in turn, and the sampling value of each light-emitting device is read, and the sampling value of the light-emitting device is compared with the preset value to obtain a second comparison result, and the self-test state of the light-emitting device and the self-test state of the optical path are recorded according to the second comparison result; the light-emitting devices are lit in turn, and the second sampling value of the corresponding photosensitive device is read; the second sampling value is compared with the third threshold value and the fourth threshold value, and the preset binary word wheel table is queried according to the comparison result to obtain the actual digital data generated; the timestamp and corresponding data stored in the last data reading command are obtained, and the total self-test state is obtained by comparing with the data of the current timestamp, and the final self-test result is output.
[0087] It should be noted that after starting the photoelectric direct reading meter reading and self-test program, the photosensitive device and the light-emitting device are first self-tested, and the sampling data of each photosensitive device is read and compared with the preset value (i.e. the theoretical value) to determine whether there is a sampling abnormality caused by hardware or environmental problems. Then, each light-emitting device is turned on in turn and the sampling value of the photosensitive device is read to read the word wheel data. During this period, each sampling value read will be tested, and the legitimacy of the data will be determined by comparing it with the preset value.
[0088] In addition, by obtaining the timestamp and corresponding data stored in the last data read command and comparing them with the data of the current timestamp, the legality of the change during the period is compared to check whether the data is reasonable.
[0089] According to an embodiment of the present invention, the first sampling value of the photosensitive device is compared with a preset value to obtain a first comparison result, and the self-test state of the photosensitive device and the self-test state of the environment are recorded according to the first comparison result, including:
[0090] If the first sampling value of the photosensitive device is greater than or equal to the preset value, it is determined that the photosensitive device N is faulty or there is strong light interference, and the self-test state of the photosensitive device N is recorded as a fault state; and the environmental self-test state is strong light interference;
[0091] If the first sampling value of the photosensitive device is less than the preset value, the photosensitive device is in a normal state and the environmental self-test state is normal.
[0092] It should be noted that, in a specific embodiment, the first sampling value of the photosensitive device is recorded as RX_OFF_AD N, The preset value of the photosensitive device is RX_OFF_AD Max, That is, the theoretical value without light. If RX_OFF_AD N >=RX_OFF_AD Max , it is judged that the photosensitive device N is faulty or there is strong light interference, and the self-test state of the photosensitive device N is recorded as the fault state ST_RX N = err, and the environment self-check status is strong light interference ST_ENV = err. N <RX_OFF_AD Max , then the self-test status of the photosensitive device is normal ST_RX N =0, the environmental self-test status is normal ST_ENV=0.
[0093] According to an embodiment of the present invention, reading a sampling value of each light-emitting device, comparing the sampling value of the light-emitting device with a preset value to obtain a second comparison result, and recording a self-test state of the light-emitting device and a self-test state of the optical path according to the second comparison result, includes:
[0094] If the sampling value of the light emitting device is less than the preset value of the light emitting device, the self-test state of the light emitting device is a fault state, and the self-test state of the optical path is set to an optical path fault;
[0095] If the sampling value of the light emitting device is greater than or equal to the preset value of the light emitting device, the self-test state of the light emitting device is normal, and the self-test state of the optical path is set to be normal.
[0096] It should be noted that, in a specific embodiment, the sampled value TX_AD of each light emitting device is read. N, If the sampling value TX_AD of the light emitting device N Less than the preset value TX_AD of the light emitting device Min , that is, the self-test state of the light-emitting device is a fault state ST_TX N = err, set the optical path self-test state to optical path fault ST_GL = err;
[0097] If the sampling value of the light emitting device is greater than or equal to the preset value of the light emitting device, the self-test state of the light emitting device is normal, and the self-test state of the optical path is set to be normal.
[0098] According to an embodiment of the present invention, the second sampling value is compared with the third threshold value and the fourth threshold value, and a preset binary word wheel table is queried according to the comparison result to obtain the actual digital data, including:
[0099] The second sampling value is compared with the third threshold and the fourth threshold, the comparison result is converted into a binary word wheel state X, and the word wheel state X is queried in a preset binary word wheel table to generate actual digital data.
[0100] It should be noted that the third threshold is a 1 threshold RX_HIGN, and the fourth threshold is a 0 threshold RX_LOW, that is, if the second sampling value is greater than the third threshold, the value of X is 1, and if the second sampling value is less than the fourth threshold, the value of X is 0.
[0101] According to an embodiment of the present invention, if there is no corresponding result in the preset binary word wheel table, the optical path state is set according to the value of X. When X=0, the optical path state is that there is an optical path fault problem; if X=A, the optical path state is that there is strong light interference.
[0102] According to an embodiment of the present invention, it also includes: continuously acquiring actual digital data N times, judging the error by the average value, and recording the total self-check state according to the error.
[0103] It should be noted that, in a specific embodiment, interference is eliminated, actual digital data is obtained three times in succession, and the error is determined by the average value, and the total self-test status is recorded according to the error.
[0104] According to an embodiment of the present invention, actual digital data is obtained N times continuously, and an average value of the actual digital data is calculated. If the difference between the actual digital data and the average value for N consecutive times is within a preset error range, the overall self-test state is normal. If there is one time when the difference between the actual digital data and the average value is not within the preset error range, the overall self-test state is abnormal.
[0105] For example, actual digital data is obtained three times in succession, and the average value Data_ave of the actual digital data is calculated for the three times. If the difference between the actual digital data and the average value Data_ave for N consecutive times is within the preset error range, the overall self-test status is normal. If there is one time when the difference between the actual digital data and the average value Data_ave is not within the preset error range, the overall self-test status is abnormal, and the overall self-test status is marked with an error flag ST=err.
[0106] According to an embodiment of the present invention, obtaining the timestamp and corresponding data stored in the last data read command, and obtaining the overall self-test status by comparing with the data of the current timestamp, includes:
[0107] Get the timestamp Time_last and corresponding data Data_last stored in the last data read command;
[0108] Current timestamp Time, the flow data Data corresponding to the timestamp at that time, calculate the theoretical maximum change Data_change = (Time-Time_last)*Data_change_Max;
[0109] If Data-Data_last>Data_change, the actual digital data generated this time is incorrect and the total self-check status is abnormal.
[0110] It should be noted that the final self-test results outputted in the present invention include: final self-test results ST, photosensitive device self-test results ST_RXN, light-emitting device self-test results ST_TXN, environmental self-test results ST_ENV, and optical path self-test results ST_GL.
[0111] The third aspect of the present invention provides a computer-readable storage medium, which includes a photoelectric direct-reading water meter error self-detection method program. When the photoelectric direct-reading water meter error self-detection method program is executed by a processor, the steps of the photoelectric direct-reading water meter error self-detection method are implemented.
[0112] The present application provides a photoelectric direct-reading water meter error self-checking method, system and storage medium. The present invention obtains a first image by first acquiring an image to be processed and performing Gaussian filtering processing; extracts horizontal / vertical edge gradients from the first image using a negative symmetric matrix; uses a preset target detection algorithm to roughly extract edges to obtain coarse edge features; and tracks the coarse edge features through hysteresis threshold boundaries, connects weak edges and strong edges, and extracts edge features that meet the preset fineness. The present application extracts edge gradients through a negative symmetric matrix, and can increase weights in only one dimension, while remaining unchanged in another dimension, thereby ensuring that when extracting the gradient in one direction, it is not affected by another direction, thereby reducing the impact on noise and extracting finer edge features.
[0113] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as: multiple units or components can be combined, or can be integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the components shown or discussed can be through some interfaces, and the indirect coupling or communication connection of the devices or units can be electrical, mechanical or other forms.
[0114] The units described above as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units; they may be located in one place or distributed on multiple network units; some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0115] In addition, all functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may be separately used as a unit, or two or more units may be integrated into one unit; the above-mentioned integrated units may be implemented in the form of hardware or in the form of hardware plus software functional units.
[0116] Those skilled in the art can understand that all or part of the steps of implementing the above method embodiments can be completed by hardware related to program instructions, and the aforementioned program can be stored in a readable storage medium. When the program is executed, it executes the steps of the above method embodiments; and the aforementioned storage medium includes: mobile storage devices, read-only memories (ROM, Read-Only Memory), random access memories (RAM, Random Access Memory), disks or optical disks, and other media that can store program codes.
[0117] Alternatively, if the above-mentioned integrated unit of the present invention is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a readable storage medium. Based on this understanding, the technical solution of the embodiment of the present invention can be essentially or partly reflected in the form of a software product that contributes to the prior art. The software product is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the methods described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as mobile storage devices, ROM, RAM, magnetic disks or optical disks.
Claims
1. A self-checking method for photoelectric direct-reading water meter errors. It is characterized in that The method comprises: Obtaining a data reading command, determining a timestamp of the data reading command, and starting a photoelectric direct-reading meter reading and self-testing program; Turn off all light-emitting devices, read the sampling value of each photosensitive device in turn, compare the first sampling value of the photosensitive device with a preset value to obtain a first comparison result, and record the self-test state of the photosensitive device and the environmental self-test state according to the first comparison result; Lighting up the light-emitting devices in sequence, reading the sampling value of each light-emitting device, comparing the sampling value of the light-emitting device with a preset value to obtain a second comparison result, and recording the self-test state of the light-emitting device and the self-test state of the optical path according to the second comparison result; Turn off all light-emitting devices, light up the light-emitting devices in turn, and read the second sampling value of the photosensitive device corresponding to each light-emitting device; Compare the second sampling value with the third threshold and the fourth threshold, and query the preset binary word wheel table according to the comparison result to generate actual digital data; Get the timestamp and corresponding data stored in the last data read command, compare with the data of the current timestamp to get the total self-test status, and output the final self-test result.
2. According to the photoelectric direct reading water meter error self-checking method described in claim 1, It is characterized in that The step of comparing the first sampling value of the photosensitive device with a preset value to obtain a first comparison result, and recording the self-test state of the photosensitive device and the self-test state of the environment according to the first comparison result includes: If the first sampling value of the photosensitive device is greater than or equal to the preset value, it is determined that the photosensitive device N is faulty or there is strong light interference, and the self-test state of the photosensitive device N is recorded as a fault state; and the environmental self-test state is strong light interference; If the first sampling value of the photosensitive device is less than the preset value, the photosensitive device is in a normal state and the environmental self-test state is normal.
3. According to the photoelectric direct reading water meter error self-checking method described in claim 2, It is characterized in that Reading a sampling value of each light emitting device, comparing the sampling value of the light emitting device with a preset value to obtain a second comparison result, and recording a self-test state of the light emitting device and a self-test state of the optical path according to the second comparison result, including: If the sampling value of the light emitting device is less than the preset value of the light emitting device, the self-test state of the light emitting device is a fault state, and the self-test state of the optical path is set to an optical path fault; If the sampling value of the light emitting device is greater than or equal to the preset value of the light emitting device, the self-test state of the light emitting device is normal, and the self-test state of the optical path is set to be normal.
4. According to claim 2, a photoelectric direct reading water meter error self-checking method, It is characterized in that The second sampling value is compared with the third threshold value and the fourth threshold value, and a preset binary word wheel table is searched according to the comparison result to obtain the actual digital data, including: The second sampling value is compared with the third threshold and the fourth threshold, the comparison result is converted into a binary word wheel state X, and the word wheel state X is queried in a preset binary word wheel table to generate actual digital data.
5. According to the photoelectric direct reading water meter error self-checking method described in claim 4, It is characterized in that If there is no corresponding result in the preset binary word wheel table, the light path state is set according to the value of X. When X=0, the light path state is that there is a light path fault problem; if X=A, the light path state is that there is strong light interference.
6. A photoelectric direct-reading water meter error self-checking method according to claim 1, It is characterized in that Also includes: Continuously obtain N times of actual digital data, and determine the error through the average value, and record the total self-test status based on the error.
7. A photoelectric direct-reading water meter error self-checking method according to claim 6, It is characterized in that Continuously obtain N actual digital data, calculate the average value of the N actual digital data, if the difference between the N consecutive actual digital data and the average value is within the preset error range, the overall self-test status is normal, if there is one time that the difference between the actual digital data and the average value is not within the preset error range, the overall self-test status is abnormal.
8. A photoelectric direct-reading water meter error self-checking method according to claim 1, It is characterized in that Get the timestamp and corresponding data stored in the last data read command, and compare them with the data of the current timestamp to get the overall self-test status, including: Get the timestamp Time_last and corresponding data Data_last stored in the last data read command; Current timestamp Time, the flow data Data corresponding to the timestamp at that time, calculate the theoretical maximum change Data_change = (Time-Time_last)*Data_change_Max; If Data-Data_last>Data_change, the actual digital data generated this time is incorrect and the total self-check status is abnormal.
9. A photoelectric direct reading water meter error self-checking system, It is characterized in that The photoelectric direct-reading water meter error self-checking system comprises: a memory and a processor, wherein the memory comprises a program of a photoelectric direct-reading water meter error self-checking method, and when the program of the photoelectric direct-reading water meter error self-checking method is executed by the processor, the following steps are implemented: Obtaining a data reading command, determining a timestamp of the data reading command, and starting a photoelectric direct-reading meter reading and self-testing program; Turn off all light-emitting devices, read the sampling value of each photosensitive device in turn, compare the first sampling value of the photosensitive device with a preset value to obtain a first comparison result, and record the self-test state of the photosensitive device and the environmental self-test state according to the first comparison result; Lighting up the light-emitting devices in sequence, reading the sampling value of each light-emitting device, comparing the sampling value of the light-emitting device with a preset value to obtain a second comparison result, and recording the self-test state of the light-emitting device and the self-test state of the optical path according to the second comparison result; Turn off all light-emitting devices, light up the light-emitting devices in turn, and read the second sampling value of the photosensitive device corresponding to each light-emitting device; Compare the second sampling value with the third threshold and the fourth threshold, and query the preset binary word wheel table according to the comparison result to generate actual digital data; Get the timestamp and corresponding data stored in the last data read command, compare with the data of the current timestamp to get the total self-test status, and output the final self-test result.
10. A computer-readable storage medium, It is characterized in that The computer-readable storage medium includes a photoelectric direct-reading water meter error self-detection method program. When the photoelectric direct-reading water meter error self-detection method program is executed by a processor, the steps of the photoelectric direct-reading water meter error self-detection method according to any one of claims 1 to 8 are implemented.
Citation Information
Cited By
Counter data self-diagnosis method and device
CN120232501A
