Hybrid preemptive real-time operating system and method

Through a hybrid preemptive real-time operating system and energy management technology, the problem of both energy consumption and real-time performance of environmental energy IoT devices in harsh environments is solved, and the stable operation and efficient task scheduling of the device without battery power is achieved. In various application scenarios.

CN119127413APending Publication Date: 2024-12-13SHANDONG INSPUR SCI RES INST CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202410663384.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-27
Publication Date
2024-12-13

AI Technical Summary

Technical Problem

The real-time operating system of existing environmental energy IoT devices is difficult to take into account both the equipment energy consumption and real-time performance, and cannot effectively schedule tasks, resulting in unstable equipment operation in harsh environments.

Method used

A hybrid preemption real-time operating system is designed. By dividing tasks into computing and peripheral tasks, hybrid preemption scheduling is introduced. Computational tasks are prioritized and can be restored. Peripheral tasks adopt non-preemption scheduling and combined with photovoltaic circuits. , energy storage unit, voltage detection circuit, energy rate calculator and energy predictor to realize adaptive task scheduling and energy management.

Benefits of technology

Effectively reduces equipment energy consumption, ensures priority call of high-priority tasks, ensures the reliability and real-timeness of the equipment during power interruption, is suitable for battery-free environmental energy IoT devices, and is suitable for smart agriculture and building monitoring fields such as .

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119127413A_ABST
    Figure CN119127413A_ABST
Patent Text Reader

Abstract

The invention provides a hybrid preemptive real-time operating system and method, and belongs to the technical field of artificial intelligence. The hybrid preemptive real-time operating system comprises a photovoltaic circuit, an energy storage unit, a voltage detection circuit, an energy rate calculator, an energy predictor and a self-adaptive task scheduler which are connected in sequence; the adaptive task scheduler is used for adaptive scheduling of different tasks in the system; according to the system, tasks are divided into calculation tasks and peripheral tasks, hybrid preemptive scheduling is introduced, the calculation tasks are scheduled preferentially and can be suspended and recovered at any execution point, and preemptive scheduling is adopted for the calculation tasks; performing non-preemptive scheduling on peripheral tasks; on the premise that the efficiency is improved, priority calling of high-priority tasks is achieved, and it is guaranteed that the equipment can still keep reliable real-time performance in the power interruption period.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of artificial intelligence technology, and in particular relates to a hybrid preemptive real-time operating system and method. Background Art

[0002] In the field of Internet of Things, the environmental energy Internet of Things is an emerging technology field that has attracted much attention. The environmental energy Internet of Things is an Internet of Things terminal without a power supply or built-in battery. These terminals extract energy from the environment such as light, heat, and radio signals to meet their working needs. Environmental energy Internet of Things devices do not use batteries for power supply and can be deployed in harsh environments where batteries cannot work properly or where the cost of human maintenance is high. Therefore, energy consumption control of the equipment is particularly important.

[0003] The two main technologies for the power demand of ambient energy IoT devices are "micro energy hunting" and low power consumption technology. The combination of the two technologies can achieve the effect of battery-free power supply and extended working time. Most IoT devices are limited by hardware resources, and most of the software runs in bare metal form or micro operating systems such as Nano Rt-Thread. Bare metal operation cannot provide some basic task scheduling and can only process simple logic; some micro operating systems can perform task scheduling but cannot take into account the low power consumption characteristics of the device. At present, there is a problem that the real-time operating system running in ambient energy IoT devices cannot take into account the energy consumption of the device. Summary of the invention

[0004] The present invention aims at the problems in the prior art and provides a hybrid preemptive real-time operating system and method, which effectively takes into account the energy consumption and real-time performance of the equipment. The system divides tasks into computing and peripheral tasks, introduces hybrid preemptive scheduling, prioritizes the scheduling of computing tasks and can be suspended and resumed at any execution point, adopts preemptive scheduling; adopts non-preemptive scheduling for peripheral tasks; ensures that high-priority tasks are prioritized and called on the premise of improving efficiency.

[0005] In order to achieve the above purpose, the technical solution adopted in this application is: In a first aspect, the present invention provides a hybrid preemptive real-time operating system, including a photovoltaic circuit, an energy storage unit, a voltage detection circuit, an energy rate calculator, an energy predictor, and an adaptive task scheduler connected in sequence; The photovoltaic circuit converts solar energy into light energy through a photovoltaic converter and transmits it to the energy storage unit; The energy storage unit is used to store electrical energy in a capacitor and transmit the electrical energy to the environmental energy IoT device through a voltage rectifier and regulator; The voltage detection circuit is used to monitor and control the power supply on the circuit board, and the overall energy utilization rate is calculated by the energy rate calculator; The energy predictor obtains the predicted value of solar energy collection rate based on the neural network, and dynamically adjusts the charging rate under various environments based on the predicted value; The adaptive task scheduler is used for adaptive scheduling of different tasks in the system. The system supports periodic applications composed of task chains. The task chain starts to execute in sequence when the first task is released and enters the running state, and the next task can only be executed after the current task is completed. The tasks are divided into computing tasks and peripheral tasks, and hybrid preemptive scheduling is introduced. Computing tasks are scheduled first and can be suspended and resumed at any execution point. Preemptive scheduling is used for computing tasks; non-preemptive scheduling is used for peripheral tasks.

[0006] Furthermore, the process of the adaptive task scheduler from startup to starting task scheduling is as follows: Step 1: After the device is started, the scheduler checks whether there is a JIT checkpoint in the device's non-volatile memory. If a checkpoint is found, the task is restored from the checkpoint and the system time and timer events are updated. If no checkpoint is found, the process proceeds to step 2. Step 2: The scheduler searches for the task τh with the best priority from the task queue in the ready state and determines the category of the task τh. If the task is non-atomic, it proceeds to step 3; if the task is atomic, it proceeds to step 4. Step 3: The scheduler executes a time slice of task τh and continues to search for high-priority tasks, repeating the above process. Step 4: The scheduler estimates the energy required to execute the task and determines whether the task can be completed based on the current energy of the device. If the energy is sufficient, the scheduler will schedule the task until it is completed. If the energy is insufficient, the process proceeds to step 5. In step 5, the system performs an energy cycle to obtain more energy.

[0007] Furthermore, the energy cycle of step 5 is: Step A, calculate the energy collection time ∆t by the current charging rate, and then compare the energy collection time with the future release time of other high-priority periodic tasks to calculate the next time the device wakes up from standby, in order to ensure that high-priority tasks are not missed during charging; Step B, perform JIT check; Step C, sending a charging request.

[0008] Furthermore, the external interrupt or periodic polling of the voltage detection circuit implements a JIT check service, which is used to detect whether the voltage level of the capacitor reaches a low voltage threshold. The JIT check service also stores the current system time and counter events in a non-volatile memory to ensure the correct execution of the timer.

[0009] Furthermore, each task τ1 on the task chain can be an atomic or non-atomic task. Atomic tasks cannot be preempted or suspended during execution; non-atomic tasks can be preempted and suspended at any time. The hybrid preemptive scheduling method is based on the premise that atomic tasks are non-preemptible during operation, and the system schedules atomic tasks in a non-preemptive manner. Once the atomic tasks are scheduled, they will be executed when the system has sufficient energy, and will not be preempted by other high-priority tasks during this period. Non-atomic tasks execute the preemptive task scheduling mode of the normal RTOS.

[0010] Furthermore, the energy predictor adopts a machine learning-based energy prediction model to provide reliable solar energy collection rate prediction by utilizing time series voltage data, using half-hour time intervals as prediction windows.

[0011] In a second aspect, the present invention provides a working method of an embedded real-time operating system based on charging perception as described in the first aspect, including: storing the task context in NVM through the task chain of the software and the instantaneous point check; estimating the task scheduling time and the charging time through the voltage detection circuit and the charging manager to ensure that the atomic task can be successfully executed.

[0012] Compared with the prior art, the advantages and positive effects of the present invention are: 1. The present invention designs a hybrid preemptive real-time operating system, which is an embedded real-time operating system that supports hybrid task scheduling and is suitable for environmental energy Internet of Things devices, effectively taking into account both device energy consumption and real-time performance. The system divides tasks into computing and peripheral tasks, introduces hybrid preemptive scheduling, prioritizes computing tasks and allows them to be suspended and resumed at any execution point, and uses preemptive scheduling; non-preemptive scheduling is used for peripheral tasks; and priority calling of high-priority tasks is achieved under the premise of ensuring improved efficiency.

[0013] 2. The real-time operating system provided by the present invention is used for battery-free environmental energy IoT devices, and is intended to ensure that tasks can be fully executed when the device is intermittently powered. The system ensures that the device can still maintain reliable real-time performance during power outages. In addition, a dedicated operating system software architecture and a dedicated hardware circuit architecture are designed to implement the storage of task context in NVM through the software task chain and point-in-time check; the estimation of task scheduling time and charging time is implemented through the voltage detection circuit and the charging manager, ensuring that atomic tasks can be successfully executed. The system proposed by the present invention combines energy harvesting technology, energy storage technology, and operating system task scheduling technology, etc., and can be applied in fields such as smart agriculture and building monitoring where battery power is not desired to avoid the need for a large amount of manpower cost maintenance, and has high social application value. BRIEF DESCRIPTION OF THE DRAWINGS

[0014] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0015] Figure 1 It is a structural schematic diagram of an embedded real-time operating system based on charging perception of the present invention; Figure 2 It is a task chain schematic diagram of the present invention; Figure 3 It is a flow chart of the task scheduler of the present invention. DETAILED DESCRIPTION

[0016] In order to more clearly understand the above-mentioned purpose, features and advantages of the present invention, the present invention is further described below in conjunction with the accompanying drawings and embodiments. It should be noted that the embodiments of the present application and the features in the embodiments can be combined with each other without conflict.

[0017] In the following description, many specific details are set forth to facilitate a full understanding of the present invention. However, the present invention may also be implemented in other ways than those described herein. Therefore, the present invention is not limited to the specific embodiments of the following disclosure.

[0018] Embodiment 1, as Figure 1 to Figure 3 As shown, the present application provides a hybrid preemptive real-time operating system, specifically a charging-aware embedded real-time operating system that supports hybrid task preemption. The operating system runs on the attached Figure 1 The hardware photovoltaic circuit collects energy from the environment, and the power management unit converts the energy into a stable voltage and stores it in the energy storage circuit. It is also responsible for powering the device. The hardware circuit has a dedicated external non-volatile memory NVM to store the context data of the task when the device is powered off. The specific functions of each part of the system are described as follows: Photovoltaic circuit: The photovoltaic array converts the solar energy in the environment into electrical energy through a photovoltaic converter and transmits it to the energy storage unit; Energy storage unit: stores electrical energy in capacitors and transmits the electrical energy to environmental energy IoT devices through voltage rectifiers and regulators; Voltage detection circuit: monitors and controls the power supply on the entire circuit board, calculates the overall energy utilization, provides low-voltage threshold information for the device, can monitor the charging rate of the current circuit and calculate the remaining energy in the system, and can disconnect the power supply of the device within a specified time; the voltage detection circuit can utilize existing solutions of common integrated circuits.

[0019] Energy predictor: A neural network-based energy predictor that can adapt to a variety of environmental conditions and dynamically adjust the charging rate in a variety of environments through neural networks; Task chain. The system supports periodic applications composed of task chains. Each task τ1 on the task chain can be an atomic or non-atomic task. Atomic tasks cannot be preempted or suspended during execution; non-atomic tasks can be preempted and suspended at any time. The task chain starts to execute in sequence when the first task is released and enters the running state, and the next task can only be executed after the previous task is completed. The task chain diagram is shown in the attached figure. Figure 2 As shown, Figure 2 The task chain in contains four tasks. The number and type of tasks in the task chain are unlimited. If the first task in the task chain is a periodic task triggered by a timer or external event, all tasks in the task chain follow the periodic mode constrained by the first task.

[0020] Hybrid preemption method: Since atomic tasks cannot be preempted during operation, the system schedules atomic tasks in a non-preemptive manner. Once an atomic task is scheduled, it will be completed when the system has sufficient energy and will not be preempted by other high-priority tasks during this period. Non-atomic tasks execute the preemptive task scheduling mode of the normal RTOS.

[0021] Non-preemptive scheduling of the system: Atomic tasks are scheduled in a non-preemptive manner. Atomic tasks use the first-come-first-served FCFS scheduling algorithm. Since atomic tasks have the highest priority, the system puts atomic tasks in the waiting queue in chronological order. The FCFS algorithm schedules atomic tasks from the queue in a first-in-first-out manner. Preemptive Scheduling: Non-atomic tasks adopt the preemptive scheduling principle of RTOS and the priority scheduling algorithm. When a high-priority task is added during the execution of a low-priority task, the system will save the context of the low-priority task, switch the context and execute the task of that priority. When the high-priority task is completed, the low-priority context will be restored and the low-priority task will continue to be executed.

[0022] Task Scheduler: The task scheduler is a pure software module of the operating system based on different scheduling algorithms.

[0023] Adaptive Task Scheduler: Aims to effectively utilize available energy to achieve adaptive scheduling of different tasks in the operating system. The process from device startup to task scheduling is shown in the attached figure. Figure 3 A more detailed description is as follows: Step 1: After the device is started, the scheduler checks whether there is a JIT checkpoint in the device's non-volatile memory. If a checkpoint is found, the task is restored from the checkpoint and the system time and timer events are updated. If no checkpoint is found, the process proceeds to step 2. Step 2: The scheduler searches for the task τh with the best priority from the task queue in the ready state and determines the category of the task τh. If the task is non-atomic, it proceeds to step 3; if the task is atomic, it proceeds to step 4. Step 3: The scheduler executes a time slice of task τh and continues to search for high-priority tasks, repeating the above process. Step 4: The scheduler estimates the energy required to execute the task and determines whether the task can be completed based on the current energy of the device. If the energy is sufficient, the scheduler will schedule the task until it is completed. If the energy is insufficient, the process proceeds to step 5. In step 5, the system performs an energy cycle to obtain more energy, including: Step A, calculate the energy collection time ∆t by the current charging rate, and then compare the energy collection time with the future release time of other high-priority periodic tasks to calculate the next time the device wakes up from standby, in order to ensure that high-priority tasks are not missed during charging; Step B, perform JIT check; Step C, sending a charging request; JIT check service: JIT check is implemented as a system service task. Its function is to detect whether the voltage level of the capacitor reaches the low voltage threshold. It can be implemented through external interrupts of the voltage detection circuit or periodic polling. The JIT service task is the first step in the startup sequence and is executed with the highest priority in the system. The low voltage threshold check task can preempt the execution of tasks at any time during the execution of non-atomic tasks. It traverses all non-atomic tasks in the system and stores the task context, stack, and SRAM data of each non-atomic task in non-volatile memory so that they can be restored to SRAM the next time the device starts. The JIT service also stores the current system time and counter events in non-volatile memory to ensure the correct execution of the timer.

[0024] Charge management: JIT inspection service promotes the correct execution of non-atomic tasks, and charge management aims to ensure the normal execution of atomic tasks. The system sets a minimum threshold voltage for atomic tasks, which represents the minimum threshold voltage before executing a task, thereby effectively ensuring that the task can be successfully executed before reaching the JIT inspection low voltage threshold.

[0025] Energy Predictor: As the environment changes, the energy collection efficiency of the system changes. The system adopts a machine learning-based energy prediction model to provide reliable solar energy collection rate prediction by utilizing time series voltage data, using half-hour time intervals as the prediction window.

[0026] Energy Controller: Although JIT checkpoints facilitate the execution of non-atomic tasks, the complete execution of atomic tasks is essential, and the energy controller is responsible for the system's charge management. The system provides a Assign a voltage threshold , which indicates that the system starts to execute atomic tasks The minimum voltage required before the task reaches the low voltage threshold for JIT checkpointing. When the system schedules an atomic task, the scheduler reads the current voltage value of the system in the voltage detection circuit and the voltage threshold of the task. Compare, if the current voltage is greater than the voltage threshold , the energy controller notifies the system scheduler that the task can be executed, otherwise the task can only be scheduled after the next charging cycle is completed.

[0027] Maximum time for task execution:

[0028] The charging time of the task, that is, the charging time required to complete the task; The energy harvesting rate of the system; :Capacitance unit; Low voltage thresholds that trigger JIT checkpoints and power cycles; The main working stages of intermittent power supply equipment are as follows: Power-off stage: During this stage, the device is completely powered off and the circuit is in the energy collection stage.

[0029] Running phase: When the energy storage circuit has sufficient energy, the device starts running. When the voltage reaches below the low voltage threshold, the power will be cut off. Before the power is cut off, the context of the task will be stored in the NVM. The system will calculate the remaining energy in the circuit and perform an immediate check before the low voltage threshold is reached, so as to ensure that the task that was not completed before the power is cut off can be executed when the device is restarted again.

[0030] Sleep stage: The device is in a low power consumption stage to save energy.

[0031] A hybrid preemptive real-time operating system provided in this embodiment is intended to ensure that IoT devices in a battery-free environment can work during power outages. Based on an embedded real-time operating system, the present invention introduces real-time detection technology and a hybrid preemptive scheduling method for the operating system, which divides the system's tasks into atomic tasks and non-atomic tasks. Timely detection technology is used for non-atomic tasks to ensure that the tasks can be fully executed while non-preemptive scheduling is used; an uninterrupted execution strategy is used for atomic tasks to ensure efficient execution of tasks. In addition, the system also supports task processing chains with priority constraints, and adjusts scheduling according to environmental changes so that devices can run continuously in different environments.

[0032] This embodiment provides a hybrid preemptive real-time operating system for battery-free environmental energy IoT devices, aiming to ensure that tasks can be fully executed when the device is intermittently powered. The system ensures that the device can still maintain reliable real-time performance during power outages. In addition, a dedicated operating system software architecture and a dedicated hardware circuit architecture are designed to implement the storage of task context in NVM through software task chains and point-in-time checks; the estimation of task scheduling time and charging time is implemented through voltage detection circuits and charging managers, ensuring that atomic tasks can be successfully executed. The system proposed by the present invention combines energy harvesting technology, energy storage technology, and operating system task scheduling technology, etc., and can be applied in fields such as smart agriculture and building monitoring where battery power is not desired to avoid requiring a large amount of manpower cost maintenance, and has high social application value.

[0033] Embodiment 2, the present invention provides a working method of an embedded real-time operating system based on charging perception as described in Embodiment 1, including: storing the task context in NVM through the task chain of the software and the instantaneous point check; estimating the task scheduling time and the charging time through the voltage detection circuit and the charging manager to ensure that the atomic task can be successfully executed.

[0034] The above description is only a preferred embodiment of the present invention and does not limit the present invention in other forms. Any technician familiar with the profession may use the technical content disclosed above to change or modify it into an equivalent embodiment with equivalent changes and apply it to other fields. However, any simple modification, equivalent change and modification made to the above embodiment based on the technical essence of the present invention without departing from the content of the technical solution of the present invention still falls within the protection scope of the technical solution of the present invention.

Claims

1. A hybrid preemptive real-time operating system, characterized in that: It includes a photovoltaic circuit, an energy storage unit, a voltage detection circuit, an energy rate calculator, an energy predictor, and an adaptive task scheduler connected in sequence; The photovoltaic circuit converts solar energy into light energy through a photovoltaic converter and transmits it to the energy storage unit; The energy storage unit is used to store electrical energy in a capacitor and transmit the electrical energy to the environmental energy IoT device through a voltage rectifier and regulator; The voltage detection circuit is used to monitor and control the power supply on the circuit board, and the overall energy utilization rate is calculated by the energy rate calculator; The energy predictor obtains the predicted value of solar energy collection rate based on the neural network, and dynamically adjusts the charging rate under various environments based on the predicted value; The adaptive task scheduler is used for adaptive scheduling of different tasks in the system. The system supports periodic applications consisting of task chains. The task chain starts to execute in sequence when the first task is released into the running state, and the next task can only be executed after the previous task is completed. Tasks are divided into computing tasks and peripheral tasks, and a hybrid preemptive scheduling method is introduced. Computing tasks are scheduled first and can be suspended and resumed at any execution point. Preemptive scheduling is used for computing tasks, and non-preemptive scheduling is used for peripheral tasks.

2. A hybrid preemptive real-time operating system according to claim 1, characterized in that: The process of the adaptive task scheduler from startup to starting task scheduling is as follows: Step 1: After the device is started, the scheduler checks whether there is a JIT checkpoint in the device's non-volatile memory. If a checkpoint is found, the task is restored from the checkpoint and the system time and timer events are updated. If no checkpoint is found, the process proceeds to step 2. Step 2: The scheduler searches for the task τh with the best priority from the task queue in the ready state and determines the category of the task τh. If the task is non-atomic, it proceeds to step 3; if the task is atomic, it proceeds to step 4. Step 3: The scheduler executes a time slice of task τh and continues to search for high-priority tasks, repeating the above process. Step 4: The scheduler estimates the energy required to execute the task and determines whether the task can be completed based on the current energy of the device. If the energy is sufficient, the scheduler will schedule the task until it is completed. If the energy is insufficient, the process proceeds to step 5. In step 5, the system performs an energy cycle to obtain more energy.

3. A hybrid preemptive real-time operating system according to claim 1, characterized in that: The energy cycle of step 5 is: Step A, calculate the energy collection time ∆t by the current charging rate, and then compare the energy collection time with the future release time of other high-priority periodic tasks to calculate the next time the device wakes up from standby, in order to ensure that high-priority tasks are not missed during charging; Step B, perform JIT check; Step C, sending a charging request.

4. A hybrid preemptive real-time operating system according to claim 1, characterized in that: The external interrupt or periodic polling of the voltage detection circuit implements a JIT check service, which is used to detect whether the voltage level of the capacitor reaches a low voltage threshold. The JIT check service also stores the current system time and counter events in a non-volatile memory to ensure the correct execution of the timer.

5. A hybrid preemptive real-time operating system according to claim 1, characterized in that: Each task τ1 on the task chain can be an atomic or non-atomic task, and an atomic task cannot be preempted or suspended during execution; Non-atomic tasks can be preempted and suspended at any time; The hybrid preemptive scheduling method is based on the premise that atomic tasks are non-preemptible during operation, and the system schedules atomic tasks in a non-preemptive manner. Once the atomic tasks are scheduled, they will be executed when the system has sufficient energy, and will not be preempted by other high-priority tasks during this period. Non-atomic tasks execute the preemptive task scheduling mode of the normal RTOS.

6. A hybrid preemptive real-time operating system according to claim 1, characterized in that: The energy forecaster adopts a machine learning based energy forecasting model to provide reliable solar energy collection rate forecasts by leveraging time series voltage data, using half-hour time intervals as the forecast window.

7. A working method of an embedded real-time operating system based on charging perception according to any one of claims 1 to 6, characterized in that: include: The task context is stored in NVM through software task chaining and point-in-time checking; The task scheduling time and charging time estimation are realized through the voltage detection circuit and the charging manager to ensure that the atomic task can be successfully completed.

Citation Information

Cited By

  • High-reliability optical storage integrated controller based on domestic chip and real-time operating system

    CN122092516A