A data unified query system and method for power system

By establishing a unified data query system and method for the power system, the problem of user-defined configuration page display content was solved, a unified point value data definition was achieved, user experience was improved, development costs and storage space were reduced, and development efficiency was increased.

CN116644092BActive Publication Date: 2026-01-23ZHUHAI YINENG TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310492139.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-05-05
Publication Date
2026-01-23
Estimated Expiration
2043-05-05

AI Technical Summary

Technical Problem

In power systems, users cannot customize the content displayed on configuration pages, making it difficult to meet personalized needs. Existing technologies make it difficult to uniformly identify data, resulting in a large workload for development, high maintenance costs, and excessive storage space consumption of time-series databases.

Method used

A unified data query system and method are provided, including a formula parsing module, a formula input parameter acquisition module, a formula pre-compilation module, and a formula calculation module. By parsing user commands, the system obtains and replaces functions, completes time identifiers, performs time-series data query and formula calculation, and returns the calculation results.

Benefits of technology

It provides users with a unified method for defining point-value data, improves user experience, reduces system development workload, saves time-series data storage space, and improves development efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116644092B_ABST
    Figure CN116644092B_ABST
Patent Text Reader

Abstract

The application relates to the computer technical field, in particular to a data unified query system and method for a power system, the data unified query system comprises a formula analysis module, a formula input parameter acquisition module, a formula precompilation module and a formula calculation module, the formula analysis module is used for receiving a first instruction of a user, and a formula is obtained through analysis, the formula input parameter acquisition module is used for receiving a second instruction of the user, and formula input parameters are acquired, the formula precompilation module is used for replacing an extended data value function, a device point value lookup function and a device point value iteration function, and a device point value variable time identifier is completed, the formula calculation module is used for executing time sequence data query and formula calculation, and returns a calculation result, the application provides a data unified query method for the power system, improves user experience, reduces system development workload, saves time sequence data storage space, and improves development efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer technology, specifically to a unified data query system and method for power systems. Background Technology

[0002] Currently, power systems upload data points (such as meter current, voltage, and active power) from equipment to a time-series database via data collectors. These data points are then queried from the database and displayed on the system page. There are typically two display methods: directly displaying the current value of the data point and displaying the time-series curve of the data point through downsampling queries. However, in practical applications, users need to customize the content displayed on the configuration page, such as displaying virtual data points (the result of calculating one or more data points using formulas) and non-data point data (such as the number of inverters operating abnormally and the rated capacity of transformers). Currently, existing technologies in power systems cannot provide users with a unified data definition method, making it difficult to meet users' personalized needs.

[0003] To meet user needs, virtual point values ​​are often introduced to fulfill other requirements, such as calculating the total active power of multiple meters or the daily power generation of multiple photovoltaic subsystems within a park. However, the conventional approach is to use streaming or timed computation to write the calculation results to a time-series database, treating the virtual point values ​​as real point values. This approach suffers from problems such as excessive disk space consumption and the need to consider computational complexity due to inconsistent data upload times if the formula includes point values ​​from multiple devices.

[0004] In addition, the page also needs to display other non-device point values, such as the number of inverters operating abnormally and the rated capacity of transformers. These data typically need to be obtained through programming by querying a database or calculating by a program, and then displayed on the page. With the emergence of new display methods such as smart screens, the definition and query methods for point value data are inconsistent, leading to difficulties in unified data identification, high development workload, and high maintenance costs—problems that urgently need to be addressed. Summary of the Invention

[0005] The purpose of this invention is to provide a unified data query system and method for power systems to solve the problems mentioned in the background art.

[0006] To address the aforementioned technical problems, this invention provides the following technical solution: a unified data query system for power systems, comprising a formula parsing module, a formula input parameter acquisition module, a formula pre-compilation module, and a formula calculation module. The formula parsing module receives a first user instruction and parses it to obtain a formula. The formula input parameter acquisition module receives a second user instruction and acquires the formula input parameters. The formula pre-compilation module replaces the extended data retrieval function, the equipment point value lookup function, and the equipment point value iteration function, and completes the time identifier of the equipment point value variable. The formula calculation module performs time-series data query and formula calculation, and returns the calculation results.

[0007] This invention provides a unified data query method for power systems, offering users a unified method for defining point value data, providing the ability to query point value numerical values ​​and point value downsampling curves, improving user experience, reducing system development workload, saving time-series data storage space, and increasing development efficiency.

[0008] Furthermore, the formula parsing module includes a first receiving unit and a parsing unit. The first receiving unit is used to receive a first user instruction, which includes a formula unique identifier, a formula expression and its parameters, and formula variants to help users simplify the use of the formula. The first user instruction is also a request from the user for one or more formulas to be queried. The parsing unit is used to parse the first user instruction to obtain the formula.

[0009] This invention allows users to input a first command, which is then analyzed by a parsing unit to obtain the formula, saving time, improving the accuracy of the analysis, and increasing the efficiency of the analysis.

[0010] Furthermore, the formula input parameter acquisition module includes a second receiving unit and an acquisition unit. The second receiving unit is used to receive a second user instruction, and the acquisition unit is used to acquire formula input parameters. The formula input parameters include user characteristics, time-series downsampling query parameters, formula calculation control parameters, and the current time. The user characteristics include user ID, user type, and user's region. The time-series downsampling query parameters include query time range and query time interval. The formula calculation control parameters include how to assign a value when the device point value at a specified time cannot be found and how to assign a value when a point value is missing in the formula. The assignment method includes assigning the value using the average value of historical data and assigning the value using the nearest neighbor value.

[0011] This invention obtains formula input parameters through a second user instruction, clarifies the relationship between parameters, improves accuracy, reduces the frequency of repeated parameter input, and improves calculation efficiency.

[0012] Furthermore, the formula pre-compilation module includes a replacement unit and a completion unit. The replacement unit is used to replace the extended data retrieval function with the result of the extended data retrieval function, replace the device point value lookup function with the result of the device point value lookup function, and replace the device point value iteration function with the result of the device point value iteration function. The completion unit is used to add time identifiers to all device point value variables in the obtained formula that do not have time identifiers.

[0013] This invention improves computation speed and enhances security by replacing the original function and completing the time identifier.

[0014] Furthermore, the formula calculation module includes a data query unit and a calculation feedback unit. The data query unit is used to perform time-series data query, and the calculation feedback unit is used to calculate the formula and return the calculation result.

[0015] This invention provides clearer data queries and returns the calculation results of the formulas, saving time-series database storage space and improving development efficiency.

[0016] A unified data query method for power systems includes the following steps:

[0017] S100: Receives the user's first instruction and parses it to obtain the formula;

[0018] The user's first instruction is a request from the user for one or more formulas to be queried. The user's first instruction includes a unique formula identifier, a formula expression and its parameters, and formula variants to simplify user usage. The formula consists of a formula expression, a device point value attribute mapping table corresponding to the device point value variables in the formula, and a formula tree. The formula tree is obtained by parsing the formula expression. The formula supports operators, constants, arrays, regular functions, and logical functions. The formula also supports the following extensions:

[0019] a. Equipment point value variables and time identifiers used for equipment point value variables;

[0020] b. Equipment point value selection function;

[0021] c. Equipment point value iteration function;

[0022] d. Extended data retrieval functions

[0023] The equipment point value variable is composed of the independent variable symbol and the corresponding equipment point value attribute in the formula.

[0024] The time identifier used for device point value variables refers to a set of instructions used to represent time and time range, including time identifier and time range identifier.

[0025] The device point value selection function is used to represent a single device point value or the same device point value for a group of devices.

[0026] The device point value iteration function is used to substitute a set of device point values ​​into a specified formula expression in sequence, and return a set of formula expressions.

[0027] The extended data retrieval function is used to obtain data from other data sources.

[0028] The parsing method:

[0029] (1) If the user's first instruction contains a formula unique identifier, then the formula is loaded in the formula storage database using the unique identifier;

[0030] (2) If the user's first instruction contains a formula expression and its parameters, it is parsed into a formula by the formula parser;

[0031] (3) If the user's first instruction contains a formula variant to help simplify the user's use, then according to the rules defined for the variant, it is first parsed into a formula expression and its parameters, and then parsed into a formula by the formula parser.

[0032] S200: Receives the user's second instruction and obtains the formula input parameters;

[0033] The formula input parameters include user characteristics, time-series downsampling query parameters, formula calculation control parameters, and the current time. The user characteristics include user ID, user type, and user's region. The time-series downsampling query parameters include the query time range and query time interval. The formula calculation control parameters include how to assign values ​​when the device point value for a specified time cannot be found and how to assign values ​​when point values ​​are missing in the formula. The assignment methods include using the average value of historical data and using the nearest neighbor value.

[0034] S300: Formula engine for pre-compiling formulas;

[0035] S301: Execute the extended data retrieval function and replace the extended data retrieval function with its result;

[0036] The method for executing the extended data retrieval function is as follows: Locate the program function entity corresponding to the formula function in the program, execute the program function entity using the parameters of the formula function as parameters, and use the execution result of the function entity as the result of the extended data retrieval function in the formula.

[0037] S302: Execute the device point value lookup function and replace the device point value lookup function with its result;

[0038] The method for executing the device point value lookup function is as follows: Locate the program function entity corresponding to the device point value lookup function in the program, execute the program function entity using the parameters of the formula function as parameters, and use the execution result of the function entity as the result of the device point value lookup function in the formula.

[0039] S303: Execute the device point value iteration function, and expand the iteration function based on the result of the device point value iteration function;

[0040] The method for executing the device point value iteration function is to sequentially render the device point value symbols from the received device point value variable array parameter into the pre-specified symbols in the received formula expression string, thereby obtaining the result of the device point value iteration function.

[0041] S304: The addition of a device point value variable without a time identifier in the formula means that the current time identifier is added.

[0042] The S400 formula engine performs calculations and returns the results.

[0043] S401: Assigning a time identifier;

[0044] (1) For the formula for executing point value query, the time identifier is parsed into a specific time, specifically: according to the input parameters of step S200, the time corresponding to the key moment identifier is determined, and then the rounding operation and addition and subtraction operation of the execution time identifier are used to obtain the time corresponding to the time identifier.

[0045] (2) For the formula for performing point value downsampling query, the query time range is divided into multiple time windows according to the query time interval, and the time identifier is parsed into a specific time in each time window.

[0046] S402: Retrieve the device point value variables from the formula set, generate SQL statements and execute them respectively, and obtain the final device point value variable values;

[0047] (1) For the device point value variable in the formula for executing point value downsampling query, it is preferable to use a downsampling query SQL statement for querying; otherwise, it should be split into several point value query requests at specified time windows. Specifically, if most of the time values ​​to be queried for the device point value variable in multiple time windows fall within a single downsampling SQL statement, then after executing the SQL statement, the results corresponding to each time point should be retrieved as the results of the device point value variable. When executing the downsampling query SQL statement, it is preferable to use the semantics of "FILL(PREV)" (filling data with the previous non-NULL value) and "FILL(NEXT)" (filling data with the next non-NULL value) to solve the problem of missing data in some time windows. When obtaining the results of the device point value variable at a specified time, the control parameters are calculated according to the formula to determine whether to use the returned results.

[0048] (2) For the device point value variable that executes the query for the point value at a specified time, generate the corresponding SQL statement and obtain the result; preferably, use the SQL statement with the semantics "WHERE time column name ≤ specified time LIMIT1" to query, and in the obtained SQL result, determine whether the original time of the result value is equal to the specified time. If yes, then this result is a valid result; if no, then combine the control parameters with the formula described in step S200 to calculate whether to use another SQL statement to query the first result whose time is greater than the specified time, and finally generate a valid result based on the control parameters calculated by the formula and the SQL result obtained from the query.

[0049] (3) For device point value variables with time ranges, the time-series database SQL statement containing functions is used first for querying. If this is not possible, all device point value variables within the time range are retrieved. Generally, for device point value variables with time range identifiers, the generated SQL statement will return all device point values ​​within the specified time range after execution. Preferably, for functions in the formula expression that represent summation, counting, maximum, minimum, first, and last semantics, if a corresponding SQL function exists in the time-series database, an SQL statement containing the SQL function is generated for the device point value variables with time range identifiers that operate on the formula function.

[0050] S403: Insert the value of the equipment point value variable into the equipment point value variable position in the formula, perform the calculation, and obtain the final calculation result.

[0051] (1) For the formula for performing point value downsampling query, calculate it in each time window, and take (time window start time, result) as the time window result. The time window result sequence is the final calculation result.

[0052] (2) For executing the point value query formula, the formula calculation result is used as the final calculation result.

[0053] Compared with the prior art, the beneficial effects achieved by the present invention are:

[0054] (1) This invention provides users with a unified method for defining point value data, and provides the ability to query point value values ​​and point value downsampling curves, thereby improving the user experience;

[0055] (2) This invention reduces the workload of system development, saves time-series data storage space, and improves development efficiency. Attached Figure Description

[0056] The accompanying drawings are provided to further illustrate the invention and form part of the specification. They are used in conjunction with embodiments of the invention to explain the invention and do not constitute a limitation thereof. In the drawings:

[0057] Figure 1 This is a schematic diagram of the structure of a unified data query system for power systems according to the present invention;

[0058] Figure 2 This is a flowchart illustrating a unified data query method for power systems according to the present invention. Detailed Implementation

[0059] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0060] Please see Figure 1 This invention provides a technical solution: a unified data query system for power systems, comprising a formula parsing module, a formula input parameter acquisition module, a formula pre-compilation module, and a formula calculation module.

[0061] The formula parsing module is used to receive the user's first instruction and parse it to obtain the formula. The formula input parameter acquisition module is used to receive the user's second instruction and acquire the formula input parameters. The formula pre-compilation module is used to replace the extended data value retrieval function, the device point value lookup function, and the device point value iteration function, and to complete the device point value variable time identifier. The formula calculation module is used to perform time series data query and formula calculation, and return the calculation result.

[0062] This invention provides a unified data query method for power systems, offering users a unified method for defining point value data, providing the ability to query point value numerical values ​​and point value downsampling curves, improving user experience, reducing system development workload, saving time-series data storage space, and increasing development efficiency.

[0063] The formula parsing module includes a first receiving unit and a parsing unit. The first receiving unit is used to receive a first user instruction, which includes a formula unique identifier, a formula expression and its parameters, and formula variants to help users simplify the use of the formula. The first user instruction is also a request from the user for one or more formulas to be queried. The parsing unit is used to parse the first user instruction to obtain the formula.

[0064] This invention allows users to input a first command, which is then analyzed by a parsing unit to obtain the formula, saving time, improving the accuracy of the analysis, and increasing the efficiency of the analysis.

[0065] The formula input parameter acquisition module includes a second receiving unit and an acquisition unit. The second receiving unit is used to receive a second user instruction, and the acquisition unit is used to acquire formula input parameters. The formula input parameters include user characteristics, time-series downsampling query parameters, formula calculation control parameters, and the current time. The user characteristics include user ID, user type, and user's region. The time-series downsampling query parameters include query time range and query time interval. The formula calculation control parameters include how to assign values ​​when the device point value at a specified time cannot be found and how to assign values ​​when point values ​​are missing in the formula. The assignment methods include assigning values ​​using the average value of historical data and assigning values ​​using the nearest neighbor value.

[0066] This invention obtains formula input parameters through a second user instruction, clarifies the relationship between parameters, improves accuracy, reduces the frequency of repeated parameter input, and improves calculation efficiency.

[0067] The formula pre-compilation module includes a replacement unit and a completion unit. The replacement unit is used to replace the extended data retrieval function with the result of the extended data retrieval function, replace the device point value lookup function with the result of the device point value lookup function, and replace the device point value iteration function with the result of the device point value iteration function. The completion unit is used to add time identifiers to all device point value variables in the obtained formula that do not have time identifiers.

[0068] This invention improves computation speed and enhances security by replacing the original function and completing the time identifier.

[0069] The formula calculation module includes a data query unit and a calculation feedback unit. The data query unit is used to perform time-series data query, and the calculation feedback unit is used to calculate the formula and return the calculation result.

[0070] This invention provides clearer data queries and returns the calculation results of the formulas, saving time-series database storage space and improving development efficiency.

[0071] Please see Figure 2 A unified data query method for power systems, the method comprising the following steps:

[0072] S100: Receives the user's first instruction and parses it to obtain the formula;

[0073] S200: Receives the user's second instruction and obtains the formula input parameters;

[0074] S300: Formula engine for pre-compiling formulas;

[0075] The S400 formula engine performs calculations and returns the results.

[0076] Example:

[0077] S100: Receives the user's first instruction and parses it to obtain the formula;

[0078] The user's first instruction is a request from the user for one or more formulas to be queried. The user's first instruction includes a unique formula identifier, a formula expression and its parameters, and formula variants to simplify user usage. The formula consists of a formula expression, a device point value attribute mapping table corresponding to the device point value variables in the formula, and a formula tree. The formula tree is obtained by parsing the formula expression. The formula supports operators, constants, arrays, regular functions, and logical functions. The formula also supports the following extensions:

[0079] a. Equipment point value variables and time identifiers used for equipment point value variables;

[0080] b. Equipment point value selection function;

[0081] c. Equipment point value iteration function;

[0082] d. Extended data retrieval functions

[0083] The equipment point value variable is composed of the independent variable symbol and the corresponding equipment point value attribute in the formula.

[0084] The time identifier used for device point value variables refers to a set of instructions used to represent time and time range, including time identifier and time range identifier.

[0085] The device point value selection function is used to represent a single device point value or the same device point value for a group of devices.

[0086] The device point value iteration function is used to substitute a set of device point values ​​into a specified formula expression in sequence, and return a set of formula expressions.

[0087] The extended data retrieval function is used to obtain data from other data sources.

[0088] The parsing method:

[0089] (1) If the user's first instruction contains a formula unique identifier, then the formula is loaded in the formula storage database using the unique identifier;

[0090] (2) If the user's first instruction contains a formula expression and its parameters, it is parsed into a formula by the formula parser;

[0091] (3) If the user’s first instruction contains a formula variant that helps the user simplify the use, it is first parsed into a formula expression and its parameters according to the rules defined by the variant, and then parsed into a formula by the formula parser.

[0092] Equipment point value variables are represented as independent variable symbols in formula expressions, such as "YC1" and "YC2". Combined with the equipment point value attribute mapping table corresponding to the equipment point value variables in the formula, the meaning of performing operations on the corresponding equipment point values ​​can be realized.

[0093] The time identifier for a device point value variable refers to a set of instructions used to represent moments and time ranges, including moment identifiers and time range identifiers. In formula expressions, "device point value variable [moment identifier]" expresses the value of the point value at a specified time, and "device point value variable [time range identifier]" expresses all values ​​of the point value within a time range. The moment identifier defines time units such as year, month, day of the week, hour, minute, and second; defines special moment values ​​such as current, start of the time range, and end of the time range; defines time rounding operations to express the start time of the current month, year, and week; and defines time addition and subtraction operations to express the meaning of moment offset. The time range identifier is represented using "left moment identifier:right moment identifier," indicating that the time range is greater than or equal to the left moment and less than the right moment; using "left moment identifier:," indicating that the time range is greater than or equal to the left moment; using ":right moment identifier," indicating that the time range is less than the right moment; and using ":," indicating that the time range covers all moments involved in the device point value data.

[0094] For example, define time units such as y (year), M (month), d (day), and h (hour); define now as the current time, and range_start and range_end as the start and end times of the time interval, respectively. For point value downsampling queries, now can be further defined as the end time of each time interval; define " / " as the rounding operation, then now / y represents the start time of the year, and now / d represents the start time of the day; define time operations, using expressions like "now-1h" (before 1 hour) and "now-8h / d" (the start time of the day corresponding to the time 8 hours ago) to represent time offsets. Accordingly, for the device point value variable "YC1", "YC1[now]" represents the current value of YC1, and "YC1[:]" represents all possible values ​​of YC1.

[0095] Device point value selection functions are used to represent a single device point value or the same device point value for a group of devices. At least two sets of device point value selection functions should be defined: one set to select a single device point value, and the other set to select a group of device point values. For example, the `DeviceGet` function returns a single device point value, and the `DeviceList` function returns a group of device point values. Based on the characteristics of power systems, device point value selection functions can select device point values ​​using unique device point value identifiers, "device name + point value name", "device type + point value name", "device tag + point value name", etc. For example, `DeviceGet(name = 'Inverter A', point = 'Total Power Generation')` returns the total power generation point value for inverter A, and `DeviceList(type = 'Inverter', point = 'Total Power Generation')` returns the total power generation point value for all inverter types.

[0096] The device point value iteration function takes a set of device point values ​​and substitutes them sequentially into a specified formula expression, returning a set of formula expressions to enhance the expressive power of the formula. The device point value iteration function contains at least two parameters: an array parameter for receiving device point value variables and a string parameter for receiving formula expressions. The array parameter for receiving device point value variables can use a device point value selection function that returns a set of device point values ​​as input. The string parameter for receiving formula expressions is a subset of the formula and does not support the device point value selection function, device point value iteration function, or extended data retrieval function. The string parameter for receiving formula expressions contains at most one device point value variable symbol, and this device point value variable symbol is a pre-specified value, such as YC. For example, defining a map function...

[0097] The expression “map(DeviceList(type='inverter',point='total power generation'),'YC[now]-YC[now / y]')” means that for the total power generation point value of all inverter types, a set of expressions similar to “YC1[now]-YC1[now / y]” will be generated.

[0098] Extended data retrieval functions are used to retrieve data from other data sources. Their purpose is to obtain data beyond point-value queries and point-value downsampling queries. For example, the number of inverters or the total number of alarms can be obtained independently using extended data retrieval functions, even if the data cannot be calculated using formulas containing device point-value variables. For instance, defining the extended data retrieval function `GetData` in the power system as `GetData(key = 'number of inverters')` will execute the corresponding function in the power system program, using the parameter `key` to retrieve the number of inverters. Therefore, in the worst-case scenario, for each `key` value appearing in the extended data retrieval function formula, a corresponding code in the power system program is required. Optimistically, the number of point values ​​that user reports in the power system require extended data retrieval functions to support is generally relatively small.

[0099] The device point value selection function, extended data retrieval function, and device point value iteration function support key-value pair parameter passing, where the key of the key-value pair is the parameter name and the value is the parameter value.

[0100] All functions in the formula expression support parameter validation. The purpose is to easily determine the validity of the formula through function validation. During the formula parsing process, the parameter validation function of the functions in the formula is executed to determine its validity; if the formula is invalid, an error message is returned, and the data query process is terminated prematurely.

[0101] S200: Receives the user's second instruction and obtains the formula input parameters;

[0102] The formula input parameters include user characteristics, time-series downsampling query parameters, formula calculation control parameters, and the current time. The user characteristics include user ID, user type, and user's region. The time-series downsampling query parameters include the query time range and query time interval. The formula calculation control parameters include how to assign values ​​when the device point value for a specified time cannot be found and how to assign values ​​when point values ​​are missing in the formula. The assignment methods include using the average value of historical data and using the nearest neighbor value.

[0103] S300: Formula engine for pre-compiling formulas;

[0104] S301: Execute the extended data retrieval function and replace the extended data retrieval function with its result;

[0105] The method for executing the extended data retrieval function is as follows: Locate the program function entity corresponding to the formula function in the program, execute the program function entity using the parameters of the formula function as parameters, and use the execution result of the function entity as the result of the extended data retrieval function in the formula.

[0106] S302: Execute the device point value lookup function and replace the device point value lookup function with its result;

[0107] The method for executing the device point value lookup function is as follows: Locate the program function entity corresponding to the device point value lookup function in the program, execute the program function entity using the parameters of the formula function as parameters, and use the execution result of the function entity as the result of the device point value lookup function in the formula.

[0108] S303: Execute the device point value iteration function, and expand the iteration function based on the result of the device point value iteration function;

[0109] The method for executing the device point value iteration function is to sequentially render the device point value symbols from the received device point value variable array parameter into the pre-specified symbols in the received formula expression string, thereby obtaining the result of the device point value iteration function.

[0110] S304: The addition of a device point value variable without a time identifier in the formula means that the current time identifier is added.

[0111] The S400 formula engine performs calculations and returns the results.

[0112] S401: Assigning a time identifier;

[0113] (1) For the formula for executing point value query, the time identifier is parsed into a specific time, specifically: according to the input parameters of step S200, the time corresponding to the key moment identifier is determined, and then the rounding operation and addition and subtraction operation of the execution time identifier are used to obtain the time corresponding to the time identifier.

[0114] (2) For the formula for performing point value downsampling query, the query time range is divided into multiple time windows according to the query time interval, and the time identifier is parsed into a specific time in each time window.

[0115] S402: Retrieve the device point value variables from the formula set, generate SQL statements and execute them respectively, and obtain the final device point value variable values;

[0116] (1) For the device point value variable in the formula for executing point value downsampling query, it is preferable to use a downsampling query SQL statement for querying; otherwise, it should be split into several point value query requests at specified time windows. Specifically, if most of the time values ​​to be queried for the device point value variable in multiple time windows fall within a single downsampling SQL statement, then after executing the SQL statement, the results corresponding to each time point should be retrieved as the results of the device point value variable. When executing the downsampling query SQL statement, it is preferable to use the semantics of "FILL(PREV)" (filling data with the previous non-NULL value) and "FILL(NEXT)" (filling data with the next non-NULL value) to solve the problem of missing data in some time windows. When obtaining the results of the device point value variable at a specified time, the control parameters are calculated according to the formula to determine whether to use the returned results.

[0117] (2) For the device point value variable that executes the query for the point value at a specified time, generate the corresponding SQL statement and obtain the result; preferably, use the SQL statement with the semantics "WHERE time column name ≤ specified time LIMIT1" to query, and in the obtained SQL result, determine whether the original time of the result value is equal to the specified time. If yes, then this result is a valid result; if no, then combine the control parameters with the formula described in step S200 to calculate whether to use another SQL statement to query the first result whose time is greater than the specified time, and finally generate a valid result based on the control parameters calculated by the formula and the SQL result obtained from the query.

[0118] (3) For device point value variables with time ranges, the time-series database SQL statement containing functions is used first for querying. If this is not possible, all device point value variables within the time range are retrieved. Generally, for device point value variables with time range identifiers, the generated SQL statement will return all device point values ​​within the specified time range after execution. Preferably, for functions in the formula expression that represent summation, counting, maximum, minimum, first, and last semantics, if a corresponding SQL function exists in the time-series database, an SQL statement containing the SQL function is generated for the device point value variables with time range identifiers that operate on the formula function.

[0119] S403: Insert the value of the equipment point value variable into the equipment point value variable position in the formula, perform the calculation, and obtain the final calculation result.

[0120] (1) For the formula for performing point value downsampling query, calculate it in each time window, and take (time window start time, result) as the time window result. The time window result sequence is the final calculation result.

[0121] (2) For executing the point value query formula, the formula calculation result is used as the final calculation result.

[0122] The working principle of this invention is as follows: The unified data query system uses the first receiving unit of the formula parsing module to receive the user's first instruction. The parsing unit parses the formula according to the user's first instruction. Then, the second receiving unit of the formula input parameter module receives the user's second instruction, and the acquisition unit acquires the formula input parameters according to the user's second instruction. Next, the replacement unit of the formula pre-compilation module replaces the extended data value retrieval function, device point value lookup function, and device point value iteration function in the formula with their results. The completion unit adds time identifiers to the device point value variables in the obtained formula that do not have time identifiers. Finally, the formula calculation module performs time-series data query and formula calculation and returns the calculation results.

[0123] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus.

[0124] Finally, it should be noted that the above descriptions are merely preferred embodiments of the present invention and are not intended to limit the present invention. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions described in the foregoing embodiments or make equivalent substitutions for some of the technical features. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.

Claims

1. A unified data query system for power systems, characterized in that, The unified data query system includes a formula parsing module, a formula input parameter acquisition module, a formula pre-compilation module, and a formula calculation module. The formula parsing module is used to receive the user's first instruction and parse it to obtain the formula. The formula input parameter acquisition module is used to receive a second user instruction and acquire the formula input parameters. The formula pre-compilation module is used to replace the extended data retrieval function, the equipment point value lookup function, and the equipment point value iteration function, and to complete the time identifier of the equipment point value variable. The formula calculation module is used to perform time-series data queries and formula calculations, and return the calculation results; The formula input parameter acquisition module includes a second receiving unit and an acquisition unit. The second receiving unit is used to receive a second user instruction, and the acquisition unit is used to acquire formula input parameters. The formula input parameters include user characteristics, time-series downsampling query parameters, formula calculation control parameters, and current time. The user characteristics include user ID, user type, and user region. The time-series downsampling query parameters include query time range and query time interval. The formula calculation control parameters include how to assign values ​​when the device point value at a specified time cannot be found and how to assign values ​​when point values ​​are missing in the formula. The assignment methods include assigning values ​​using the average value of historical data and assigning values ​​using the nearest neighbor value. The formula pre-compilation module includes a replacement unit and a completion unit. The replacement unit is used to replace the extended data retrieval function with the result of the extended data retrieval function, replace the device point value lookup function with the result of the device point value lookup function, and replace the device point value iteration function with the result of the device point value iteration function. The completion unit is used to add time identifiers to all device point value variables in the obtained formula that do not have time identifiers.

2. The unified data query system for power systems according to claim 1, characterized in that: The formula parsing module includes a first receiving unit and a parsing unit. The first receiving unit is used to receive a first user instruction. The first user instruction includes a formula unique identifier, a formula expression and its parameters, and a formula variant to help the user simplify the use. The first user instruction is also a request from the user for one or more formulas to be queried. The parsing unit is used to parse the first user instruction to obtain the formula.

3. A unified data query system for power systems according to claim 2, characterized in that: The formula calculation module includes a data query unit and a calculation feedback unit. The data query unit is used to perform time-series data query, and the calculation feedback unit is used to calculate the formula and return the calculation result.

4. A unified data query method for a power system, applied to the unified data query system for a power system as described in any one of claims 1-3, characterized in that: The method includes the following steps: S100: Receives the user's first instruction and parses it to obtain the formula; S200: Receives the user's second instruction and obtains the formula input parameters; The formula input parameters include user characteristics, time-series downsampling query parameters, formula calculation control parameters, and the current time. The user characteristics include user ID, user type, and user's region. The time-series downsampling query parameters include the query time range and query time interval. The formula calculation control parameters include how to assign values ​​when the device point value for a specified time cannot be found and how to assign values ​​when point values ​​are missing in the formula. The assignment methods include using the average value of historical data and using the nearest neighbor value. S300: Formula engine for pre-compiling formulas; The S400 formula engine performs calculations and returns the results.

5. The method for unified data query in a power system according to claim 4, characterized in that: The user's first instruction is a request from the user for one or more formulas to be queried. The user's first instruction includes a unique formula identifier, a formula expression and its parameters, and formula variants to simplify user usage. The formula consists of a formula expression, a device point value attribute mapping table corresponding to the device point value variables in the formula, and a formula tree. The formula tree is obtained by parsing the formula expression. The formula supports operators, constants, arrays, regular functions, and logical functions. The formula also supports the following extensions: a. Equipment point value variables and time identifiers used for equipment point value variables; b. Equipment point value selection function; c. Equipment point value iteration function; d. Extended data retrieval functions The equipment point value variable is composed of the independent variable symbol and the corresponding equipment point value attribute in the formula. The time identifier used for device point value variables refers to a set of instructions used to represent time and time range, including time identifier and time range identifier. The device point value selection function is used to represent a single device point value or the same device point value for a group of devices. The device point value iteration function is used to substitute a set of device point values ​​into a specified formula expression in sequence, and return a set of formula expressions. The extended data retrieval function is used to obtain data from other data sources. Analysis method: (1) If the user’s first instruction contains a formula unique identifier, then the formula is loaded in the formula storage database using the unique identifier; (2) If the user's first instruction contains a formula expression and its parameters, it is parsed into a formula by the formula parser; (3) If the user’s first instruction contains a formula variant that helps the user simplify the use, it is first parsed into a formula expression and its parameters according to the rules defined by the variant, and then parsed into a formula by the formula parser.

6. The method for unified data query in a power system according to claim 5, characterized in that: The S300 formula engine precompiles formulas, including the following sub-steps: S301: Execute the extended data retrieval function and replace the extended data retrieval function with its result; The method for executing the extended data retrieval function is as follows: Locate the program function entity corresponding to the formula function in the program, use the parameters of the formula function as parameters, execute the program function entity, and use the execution result of the function entity as the result of the extended data retrieval function in the formula. S302: Execute the device point value lookup function and replace the device point value lookup function with its result; The method for executing the device point value lookup function is as follows: Locate the program function entity corresponding to the device point value lookup function in the program, execute the program function entity using the parameters of the formula function as parameters, and use the execution result of the function entity as the result of the device point value lookup function in the formula. S303: Execute the device point value iteration function, and expand the iteration function based on the result of the device point value iteration function; The method for executing the device point value iteration function is to sequentially render the device point value symbols from the received device point value variable array parameter into the pre-specified symbols in the received formula expression string, thereby obtaining the result of the device point value iteration function. S304: The addition of a device point value variable without a time identifier in the formula means that the current time identifier is added.

7. The method for unified data query in a power system according to claim 6, characterized in that: Step S400: The formula engine performs the calculation and returns the result, including the following sub-steps: S401: Assigning a time identifier; S402: Retrieve the device point value variables from the formula set, generate SQL statements for each, execute them, and obtain the final device point value variable values; S403: Insert the value of the equipment point value variable into the equipment point value variable position of the formula, perform the calculation, and obtain the final calculation result.

Citation Information

Patent Citations

  • Data query method and device

    CN107491454A

  • Energy data processing method and device, electronic equipment and storage medium

    CN114218206A