Malfunction prevention process for devices having sensors and measurement value storage buffers.
The device with a control unit and state storage unit addresses buffer overflow and abnormal value issues by setting cooldown states, enhancing sensor measurement reliability and stability.
Patent Information
- Authority / Receiving Office
- JP · JP
- Patent Type
- Patents
- Current Assignee / Owner
- 倉光 周作
- Filing Date
- 2025-12-02
- Publication Date
- 2026-06-26
Smart Images

Figure 0007881029000001 
Figure 0007881029000002 
Figure 0007881029000003
Abstract
Description
Technical Field
[0001] The present invention relates to a device having a sensor and a measurement value storage buffer capable of avoiding malfunction, and a program therefor.
Background Art
[0002] Patent Document 1 describes a technique for reducing the number of buffers to be used when invalid values are input to a FIFO buffer. It also discloses ignoring buffer overflows caused by the accumulation of invalid data.
Prior Art Documents
Patent Documents
[0003]
Patent Document 1
Summary of the Invention
Problems to be Solved by the Invention
[0004] By the way, when the inventor was working on the development of a device in which the measurement values of a sensor are captured in a FIFO buffer, the device was sometimes troubled by malfunction due to buffer overflows that occur from time to time and abnormal measurement values. For example, the measurement values obtained immediately after a buffer overflow often deviated significantly from the original measurement values. In addition, a phenomenon was also observed in which the value of the measurement value changed between a normal value within the normal range and an abnormal value outside the normal range in a short period of time.
[0005] Judging whether the measurement value is within the normal range within the process of using the measurement value and simply ignoring the abnormal value was not sufficient to prevent such malfunction. This is because immediately after the occurrence of a phenomenon that causes an abnormality in the measurement value (buffer overflow, noise recognized as an abnormal measurement from the device, poor contact, etc.), even if the measurement value of the sensor is within the normal range, the measurement value itself may not be reliable and may be significantly different from the actual value. [Means for solving the problem]
[0006] The device to solve this problem is, A device having a sensor and a buffer for storing the sensor's measured values connected to it, and comprising a control unit and a state storage unit, The control unit performs control over the overall process, including the sensor acquisition process and the measurement value usage process that uses the measured values. The aforementioned sensor acquisition process is, If it is determined that the buffer has overflowed, An overflow determination process that creates free space in the buffer and sets a cooldown state valid for a first predetermined period in the state storage unit, If it is determined that the measured value stored in the buffer does not meet the predetermined normal value conditions, The state storage unit includes an abnormal value determination process for setting a cool-down state that is valid for a second predetermined period, The measurement value usage process includes a measurement value determination process that determines whether the measurement value has continuously met the continuation conditions for a predetermined measurement value determination period. If the cool-down state is set during the measurement value determination period, it will be treated as if the continuation condition was not met. This device is characterized by the following features.
[0007] Furthermore, a program for causing the device to function as such a device is also disclosed. [Effects of the Invention]
[0008] As a result, improved operational stability can be expected in devices that use sensor measurements. [Brief explanation of the drawing]
[0009] [Figure 1] This is a summary diagram of the present invention. [Figure 2] This is a block diagram of the device according to the present invention. [Figure 3] This demonstrates the control of the device according to the present invention. [Modes for carrying out the invention]
[0010] Embodiments of the present invention are described below. Reference numerals correspond to those in the drawings. The following embodiments are merely examples and are not limited to those described below. Necessary design modifications may be made without departing from the spirit of the invention, or components from the same or different embodiments may be combined as needed. Furthermore, "includes," "has," and "equips" do not exclude the existence of other configurations, but are interpreted as "includes (has, equips) but is not limited to these." Also, the order of steps such as control and information processing can be arbitrarily rearranged within the scope that achieves their objectives.
[0011] <Hardware Configuration> As shown in Figure 2, the device 10 according to the present invention has a control unit 13 and a state storage unit 14. The control unit 13 is, for example, a processor or FPGA that executes a program. The state storage unit 14 is, for example, memory such as registers or RAM. The control unit 13 and the state storage unit 14 may be implemented as a microcontroller, a System on Chip (SoC), or the like. It is clear that computers (personal computers, mobile phones, smartphones, tablet devices, etc.) are included in devices having a control unit 13 and a state storage unit 14.
[0012] Furthermore, the device is connected to a sensor 11 and a buffer 12 for storing the sensor's measured values by wire or wirelessly. The connection interface can be selected from known interfaces such as I2C, SPI, USB, ZigBee®, Bluetooth®, etc. This sensor measures some kind of value. For example, sensor 11 may measure physical quantities such as velocity, acceleration, angular velocity, angle, position information, temperature, humidity, length, distance, time, current, voltage, power consumption, etc. This measurement may be direct or indirect. Sensor 11 may also measure the state of an interface, such as whether a button is pressed or the direction of a joystick, as a measured value. The measured values of sensor 11 are once stored in buffer 12, and the measured values stored in buffer 12 are used by the control unit. This buffer 12 is, for example, a FIFO or LIFO buffer. Note that buffer 12 is usually located on the same board as sensor 11 and is independent of the state storage unit 14 of device 10, but in another embodiment, it may be located within the state storage unit 14 of device 10.
[0013] Buffer capacity is finite and usually fixed. Therefore, attempting to insert data exceeding the buffer capacity usually results in a buffer overflow. In one embodiment, the buffer has a means to indicate the occurrence of a buffer overflow, such as a state register. Therefore, the control unit can determine whether a buffer overflow has occurred by, for example, checking the state register. In another embodiment, a buffer overflow is confirmed by checking that there is no free space in the buffer, i.e., that the amount stored in the buffer is equal to the buffer capacity. When a buffer overflow occurs, it is necessary to clear the buffer or retrieve data to create space in the buffer. The cause of a buffer overflow is often that the control unit's buffer data acquisition process cannot keep up with the speed of data output from the buffer due to the load on the control unit, etc., and it often recovers naturally if left alone.
[0014] The criteria (predetermined normal value conditions) for determining that the measured value of the sensor is a normal value are determined as appropriate. In one embodiment, this is determined based on whether the measured value is within the range of normal values or measurable values disclosed in the data sheet of the sensor or the like. In one embodiment, this is determined by the mechanical constraints of the sensor. For example, in a sensor having buttons A and B, if it is mechanically impossible to press both buttons simultaneously, the measured value that both buttons are pressed is an abnormal value, so the normal value condition is "button A is pressed NAND button B is pressed". In one embodiment, this is determined by the usage environment of the sensor. For example, when measuring room temperature with a sensor and measuring a room temperature below -20°C or above 50°C, in most cases, it is not that the room temperature has an extreme value but rather it indicates a malfunction of the sensor. At this time, the normal value condition is that the room temperature is -20°C or higher and lower than 50°C. As another example, there is a case where a value that cannot be considered as the movable range of a normal person's upper limb is measured with a sensor for measuring the angle of a person's upper limb. This criterion may be obtained from experiments or empirical rules. Also, when the sensor itself has a means for indicating an abnormality, for example, when it has a register for storing an error code, the fact that it does not indicate an abnormality can be the normal value condition.
[0015] The use of the measured value of the sensor is not particularly limited. In one embodiment, the measured value of the sensor is used for determining whether a condition (continuity condition) where there is a measured value is continuously satisfied for a predetermined period, for example, whether the acceleration continuously exceeds a certain value for a predetermined period, or whether a button is continuously pressed for a predetermined period, but the use of that determination is also not particularly limited.
[0016] The program may be recorded on a recording medium. Examples of the recording medium include flash memory, RAM, ROM, HDD, SSD, CD, DVD, USB memory, memory card, etc. The control unit reads and executes the instructions of the program recorded on the recording medium.
[0017] <Program Control> The following describes the processing performed by the control unit. In a certain embodiment, the control unit periodically executes periodic processing as overall processing. Periodic processing is processing that is executed periodically, and is executed by an infinite loop, the loop function of Arduino (registered trademark), a handler whose execution is scheduled periodically, or the like. One execution of the periodic processing is defined as one cycle. The number of cycles can be used as a unit of time. In another embodiment, the control unit executes event-driven processing as overall processing. This is processing that is executed by the occurrence of a specific event, and is implemented by, for example, an interrupt handler. In a certain embodiment, specific events include that data has been input to the buffer and / or that a buffer overflow has occurred. Note that an initialization process may be executed when the control unit is activated.
[0018] The following refers to FIG. 3 and describes the implementation in the control unit that performs periodic processing. In this embodiment, the periodic processing includes sensor acquisition processing and measured value use processing. Note that in the control unit that performs event-driven processing, sensor acquisition processing and measured value use processing are included in the event-driven processing instead.
[0019] In step 21, the control unit performs sensor acquisition processing. The control unit acquires the measured value of the sensor from the buffer. At this time, it is also confirmed whether a buffer overflow has occurred. The sensor acquisition processing includes the following two processes. The first is overflow determination processing. When the control unit determines the occurrence of a buffer overflow, it creates space in the buffer and sets a cooldown state valid for a first predetermined period in the state storage unit. The second is abnormal value determination processing. When the measured value is an abnormal value, that is, when it does not satisfy the above normal value condition, a cooldown state valid for a second predetermined period is set in the state storage unit. Note that in a certain embodiment, when the overflow determination processing detects a buffer overflow, the abnormal value determination processing is skipped. Conversely, the abnormal value determination processing may be performed first, and if the normal value condition is not satisfied, the overflow determination processing may be skipped. In this case, it is desirable to always create space in the buffer before skipping.
[0020] The cooldown state is a state stored in the state memory unit, for example, as a bit flag. The cooldown state lasts for a predetermined period (is valid for a predetermined period). In one embodiment, setting the cooldown state is implemented by calculating the time at which the cooldown state should end and storing it in the state memory unit. This is easy to use in event-driven systems. The time can be the actual time or a predetermined time, e.g., the time elapsed since the startup time. In another embodiment, the cooldown state is set by storing its duration. This stored duration decreases over time. While the stored duration is positive, the cooldown state is active; when it becomes 0 or less, the cooldown is considered to have ended. Within the overall process, if the cooldown state is active, the elapsed time is subtracted from the stored duration. For example, if the unit of the duration is real time, the elapsed time since the last execution of the overall process can be subtracted from the stored duration. This process of reducing the stored period may be performed at the beginning of the overall process or between the sensor acquisition process and the measurement value usage process. In particular, when this period is specified by the number of times a periodic process is executed, i.e., the number of cycles, the period to be stored becomes an integer counter, which we will call the cooldown counter. The cooldown counter decreases by 1 after each periodic process. The cooldown state is active when the cooldown counter is positive, and the cooldown ends when the cooldown counter reaches 0.
[0021] The first predetermined period (cool-down period in case of buffer overflow) and the second predetermined period (cool-down period in case of abnormal value) may be the same or different. Unlike buffer overflow, which is mainly caused by processing delays in the control unit, when a sensor measures an abnormal value, various causes are possible, such as electrical causes like noise, sensor malfunction, or incorrect device usage. Furthermore, while a buffer overflow can be expected to not recur for a certain period after clearing the buffer, this cannot be expected when measuring an abnormal value. For this reason, it is possible to set the second predetermined period to be longer than the first predetermined period. This will sacrifice responsiveness, but it can improve reliability.
[0022] Furthermore, if the cooldown state is already active, it is desirable to avoid performing the sensor acquisition process, or the overflow detection process and abnormal value detection process. In other words, check if the cooldown state is active at the beginning of the overall process, and if so, skip the sensor acquisition process. Alternatively, check if the cooldown state is active at the beginning of the sensor acquisition process, and if so, skip the overflow detection process and abnormal value detection process. In this case, it is desirable to create free space in the buffer before skipping the process; otherwise, a buffer overflow will occur again.
[0023] In step 22, the control unit performs measurement value usage processing. This includes processing using the measurement values acquired in the sensor acquisition process. All or part of this measurement value usage processing is skipped in the cooldown state. For example, in Figure 3, it is checked whether the cooldown state is active (23). If it is active, transition 25 skips the normal processing 24; if it is not active, transition 26 executes the normal processing 24. In other words, if the cooldown state is active, the processing is not performed. In one embodiment, this means that at the beginning of the measurement value usage processing, the cooldown state is checked, and if the cooldown state is active, the current execution of the overall processing is terminated with a continue statement or the like.
[0024] In another embodiment, the measurement usage process in the step includes a measurement determination process that determines whether the measurement has continuously met the continuation condition for a predetermined measurement determination period. This measurement determination process may also be performed in a cooldown state. If a cooldown state is set during the measurement determination period, it is treated as if the continuation condition has not been continuously met. In one embodiment, this is implemented by storing the duration for which the continuation condition is met in the state memory unit, and in the measurement value determination process, resetting the stored duration to 0 if a cool-down state is set, and increasing the duration otherwise. In another embodiment, the stored duration is reset to 0 when a cool-down state is set. In yet another embodiment, the remaining duration for which the continuation condition should be met is stored, and the remaining time is reset to its initial value when a cool-down state is set, or when a cool-down state is set during the measurement value determination process. The measurement data usage process may include both the measurement data determination process and the process that is skipped during the cooldown period.
[0025] <Note> Claim 1 A device having a sensor and a buffer for storing the sensor's measured values connected to it, and comprising a control unit and a state storage unit, The control unit performs control over the overall process, including the sensor acquisition process and the measurement value usage process that uses the measured values. The aforementioned sensor acquisition process is, If it is determined that the buffer has overflowed, An overflow determination process that creates free space in the buffer and sets a cooldown state valid for a first predetermined period in the state storage unit, If it is determined that the measured value stored in the buffer does not meet the predetermined normal value conditions, The state storage unit includes an abnormal value determination process for setting a cool-down state that is valid for a second predetermined period, The aforementioned measurement value usage process is, If the aforementioned cool-down state is effective, They will not carry out all or part of it. A device characterized by the following features. Claim 2 The characteristic feature is that if the cooldown state is set in the overflow determination process, the abnormal value determination process is not performed. The device according to claim 1. Claim 3 The aforementioned overall process is, If the aforementioned cool-down state is effective, The method is characterized by creating free space in the buffer and not performing the sensor acquisition process. The device according to one of claims 1 to 2. Claim 4 The aforementioned overall process is a periodic process that is executed periodically. The first predetermined period and the second predetermined period are characterized in that they are specified in units of the execution cycle of the periodic processing. The device according to one of claims 1 to 3. Claim 5 The state memory unit further stores a cooldown counter, Setting the cooldown state includes storing the number of execution cycles to be cooled in the cooldown counter. The aforementioned periodic processing includes, if the cooldown counter is positive, processing to decrement it, The aforementioned cool-down state is characterized in that it is effective when the cool-down counter is positive. The device according to claim 4. Claim 6 A device having a sensor and a buffer for storing the sensor's measured values connected to it, and comprising a control unit and a state storage unit, The control unit performs control over the overall process, including the sensor acquisition process and the measurement value usage process that uses the measured values. The aforementioned sensor acquisition process is, If it is determined that the buffer has overflowed, An overflow determination process that creates free space in the buffer and sets a cooldown state valid for a first predetermined period in the state storage unit, If it is determined that the measured value stored in the buffer does not meet the predetermined normal value conditions, The state storage unit includes an abnormal value determination process for setting a cool-down state that is valid for a second predetermined period, The measurement value usage process includes a measurement value determination process that determines whether the measurement value has continuously met the continuation conditions for a predetermined measurement value determination period. The device is characterized in that if the cool-down state is set during the measurement value determination period, it is treated as if the continuation condition has not been continuously met. Claim 7 A device having a sensor and a buffer for storing the sensor's measured values, a control unit and a state storage unit, A program for causing a device to function as described in any one of claims 1 to 6. [Explanation of symbols]
[0026] 10 devices 11 sensors 12 buffers 13 Control Unit 14 State Memory Unit 21 Sensor acquisition process 22 Processing using measured values 23. Check cooldown. 24. Normal measurement usage processing 25 Transitions when cooldown state is active 26 Transitions when the cooldown state is not active
Claims
1. A device having a sensor and a buffer for storing the sensor's measured values connected to it, and comprising a control unit and a state storage unit, The control unit performs control over the overall process, including the sensor acquisition process and the measurement value usage process that uses the measured values. The aforementioned sensor acquisition process is: If it is determined that the buffer has overflowed, An overflow determination process that creates space in the buffer and sets a cooldown state valid for a first predetermined period in the state storage unit, If it is determined that the measured value stored in the buffer does not meet the predetermined normal value conditions, The state storage unit includes an abnormal value determination process for setting a cool-down state that is valid for a second predetermined period. The measurement value usage process includes a measurement value determination process that determines whether the measurement value has continuously met the continuation condition for a predetermined measurement value determination period. The device is characterized in that if the cool-down state is set during the measurement value determination period, it is treated as if the continuation condition has not been continuously met.
2. A device having a sensor and a buffer for storing the sensor's measured values connected, a control unit and a state storage unit, A program for causing the device to function as described in claim 1.