Real-time calculation method, device and equipment based on object model and device shadow
By generating device shadows and using a computing engine module to process IoT device data in real time, the problem of IoT device computing rules not being able to be adjusted in real time is solved, achieving efficient real-time data processing.
Patent Information
- Application Number
- CN202410900284.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-05
- Publication Date
- 2026-11-06
- Estimated Expiration
- 2044-07-05
AI Technical Summary
In existing technologies, the calculation rules of IoT devices cannot be adjusted in real time according to business needs, and querying the calculation results of devices requires transfer through the database, resulting in low real-time performance.
By receiving the target object model information and IoT device identifiers configured by the user, the system generates device shadows and a computing engine module in real time, directly processes the real-time data, and outputs the data processing results, avoiding data transfer to the database.
It enables real-time adjustment of calculation rules based on business needs, improving the real-time performance and efficiency of calculations and adapting to dynamic business requirements.
Smart Images

Figure CN118861110B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of Internet of Things (IoT) technology, and more specifically, to a real-time computing method, apparatus, and device based on object models and device shadows. Background Technology
[0002] With the increasing number and popularity of IoT devices, it is becoming increasingly important to process and analyze the data generated by IoT devices in real time in order to bring users more efficient and intelligent services.
[0003] In existing technologies, corresponding code is usually developed based on specific business needs, and the results of conventional calculations are output to database tables according to conventional calculation rules for querying by the business platform.
[0004] However, in existing technologies, conventional calculation rules cannot be adjusted in real time according to business needs, and queries for device calculation results need to be relayed through the database, so the real-time performance is not high. Summary of the Invention
[0005] The purpose of this application is to address the shortcomings of the prior art by providing a real-time computing method, apparatus, and device based on object models and device shadows, so as to solve the problem that the prior art cannot adjust the computing rules in real time according to business needs.
[0006] To achieve the above objectives, the technical solution adopted in this application is as follows:
[0007] In a first aspect, this application provides a real-time calculation method based on an object model and device shadows, the method comprising:
[0008] The system receives information about a target object model configured by a user through an IoT configuration platform, as well as the identifier of a target IoT device. The information about the target object model includes at least: object data and calculation rules. The target IoT device is a device that applies the target object model.
[0009] Based on the information of the target object model and the identifier of the target IoT device, multiple device shadows and computing engine modules that match the target object model are generated in real time, and each device shadow and computing engine module corresponds one-to-one with the target IoT device that matches the target object model.
[0010] Obtain real-time data of the target IoT device based on the identifier of the target IoT device;
[0011] The real-time data is processed using the device shadow and computing engine module corresponding to the target IoT device to obtain and output the data processing results of the target IoT device.
[0012] Optionally, the step of generating multiple device shadows and a computing engine module that match the target object model in real time based on the information of the target object model and the identifier of the target IoT device includes:
[0013] Based on the target IoT device information, determine the target number of device shadows and computing engine modules to be generated;
[0014] Based on the information of the target object model, the target number of device shadows and the computing engine module are generated in real time.
[0015] Optionally, the step of generating the target number of device shadows and the computing engine module in real time based on the information of the target object model includes:
[0016] Based on the information of the target object model, the target number of device shadows are created in real time;
[0017] The object data and the calculation rules are parsed, and based on the parsing results, the calculation engine module that satisfies the object data and the calculation rules is created.
[0018] Optionally, acquiring the real-time data of the target IoT device includes:
[0019] Send data request signals to each target IoT device;
[0020] Receive real-time data sent by each of the target IoT devices.
[0021] Optionally, acquiring the real-time data of the target IoT device includes:
[0022] Receive real-time data sent by each target IoT device according to preset data acquisition rules.
[0023] Optionally, the configuration process of the target object model information includes:
[0024] The IoT configuration platform receives the computing domain sent by the user, determines the range information based on the computing domain, and sends multiple computing objects in the range information to the user;
[0025] Receive the target computing object selected and sent by the user, and retrieve and determine the object data and computing rules that match the target computing object from the pre-configured computing rule base;
[0026] The object data and the calculation rules are used as information for the target object model.
[0027] Optionally, the configuration process of the target object model information includes:
[0028] The IoT configuration platform receives the calculation formula input by the user, analyzes and determines the object data according to the calculation formula, and uses the calculation formula as the calculation rule;
[0029] The object data and the calculation rules are used as information for the target object model.
[0030] Secondly, this application provides a real-time computing device based on an object model and device shadows, the device comprising:
[0031] The receiving module is used to receive information about the target object model configured by the user through the IoT configuration platform and the identifier of the target IoT device. The information about the target object model includes at least: object data and calculation rules. The target IoT device is a device that applies the target object model.
[0032] The generation module is used to generate multiple device shadows and computing engine modules that match the target object model in real time based on the information of the target object model and the identifier of the target IoT device. Each device shadow and computing engine module corresponds one-to-one with the target IoT device that matches the target object model.
[0033] The acquisition module is used to acquire real-time data of the target IoT device based on the identifier of the target IoT device;
[0034] The processing module is used to process the real-time data through the device shadow corresponding to the target IoT device and the computing engine module, and to obtain and output the data processing result of the target IoT device.
[0035] Optionally, the generation module is specifically used for:
[0036] Based on the target IoT device information, determine the target number of device shadows and computing engine modules to be generated;
[0037] Based on the information of the target object model, the target number of device shadows and the computing engine module are generated in real time.
[0038] Optionally, the generation module is specifically used for:
[0039] Based on the information of the target object model, the target number of device shadows are created in real time;
[0040] The object data and the calculation rules are parsed, and based on the parsing results, the calculation engine module that satisfies the object data and the calculation rules is created.
[0041] Optionally, the acquisition module is specifically used for:
[0042] Send data request signals to each target IoT device;
[0043] Receive real-time data sent by each of the target IoT devices.
[0044] Optionally, the acquisition module is specifically used for:
[0045] Receive real-time data sent by each target IoT device according to preset data acquisition rules.
[0046] Optionally, the receiving module is specifically used for:
[0047] The IoT configuration platform receives the computing domain sent by the user, determines the range information based on the computing domain, and sends multiple computing objects in the range information to the user;
[0048] Receive the target computing object selected and sent by the user, and retrieve and determine the object data and computing rules that match the target computing object from the pre-configured computing rule base;
[0049] The object data and the calculation rules are used as information for the target object model.
[0050] Optionally, the receiving module is specifically used for:
[0051] The IoT configuration platform receives the calculation formula input by the user, analyzes and determines the object data according to the calculation formula, and uses the calculation formula as the calculation rule;
[0052] The object data and the calculation rules are used as information for the target object model.
[0053] Thirdly, this application provides an electronic device, including: a processor, a storage medium, and a bus, wherein the storage medium stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor communicates with the storage medium via the bus, and the processor executes the machine-readable instructions to perform the steps of the real-time computing method based on object models and device shadows as described above.
[0054] Fourthly, this application provides a computer-readable storage medium storing a computer program that, when executed by a processor, performs the steps of the real-time computing method based on object models and device shadows as described above.
[0055] The beneficial effects of this application are as follows: First, it receives information about the target object model configured by the user through an IoT configuration platform, as well as the identifier of the target IoT device. Based on the target object model information and the target IoT device identifier, it generates multiple device shadows and computing engine modules that match the target object model in real time. It then obtains real-time data from the target IoT device based on the device identifier, processes the real-time data through the corresponding device shadow and computing engine module, and outputs the data processing result of the target IoT device. This embodiment achieves the reuse of computing rules for all IoT devices under the target object model by configuring multiple device shadows and computing engine modules based on the target object model information and the target IoT device identifier. Furthermore, when it is necessary to change the computing rules for the real-time data of the IoT device, or to change the IoT device corresponding to the current computing rules, the user can directly configure and modify them through the IoT configuration platform. The server outputs the modified data processing result in real time through the target object model and the real-time updated device shadows, thereby achieving dynamic adjustment of real-time computing. Attached Figure Description
[0056] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0057] Figure 1 This is a schematic diagram illustrating an application scenario of a real-time calculation method based on object models and device shadows provided in an embodiment of this application.
[0058] Figure 2 This is a flowchart illustrating a real-time calculation method based on an object model and device shadow provided in an embodiment of this application;
[0059] Figure 3 This is a schematic flowchart of an information configuration method for a target object model provided in an embodiment of this application;
[0060] Figure 4 This is a flowchart illustrating another real-time calculation method based on object models and device shadows provided in an embodiment of this application;
[0061] Figure 5 This is a schematic diagram of the module structure of a real-time calculation method based on object models and device shadows provided in an embodiment of this application;
[0062] Figure 6 This is a schematic diagram of the structure of a real-time computing device based on an object model and device shadow provided in an embodiment of this application;
[0063] Figure 7 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0064] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. It should be understood that the accompanying drawings in this application are for illustrative and descriptive purposes only and are not intended to limit the scope of protection of this application. Furthermore, it should be understood that the schematic drawings are not drawn to scale. The flowcharts used in this application illustrate operations implemented according to some embodiments of this application. It should be understood that the operations in the flowcharts may not be implemented in sequence, and steps without logical contextual relationships may be reversed or implemented simultaneously. In addition, those skilled in the art, guided by the content of this application, may add one or more other operations to the flowcharts, or remove one or more operations from the flowcharts.
[0065] Furthermore, the described embodiments are merely some, not all, of the embodiments of this application. The components of the embodiments of this application described and illustrated herein can typically be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of this application provided in the accompanying drawings is not intended to limit the scope of the claimed application, but merely to illustrate selected embodiments of the application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application.
[0066] It should be noted that the term "comprising" will be used in the embodiments of this application to indicate the presence of the features declared thereafter, but does not exclude the addition of other features.
[0067] In existing technologies, corresponding code is typically developed for each device in the Internet of Things (IoT) based on specific business needs. The results of conventional calculations are then output to a database table for querying by the business platform, following standard calculation rules. However, these conventional calculation rules cannot be adjusted to meet real-time business requirements, and querying device calculation results requires intermediaries through the database, resulting in low real-time performance.
[0068] As an example, in IoT application scenarios where charging fees for charging stations are calculated in real time, charges are levied by accurately measuring the electricity consumption during the charging process of electric vehicles. This requires adherence to relevant electricity pricing and metering rules, consideration of duration requirements and operating costs, and even consideration of different charging stations in different areas requiring different metering rules. Furthermore, given the large number of charging stations, it is necessary to dynamically develop differentiated billing strategies to build a stable profit model.
[0069] As another example, an IoT application scenario could involve real-time metering of water consumption on each floor. Based on this, the operating frequency of water pressure boosting equipment could be dynamically adjusted. When water consumption is high, the equipment frequency would increase; when water consumption is low, the frequency would decrease, thus achieving a stable water supply. This not only improves the quality of water supply services but also helps reduce resource waste, promoting the rational use of resources. However, actual water consumption varies throughout the day, as well as during holidays and weekends, and varies between floors and the number of users. Therefore, different rules are needed to statistically analyze water consumption in real time, and metering strategies need to be dynamically adjusted according to different situations to achieve a stable water supply.
[0070] Based on this, this application proposes a real-time computing method based on object models and device shadows. This method receives information about the target object model configured by the user and the identifier of the target IoT device. Then, it generates multiple device shadows and computing engine modules that match the target object model in real time, based on the object model information and the target IoT device identifier. In practical applications, real-time data from the target IoT device is received based on the target IoT device identifier. The real-time data is processed by the target device shadow and computing engine modules corresponding to the target IoT device, and the data processing results are obtained and output. Because this method generates device shadows and computing engine modules in real time according to user-configured computing rules, and calculates and outputs data processing results in real time upon receiving real-time data, this method can be adjusted according to the user's real-time business needs. Furthermore, since the data processing results are directly output after calculation, there is no need to query a database for intermediate processing.
[0071] Figure 1 This is a schematic diagram illustrating an application scenario of a real-time calculation method based on object models and device shadows provided in this application embodiment. Next, refer to... Figure 1 This paper introduces the application scenarios of the real-time calculation method based on object models and device shadows in this application.
[0072] This application can be applied to a server connected to an IoT configuration platform and an IoT data statistics platform, both of which can be used as client-side applications. The server also connects to multiple target IoT devices via Message Queuing Telemetry Transport (MQTT) to receive real-time data collected by each target IoT device. These target IoT devices can be... Figure 1The target IoT device includes target IoT device 1, target IoT device 2, and target IoT device n. Specifically, the server receives information about the target object model configured by the user on the IoT configuration platform, generates data processing results based on the target object model information and real-time data sent by the target IoT devices, and can send the data processing results to the IoT data statistics platform for display. As an optional implementation, the server can also send the data processing results to the corresponding target IoT devices for display.
[0073] Next, refer to Figure 2 This application introduces the real-time calculation method based on object models and device shadows.
[0074] S201. Receive information about the target object model configured by the user through the IoT configuration platform and the identifier of the target IoT device. The information about the target object model includes at least: object data and calculation rules. The target IoT device is a device that applies the target object model.
[0075] As an optional implementation, users can configure information for multiple object models through the IoT configuration platform. Different object models can correspond to different object data and calculation rules. Users can perform management operations such as adding, deleting, modifying, and querying data on the IoT configuration platform.
[0076] Among them, the object model refers to the structured representation of physical entities or devices in the Internet of Things (IoT) system. It is used to define the attributes, states, behaviors, and relationships of IoT devices so that the system can manage IoT devices.
[0077] Optionally, the object data included in the target IoT information may include device attributes, device status, and device calculation results. Device status describes the dynamic information of a device or object at a specific moment; its state is variable. Device attributes describe the static information of a device or object, characterizing its inherent properties. For example, device attributes may include electricity unit price and hourly service fee, where the electricity unit price ATR1 is in yuan per kilowatt-hour and its value is set to 1.5, and the hourly service fee ATR2 is in yuan per hour and its value is set to 2. Then, the information of the device attributes in the target object model can be represented as follows:
[0078] "attributes":{
[0079] "ATR1":{
[0080] "code":"ATR1",
[0081] "name": "Electricity unit price",
[0082] "type":"number",
[0083] "value":1.5,
[0084] "unit":"yuan / degree"
[0085] },
[0086] "ATR2":{
[0087] "code":"ATR2",
[0088] "name":"Hourly service fee",
[0089] "type":"number",
[0090] "value":2.0,
[0091] "unit": "yuan / hour"
[0092] },
[0093] }
[0094] It is worth noting that the equipment attributes are static data; once the information of the target object model is determined, its equipment attributes will not change.
[0095] Optionally, and exemplarily, the device status may include electricity consumption and charging time, wherein the electricity unit price STA1 is in kilowatt-hours and is a numerical value, and the charging time STA2 is in hours and is also a numerical value. The device status information in the target object model can then be represented as follows:
[0096] "states":{
[0097] "STA1":{
[0098] "code":"STA1",
[0099] "name": "Electricity consumption"
[0100] "type":"number",
[0101] "unit": "degree"
[0102] },
[0103] "STA2":{
[0104] "code":"STA2",
[0105] "name":"Charging time",
[0106] "type":"number",
[0107] "unit":"hour"
[0108] },
[0109] }
[0110] The device calculation result may be the electricity fee CAL1, which is of numeric type with the unit of Yuan. Then the information of the device calculation result in the target object model can be expressed as:
[0111] "calculates":{
[0112] "CAL1":{
[0113] "code":"CAL1",
[0114] "name":"electricity fee",
[0115] "type":"number",
[0116] "unit":"Yuan"
[0117] },
[0118] }
[0119] Optionally, the calculation rule may be a calculation rule based on object data. For example, for the device attributes, device states and device calculation results described in the above example, the calculation rule may be: attributes.ATR1.value*states.STA1.value+attributes.ATR2.value*states.STA2.value.
[0120] Optionally, the user may select IoT devices that use the same calculation rule as the target IoT devices.
[0121] Optionally, the identifier of the target IoT device is the identifier of the device applying the target object model.
[0122] S202: According to the information of the target object model and the identifiers of the target IoT devices, a plurality of device shadows and calculation engine modules matching the target object model are generated in real time, and each device shadow and calculation engine module is in one-to-one correspondence with the target IoT device matching the target object model.
[0123] Optionally, the number of device shadows may be determined according to the identifiers of the target IoT devices, and then the device shadows and calculation engine modules are generated in real time according to the number as well as the object data and calculation rules in the information of the target object model. The device shadow is configured to represent and manage the states, attributes, behaviors, etc. of the IoT device.
[0124] A device shadow acts as a virtual, persistent device proxy, allowing users to remotely access and control IoT devices. IoT devices can send real-time data to the server; upon receiving this data, the server updates the corresponding device shadow and sends an update notification. Importantly, even when the IoT device is offline or inaccessible, the device shadow maintains the latest device state, ensuring it remains accessible.
[0125] The computing engine module is the core software component responsible for performing computational tasks, including numerical or scientific calculations. It's worth noting that there's a one-to-one correspondence between the device shadow, the computing engine module, and the target IoT device.
[0126] For example, the identifiers of the target IoT devices can be set as TM 1DEV1, TM 1DEV2, TM1DEV3, ..., TM 1DEVn, etc., where n is greater than or equal to 1. Then, the identifiers of the device shadows corresponding to the target IoT devices can be set as Y TM 1DEV1, Y TM 1DEV2, Y TM 1DEV3, ..., Y TM 1DEVn, etc., where n is greater than or equal to 1.
[0127] Optionally, multiple device shadows matching the target object model are generated in real time based on the information of the target object model. Specifically, the device shadow object data in the device shadows is initialized. The device shadow object data corresponds one-to-one with the object data of each object in the target object model. Taking YTM 1DEV1 as an example, the formatted storage content of a device shadow is represented as follows:
[0128] {
[0129] "attributes":{
[0130] "ATR1":{
[0131] "code":"ATR1",
[0132] "name": "Electricity unit price",
[0133] "type":"number",
[0134] "value":1.5,
[0135] "unit":"yuan / degree"
[0136] },
[0137] "ATR2":{
[0138] "code":"ATR2",
[0139] "name":"Hourly service fee",
[0140] "type":"number",
[0141] "value":2.0,
[0142] "unit": "yuan / hour"
[0143] },
[0144] },
[0145] "states":{
[0146] "STA1":{
[0147] "code":"STA1",
[0148] "name": "Electricity consumption"
[0149] "type":"number",
[0150] "value":0,
[0151] "time":"2024-01-01 00:00:00.000",
[0152] "unit": "degree"
[0153] },
[0154] "STA2":{
[0155] "code":"STA2",
[0156] "name":"Charging time",
[0157] "type":"number",
[0158] "value":0,
[0159] "time":"2024-01-01 00:00:00.000",
[0160] "unit": "hour"
[0161] },
[0162] }
[0163] "calcutes":{
[0164] "CAL1":{
[0165] "code":"CAL1",
[0166] "name":"electricity fee",
[0167] "type":"number",
[0168] "value":0,
[0169] "time":"2024-01-01 00:00:00.000",
[0170] "unit":"Yuan"
[0171] }
[0172] }
[0173] }
[0174] Optionally, the calculation engine module may load a Lua script based on calculation rules. For example, based on the above example, the Lua script is as follows:
[0175] function rule(attributes,states,calcutes)
[0176] {
[0177] calcutes.CAl1.value=attributes.ATR1.value*states.STA1.value+attributes.ATR2.value*states.STA2.value
[0178] }
[0179] Wherein, the Lua script is a lightweight, efficient, embedded scripting language. Since it supports compilation and operation on various platforms and provides powerful function and closure support, the present application uses the Lua script to be applicable to platforms in various environments, and ensures the implementability of real-time calculation.
[0180] Optionally, the calculation engine module includes a calculation engine object, one target Internet of Things device corresponds to one calculation engine object, and the calculation engine object is generated according to the information of the target thing model.
[0181] S203: Acquire real-time data of the target Internet of Things device according to the identifier of the target Internet of Things device.
[0182] Optionally, according to the identifier of the target Internet of Things device, the real-time data of the target Internet of Things device is screened and obtained from the real-time data sent by each Internet of Things device.
[0183] Optionally, the real-time data includes the identifier of the target IoT device, thereby assigning the real-time data of each target IoT device to the corresponding device shadow and storing it in the memory of the device shadow. By storing the real-time data in the content of the device shadow, all read or write operations during data processing are memory operations, which will improve the processing speed of real-time computing and ensure the real-time performance of data processing.
[0184] S204. Using the device shadow corresponding to the target IoT device and the computing engine module, process the real-time data to obtain and output the data processing results of the target IoT device.
[0185] As an optional implementation, real-time data of the target IoT device is written into the corresponding device shadow. Specifically, the object data of the device shadow corresponding to the target IoT device is updated. For example, the "value" field in the device status of the device shadow is filled with the corresponding value from the real-time data, and the "time" field is filled with the time.
[0186] When the real-time data of the target IoT device changes, the computing engine module is triggered to process the data in the device shadow. The specific process includes: the device shadow updates the device shadow object data and generates an update instruction. This update instruction is used to initiate data processing by the computing engine module. Then, the computing engine module reads the updated device shadow object data and the update instruction, and retrieves the function "rule" from the Lua script loaded by the computing engine module. For example, as shown above, this is the function "rule" in the Lua script. The object data related to the real-time data stored in the device shadow is then passed to the Lua script as input parameters to the function "rule". The object data, as shown above, can be "attributes", "states", and "calcutes". Finally, the function "rule" in the Lua script loaded by the computing engine module is executed to perform data processing.
[0187] As an optional implementation, the data processing results can be written back to the corresponding device shadow object data. For example, after data processing is complete, the device calculation result portion of the device shadow can be represented as follows:
[0188] "calcutes":{
[0189] "CAL1":{
[0190] "code":"CAL1",
[0191] "name":"electricity fee",
[0192] "type":"17.3",
[0193] "time":"2024-01-01 00:01:00.000",
[0194] "unit":"CNY"
[0195] }
[0196] }
[0197] It is worth noting that since the device status is dynamic data, its value item will change in real time according to the real-time data sent by the target Internet of Things device, therefore, the value item and time item in the device calculation result will also change in real time.
[0198] Further, if the information of the target thing model configured by the user through the Internet of Things configuration platform or the identifier of the target Internet of Things changes, the device shadow and the computing engine module generated in real time based on the Internet of Things configuration platform will also change accordingly, and when the real-time data sent by the target Internet of Things device is received, the data processing result will also be different.
[0199] Optionally, after the computing engine module calculates and obtains the data processing result, the data processing result may be sent to the device shadow, and the device shadow updates the object data in the device shadow according to the data processing result. The data processing result may also be sent to the Internet of Things data statistics platform on the client side, to display the data processing results of each target Internet of Things device to the user in real time.
[0200] In this embodiment, first, the information of the target thing model and the identifier of the target Internet of Things device configured by the user through the Internet of Things configuration platform are received, a plurality of device shadows and computing engine modules matching the target thing model are generated in real time according to the information of the target thing model and the identifier of the target Internet of Things device, the real-time data of the target Internet of Things device is acquired according to the identifier of the target Internet of Things device, and the real-time data is processed through the device shadow and the computing engine module corresponding to the target Internet of Things device, to obtain and output the data processing result of the target Internet of Things device. In this embodiment, by configuring a plurality of device shadows and computing engine modules according to the information of the target thing model and the identifier of the target Internet of Things device, the reuse of calculation rules for all Internet of Things devices under the target thing model is realized. Moreover, when it is necessary to change the calculation rule for the real-time data of the Internet of Things device, or change the Internet of Things device corresponding to the current calculation rule, the user can directly perform configuration and modification through the Internet of Things configuration platform, and the server outputs the modified data processing result in real time through the target thing model and the device shadow generated by real-time update, thereby realizing dynamic adjustment of real-time calculation.
[0201] Next, the step of generating in real time a plurality of device shadows and computing engine modules matching the target thing model according to the information of the target thing model and the identifier of the target Internet of Things device in the above step S202 will be introduced:
[0202] First, the target number of device shadows and computing engine modules to be generated is determined based on the identifier of the target IoT device. The number of device shadows and computing engine modules to be generated is the same, both being the target number. The target number is greater than or equal to 1.
[0203] Then, based on the object data and calculation rules in the target object model information, the target number of device shadows and calculation engine modules are generated in real time.
[0204] It is worth mentioning that the target number of device shadows and computing engine modules generated at this time are all the same, being the initialized device shadows, and the computing engine modules are identical.
[0205] In this embodiment, the target number of device shadows and computing engine modules to be generated is determined based on the identifier of the target IoT device. Based on the object data and calculation rules in the information of the target object model, the target number of device shadows and computing engine modules are generated in real time, thereby creating the initialized device shadows and computing engine modules. When it is necessary to change the data processing method of the real-time data sent to the IoT device, it is only necessary to update the information of the target object model.
[0206] Furthermore, the following section introduces how to generate the target number of device shadows and the calculation engine module in real time based on the object data and calculation rules in the object model information:
[0207] First, based on the information from the target object model, create the target number of device shadows in real time.
[0208] Specifically, a target number of device shadows are created based on object data and calculation rules.
[0209] As an optional implementation, if the user changes the information of the target object model or the identifier of the target IoT device on the IoT configuration platform, it is necessary to recreate the target number of device shadows. The data of the previous device shadows are stored uniformly in the server's memory.
[0210] Secondly, the object data and calculation rules are parsed, and based on the parsing results, a calculation engine module that satisfies the object data and calculation rules is dynamically created.
[0211] Optionally, the server determines the calculation script based on the object data and calculation rules, and uses the calculation script as the parsing result to create a calculation engine module.
[0212] It is worth mentioning that the calculation rules should correspond to the object data; that is, the calculation rules should include all object data.
[0213] In this embodiment, a target number of device shadows are created in real time based on the information of the target object model. The object data and calculation rules are parsed, and a calculation engine module that meets the object data and calculation rules is dynamically created based on the parsing results. Thus, the device shadows and calculation engine modules can be updated in real time according to user needs.
[0214] This application proposes two methods for acquiring real-time data from a target IoT device. As an optional implementation, the first method is as follows:
[0215] Optionally, a data request signal can be sent to each target IoT device.
[0216] Optionally, the data request signal includes the type of data requested.
[0217] Optionally, data request signals can be sent to each target IoT device according to a preset time period.
[0218] Optionally, it can receive real-time data sent by each target IoT device.
[0219] Specifically, the real-time data sent by the target IoT device includes the device identifier of the target IoT device.
[0220] In this embodiment, by sending data request signals to each target IoT device and receiving real-time data sent by each target IoT device, real-time data of the target IoT devices is obtained in real time, and then calculations are performed based on the real-time data.
[0221] As another optional implementation method, the second method of obtaining the information is as follows:
[0222] Receive real-time data sent by each target IoT device according to preset data acquisition rules.
[0223] Optionally, the real-time data transmission period can be preset, and a fixed connection relationship can be set between the target IoT devices and the server, so that the server can receive the real-time data from each target IoT device at regular intervals.
[0224] In this embodiment, real-time data sent by each target IoT device is received according to preset data acquisition rules, thereby obtaining real-time data of the target IoT devices in real time, and then performing calculations based on the real-time data.
[0225] Figure 3 This is a schematic flowchart of an information configuration method for a target object model provided in an embodiment of this application. Next, refer to... Figure 3 The process of configuring information for the target object model is described below:
[0226] S301 The IoT configuration platform receives the computing domain sent by the user, determines the scope information based on the computing domain, and sends multiple computing objects in the scope information to the user.
[0227] Optionally, the computing domain can include multiple IoT application domains. For example, the computing domain can include: water bill calculation, electricity bill calculation, aquaculture calculation, and environmental monitoring calculation. Different computing domains have different computing objects, and different computing objects have different object data and calculation rules.
[0228] Optionally, the scope information includes multiple calculation objects. For example, calculation objects in the water fee calculation field may include residential water fees, public building water fees, and agricultural water fees, etc. Calculation objects in the environmental monitoring calculation field may include temperature difference detection, sewage discharge detection, and noise detection, etc.
[0229] After the user selects a computing domain, multiple computing object selection options are sent to the user based on the computing domain, and the user can select the computing object they need.
[0230] S302. Receive the target computing object selected and sent by the user, and retrieve and determine the object data and computing rules that match the target computing object from the pre-configured computing rule base.
[0231] Optionally, the target calculation object is one of the calculation objects in the scope information. Each calculation object can correspond to multiple calculation rules. The calculation rules for each calculation object are pre-organized and stored in the calculation rule library. When the user selects the target calculation object, the object data and calculation rules corresponding to the target calculation object are determined in the calculation rule library according to the target calculation object.
[0232] S303. Use object data and calculation rules as information for the target object model.
[0233] In this embodiment, the IoT configuration platform receives the computing domain sent by the user, determines the scope information based on the computing domain, and sends multiple computing objects in the scope information to the user. Then, it receives the target computing object selected and sent by the user, retrieves and determines the object data and computing rules that match the target computing object in the pre-configured computing rule library, and receives the target IoT device information sent by the user. This enables the user to determine the information of the target object model without having to deal with complex code and formulas.
[0234] In addition to the methods mentioned above, we will now introduce another process for configuring information for the target object model.
[0235] Optionally, the IoT configuration platform receives the calculation formula input by the user, analyzes and determines the object data based on the calculation formula, and uses the calculation formula as the calculation rule.
[0236] Optionally, the IoT configuration platform, while providing options for computing domains, also offers a calculation formula input field. When users cannot find the required domain or the required computing object within the chosen domain, or if they wish to quickly set calculation rules directly by inputting a calculation formula, they can enter the calculation formula in the input field. The calculation formula should include at least one object data point.
[0237] After receiving the calculation formula input by the user, the server parses the formula. For example, the static parameters are treated as device attributes, the dynamic parameters as device states, and the result parameters as the device calculation result.
[0238] Optionally, object data and calculation rules can be used as information for the target object model.
[0239] In this embodiment, the IoT configuration platform receives the calculation formula input by the user, analyzes and determines the object data according to the calculation formula, and uses the calculation formula as the calculation rule. It also receives the target IoT device information sent by the user, determines the identifier of each target IoT device that matches the target object model according to the target IoT device information, and thus quickly obtains the object data and calculation rules according to the calculation formula input by the user, thereby improving the configuration efficiency.
[0240] As an optional implementation, the IoT configuration platform can provide icons for multiple IoT devices, allowing users to select a target IoT device by clicking on it within the application's object model. The server responds to the user's click and retrieves the identifier of the target IoT device.
[0241] As another alternative implementation, the IoT configuration platform can also provide an input field where users can enter the identifier of the target IoT device so that the server can obtain the identifier of the target IoT device.
[0242] Figure 4 This is a flowchart illustrating another real-time calculation method based on object models and device shadows provided in an embodiment of this application. Figure 5 This is a schematic diagram of the module structure of a real-time calculation method based on object models and device shadows provided in an embodiment of this application. Next, refer to... Figure 4 and Figure 5This paper describes the overall process and module structure of the real-time computing method based on object models and device shadows. First, the device configuration module configures the target object model information and the target IoT device identifier on the IoT configuration platform. Then, based on the target object model information and the target IoT device identifier, it generates multiple device shadows and a computing engine module. The computing engine module is generated based on object data in the target object model information combined with computing rules. Next, the data acquisition module obtains real-time data from the target IoT device based on its identifier and submits the real-time data to the device shadows. The device shadows update their object data based on the real-time data and send an update notification to the computing engine module. The computing engine module receives the device shadow object data and the update notification, calls the computing engine object within the computing engine module, calculates according to the computing rules, outputs the data processing results, and sends them to the device shadows. The device shadows receive the data processing results generated by the computing engine object and update their object data.
[0243] Based on the same inventive concept, this application also provides a real-time computing device based on object models and device shadows, corresponding to the real-time computing method based on object models and device shadows. Since the principle of the device in this application is similar to the real-time computing method based on object models and device shadows described above in this application, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be described again.
[0244] Reference Figure 6 The diagram shown is a schematic of a real-time computing device based on an object model and device shadow provided in an embodiment of this application. The device includes: a receiving module 601, a generating module 602, an acquiring module 603, and a processing module 604; wherein:
[0245] The receiving module 601 is used to receive information about the target object model configured by the user through the Internet of Things configuration platform and the identifier of the target Internet of Things device. The information about the target object model includes at least: object data and calculation rules. The target Internet of Things device is a device that applies the target object model.
[0246] The generation module 602 is used to generate multiple device shadows and computing engine modules that match the target object model in real time based on the information of the target object model and the identifier of the target IoT device. Each device shadow and computing engine module corresponds one-to-one with the target IoT device that matches the target object model.
[0247] The acquisition module 603 is used to acquire real-time data of the target IoT device based on the identifier of the target IoT device;
[0248] The processing module 604 is used to process the real-time data through the device shadow corresponding to the target IoT device and the computing engine module, and to obtain and output the data processing result of the target IoT device.
[0249] Optionally, the generation module 602 is specifically used for:
[0250] Based on the target IoT device information, determine the target number of device shadows and computing engine modules to be generated;
[0251] Based on the information of the target object model, the target number of device shadows and the computing engine module are generated in real time.
[0252] Optionally, the generation module 602 is specifically used for:
[0253] Based on the information of the target object model, the target number of device shadows are created in real time;
[0254] The object data and the calculation rules are parsed, and based on the parsing results, the calculation engine module that satisfies the object data and the calculation rules is created.
[0255] Optionally, the acquisition module 603 is specifically used for:
[0256] Send data request signals to each target IoT device;
[0257] Receive real-time data sent by each of the target IoT devices.
[0258] Optionally, the acquisition module 603 is specifically used for:
[0259] Receive real-time data sent by each target IoT device according to preset data acquisition rules.
[0260] Optionally, the receiving module 601 is specifically used for:
[0261] The IoT configuration platform receives the computing domain sent by the user, determines the range information based on the computing domain, and sends multiple computing objects in the range information to the user;
[0262] Receive the target computing object selected and sent by the user, and retrieve and determine the object data and computing rules that match the target computing object from the pre-configured computing rule base;
[0263] The object data and the calculation rules are used as information for the target object model.
[0264] Optionally, the receiving module 601 is specifically used for:
[0265] The IoT configuration platform receives the calculation formula input by the user, analyzes and determines the object data according to the calculation formula, and uses the calculation formula as the calculation rule;
[0266] The object data and the calculation rules are used as information for the target object model.
[0267] The processing flow of each module in the device and the interaction flow between each module can be referred to the relevant descriptions in the above method embodiments, and will not be detailed here.
[0268] This application also provides an electronic device, such as... Figure 7 The diagram shown is a schematic representation of an electronic device structure provided in an embodiment of this application, including: a processor 701, a memory 702, and a bus. The memory 702 stores machine-readable instructions executable by the processor 701 (e.g., ...). Figure 6 The device includes a receiving module 601, a generating module 602, an acquiring module 603, and a processing module 604 (with corresponding execution instructions, etc.). When the computer device is running, the processor 701 and the memory 702 communicate via a bus. When the machine-readable instructions are executed by the processor 701, the processing of the above-mentioned real-time calculation method based on the object model and device shadow is performed.
[0269] This application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, performs the steps of the above-described real-time calculation method based on object models and device shadows.
[0270] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems and devices described above can be referred to the corresponding processes in the method embodiments, and will not be repeated here. In the several embodiments provided in this application, it should be understood that the disclosed systems, devices, and methods can be implemented in other ways. The device embodiments described above are merely illustrative. For example, the division of modules is only a logical functional division, and in actual implementation, there may be other division methods. Furthermore, multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed mutual coupling or direct coupling or communication connection can be through some communication interfaces; the indirect coupling or communication connection of devices or modules can be electrical, mechanical, or other forms.
[0271] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. If the functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0272] The above are merely specific embodiments of this application, but the scope of protection of this application is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application.
Claims
1. A real-time calculation method based on object models and device shadows, characterized in that, The method includes: The system receives information about a target object model configured by a user through an IoT configuration platform, as well as the identifier of a target IoT device. The information about the target object model includes at least: object data and calculation rules. The target IoT device is a device that applies the target object model. Based on the information of the target object model and the identifier of the target IoT device, multiple device shadows and computing engine modules that match the target object model are generated in real time, and each device shadow and computing engine module corresponds one-to-one with the target IoT device that matches the target object model. Obtain real-time data of the target IoT device based on the identifier of the target IoT device; The real-time data is processed using the device shadow and computing engine module corresponding to the target IoT device to obtain and output the data processing results of the target IoT device.
2. The real-time calculation method based on object model and device shadow according to claim 1, characterized in that, The step of generating multiple device shadows matching the target object model in real time, based on the information of the target object model and the identifier of the target IoT device, and the computing engine module, includes: Based on the target IoT device information, determine the target number of device shadows and computing engine modules to be generated; Based on the information of the target object model, the target number of device shadows and the computing engine module are generated in real time.
3. The real-time calculation method based on object models and device shadows according to claim 2, characterized in that, The module for generating the target number of device shadows and the computing engine module in real time based on the information of the target object model includes: Based on the information of the target object model, the target number of device shadows are created in real time; The object data and the calculation rules are parsed, and based on the parsing results, a calculation engine module that satisfies the object data and the calculation rules is created.
4. The real-time calculation method based on object models and device shadows according to claim 1, characterized in that, The acquisition of real-time data from the target IoT device includes: Send data request signals to each target IoT device; Receive real-time data sent by each of the target IoT devices.
5. The real-time calculation method based on object model and device shadow according to claim 1, characterized in that, The acquisition of real-time data from the target IoT device includes: Receive real-time data sent by each target IoT device according to preset data acquisition rules.
6. The real-time calculation method based on object models and device shadows according to any one of claims 1-5, characterized in that, The configuration process of the target object model information includes: The IoT configuration platform receives the computing domain sent by the user, determines the range information based on the computing domain, and sends multiple computing objects in the range information to the user; Receive the target computing object selected and sent by the user, and retrieve and determine the object data and computing rules that match the target computing object from the pre-configured computing rule base; The object data and the calculation rules are used as information for the target object model.
7. The real-time calculation method based on object models and device shadows according to any one of claims 1-5, characterized in that, The configuration process of the target object model information includes: The IoT configuration platform receives the calculation formula input by the user, analyzes and determines the object data according to the calculation formula, and uses the calculation formula as the calculation rule; The object data and the calculation rules are used as information for the target object model.
8. A real-time computing device based on object models and device shadows, characterized in that, The device includes: The receiving module is used to receive information about the target object model configured by the user through the IoT configuration platform and the identifier of the target IoT device. The information about the target object model includes at least: object data and calculation rules. The target IoT device is a device that applies the target object model. The generation module is used to generate multiple device shadows and computing engine modules that match the target object model in real time based on the information of the target object model and the identifier of the target IoT device. Each device shadow and computing engine module corresponds one-to-one with the target IoT device that matches the target object model. The acquisition module is used to acquire real-time data of the target IoT device based on the identifier of the target IoT device; The processing module is used to process the real-time data through the device shadow corresponding to the target IoT device and the computing engine module, and to obtain and output the data processing result of the target IoT device.
9. An electronic device, characterized in that, include: A processor and a memory, the memory storing machine-readable instructions executable by the processor, which, when the electronic device is running, are executed by the processor to perform the steps of the real-time computing method based on object models and device shadows as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, performs the steps of the real-time computation method based on object models and device shadows as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Data communication method and device, equipment and storage medium
CN113328891A
Data processing method and device based on object model and electronic equipment
CN116319892A
