Automatic calculation method and device for equipment use duration and electronic equipment

By acquiring and analyzing the original data set of equipment status changes, calculating the usage time of smart home devices in the target time period and state, the problem of low calculation efficiency of large-data equipment usage time is solved, and an in-depth understanding of user habits and equipment status is achieved, and product optimization and maintenance is supported.

CN119988778APending Publication Date: 2025-05-13SHENZHEN CHENBEI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411824523.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-11
Publication Date
2025-05-13

AI Technical Summary

Technical Problem

The existing technology is difficult to efficiently calculate the usage time of large data smart home equipment, which affects product optimization and predictive maintenance.

Method used

By obtaining the original data set of device status changes, extracting the target calculation time period, target device identification, target device status and target state value, and calculating the usage time of the target device when it meets the target state value.

Benefits of technology

It realizes automated and efficient computing of large-data equipment, understands user usage habits and equipment health status, and supports product optimization and predictive maintenance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119988778A_ABST
    Figure CN119988778A_ABST
Patent Text Reader

Abstract

The invention provides an automatic calculation method and device for equipment use duration and electronic equipment, and relates to the technical field of intelligent Internet of Things. The method comprises the following steps: acquiring target demand information of the use duration of computing equipment, and extracting a target computing time period, a target equipment identifier, a target equipment state and a target state value in the target demand information; acquiring an equipment state change original data set; and based on the target calculation time period, the target equipment identifier, the target equipment state, the target state value and the data in the equipment state change original data set, calculating the use duration when the target equipment identifier in the target calculation time period meets the target equipment state and the target state value. According to the embodiment of the invention, for large-data-volume equipment, the use duration when the target equipment identifier meets the target equipment state and the target state value in the target calculation time period can be automatically, efficiently and accurately calculated, and the use habit of a user and the equipment operation condition can be known, so that subsequent product optimization and predictive maintenance are facilitated.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of intelligent Internet of Things technology, and in particular to a method and device for automatically calculating the usage time of a device, and an electronic device. Background Art

[0002] Smart home devices are gradually becoming part of modern life. They are connected through the Internet, making home management more convenient and efficient. These devices can include smart fans, smart light bulbs, thermostats, security cameras, smart speakers, etc., which can be remotely controlled through mobile phone applications or voice assistants. Smart home devices can not only improve living comfort, but also save energy and enhance home safety. By analyzing the usage time of smart home devices, we can understand user usage habits and device operating conditions, so as to optimize products and predictive maintenance. However, the calculation of the usage time of smart home devices with large amounts of data has become a technical problem that needs to be solved urgently. Summary of the invention

[0003] In view of the above problems, the present application is proposed to provide a method and apparatus for automatically calculating the usage time of a device, an electronic device, a storage medium and a computer program product that overcome the above problems or at least partially solve the above problems. The technical solution is as follows:

[0004] In a first aspect, a method for automatically calculating device usage time is provided, comprising:

[0005] Obtain target demand information for computing device usage time, and extract a target computing time period, a target device identifier, a target device state, and a target state value from the target demand information;

[0006] Acquire an original data set of device state changes, wherein each piece of data in the original data set of device state changes includes a device identifier, a corresponding changed device state and state value, a corresponding unchanged device state and state value, and time information of a corresponding device state change;

[0007] Based on the target calculation time period, the target device identifier, the target device state, the target state value, and data in the device state change original data set, the usage time when the target device identifier in the target calculation time period meets the target device state and the target state value is calculated.

[0008] In a possible implementation, based on the target calculation time period, the target device identifier, the target device state, the target state value, and data in the device state change original data set, calculating the usage duration of the target calculation time period when the target device identifier satisfies the target device state and the target state value includes:

[0009] Determine whether the target state value is empty;

[0010] If the target state value is empty, determining the core state according to the target device state;

[0011] Extracting data including the core state of the target device identification in the changed device state during the target calculation period from the device state change original data set, and then storing it in an empty device state change table, wherein the table fields of the device state change table include device identification, device state, state value, and time information of device state change;

[0012] Obtaining a device latest status table, wherein the device latest status table is a partition table, and the table fields of the device latest status table include device identification, device status, latest status value, time information of device status change, and partition date; each partition of the device latest status table stores the latest status value of the core status of the target device identification up to the corresponding partition date;

[0013] Extracting all data from the device status change table, and extracting data from the partition date of the core status of the target device identifier in the device latest status table before the target calculation time period;

[0014] All data in the device status change table and data in the device latest status table on the partition date of the core status of the target device identifier before the target calculation time period are grouped according to device identifier and device status, and each piece of grouped data includes device identifier, device status, status value, and time information of device status change; based on device identifier, device status, status value, and time information of device status change, the usage time of each status value of the target device identifier in the core state during the target calculation time period is calculated.

[0015] In a possible implementation, the calculating of the usage time of each state value of the target device identifier in the core state in the target calculation time period based on the device identifier, the device state, the state value, and the time information of the device state change includes:

[0016] Sort the time information of device status changes from small to large, open a window to obtain the time information and status value of the device status change of the next data of each data, and obtain the newly added time information column and newly added status value column after the window is opened;

[0017] Based on the device identification, device status, status value, time information of device status change, the newly added time information column and the newly added status value column after the window is opened, the usage time of each status value of the target device identification in the core state during the target calculation time period is calculated.

[0018] In a possible implementation, after calculating and obtaining the usage time of each state value of the target device identifier in the core state during the target calculation time period, the method further includes:

[0019] The calculated usage time of each state value of the target device identifier in the core state during the target calculation time period is stored in a device usage time table, wherein the table fields of the device usage time table include device identifier, device state, state value, usage time, and calculation time period.

[0020] In a possible implementation, the device latest status table is updated by the following steps:

[0021] Determine the latest state value of the core state of the target device identifier in the target calculation time period according to all data in the device state change table;

[0022] The target calculation time period is used as a new partition date, and the latest state value of the core state of the target device identifier in the target calculation time period is stored in the device state change table, thereby updating the device latest state table.

[0023] In a possible implementation, the method further includes:

[0024] If the target state value is not empty, determining the core state and the important state according to the target device state and the target state value; wherein the important state includes the core state;

[0025] Extracting data containing important status in the changed device status of the target device identification in the target calculation time period from the device status change original data set, which is called the first type of data;

[0026] The device identification, time information of device status change, important status and status value of important status are obtained by parsing the first type of data, which is called the second type of data;

[0027] The data satisfying the target state value is selected from the second type of data, which is called the third type of data;

[0028] The second type of data is grouped according to the device identifier, and sorted from small to large according to the time information of the device status change, and the data that does not currently meet the target status value but the previous data meets the target status value is taken, and the status value of the core status is modified to the first preset character, which is called the fourth type of data;

[0029] Taking the device identification, the time information of the device status change, the core status and the status value of the core status from the third type of data and the fourth type of data and storing them in an empty device status change table; wherein the table fields of the device status change table include the device identification, the device status, the status value and the time information of the device status change;

[0030] Obtaining a device latest status table, wherein the device latest status table is a partition table, and the table fields of the device latest status table include device identification, device status, latest status value, time information of device status change, and partition date; each partition of the device latest status table stores the latest status value of the core status of the target device identification up to the corresponding partition date;

[0031] Extracting all data from the device status change table, and extracting data from the partition date of the core status of the target device identifier in the device latest status table before the target calculation time period;

[0032] All data in the device status change table and data in the device latest status table on the partition date of the core status of the target device identifier before the target calculation time period are grouped according to device identifier and device status, and each grouped data includes device identifier, device status, status value, and time information of device status change; based on device identifier, device status, status value, and time information of device status change, calculate the usage time of each status value in the core state when the target device identifier meets the target status value during the target calculation time period.

[0033] In a possible implementation, the calculating, based on the device identifier, the device state, the state value, and the time information of the device state change, to obtain the usage time of each state value in the core state when the target device identifier meets the target state value during the target calculation time period includes:

[0034] Sort the time information of device status changes from small to large, open a window to obtain the time information and status value of the device status change of the next data of each data, and obtain the newly added time information column and newly added status value column after the window is opened;

[0035] According to the device identification, device status, status value, time information of device status change, newly added time information column and newly added status value column after the window is opened, filter out data whose current status value is equal to the status value of the next data, and filter out data whose current status value is the first preset character or the second preset character, and then calculate the usage time of each status value in the core state when the target device identification meets the target status value during the target calculation time period.

[0036] In a possible implementation, after calculating and obtaining the usage duration of each state value of the core state when the target device identifier satisfies the target state value during the target calculation time period, the method further includes:

[0037] The calculated usage time of each state value in the core state when the target device identifier of the target calculation time period meets the target state value is stored in the device usage time table, wherein the table fields of the device usage time table include device identifier, device state, state value, usage time, and calculation time period.

[0038] In a possible implementation manner, after extracting the target computing time period, the target device identifier, the target device status, and the target status value in the target requirement information, the method further includes:

[0039] The extracted target calculation time period, the target device identification, the target device status and the target status value are stored in a calculation logic configuration table, wherein the table fields of the calculation logic configuration table include calculation time period, device identification, device status and status value.

[0040] In a second aspect, a device for automatically calculating the usage time of a device is provided, comprising:

[0041] An extraction unit, used to obtain target demand information of the usage time of the computing device, and extract a target computing time period, a target device identifier, a target device state, and a target state value from the target demand information;

[0042] An acquisition unit is used to acquire an original data set of device state changes, wherein each piece of data in the original data set of device state changes includes a device identifier, a corresponding changed device state and state value, a corresponding unchanged device state and state value, and time information of a corresponding device state change;

[0043] A calculation unit is used to calculate the usage time when the target device identifier in the target calculation time period meets the target device status and the target status value based on the target calculation time period, the target device identifier, the target device status, the target status value, and the data in the device status change original data set.

[0044] In a possible implementation manner, the computing unit is further configured to:

[0045] Determine whether the target state value is empty;

[0046] If the target state value is empty, determining the core state according to the target device state;

[0047] Extracting data including the core state of the target device identification in the changed device state during the target calculation period from the device state change original data set, and then storing it in an empty device state change table, wherein the table fields of the device state change table include device identification, device state, state value, and time information of device state change;

[0048] Obtaining a device latest status table, wherein the device latest status table is a partition table, and the table fields of the device latest status table include device identification, device status, latest status value, time information of device status change, and partition date; each partition of the device latest status table stores the latest status value of the core status of the target device identification up to the corresponding partition date;

[0049] Extracting all data from the device status change table, and extracting data from the partition date of the core status of the target device identifier in the device latest status table before the target calculation time period;

[0050] All data in the device status change table and data in the device latest status table on the partition date of the core status of the target device identifier before the target calculation time period are grouped according to device identifier and device status, and each piece of grouped data includes device identifier, device status, status value, and time information of device status change; based on device identifier, device status, status value, and time information of device status change, the usage time of each status value of the target device identifier in the core state during the target calculation time period is calculated.

[0051] In a possible implementation manner, the computing unit is further configured to:

[0052] Sort the time information of device status changes from small to large, open a window to obtain the time information and status value of the device status change of the next data of each data, and obtain the newly added time information column and newly added status value column after the window is opened;

[0053] Based on the device identification, device status, status value, time information of device status change, the newly added time information column and the newly added status value column after the window is opened, the usage time of each status value of the target device identification in the core state during the target calculation time period is calculated.

[0054] In a possible implementation manner, the computing unit is further configured to:

[0055] After calculating the usage time of each state value of the target device identifier in the core state during the target calculation time period, the calculated usage time of each state value of the target device identifier in the core state during the target calculation time period is stored in a device usage time table, wherein the table fields of the device usage time table include device identifier, device state, state value, usage time, and calculation time period.

[0056] In a possible implementation manner, the computing unit is further configured to:

[0057] Update the latest status table of the device by following the steps below:

[0058] Determine the latest state value of the core state of the target device identifier in the target calculation time period according to all data in the device state change table;

[0059] The target calculation time period is used as a new partition date, and the latest state value of the core state of the target device identifier in the target calculation time period is stored in the device state change table, thereby updating the device latest state table.

[0060] In a possible implementation manner, the computing unit is further configured to:

[0061] If the target state value is not empty, determining the core state and the important state according to the target device state and the target state value; wherein the important state includes the core state;

[0062] Extracting data containing important status in the changed device status of the target device identification in the target calculation time period from the device status change original data set, which is called the first type of data;

[0063] The device identification, time information of device status change, important status and status value of important status are obtained by parsing the first type of data, which is called the second type of data;

[0064] The data satisfying the target state value is selected from the second type of data, which is called the third type of data;

[0065] The second type of data is grouped according to the device identifier, and sorted from small to large according to the time information of the device status change, and the data that does not currently meet the target status value but the previous data meets the target status value is taken, and the status value of the core status is modified to the first preset character, which is called the fourth type of data;

[0066] Taking the device identification, the time information of the device status change, the core status and the status value of the core status from the third type of data and the fourth type of data and storing them in an empty device status change table; wherein the table fields of the device status change table include the device identification, the device status, the status value and the time information of the device status change;

[0067] Obtaining a device latest status table, wherein the device latest status table is a partition table, and the table fields of the device latest status table include device identification, device status, latest status value, time information of device status change, and partition date; each partition of the device latest status table stores the latest status value of the core status of the target device identification up to the corresponding partition date;

[0068] Extracting all data from the device status change table, and extracting data from the partition date of the core status of the target device identifier in the device latest status table before the target calculation time period;

[0069] All data in the device status change table and data in the device latest status table on the partition date of the core status of the target device identifier before the target calculation time period are grouped according to device identifier and device status, and each grouped data includes device identifier, device status, status value, and time information of device status change; based on device identifier, device status, status value, and time information of device status change, calculate the usage time of each status value in the core state when the target device identifier meets the target status value during the target calculation time period.

[0070] In a possible implementation manner, the computing unit is further configured to:

[0071] Sort the time information of device status changes from small to large, open a window to obtain the time information and status value of the device status change of the next data of each data, and obtain the newly added time information column and newly added status value column after the window is opened;

[0072] According to the device identification, device status, status value, time information of device status change, newly added time information column and newly added status value column after the window is opened, filter out data whose current status value is equal to the status value of the next data, and filter out data whose current status value is the first preset character or the second preset character, and then calculate the usage time of each status value in the core state when the target device identification meets the target status value during the target calculation time period.

[0073] In a possible implementation manner, the computing unit is further configured to:

[0074] After calculating the usage time of each state value in the core state when the target device identifier meets the target state value during the target calculation time period, the calculated usage time of each state value in the core state when the target device identifier meets the target state value during the target calculation time period is stored in a device usage time table, wherein the table fields of the device usage time table include device identifier, device state, state value, usage time, and calculation time period.

[0075] In a possible implementation manner, the extraction unit is further used for:

[0076] After extracting the target calculation time period, target device identification, target device status and target status value from the target demand information, the extracted target calculation time period, target device identification, target device status and target status value are stored in a calculation logic configuration table, wherein the table fields of the calculation logic configuration table include calculation time period, device identification, device status and status value.

[0077] According to a third aspect, an electronic device is provided, comprising a processor and a memory, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute any of the above-described methods for automatically calculating the device usage time.

[0078] In a fourth aspect, a storage medium is provided, wherein the storage medium stores a computer program, wherein the computer program is configured to execute any of the above-mentioned methods for automatically calculating the device usage time when running.

[0079] In a fifth aspect, a computer program product is provided, comprising a computer program, wherein the computer program is configured to execute any of the above-mentioned methods for automatically calculating the device usage time when running.

[0080] By means of the above technical scheme, the automatic calculation method and device for the equipment usage time provided by the embodiment of the present application, the electronic device, the storage medium and the computer program product, the method can obtain the target demand information for calculating the equipment usage time, extract the target calculation time period, the target equipment identification, the target equipment state and the target state value in the target demand information; obtain the original data set of equipment state change, wherein each data in the original data set of equipment state change includes the equipment identification, the corresponding changed equipment state and state value, the corresponding unchanged equipment state and state value, and the time information of the corresponding equipment state change; and then based on the target calculation time period, the target equipment identification, the target equipment state, the target state value, and the data in the original data set of equipment state change, calculate the usage time when the target equipment identification of the target calculation time period meets the target equipment state and the target state value. It can be seen that this embodiment can automatically, efficiently and accurately calculate the usage time when the target equipment identification of the target calculation time period meets the target equipment state and the target state value for large data volume equipment, and can understand the user's usage habits and equipment operation status, so as to perform product optimization and predictive maintenance later. BRIEF DESCRIPTION OF THE DRAWINGS

[0081] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in describing the embodiments of the present application are briefly introduced below.

[0082] Figure 1 A flow chart of an automated calculation method for device usage time provided in an embodiment of the present application is shown;

[0083] Figure 2 A structural diagram of an automatic calculation device for equipment usage time provided in an embodiment of the present application is shown;

[0084] Figure 3 A structural diagram of an electronic device provided in an embodiment of the present application is shown. DETAILED DESCRIPTION

[0085] The exemplary embodiments of the present application will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present application are shown in the accompanying drawings, it should be understood that the present application can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided in order to enable a more thorough understanding of the present application and to fully convey the scope of the present application to those skilled in the art.

[0086] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that such use is interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the term "including" and its variants are to be interpreted as open-ended terms meaning "including but not limited to".

[0087] In order to solve the above technical problems, the present application embodiment provides an automatic calculation method for the device usage time, such as Figure 1 As shown, the automatic calculation method of the device usage time may include the following steps S1 to S3:

[0088] Step S1, obtaining target demand information of computing device usage time, and extracting target computing time period, target device identification, target device status and target status value from the target demand information.

[0089] In this step, the target device identifier can be used to uniquely identify the target device, and may include the target device type and the target device identity tag, etc., which are not limited in this embodiment. For example, the target device identifier is smart fan A, where the smart fan is the target device type, and A is the target device identity tag. It should be noted that the examples here are only illustrative and do not limit this embodiment.

[0090] For example, if the target demand information is the usage time of each gear of smart fan A the day before, then the target calculation time period, target device identifier, target device status and target status value extracted from the target demand information are the day before today, smart fan A, fan gear, and null value respectively.

[0091] For example, the target demand information is the usage time of each gear of smart fan A in manual mode the day before. The target calculation time period, target device identifier, target device status and target status value extracted from the target demand information are the day before today, smart fan A, device mode and fan gear, and manual mode, respectively.

[0092] For another example, the target demand information is the usage duration of each device mode of smart fans A, B and C the day before yesterday. The target calculation time period, target device identifier, target device status and target status value extracted from the target demand information are respectively the day before today, smart fans A, B and C, device mode, and null value.

[0093] For another example, the target demand information is the usage time of smart fan A in manual mode and gear 1 the day before. The target calculation time period, target device identifier, target device status and target status value extracted from the target demand information are respectively the day before today, smart fan A, device mode and fan gear, manual mode, gear 1.

[0094] It should be noted that the above examples are merely illustrative and do not limit this embodiment.

[0095] Step S2, obtaining an original data set of device status changes, wherein each data in the original data set of device status changes includes a device identifier, a corresponding changed device status and status value, a corresponding unchanged device status and status value, and time information of a corresponding device status change.

[0096] In this step, the device identifier may be used to uniquely identify each device, and may include a device type and a device identity tag, etc., which is not limited in this embodiment.

[0097] Step S3, based on the target calculation time period, the target device identifier, the target device state, the target state value, and the data in the device state change original data set, calculate the usage time when the target device identifier in the target calculation time period meets the target device state and the target state value.

[0098] For devices with large amounts of data, this embodiment can automatically, efficiently and accurately calculate the usage time when the target device identifier in the target calculation time period meets the target device state and target state value, and can understand user usage habits and device operating conditions to facilitate subsequent product optimization and predictive maintenance.

[0099] After the above step S1 extracts the target calculation time period, target device identification, target device status and target status value in the target demand information, the extracted target calculation time period, target device identification, target device status and target status value can also be stored in the calculation logic configuration table, wherein the table fields of the calculation logic configuration table include the calculation time period, device identification, device status and status value; this can facilitate subsequent use and improve calculation efficiency.

[0100] The target state value extracted in step S1 above may be a null value or may not be a null value. Depending on whether the target state value is a null value, the processing method of step S3 is different, which will be introduced below respectively.

[0101] In case 1, the target state value is null, that is, the target state value is null, then step S3 calculates the usage time when the target device identifier in the target calculation time period satisfies the target device state and the target state value based on the target calculation time period, the target device identifier, the target device state, the target state value, and the data in the device state change original data set, and specifically may include the following steps S311 to S315:

[0102] Step S311, determining the core state according to the target device state.

[0103] In this step, the target device state can be used as the core state. Taking the target demand information as the usage time of each gear of smart fan A the day before as an example, the target calculation time period, target device identifier, target device state and target state value extracted from the target demand information are the day before today, smart fan A, fan gear, and null value, respectively. The core state determined according to the target device state is the fan gear.

[0104] Taking the target demand information being the usage duration of each device mode of smart fans A, B and C the day before as an example, the target calculation time period, target device identifier, target device status and target status value extracted from the target demand information are respectively the day before today, smart fans A, B and C, device mode, and null value. The core status determined according to the target device status is the device mode.

[0105] It should be noted that the above examples are merely illustrative and do not limit this embodiment.

[0106] Step S312, extract the data including the core state of the target device identifier in the device state after the change in the target calculation time period from the original data set of the device state change, and then store it into an empty device state change table, wherein the table fields of the device state change table include the device identifier, device state, state value, and time information of the device state change.

[0107] Step S313, obtaining the device latest status table, wherein the device latest status table is a partition table, and the table fields of the device latest status table include device identification, device status, latest status value, time information of device status change, and partition date; each partition of the device latest status table stores the latest status value of the core status of the target device identification up to the corresponding partition date.

[0108] Step S314, extracting all data from the device state change table, and extracting data on the partition date of the core state of the target device identifier before the target calculation time period in the device latest state table.

[0109] Step S315, group all data in the device status change table and the data of the partition date of the core status of the target device identifier in the device latest status table before the target calculation time period according to the device identifier and device status, and each grouped data includes the device identifier, device status, status value, and time information of the device status change; based on the device identifier, device status, status value, and time information of the device status change, calculate the usage time of each status value of the target device identifier in the core state during the target calculation time period.

[0110] This embodiment uses the device status change table and the device latest status table to calculate the usage time of each status value of the target device identifier in the core state during the target calculation time period. It can process the original data set of device status changes offline throughout the process, making the calculation method more flexible and improving the calculation efficiency.

[0111] In the above step S315, based on the device identification, device status, status value, and time information of device status change, the usage time of each status value of the target device identification in the core state in the target calculation time period is calculated, which may specifically include the following steps S3151 and S3152:

[0112] Step S3151, sort the device status change time information from small to large, open a window to obtain the device status change time information and status value of the next data of each data, and obtain the newly added time information column and newly added status value column after opening the window.

[0113] In this step, windowing means introducing data from other rows into this row without affecting the data in the current row. In this way, the time information and status value of the device status change of the next data of each data are obtained through windowing, and the newly added time information column and the newly added status value column are obtained after the windowing.

[0114] Step S3152, calculate the usage time of each status value of the target device identifier in the core state during the target calculation time period based on the device identifier, device status, status value, time information of device status change, the time information column newly added after the window is opened, and the status value column newly added.

[0115] This embodiment calculates the usage time of each status value of the target device identifier in the core state during the target calculation time period based on the device identifier, device status, status value, time information of device status change, the newly added time information column after the window is opened, and the newly added status value column, which is clearer and more efficient.

[0116] After calculating the usage time of each state value of the target device identifier in the core state in the target calculation time period in step S315 or calculating the usage time of each state value of the target device identifier in the core state in step S3152, the following step S316 may be further included:

[0117] Step S316, storing the calculated usage time of each state value of the target device identifier in the core state in the target calculation time period into the device usage time table, wherein the table fields of the device usage time table include device identifier, device state, state value, usage time, and calculation time period.

[0118] This embodiment stores the calculated usage time of each state value of the target device identifier in the core state in the target calculation time period into the device usage time table, which can be easily recorded and consulted, and is convenient for understanding user usage habits and device operating conditions, so as to facilitate subsequent product optimization and predictive maintenance.

[0119] The device latest status table obtained in step S313 above can be updated through the following steps S3131 and S3132:

[0120] Step S3131, determining the latest state value of the core state of the target device identifier in the target calculation time period according to all data in the device state change table.

[0121] In this step, the device status change table is obtained according to step S312, and the table fields of the device status change table include device identification, device status, status value, and time information of device status change.

[0122] Step S3132, taking the target calculation time period as the new partition date, storing the latest status value of the core status of the target device identifier in the target calculation time period into the device status change table, thereby updating the device latest status table.

[0123] This embodiment can timely update the device latest status table according to all the data in the device status change table, so as to facilitate the calculation of subsequent device usage time.

[0124] In case 2, the target state value is not a null value, that is, the target state value is not empty, then step S3 calculates the usage time when the target device identifier in the target calculation time period satisfies the target device state and the target state value based on the target calculation time period, the target device identifier, the target device state, the target state value, and the data in the device state change original data set, and specifically may include the following steps S321 to S329:

[0125] Step S321, determining the core state and the important state according to the target device state and the target state value; wherein the important state includes the core state.

[0126] In this step, taking the target demand information being the usage time of each gear in manual mode of smart fan A the day before as an example, the target calculation time period, target device identifier, target device status and target status value extracted from the target demand information are respectively the day before today, smart fan A, device mode and fan gear, and manual mode. Based on the target device status and target status value, the core status determined is the fan gear, and the important statuses are the fan gear and device mode.

[0127] Taking the target demand information as an example, the target demand information is the usage time of smart fan A in manual mode at gear 1 the day before, the target calculation time period, target device identifier, target device status and target status value extracted from the target demand information are respectively the day before today, smart fan A, device mode and fan gear, manual mode, and gear 1. According to the target device status and target status value, the core state determined is the fan gear, and the important states are the fan gear and device mode.

[0128] It should be noted that the above examples are merely illustrative and do not limit this embodiment.

[0129] Step S322, extracting data containing important status in the changed device status of the target device identification in the target calculation time period from the device status change original data set, which is called the first type of data.

[0130] Step S323, parsing the first type of data to obtain the device identification, time information of device status change, important status and status value of the important status, which is called the second type of data.

[0131] Step S324, taking data that meets the target state value from the second category of data, which is called the third category of data.

[0132] Step S325, group the second category data according to the device identifier, sort them from small to large according to the time information of the device status change, take the data that does not currently meet the target status value but the previous data meets the target status value, and modify the status value of the core status to the first preset character, which is called the fourth category data.

[0133] In this step, the first preset character can be set according to actual needs, such as the first preset character is off, etc., which is not limited in this embodiment.

[0134] Step S326, take the device identification, time information of device status change, core status and status value of core status from the third and fourth categories of data and store them into an empty device status change table; wherein the table fields of the device status change table include device identification, device status, status value and time information of device status change.

[0135] Step S327, obtaining the device latest status table, wherein the device latest status table is a partition table, and the table fields of the device latest status table include device identification, device status, latest status value, time information of device status change, and partition date; each partition of the device latest status table stores the latest status value of the core status of the target device identification up to the corresponding partition date.

[0136] Step S328, extracting all data of the device state change table, and extracting data of the partition date of the core state of the target device identifier before the target calculation time period in the device latest state table.

[0137] Step S329, group all data in the device status change table and the data of the partition date of the core status of the target device identifier in the device latest status table before the target calculation time period according to the device identifier and device status, and each grouped data includes the device identifier, device status, status value, and time information of the device status change; based on the device identifier, device status, status value, and time information of the device status change, calculate the usage time of each status value in the core state when the target device identifier meets the target status value during the target calculation time period.

[0138] In this step, if the target state value does not contain any state value of the core state, then the use time of each state value of the core state when the target device identifier meets the target state value in the target calculation time period can be calculated based on the device identifier, device state, state value, and time information of device state change. For example, taking the target demand information as the use time of each gear in the manual mode of smart fan A the day before, the target calculation time period, target device identifier, target device state and target state value extracted from the target demand information are respectively the day before today, smart fan A, device mode and fan gear, manual mode, then according to the target device state and target state value, the core state determined is the fan gear, the important state is the fan gear and device mode, then the target state value is the manual mode, and does not contain any state value of the core state fan gear, then the use time of each fan gear when smart fan A meets the manual mode the day before today can be calculated based on the device identifier, device state, state value, and time information of device state change.

[0139] If the target state value includes one or more state values ​​of the core state, it may be referred to as the target core state value. Then, based on the device identification, device state, state value, and time information of device state change, the target calculation time period target device identification meets the target state value in the core state target core state value usage time. For example, taking the target demand information as the target demand information is the usage time of the smart fan A in the manual mode and the 1st gear the day before, the target calculation time period, target device identification, target device state, and target state value extracted from the target demand information are respectively the day before today, smart fan A, device mode and fan gear, manual mode, and 1st gear. Then, according to the target device status and target state value, the core state determined is the fan gear, and the important state is the fan gear and device mode. Then, the target state value is manual mode and 1st gear, including the core state fan gear 1st gear, which may be referred to as the target core state value. Then, based on the device identification, device state, state value, and time information of device state change, the usage time of the smart fan A in the manual mode and the 1st gear the day before today can be calculated.

[0140] This embodiment combines the core status and important status, uses the device status change table and the device latest status table, and calculates the usage time of each status value in the core status when the target device identifier meets the target status value during the target calculation time period. The original data set of the device status change can be processed offline throughout the process, making the calculation method more flexible and improving the calculation efficiency.

[0141] The above step S329 calculates the usage time of each state value in the core state when the target device identification meets the target state value in the target calculation time period based on the device identification, device state, state value, and time information of the device state change, which may specifically include the following steps S3291 and S3292:

[0142] Step S3291, sort the device status change time information from small to large, open a window to obtain the device status change time information and status value of the next data of each data, and obtain the newly added time information column and newly added status value column after opening the window.

[0143] In this step, windowing means introducing data from other rows into this row without affecting the data in the current row. In this way, the time information and status value of the device status change of the next data of each data are obtained through windowing, and the newly added time information column and the newly added status value column are obtained after the windowing.

[0144] Step S3292, based on the device identification, device status, status value, time information of device status change, the newly added time information column after the window is opened, and the newly added status value column, filter out the data whose current status value is equal to the status value of the next data, and filter out the data whose current status value is the first preset character or the second preset character, and then calculate the usage time of each status value in the core state when the target device identification meets the target status value during the target calculation time period.

[0145] In this step, the second preset character can be set according to actual needs. For example, if the second preset character is 0, it means that the device status is off, which is not limited in this embodiment.

[0146] This embodiment filters out data whose current status value is equal to the status value of the next data piece, and filters out data whose current status value is the first preset character or the second preset character based on the device identification, device status, status value, time information of device status change, the time information column newly added after the window is opened, and the data whose current status value is the first preset character or the second preset character. Then, the usage time of each status value in the core state when the target device identification meets the target status value during the target calculation time period is calculated, which is clearer and more efficient.

[0147] After the use time of each state value of the core state when the target device identifier in the target calculation time period satisfies the target state value is calculated in step S329 or after the use time of each state value of the core state when the target device identifier in the target calculation time period satisfies the target state value is calculated in step S3292, the following step S330 may also be included:

[0148] Step S330, storing the calculated usage time of each state value in the core state when the target device identifier of the target calculation time period meets the target state value into the device usage time table, wherein the table fields of the device usage time table include device identifier, device state, state value, usage time, and calculation time period.

[0149] This embodiment stores the calculated usage time of each state value in the core state when the target device identifier in the target calculation time period meets the target state value into the device usage time table, which can be easily recorded and consulted, and is convenient for understanding user usage habits and device operating conditions, so as to facilitate subsequent product optimization and predictive maintenance.

[0150] The device latest status table obtained in step S327 above can be updated through the following steps S3271 and S3272:

[0151] Step S3271, determining the latest status value of the core status of the target device identifier in the target calculation time period according to all data in the device status change table.

[0152] In this step, the device status change table is obtained in step S326, and the table fields of the device status change table include device identification, device status, status value, and time information of device status change.

[0153] Step S3272, taking the target calculation time period as the new partition date, storing the latest status value of the core status of the target device identifier in the target calculation time period into the device status change table, thereby updating the device latest status table.

[0154] This embodiment can timely update the device latest status table according to all the data in the device status change table, so as to facilitate the calculation of subsequent device usage time.

[0155] The above introduces Figure 1 There are multiple implementation methods for each link of the illustrated embodiment. The following will further illustrate the method for automatically calculating the device usage time of the embodiment of the present application through specific embodiments.

[0156] In this specific embodiment, it is assumed that Xiao Wang's family has smart fans A and B, and they are used in summer; further assuming that 2024 / 7 / 3 is today, 2024 / 7 / 2 is the day before today, and 2024 / 7 / 1 is two days before today. The following is the original data set of device status changes of smart fans A and B from the time they were put online to today:

[0157] 1) Smart fan A, changed device status and status value (online device mode, manual mode / online fan gear, 1st gear / online night light brightness, medium), unchanged device status and status value (none), 2024 / 7 / 1 / 9:00;

[0158] 2) Smart fan A, changed device status and status value (device mode, advanced mode / night light brightness, low), unchanged device status and status value (fan gear, gear 1), 2024 / 7 / 1 / 9:05;

[0159] 3) Smart fan B, device status and status value after change (online device mode, manual mode / online fan gear, 1st gear / online night light brightness, medium), device status and status value unchanged (none), 2024 / 7 / 1 / 9:10;

[0160] 4) Smart fan A, changed device status and status value (fan gear, gear 2), unchanged device status and status value (device mode, advanced mode / night light brightness, low), 2024 / 7 / 2 / 9:03;

[0161] 5) Smart fan A, changed device status and status value (fan gear, gear 3), unchanged device status and status value (device mode, advanced mode / night light brightness, low), 2024 / 7 / 2 / 12:03;

[0162] 6) Smart fan A, changed device status and status value (device mode, manual mode), unchanged device status and status value (fan gear, 3 gears / night light brightness, low), 2024 / 7 / 2 / 17:00;

[0163] 7) Smart fan A, changed device status and status value (device mode, sleep mode / night light brightness, high), unchanged device status and status value (fan gear, gear 3), 2024 / 7 / 2 / 21:00;

[0164] 8) Smart fan A, changed device status and status value (fan gear, gear 2 / device mode, advanced mode / night light brightness, low), unchanged device status and status value (none), 2024 / 7 / 3 / 8:00;

[0165] 9) Smart fan B, changed device status and status value (night light brightness, low), unchanged device status and status value (device mode, manual mode / fan gear, gear 1), 2024 / 7 / 3 / 8:02;

[0166] 10) Smart fan B, changed device status and status value (fan gear, gear 2), unchanged device status and status value (device mode, manual mode / night light brightness, low), 2024 / 7 / 3 / 11:00.

[0167] It should be noted that the embodiments of the present application can be applied to devices with large amounts of data, and the above-mentioned examples of smart fan A and smart fan B are only illustrative and do not limit the embodiments of the present application.

[0168] The target demand information for calculating the usage time of the device is: the usage time of smart fan A at each gear on 2024 / 7 / 2.

[0169] Execute step S1 to extract the target calculation time period, target device identifier, target device status and target status value in the target demand information, which are 2024 / 7 / 2 / 0:00-2024 / 7 / 2 / 24:00, smart fan A, fan gear, and null value.

[0170] Then, the extracted target calculation time period, target device identification, target device status and target status value can be stored in the calculation logic configuration table, wherein the table fields of the calculation logic configuration table include calculation time period, device identification, device status and status value; this can facilitate subsequent use and improve calculation efficiency.

[0171] Execute step S2 to obtain the original data set of device status changes, that is, obtain the above-mentioned original data set of device status changes, each data in the original data set of device status changes includes the device identification, the corresponding changed device status and status value, the corresponding unchanged device status and status value, and the time information of the corresponding device status change.

[0172] Continue to execute step S311 to determine the core state according to the target device state, and the core state is the fan gear position.

[0173] Step S312 is executed to extract the data of the target device identification in the changed device state during the target calculation time period from the device state change original data set, and then store it into an empty device state change table, wherein the table fields of the device state change table include device identification, device state, state value, and time information of device state change, as follows:

[0174] Smart fan A, fan gear, gear 2, 2024 / 7 / 2 / 9:03;

[0175] Smart fan A, fan gear, gear 3, 2024 / 7 / 2 / 12:03.

[0176] Execute step S313 to obtain the latest device status table, wherein the latest device status table is a partition table, and the table fields of the latest device status table include device identification, device status, latest status value, time information of device status change, and partition date; each partition of the latest device status table stores the latest status value of the core status of the target device identification up to the corresponding partition date, as follows:

[0177] Smart fan A, fan gear, gear 1, 2024 / 7 / 1 / 9:00, 2024 / 7 / 1.

[0178] Execute step S314 to extract all data in the device state change table, and extract data on the partition date of the core state of the target device identifier before the target calculation time period in the device latest state table, as follows:

[0179] Smart fan A, fan gear, gear 1, 2024 / 7 / 1 / 9:00, 2024 / 7 / 1;

[0180] Smart fan A, fan gear, gear 2, 2024 / 7 / 2 / 9:03;

[0181] Smart fan A, fan gear, gear 3, 2024 / 7 / 2 / 12:03.

[0182] Execute step S315 to group all data in the device status change table and the data of the partition date of the core status of the target device identifier in the device latest status table before the target calculation time period according to the device identifier and the device status, and each piece of data after grouping includes the device identifier, the device status, the status value, and the time information of the device status change; and step S3151 sorts the time information of the device status change from small to large, opens a window to obtain the time information and status value of the device status change of the next piece of data of each piece of data, and obtains the newly added time information column and the newly added status value column after the window is opened, as shown in Table 1 below:

[0183] Table 1

[0184]

[0185]

[0186] Execute step S3152 to calculate the usage time of each status value of the target device identifier in the core state during the target calculation time period based on the device identifier, device status, status value, time information of device status change, the time information column newly added after the window is opened, and the newly added status value column. The usage time here can include the following four methods.

[0187] Method 1: If the time in the time information of the device status change is less than 0:00 of the target calculation time period, and the time in the time information column newly added after the window is opened is not empty, the usage duration = the time in the time information column newly added after the window is opened - 0:00 of the target calculation time period.

[0188] Method 2: If the time in the time information of the device status change is less than 0 o'clock of the target calculation time period, and the time in the time information column newly added after the window is opened is empty, the usage duration = the target calculation time period.

[0189] Method three, if the time in the time information of the device status change is greater than 0 o'clock of the target calculation time period, and the time in the time information column newly added after the window is opened is not empty, then the usage duration = time in the time information column newly added after the window is opened - time in the time information of the device status change.

[0190] Method 4: If the time in the time information of the device status change is greater than 0:00 of the target calculation time period, and the time in the time information column newly added after the window is opened is empty, the usage duration = 0:00 after the target calculation time period - the time in the time information of the device status change.

[0191] Referring to Table 1, according to the second row, using method 1, from 2024 / 7 / 2 / 0:00 to 2024 / 7 / 2 / 24:00 (i.e., 2024 / 7 / 2), the usage time of smart fan A, when the fan gear is gear 1, is 543 minutes;

[0192] According to the third row, using method 3, from 2024 / 7 / 2 / 0:00 to 2024 / 7 / 2 / 24:00 (i.e., 2024 / 7 / 2), the usage time of smart fan A at fan gear 2 is 180 minutes;

[0193] According to row 4, using method 4, we can obtain that from 2024 / 7 / 2 / 0:00 to 2024 / 7 / 2 / 24:00 (i.e., 2024 / 7 / 2), the usage time of smart fan A at fan gear 3 is 717 minutes.

[0194] Next, step S316 may be continued to store the calculated usage duration of each state value of the target device identifier in the core state in the target calculation time period into the device usage duration table, wherein the table fields of the device usage duration table include device identifier, device state, state value, usage duration, and calculation time period, as follows:

[0195] Smart fan A, fan gear, gear 1, 543 minutes, 2024 / 7 / 2 / 0:00-2024 / 7 / 2 / 24:00;

[0196] Smart fan A, fan gear, gear 2, 180 minutes, 2024 / 7 / 2 / 0:00-2024 / 7 / 2 / 24:00;

[0197] Smart fan A, fan gear, 3 gears, 717 minutes, 2024 / 7 / 2 / 0:00-2024 / 7 / 2 / 24:00.

[0198] Continue to execute step S3131 and step S3132 to update the latest status table of the device, as follows:

[0199] Smart fan A, fan gear, gear 1, 2024 / 7 / 1 / 9:00, 2024 / 7 / 1;

[0200] Smart fan A, fan gear, gear 3, 2024 / 7 / 2 / 12:03, 2024 / 7 / 2.

[0201] This embodiment can use the calculation logic configuration table, the device state change table and the device latest state table for devices with large amounts of data to calculate the usage time of the smart fan A at each gear from 2024 / 7 / 2 / 0:00 to 2024 / 7 / 2 / 24:00 (i.e., the day of 2024 / 7 / 2) and store it in the device usage time table. The original data set of the device state change can be processed offline throughout the process, making the calculation method more flexible and improving the calculation efficiency.

[0202] The target demand information for calculating the device usage time is: the usage time of each gear of smart fan A in manual mode on 2024 / 7 / 2.

[0203] Execute step S1 to extract the target calculation time period, target device identifier, target device status and target status value in the target demand information, which are 2024 / 7 / 2 / 0:00-2024 / 7 / 2 / 24:00, smart fan A, device mode and fan gear, manual mode.

[0204] Then, the extracted target calculation time period, target device identification, target device status and target status value can be stored in the calculation logic configuration table, wherein the table fields of the calculation logic configuration table include calculation time period, device identification, device status and status value; this can facilitate subsequent use and improve calculation efficiency.

[0205] Execute step S2 to obtain the original data set of device status changes, that is, obtain the above-mentioned original data set of device status changes, each data in the original data set of device status changes includes the device identification, the corresponding changed device status and status value, the corresponding unchanged device status and status value, and the time information of the corresponding device status change.

[0206] Continue to execute step S321 to determine the core state and important state according to the target device state and the target state value. The determined core state is the fan gear position, and the important state is the fan gear position and the device mode.

[0207] Step S322 is executed to extract data containing important status in the changed device status of the target device identification in the target calculation time period from the device status change original data set, which is called the first type of data, and is as follows:

[0208] Smart fan A, changed device status and status value (fan gear, gear 2), unchanged device status and status value (device mode, advanced mode / night light brightness, low), 2024 / 7 / 2 / 9:03;

[0209] Smart fan A, changed device status and status value (fan gear, gear 3), unchanged device status and status value (device mode, advanced mode / night light brightness, low), 2024 / 7 / 2 / 12:03;

[0210] Smart fan A, changed device status and status value (device mode, manual mode), unchanged device status and status value (fan gear, 3 gears / night light brightness, low), 2024 / 7 / 2 / 17:00;

[0211] Smart fan A, changed device status and status value (device mode, sleep mode / night light brightness, high), unchanged device status and status value (fan gear, gear 3), 2024 / 7 / 2 / 21:00.

[0212] Step S323 is executed to parse the first type of data to obtain the device identification, the time information of the device status change, the important status and the status value of the important status, which is called the second type of data, which is as follows:

[0213] Smart fan A, 2024 / 7 / 2 / 9:03, fan gear, 2 gears / device mode, advanced mode;

[0214] Smart fan A, 2024 / 7 / 2 / 12:03, fan gear, 3 gears / device mode, advanced mode;

[0215] Smart fan A, 2024 / 7 / 2 / 17:00, fan gear, 3 gears / device mode, manual mode;

[0216] Smart fan A, 2024 / 7 / 2 / 21:00, fan gear, 3 gears / device mode, sleep mode.

[0217] Step S324 is executed to obtain data that meets the target state value from the second type of data, which is called the third type of data, as follows:

[0218] Smart fan A, 2024 / 7 / 2 / 17:00, fan gear, 3 gears / device mode, manual mode.

[0219] Execute step S325 to group the second type of data according to the device identifier, sort them from small to large according to the time information of the device status change, take the data that does not meet the target status value at present, but the previous data meets the target status value, and modify the status value of the core status to the first preset character off, which is called the fourth type of data, which is as follows:

[0220] Smart fan A, 2024 / 7 / 2 / 21:00, fan gear, off / device mode, sleep mode.

[0221] Execute step S326 to obtain the device identification, the time information of the device status change, the core status and the status value of the core status from the third type of data and the fourth type of data and store them in the empty device status change table; wherein the table fields of the device status change table include the device identification, the device status, the status value and the time information of the device status change, which are as follows:

[0222] Smart fan A, fan gear, gear 3, 2024 / 7 / 2 / 17:00;

[0223] Smart fan A, fan gear, off, 2024 / 7 / 2 / 21:00.

[0224] Execute step S327 to obtain the latest device status table, wherein the latest device status table is a partition table, and the table fields of the latest device status table include device identification, device status, latest status value, time information of device status change, and partition date; each partition of the latest device status table stores the latest status value of the core status of the target device identification up to the corresponding partition date, as follows:

[0225] Smart fan A, fan gear, off, 2024 / 7 / 1 / 9:05, 2024 / 7 / 1.

[0226] Execute step S328 to extract all data in the device state change table, and extract data on the partition date of the core state of the target device identifier before the target calculation time period in the device latest state table, as follows:

[0227] Smart fan A, fan position, off, 2024 / 7 / 1 / 9:05, 2024 / 7 / 1;

[0228] Smart fan A, fan gear, gear 3, 2024 / 7 / 2 / 17:00;

[0229] Smart fan A, fan gear, off, 2024 / 7 / 2 / 21:00.

[0230] Execute step S329 to group all data in the device status change table and the data of the partition date of the core status of the target device identifier in the device latest status table before the target calculation time period according to the device identifier and the device status, and each piece of data after grouping includes the device identifier, the device status, the status value, and the time information of the device status change; and step S3291 sorts the time information of the device status change from small to large, opens a window to obtain the time information and status value of the device status change of the next piece of data of each piece of data, and obtains the time information column and the status value column newly added after the window is opened, as shown in Table 2 below:

[0231] Table 2

[0232]

[0233] Continue to execute step S3292, according to the device identification, device status, status value, time information of device status change, newly added time information column after window opening, and newly added status value column, filter out data whose current status value is equal to the status value of the next data, and filter out data whose current status value is the first preset character off or the second preset character 0. Both off and 0 indicate that the device status is off. For example, if the fan gear here is off, it means that the device is not in the joint state of any fan gear in manual mode. The details are as follows in Table 3:

[0234] Table 3

[0235]

[0236] Then, the usage time of each state value in the core state when the target device identifier meets the target state value during the target calculation time period is calculated. The usage time here may include the following four methods.

[0237] Method 1: If the time in the time information of the device status change is less than 0:00 of the target calculation time period, and the time in the time information column newly added after the window is opened is not empty, the usage duration = the time in the time information column newly added after the window is opened - 0:00 of the target calculation time period.

[0238] Method 2: If the time in the time information of the device status change is less than 0 o'clock of the target calculation time period, and the time in the time information column newly added after the window is opened is empty, the usage duration = the target calculation time period.

[0239] Method three, if the time in the time information of the device status change is greater than 0 o'clock of the target calculation time period, and the time in the time information column newly added after the window is opened is not empty, then the usage duration = time in the time information column newly added after the window is opened - time in the time information of the device status change.

[0240] Method 4: If the time in the time information of the device status change is greater than 0:00 of the target calculation time period, and the time in the time information column newly added after the window is opened is empty, the usage duration = 0:00 after the target calculation time period - the time in the time information of the device status change.

[0241] Referring to Table 3, according to the second row, using method 3, it is obtained that from 2024 / 7 / 2 / 0:00 to 2024 / 7 / 2 / 24:00 (i.e., 2024 / 7 / 2), the usage time of smart fan A in manual mode with the fan gear at gear 3 is 240 minutes;

[0242] Next, step S330 may be continued to store the calculated usage duration of each state value in the core state when the target device identifier of the target calculation time period meets the target state value into the device usage duration table, wherein the table fields of the device usage duration table include device identifier, device state, state value, usage duration, and calculation time period, as follows:

[0243] Smart fan A; device mode, manual mode / fan gear, 3 gears; 240 minutes; 2024 / 7 / 2 / 0:00-2024 / 7 / 2 / 24:00.

[0244] Continue to execute step S3271 and step S3272 to update the latest status table of the device, as follows:

[0245] Smart fan A, fan position, off, 2024 / 7 / 1 / 9:05, 2024 / 7 / 1;

[0246] Smart fan A, fan gear, off, 2024 / 7 / 2 / 21:00, 2024 / 7 / 2.

[0247] This embodiment can use the calculation logic configuration table, the device state change table and the device latest state table for devices with large amounts of data to calculate the usage time of each gear in the manual mode of smart fan A from 2024 / 7 / 2 / 0:00 to 2024 / 7 / 2 / 24:00 (i.e., the day of 2024 / 7 / 2), and store it in the device usage time table. The original data set of the device state change can be processed offline throughout the process, making the calculation method more flexible and improving the calculation efficiency.

[0248] It should be noted that the size of the sequence number of each step in the above embodiment does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present application. In practical applications, all the above possible implementation methods can be combined in any way to form possible embodiments of the present application, which will not be described one by one here.

[0249] Based on the automatic calculation method of the device usage time provided in each of the above embodiments, based on the same inventive concept, an embodiment of the present application also provides an automatic calculation device for the device usage time.

[0250] Figure 2 1 is a structural diagram of an automatic calculation device for equipment usage time provided in an embodiment of the present application. Figure 2 As shown, the automatic calculation device for the equipment usage time may specifically include an extraction unit 210 , an acquisition unit 220 and a calculation unit 230 .

[0251] An extraction unit 210 is used to obtain target demand information of the usage time of the computing device, and extract the target computing time period, target device identifier, target device state and target state value from the target demand information;

[0252] The acquisition unit 220 is used to acquire an original data set of device state changes, wherein each data in the original data set of device state changes includes a device identifier, a corresponding changed device state and state value, a corresponding unchanged device state and state value, and time information of a corresponding device state change;

[0253] The calculation unit 230 is used to calculate the usage time when the target device identifier in the target calculation time period meets the target device status and the target status value based on the target calculation time period, the target device identifier, the target device status, the target status value, and the data in the device status change original data set.

[0254] A possible implementation is provided in an embodiment of the present application, wherein the calculation unit 230 is further configured to:

[0255] Determine whether the target state value is empty;

[0256] If the target state value is empty, determining the core state according to the target device state;

[0257] Extracting data including the core state of the target device identification in the changed device state during the target calculation period from the device state change original data set, and then storing it in an empty device state change table, wherein the table fields of the device state change table include device identification, device state, state value, and time information of device state change;

[0258] Obtaining a device latest status table, wherein the device latest status table is a partition table, and the table fields of the device latest status table include device identification, device status, latest status value, time information of device status change, and partition date; each partition of the device latest status table stores the latest status value of the core status of the target device identification up to the corresponding partition date;

[0259] Extracting all data from the device status change table, and extracting data from the partition date of the core status of the target device identifier in the device latest status table before the target calculation time period;

[0260] All data in the device status change table and data in the device latest status table on the partition date of the core status of the target device identifier before the target calculation time period are grouped according to device identifier and device status, and each piece of grouped data includes device identifier, device status, status value, and time information of device status change; based on device identifier, device status, status value, and time information of device status change, the usage time of each status value of the target device identifier in the core state during the target calculation time period is calculated.

[0261] A possible implementation is provided in an embodiment of the present application, wherein the calculation unit 230 is further configured to:

[0262] Sort the time information of device status changes from small to large, open a window to obtain the time information and status value of the device status change of the next data of each data, and obtain the newly added time information column and newly added status value column after the window is opened;

[0263] Based on the device identification, device status, status value, time information of device status change, the newly added time information column and the newly added status value column after the window is opened, the usage time of each status value of the target device identification in the core state during the target calculation time period is calculated.

[0264] A possible implementation is provided in an embodiment of the present application, wherein the calculation unit 230 is further configured to:

[0265] After calculating the usage time of each state value of the target device identifier in the core state during the target calculation time period, the calculated usage time of each state value of the target device identifier in the core state during the target calculation time period is stored in a device usage time table, wherein the table fields of the device usage time table include device identifier, device state, state value, usage time, and calculation time period.

[0266] A possible implementation is provided in an embodiment of the present application, wherein the calculation unit 230 is further configured to:

[0267] Update the latest status table of the device by following the steps below:

[0268] Determine the latest state value of the core state of the target device identifier in the target calculation time period according to all data in the device state change table;

[0269] The target calculation time period is used as a new partition date, and the latest state value of the core state of the target device identifier in the target calculation time period is stored in the device state change table, thereby updating the device latest state table.

[0270] A possible implementation is provided in an embodiment of the present application, wherein the calculation unit 230 is further configured to:

[0271] If the target state value is not empty, determining the core state and the important state according to the target device state and the target state value; wherein the important state includes the core state;

[0272] Extracting data containing important status in the changed device status of the target device identification in the target calculation time period from the device status change original data set, which is called the first type of data;

[0273] The device identification, time information of device status change, important status and status value of important status are obtained by parsing the first type of data, which is called the second type of data;

[0274] The data satisfying the target state value is selected from the second type of data, which is called the third type of data;

[0275] The second type of data is grouped according to the device identifier, and sorted from small to large according to the time information of the device status change, and the data that does not currently meet the target status value but the previous data meets the target status value is taken, and the status value of the core status is modified to the first preset character, which is called the fourth type of data;

[0276] Taking the device identification, the time information of the device status change, the core status and the status value of the core status from the third type of data and the fourth type of data and storing them in an empty device status change table; wherein the table fields of the device status change table include the device identification, the device status, the status value and the time information of the device status change;

[0277] Obtaining a device latest status table, wherein the device latest status table is a partition table, and the table fields of the device latest status table include device identification, device status, latest status value, time information of device status change, and partition date; each partition of the device latest status table stores the latest status value of the core status of the target device identification up to the corresponding partition date;

[0278] Extracting all data from the device status change table, and extracting data from the partition date of the core status of the target device identifier in the device latest status table before the target calculation time period;

[0279] All data in the device status change table and data in the device latest status table on the partition date of the core status of the target device identifier before the target calculation time period are grouped according to device identifier and device status, and each grouped data includes device identifier, device status, status value, and time information of device status change; based on device identifier, device status, status value, and time information of device status change, calculate the usage time of each status value in the core state when the target device identifier meets the target status value during the target calculation time period.

[0280] A possible implementation is provided in an embodiment of the present application, wherein the calculation unit 230 is further configured to:

[0281] Sort the time information of device status changes from small to large, open a window to obtain the time information and status value of the device status change of the next data of each data, and obtain the newly added time information column and newly added status value column after the window is opened;

[0282] According to the device identification, device status, status value, time information of device status change, newly added time information column and newly added status value column after the window is opened, filter out data whose current status value is equal to the status value of the next data, and filter out data whose current status value is the first preset character or the second preset character, and then calculate the usage time of each status value in the core state when the target device identification meets the target status value during the target calculation time period.

[0283] A possible implementation is provided in an embodiment of the present application, wherein the calculation unit 230 is further configured to:

[0284] After calculating the usage time of each state value in the core state when the target device identifier meets the target state value during the target calculation time period, the calculated usage time of each state value in the core state when the target device identifier meets the target state value during the target calculation time period is stored in a device usage time table, wherein the table fields of the device usage time table include device identifier, device state, state value, usage time, and calculation time period.

[0285] A possible implementation method is provided in an embodiment of the present application, wherein the extraction unit 210 is further configured to:

[0286] After extracting the target calculation time period, target device identification, target device status and target status value from the target demand information, the extracted target calculation time period, target device identification, target device status and target status value are stored in a calculation logic configuration table, wherein the table fields of the calculation logic configuration table include calculation time period, device identification, device status and status value.

[0287] Based on the same inventive concept, an embodiment of the present application also provides an electronic device, including a processor and a memory, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the automatic calculation method of the device usage time of any of the above embodiments.

[0288] In an exemplary embodiment, an electronic device is provided, such as Figure 3 As shown, Figure 3 The electronic device 300 shown includes: a processor 301 and a memory 303. The processor 301 and the memory 303 are connected, such as through a bus 302. Optionally, the electronic device 300 may also include a transceiver 304. It should be noted that in actual applications, the transceiver 304 is not limited to one, and the structure of the electronic device 300 does not constitute a limitation on the embodiments of the present application.

[0289] Processor 301 may be a CPU (Central Processing Unit), a GPU (Graphics Processing Unit), a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array) or other programmable logic devices, transistor logic devices, hardware components or any combination thereof. It may implement or execute various exemplary logic blocks, modules and circuits described in conjunction with the disclosure of this application. Processor 301 may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, etc.

[0290] The bus 302 may include a path to transmit information between the above components. The bus 302 may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus. The bus 302 may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 3 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0291] The memory 303 can be a ROM (Read Only Memory) or other types of static storage devices that can store static information and instructions, a RAM (Random Access Memory) or other types of dynamic storage devices that can store information and instructions, or an EEPROM (Electrically Erasable Programmable Read Only Memory), a CD-ROM (Compact Disc Read Only Memory) or other optical disk storage, optical disk storage (including compressed optical disk, laser disk, optical disk, digital versatile disk, Blu-ray disk, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited to these.

[0292] The memory 303 is used to store the computer program code for executing the solution of the present application, and the execution is controlled by the processor 301. The processor 301 is used to execute the computer program code stored in the memory 303 to implement the contents shown in the above method embodiment.

[0293] Among them, electronic devices include but are not limited to: mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 3 The electronic device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0294] Based on the same inventive concept, an embodiment of the present application further provides a storage medium, in which a computer program is stored, wherein the computer program is configured to execute, when running, a method for automatically calculating the device usage time of any of the above embodiments.

[0295] Those skilled in the art can clearly understand that the specific working processes of the systems, devices, and modules described above can refer to the corresponding processes in the aforementioned method embodiments, and for the sake of brevity, they are not further described here.

[0296] Those skilled in the art can understand that the technical solution of the present application can be essentially or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, which includes a number of program instructions, so that an electronic device (such as a personal computer, a server, or a network device, etc.) executes all or part of the steps of the method described in each embodiment of the present application when running the program instructions. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk, etc., various media that can store program codes.

[0297] Alternatively, all or part of the steps of implementing the aforementioned method embodiments may be accomplished by hardware associated with program instructions (such as electronic devices such as personal computers, servers, or network devices), and the program instructions may be stored in a computer-readable storage medium. When the program instructions are executed by a processor of an electronic device, the electronic device executes all or part of the steps of the methods described in the embodiments of the present application.

[0298] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that within the spirit and principles of the present application, they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not deviate from the protection scope of the present application.

Claims

1. A method for automatically calculating the usage time of a device, characterized in that: include: Obtain target demand information for computing device usage time, and extract a target computing time period, a target device identifier, a target device state, and a target state value from the target demand information; Acquire an original data set of device state changes, wherein each piece of data in the original data set of device state changes includes a device identifier, a corresponding changed device state and state value, a corresponding unchanged device state and state value, and time information of a corresponding device state change; Based on the target calculation time period, the target device identifier, the target device state, the target state value, and data in the device state change original data set, the usage time when the target device identifier in the target calculation time period meets the target device state and the target state value is calculated.

2. The method according to claim 1, characterized in that Based on the target calculation time period, the target device identifier, the target device state, the target state value, and data in the device state change original data set, calculating the usage duration when the target device identifier in the target calculation time period satisfies the target device state and the target state value, including: Determine whether the target state value is empty; If the target state value is empty, determining the core state according to the target device state; Extracting data including the core state of the target device identification in the changed device state during the target calculation period from the device state change original data set, and then storing it in an empty device state change table, wherein the table fields of the device state change table include device identification, device state, state value, and time information of device state change; Obtaining a device latest status table, wherein the device latest status table is a partition table, and the table fields of the device latest status table include device identification, device status, latest status value, time information of device status change, and partition date; each partition of the device latest status table stores the latest status value of the core status of the target device identification up to the corresponding partition date; Extracting all data from the device status change table, and extracting data from the partition date of the core status of the target device identifier in the device latest status table before the target calculation time period; All data in the device status change table and data in the device latest status table on the partition date of the core status of the target device identifier before the target calculation time period are grouped according to device identifier and device status, and each piece of grouped data includes device identifier, device status, status value, and time information of device status change; based on device identifier, device status, status value, and time information of device status change, the usage time of each status value of the target device identifier in the core state during the target calculation time period is calculated.

3. The method according to claim 2, characterized in that The calculating of the usage time of each state value of the target device identifier in the core state during the target calculation time period based on the device identifier, the device state, the state value, and the time information of the device state change includes: Sort the time information of device status changes from small to large, open a window to obtain the time information and status value of the device status change of the next data of each data, and obtain the newly added time information column and newly added status value column after the window is opened; Based on the device identification, device status, status value, time information of device status change, the newly added time information column and the newly added status value column after the window is opened, the usage time of each status value of the target device identification in the core state during the target calculation time period is calculated.

4. The method according to claim 2, characterized in that: After calculating and obtaining the usage time of each state value of the target device identifier in the core state during the target calculation time period, the method further includes: The calculated usage time of each state value of the target device identifier in the core state during the target calculation time period is stored in a device usage time table, wherein the table fields of the device usage time table include device identifier, device state, state value, usage time, and calculation time period.

5. The method according to claim 2, characterized in that: Update the latest status table of the device by following the steps below: Determine the latest state value of the core state of the target device identifier in the target calculation time period according to all data in the device state change table; The target calculation time period is used as a new partition date, and the latest state value of the core state of the target device identifier in the target calculation time period is stored in the device state change table, thereby updating the device latest state table.

6. The method according to claim 2, characterized in that The method further comprises: If the target state value is not empty, determining the core state and the important state according to the target device state and the target state value; wherein the important state includes the core state; Extracting data containing important status in the changed device status of the target device identification in the target calculation time period from the device status change original data set, which is called the first type of data; The device identification, time information of device status change, important status and status value of important status are obtained by parsing the first type of data, which is called the second type of data; The data satisfying the target state value is selected from the second type of data, which is called the third type of data; The second type of data is grouped according to the device identifier, and sorted from small to large according to the time information of the device status change, and the data that does not currently meet the target status value but the previous data meets the target status value is taken, and the status value of the core status is modified to the first preset character, which is called the fourth type of data; Taking the device identification, the time information of the device status change, the core status and the status value of the core status from the third type of data and the fourth type of data and storing them in an empty device status change table; wherein the table fields of the device status change table include the device identification, the device status, the status value and the time information of the device status change; Obtaining a device latest status table, wherein the device latest status table is a partition table, and the table fields of the device latest status table include device identification, device status, latest status value, time information of device status change, and partition date; each partition of the device latest status table stores the latest status value of the core status of the target device identification up to the corresponding partition date; Extracting all data from the device status change table, and extracting data from the partition date of the core status of the target device identifier in the device latest status table before the target calculation time period; All data in the device status change table and data in the device latest status table on the partition date of the core status of the target device identifier before the target calculation time period are grouped according to device identifier and device status, and each grouped data includes device identifier, device status, status value, and time information of device status change; based on device identifier, device status, status value, and time information of device status change, calculate the usage time of each status value in the core state when the target device identifier meets the target status value during the target calculation time period.

7. The method according to claim 6, characterized in that The calculating, based on the device identification, device status, status value, and time information of device status change, to obtain the usage time of each status value in the core state when the target device identification meets the target status value during the target calculation time period includes: Sort the time information of device status changes from small to large, open a window to obtain the time information and status value of the device status change of the next data of each data, and obtain the newly added time information column and newly added status value column after the window is opened; According to the device identification, device status, status value, time information of device status change, newly added time information column and newly added status value column after the window is opened, filter out data whose current status value is equal to the status value of the next data, and filter out data whose current status value is the first preset character or the second preset character, and then calculate the usage time of each status value in the core state when the target device identification meets the target status value during the target calculation time period.

8. The method according to claim 6, characterized in that After calculating and obtaining the usage duration of each state value of the core state when the target device identifier satisfies the target state value during the target calculation time period, the method further includes: The calculated usage time of each state value in the core state when the target device identifier of the target calculation time period meets the target state value is stored in the device usage time table, wherein the table fields of the device usage time table include device identifier, device state, state value, usage time, and calculation time period.

9. The method according to any one of claims 1 to 8, characterized in that After extracting the target calculation time period, target device identifier, target device status and target status value from the target requirement information, the method further includes: The extracted target calculation time period, the target device identification, the target device status and the target status value are stored in a calculation logic configuration table, wherein the table fields of the calculation logic configuration table include calculation time period, device identification, device status and status value.

10. An automatic calculation device for equipment usage time, characterized in that: include: An extraction unit, used to obtain target demand information of the usage time of the computing device, and extract a target computing time period, a target device identifier, a target device state, and a target state value from the target demand information; An acquisition unit is used to acquire an original data set of device state changes, wherein each piece of data in the original data set of device state changes includes a device identifier, a corresponding changed device state and state value, a corresponding unchanged device state and state value, and time information of a corresponding device state change; A calculation unit is used to calculate the usage time when the target device identifier in the target calculation time period meets the target device status and the target status value based on the target calculation time period, the target device identifier, the target device status, the target status value, and the data in the device status change original data set.

11. An electronic device, characterized in that: The invention comprises a processor and a memory, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the automatic calculation method of the device usage time according to any one of claims 1 to 9.

12. A storage medium, characterized in that: The storage medium stores a computer program, wherein the computer program is configured to execute the method for automatically calculating the device usage time according to any one of claims 1 to 9 when running.

13. A computer program product, comprising a computer program, characterized in that The computer program is configured to execute the automatic calculation method of the device usage time according to any one of claims 1 to 9 when running.