Profit accounting method and device for power supply station, storage medium and server
By using an automated server-side system that integrates multiple profit calculation models and formulas, the system solves the problems of data error and flexibility in power supply station profit accounting, achieving efficient and accurate profit accounting and decision support, and promoting the proactive transformation of power supply station operations.
Patent Information
- Application Number
- CN202511021143.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-24
- Publication Date
- 2025-10-31
AI Technical Summary
The existing profit calculation method of power supply stations relies on manual operation, which has problems such as large data collection errors, inflexible formulas, inability to adapt to dynamic business scenarios, and lack of multi-scenario decision support, resulting in low calculation efficiency and inaccuracy.
Through an automated server-side system, multiple profit calculation models and formulas are linked, allowing users to choose flexibly and dynamically adapt to electricity price adjustments and equipment updates. This enables automated data collection and visualization, providing decision support.
It reduces human error, improves accounting efficiency and accuracy, supports dynamic business scenario adaptation, provides data-driven decision-making basis, and promotes the transformation of power supply stations from passive accounting to proactive operation.
Smart Images

Figure CN120875409A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of office automation, and more particularly to a profit calculation method, apparatus, storage medium, and server for a power supply station. Background Technology
[0002] In the power grid company's operation and management system, the power supply station, as the basic unit of production and operation, directly affects the economic decision-making and resource allocation efficiency of the regional power grid through the accuracy and timeliness of its profit calculation. However, the existing profit calculation method still relies on traditional financial processes: financial personnel need to manually extract multi-dimensional data (such as electricity sales revenue, equipment operation and maintenance costs, line loss allocation, etc.) from the financial system and perform offline calculations based on preset fixed formulas. This model has significant drawbacks: First, the data collection and calculation process is highly dependent on manual operation, and human errors are easily introduced in the process of cross-system data alignment and formula parameter updates, resulting in reduced reliability of the calculation results; Second, fixed formulas are difficult to adapt to dynamic business scenarios. For example, when electricity price policies are adjusted, equipment upgrade cycles change, or regional load characteristics change, the existing formulas cannot be iterated quickly and require secondary development or manual correction, which not only prolongs the calculation cycle but also increases system maintenance costs; Third, it lacks the ability to support decision-making in multiple scenarios. The existing calculation results only reflect historical conditions and cannot provide profit optimization suggestions for the power supply station, thus limiting the operational initiative of the basic unit.
[0003] Therefore, there is an urgent need for an automated, scalable power supply station profit accounting technology with decision support capabilities to solve the core problems of low efficiency and poor adaptability of existing solutions. Summary of the Invention
[0004] This application provides a method, apparatus, storage medium, and server for calculating the profit of power supply stations, which can solve the problems of low efficiency, susceptibility to errors, and inflexibility in the existing technology for calculating the profit of power supply stations. The technical solution is as follows:
[0005] In a first aspect, embodiments of this application provide a profit calculation method for a power supply station, the method comprising:
[0006] Identify multiple profit calculation models associated with the power supply station;
[0007] Obtain the time interval input by the user and the target profit calculation mode selected by the user among the multiple profit calculation modes;
[0008] Determine the profit calculation formula associated with the target profit calculation model, and the profit elements associated with the target profit calculation model;
[0009] The profit parameter value is obtained by retrieving data from the data source based on the profit elements and the time interval.
[0010] The profit value of the target profit calculation model is calculated based on the profit parameter value and the profit calculation formula.
[0011] The profit values of the power supply in each time interval and under each profit calculation mode are visualized.
[0012] Secondly, embodiments of this application provide a profit calculation device for a power supply station, the device comprising:
[0013] The determination unit is used to determine multiple profit calculation models associated with the power supply station;
[0014] The acquisition unit is used to acquire the time interval input by the user and the target profit calculation mode selected by the user among the multiple profit calculation modes;
[0015] The determining unit is further configured to determine the profit calculation formula associated with the target profit calculation model, and the profit elements associated with the target profit calculation model.
[0016] The data retrieval unit is used to retrieve data from the data source based on the profit elements and the time interval to obtain the profit parameter value;
[0017] A calculation unit is used to calculate the profit value of the target profit calculation model based on the profit parameter value and the profit calculation formula;
[0018] The push unit is used to visualize the profit values of the power supply in various time intervals and under various profit calculation modes.
[0019] Thirdly, embodiments of this application provide a computer storage medium storing a plurality of instructions adapted for loading by a processor and executing the above-described method steps.
[0020] Fourthly, embodiments of this application provide a server that may include a processor and a memory; wherein the memory stores a computer program adapted to be loaded by the processor and to execute the above-described method steps.
[0021] The beneficial effects of the technical solutions provided in some embodiments of this application include at least the following:
[0022] By associating multiple profit calculation modes and automatically matching calculation formulas and elements, the system eliminates repetitive operations such as manual data collection and formula configuration, greatly reducing calculation time and mitigating the risk of human error. It supports users in flexibly selecting calculation modes, dynamically adapting to business changes such as electricity price adjustments and equipment upgrades. The relationships between formulas and elements are configurable and updateable, avoiding secondary system development. Based on the visualization of profit values across time intervals and multiple modes, it intuitively presents profit fluctuations under different operating strategies, providing data-driven decision-making support for power supply stations to optimize electricity sales prices and allocate operation and maintenance resources, thus promoting the transformation of grassroots units from passive accounting to proactive management. Attached Figure Description
[0023] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0024] Figure 1 This is a schematic diagram of the network architecture provided in the embodiments of this application;
[0025] Figure 2 This is a flowchart illustrating the profit calculation method for a power supply station provided in an embodiment of this application;
[0026] Figure 3 This is a schematic diagram of the structure of a profit calculation device for a power supply station provided in this application;
[0027] Figure 4 This is a schematic diagram of the structure of a server provided in this application. Detailed Implementation
[0028] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be described in further detail below with reference to the accompanying drawings.
[0029] It should be noted that the profit calculation method for power supply stations provided in this application is generally executed by the server, and correspondingly, the profit calculation device for power supply stations is generally set up in the server.
[0030] Figure 1 An exemplary system architecture is shown that can be applied to the profit calculation method or apparatus of the power supply station in this application.
[0031] like Figure 1As shown, the system architecture may include: terminal device 101 and server 102. Terminal device 101 and server 102 can communicate via a network, which serves as the medium for providing communication links between the various units. The network may include various types of wired or wireless communication links, such as: wired communication links including fiber optic cables, twisted-pair cables, or coaxial cables; and wireless communication links including Bluetooth communication links, Wi-Fi communication links, or microwave communication links.
[0032] In this process, the user logs into the power supply station's account on the terminal device 101 and the server calculates the power supply station's profit value under different profit calculation modes and different time intervals according to the method of this application.
[0033] It should be noted that the terminal device 101 and the server 102 can be either hardware or software. When the terminal device 101 and the server 102 are hardware, they can be implemented as a distributed server cluster consisting of multiple servers, or as a single server. When the terminal device 101 and the server 102 are software, they can be implemented as multiple software programs or software modules (e.g., used to provide distributed services), or as a single software program or software module; no specific limitations are made here.
[0034] The terminal device of this application can be equipped with various communication client applications, such as video recording applications, video playback applications, voice interaction applications, search applications, instant messaging tools, email clients, social platform software, etc.
[0035] A terminal device can be either hardware or software. When the terminal device is hardware, it can be various terminal devices with a display screen, including but not limited to smartphones, tablets, laptops, and desktop computers. When the terminal device is software, it can be installed on the terminal devices listed above. It can be implemented as multiple software programs or software modules (e.g., used to provide distributed services) or as a single software program or software module; no specific limitation is made here.
[0036] When the terminal device is hardware, it can also be equipped with a display device and a camera. The display device can be any device capable of displaying information, and the camera is used to capture video streams. Examples of display devices include cathode ray tube displays (CR), light-emitting diode displays (LED), e-ink screens, liquid crystal displays (LCD), and plasma display panels (PDP). Users can use the display device on the terminal device to view displayed text, images, videos, and other information.
[0037] It should be understood that Figure 1 The number of terminal devices, networks, and servers shown is for illustrative purposes only. Depending on implementation needs, there can be any number of terminal devices, networks, and servers.
[0038] The following will be combined with the appendix Figure 2 This application provides a detailed description of the profit calculation method for power supply stations provided in its embodiments. Specifically, the profit calculation device for power supply stations in these embodiments can be... Figure 1 The server shown.
[0039] Please see Figure 2 This document provides a flowchart illustrating a profit calculation method for a power supply station, as illustrated in an embodiment of this application. Figure 2 As shown, the method described in this application embodiment may include the following steps:
[0040] S201. Determine the multiple profit calculation models associated with the power supply station.
[0041] The process begins with the server accessing a pre-defined rules database or configuration file via its internal configuration management module. This database stores the mapping between power supply stations and profit calculation models, defined by business rules (e.g., based on electricity consumption, service, or a comprehensive dimension). The server then performs a database query based on the input power supply station identifier (e.g., power supply station ID), retrieving a list of all associated profit calculation models. The query process involves establishing a database connection, filtering valid models using SQL or NoSQL queries, and validating the models (e.g., checking if they are enabled). The results are returned to the server's memory as structured data (e.g., JSON or list objects) for subsequent steps. This step ensures data consistency and scalability, supporting the dynamic addition or updating of models.
[0042] For example, power supply station A (ID PS001) has three profit calculation modes associated in the rules database: Mode 1 (calculation based on electricity sales), Mode 2 (calculation based on service fees), and Mode 3 (calculation based on a combination of electricity consumption and costs). After querying the configuration table, the server returns a list of modes: [Mode 1, Mode 2, Mode 3], which serves as the basis for subsequent user selection.
[0043] In one or more possible embodiments of this application, determining the multiple profit calculation models associated with the power supply includes:
[0044] After successfully logging into the power supply station, the system queries multiple associated profit calculation modes in a preset mapping relationship based on the power supply station's identity ID.
[0045] When the server receives a login request from the power supply station terminal and completes authentication, it parses the identity field in the request message using a secure communication protocol. This field typically contains the power supply station's unique digital ID or encrypted token. The server first calls its internal cache service to check the activity status of this ID. If it is confirmed to be valid, it triggers the profit calculation mode query process.
[0046] The system adopts a layered architecture. At the application service layer, a pre-configured mapping management component is loaded via dependency injection. This component maintains a dynamically updated key-value database, where the key is the power supply station's identity ID, and the values are sets of associated profit calculation patterns. The database uses a distributed storage solution, supporting high-concurrency queries and horizontal scaling.
[0047] The server first uses a Bloom filter to quickly filter invalid IDs, reducing database load. Second, it performs exact match queries in the mapping table of a relational database (such as MySQL), optimizing retrieval efficiency using an index on the power supply station ID field. Finally, it performs integrity checks on the query results, including mode version number comparison and permission tag verification. For power supply stations associated with multiple measurement modes, the system sorts them according to a preset priority strategy and generates a response object containing mode metadata.
[0048] In one or more possible embodiments of this application, users can flexibly configure the profit calculation formula and profit calculation mode according to actual needs. The specific process includes: configuring the profit calculation mode for the power supply station through the configuration interface.
[0049] Configure the profit calculation formula through the profit element selection panel in the configuration interface, and associate the configured profit calculation formula with the configured profit measurement mode.
[0050] The profit elements in the configured profit calculation formula are analyzed, and the analyzed profit elements are associated with the configured profit measurement model.
[0051] The server receives user operation commands through a front-end interaction framework and creates virtual configuration units for profit calculation modes in the configuration interface. These units use a key-value pair data structure to store mode attributes, including metadata such as mode name, applicable scope (e.g., by area / by line), and effective period. The server serializes the configuration unit into JSON format and persistently stores it in the calculation mode table of a relational database, while simultaneously generating a globally unique identifier (GUID) as the primary key.
[0052] When a user interacts with the profit element selection panel, the server captures the selection event in real time via the WebSocket protocol. Each candidate profit element in the panel (such as electricity sales, electricity purchase cost, line loss rate, etc.) corresponds to a predefined standardized data interface. The server automatically loads the corresponding parameter constraint rules (such as numerical range and data type) based on the element type. After the user completes the element selection and operator combination, the server converts the formula structure into an Abstract Syntax Tree (AST) representation, generates a formula fingerprint using a hash algorithm for version control, and finally stores the formula AST and fingerprint in the formula collection of a document-oriented database.
[0053] The server establishes a relationship table to achieve two-way binding: a formula reference field is added to the calculation pattern table to store the formula GUID, and a pattern association field is added to the formula set to record the associated pattern. To ensure data consistency, the server uses a distributed lock mechanism to ensure the atomicity of association operations. When the association relationship changes, the server triggers a cache invalidation mechanism to clear the old association data stored in Redis.
[0054] The server initiates a background parsing service to perform a depth-first traversal of the stored formula AST. It identifies profit element nodes in the formula using a symbolic resolution algorithm and queries the element metadata repository to obtain the element's technical identifiers (such as database field names and API endpoints). The server constructs an element mapping dictionary, mapping business terms in the formula (such as "average electricity price") to system-recognizable technical identifiers (such as "electricity_price_avg"). This mapping relationship is simultaneously stored in a graph database, forming an element association knowledge graph to support subsequent traceability.
[0055] The server integrates an expression tree-based calculation engine that converts business formulas into executable code at runtime based on a mapping dictionary. Through dependency injection, the calculation engine can dynamically invoke real-time data services provided by the data platform to obtain the current values of various profit elements. The server employs an asynchronous task queue to handle large-scale calculation requests, combined with in-memory computing technology to improve processing performance.
[0056] This embodiment achieves full lifecycle management of the profit calculation system. Through decoupling configuration and formula calculation, the system possesses high flexibility. The server-side data parsing and mapping mechanism ensures automatic conversion between business terminology and technical implementation, reducing the error rate of manual configuration. The dynamic calculation engine supports real-time data access and complex formula calculations, shortening the calculation response time to the second level, while also supporting horizontal scaling to cope with the computational pressure brought by the increase in the number of power supply stations. The construction of the knowledge graph provides technical support for element traceability and audit tracking, meeting the compliance requirements of the power industry.
[0057] Furthermore, the server can train an XGBoost recommendation model based on historical configuration data. When a user configures a new mode, the server proactively recommends: commonly used profit factor combinations (such as "line loss rate + electricity sales"), industry best practice formula templates, and a list of factors that are compatible with the current data source. The recommendation results are pushed to the configuration interface in real time via WebSocket.
[0058] S202, Obtain the time interval input by the user and the target profit calculation mode selected by the user among the multiple profit calculation modes.
[0059] The server receives user input data from the front end through a user interface layer (such as RESTful API or WebSocket). Input includes a time range (such as start and end dates) and the selection of a target profit calculation mode (such as mode ID or name). The server first performs input validation: checking the format of the time range (whether it conforms to date standards) and its logical validity (such as the end date not being earlier than the start date), while also confirming that the selected mode exists in the list returned in step S201 (to avoid invalid selections). After successful validation, the server stores the input parameters in a session cache or temporary database to ensure data consistency in subsequent steps. This process involves data parsing, error handling (such as returning an error message when input is out of range), and state management.
[0060] For example, a user submits a time range of "2023-01-01 to 2023-12-31" through the front-end interface and selects "Mode 2" as the target mode. After the server verifies that the time range is valid and that Mode 2 is in the associated list of power supply station A, it stores the parameters as: Time range = {start:2023-01-01,end:2023-12-31}, Target mode = Mode 2.
[0061] S203. Determine the profit calculation formula associated with the target profit calculation model, and the profit elements associated with the target profit calculation model.
[0062] In this process, the server accesses the rule engine or formula library (typically stored in a configuration database or memory cache) based on the target profit calculation model determined in step S202. The rule engine provides a mapping between models and formulas: profit calculation formulas are usually mathematical expressions (such as addition, subtraction, or aggregate functions), while profit elements are the input variables in the formula (such as revenue, cost, etc.). The server executes a query operation to obtain the formula definition and element list, while parsing the formula structure (e.g., converting the formula into an executable computation tree). Profit elements need to be standardized (e.g., using a unified naming convention) and their dependencies need to be checked (e.g., whether the element depends on other data sources). This step ensures the configurability and maintainability of the calculation logic.
[0063] For example, if the target pattern is Pattern 2, the server queries the rule base and determines the formula as "Profit = Service Revenue - Operating Costs - Maintenance Fees". The profit elements include "Service Revenue", "Operating Costs", and "Maintenance Fees". These elements serve as the basis for subsequent data queries.
[0064] In one or more possible embodiments, after receiving a request to invoke the target profit calculation pattern, the server first parses the request message using a secure transport protocol (such as gRPC) to extract the pattern's unique identifier (usually a UUID or hash value). This identifier serves as a system-wide index and requires dual verification: first, a fast existence check is performed in the local memory cache (such as Caffeine), triggering a secondary verification if a match is found; second, the pattern registry of a relational database (such as PostgreSQL) is accessed via a JDBC connection pool, and a precise query is performed using the unique index of the identifier field to confirm whether the pattern has passed compliance review and is in an active state.
[0065] After successful verification, the server initiates the blockchain interaction process. In the consortium blockchain system built on the Hyperledger Fabric framework, formula metadata, agreed upon by multiple parties, is pre-stored. The server, acting as a blockchain node, initiates a query transaction through the smart contract interface, passing the schema identifier as a transaction parameter. After the on-chain contract executes the existence proof verification, it reads the encrypted original formula expression from the LevelDB world state database. This expression uses the ASN.1 standard encoding format and includes metadata such as version number, creation timestamp, and digital signature.
[0066] The server first calls parser tools such as ANTLR to generate a syntax rule file, performing lexical analysis on the original expression to identify atomic units such as operators (e.g., +, *, MAX), variables (e.g., electricity quantity, electricity price), and constants (e.g., fixed cost coefficient). Then, it generates an Abstract Syntax Tree (AST) using a recursive descent algorithm, where non-leaf nodes represent operations and leaf nodes represent operands. During the tree structure construction process, computation priority rules (e.g., multiplication and division take precedence over addition and subtraction) and implicit dependencies (e.g., the computation of variable B depends on the prior value of variable A) are automatically injected.
[0067] To extract the profit element set, the server employs a post-order traversal algorithm to deeply parse the Abstract Syntax Tree (AST). When a variable-type leaf node is accessed, a callback function is triggered to record the node identifier. Simultaneously, the visitor pattern is used to check if the variable already exists in the global symbol table. If it does not exist, a metadata entry is dynamically created, containing information such as variable type (numeric / enumerated), data precision, and value range constraints. The final profit element set is encapsulated in JSON Schema format, containing structured fields such as variable name, data type, and business meaning description, and is returned to the front-end service via the OpenAPI specification.
[0068] This embodiment ensures the immutability and traceability of the profit calculation formula through blockchain notarization, and achieves transparent decomposition of the formula logic through abstract syntax tree parsing. Automated extraction of profit elements significantly reduces the error rate of manual configuration, while supporting dynamic expansion of new variable types without modifying the core parsing logic. The entire parsing process is completed in memory, reducing the processing time of a single formula and meeting the performance requirements of real-time electricity market pricing scenarios. The generated standardized element set provides a reliable data foundation for subsequent business functions such as profit simulation calculation and sensitivity analysis.
[0069] S204. Obtain the profit parameter value by retrieving data from the data source based on the profit elements and the time interval.
[0070] In this process, the server uses the profit element list from step S203 and the time interval from step S202 to construct a data query request. The data source is typically a business database (such as a relational database or data warehouse), and the server executes the query through a data access layer (such as a JDBC or ODBC connector). For each profit element, the server generates a specific SQL or API query statement, applies time interval filtering (such as a WHERE clause), and may perform data aggregation (such as summing revenue values). The query process includes data extraction, transformation (such as unit standardization), and validation (such as checking data integrity or handling missing values). The results are returned to the server's memory in key-value pair format (such as element name: parameter value) as input for calculation.
[0071] For example: The profit elements are "service revenue" and "operating costs," with a timeframe of the entire year of 2023. The server queries the sales database: performs a SUM operation on "service revenue," obtaining a value of 1,000,000 yuan; queries the cost database: performs a SUM operation on "operating costs," obtaining a value of 600,000 yuan. The returned parameter values are: {Service Revenue: 1,000,000, Operating Costs: 600,000}.
[0072] In one or more possible embodiments of this application, the server listens for HTTP POST requests initiated by the frontend through a Spring Boot application layer deployed behind an Nginx reverse proxy. The request path follows RESTful design specifications, such as / api / v1 / profit / calculate, and is configured with a Cross-Origin Resource Sharing (CORS) policy to support multi-domain frontend calls. The received JSON parameter package uses a predefined structure based on a schema validation mechanism, containing a time range (such as startDate / endDate fields) and a set of profit elements (an array type, where each element contains element name, data type, and other metadata). Before entering the business logic, the server performs integrity verification on the parameter package using a JSON schema validator (such as the Everit library).
[0073] During the parameter validity verification phase, the server integrates the Apache Shiro framework to build a security protection layer. First, it parses the user's identity information using the JWT token in the Authorization request header, and then verifies whether the user has access to the profit calculation interface using annotation-based permission control (such as @RequiresPermissions). Next, a custom ParameterValidator interceptor is enabled to perform business rule validation on the time interval (e.g., the end time must not be earlier than the start time, and the interval span must not exceed the system configuration threshold). Simultaneously, each element in the profit element set undergoes dictionary value validation (e.g., comparison with a Redis cached element enumeration list) to ensure that all parameters comply with predefined business constraints.
[0074] After successful verification, the server queries the metadata center via the dependency-injected DataSourceRegistry service. The metadata center uses a graph database (such as Neo4j) to store metadata about the data sources. Nodes represent data sources (structured data sources associated with JDBC connection pool configurations, time-series data sources associated with InfluxDB measurement table information, and file data sources associated with HDFS paths and parsing rules), and edges represent dependencies between data sources. The query process is implemented using the Cypher query language. Based on the name of each element in the profit element set, it retrieves matching data source nodes in the metagraph and returns a collection of structured objects containing information such as data source type, access address, and authentication credentials.
[0075] When multiple data sources are retrieved, the server initiates a parallel data retrieval process. A thread pool is built using the Java Concurrency Toolkit (JUC)'s ExecutorService, allocating an independent task thread for each data source. Structured data sources construct query statements using the MyBatis dynamic SQL generator, time-series data sources call InfluxDB's Flux query API, and file data sources parse Excel templates or Parquet files using Apache POI. Each thread uses CompletableFuture to asynchronously aggregate results. After all threads have completed data retrieval, the main thread performs result merging (such as deduplication by feature name and timestamp alignment), ultimately generating a mapping table containing all profit parameter values.
[0076] This embodiment ensures the legality and security of request parameters through a layered verification mechanism. The decoupling design of the metadata center and data source supports the dynamic expansion of new data storage types. The parallel data retrieval strategy significantly improves the efficiency of multi-source data acquisition, and is particularly suitable for mixed data environments containing time-series databases, relational databases, and distributed file systems. The final generated profit parameter value mapping table has complete data lineage information, providing a reliable data foundation for the subsequent profit calculation process, while reducing system maintenance costs caused by changes in data sources.
[0077] S205. Calculate the profit value of the target profit calculation model based on the profit parameter value and the profit calculation formula.
[0078] The process involves the server loading the profit parameter values from step S204 and the profit calculation formula from step S203, and performing arithmetic or logical operations in the calculation engine (such as an in-memory computing module). The calculation process parses the formula into executable instructions (e.g., interpreting "Profit = Revenue - Cost" as a subtraction operation) and substitutes the parameter values for real-time calculation. The server handles boundary conditions (e.g., using default values or throwing exceptions when parameter values are empty) and ensures calculation accuracy (e.g., using floating-point numbers). The calculation result (profit value) is stored in a results database or cache, and logs are recorded (e.g., audit trails). This step emphasizes efficiency and accuracy, supporting high-concurrency calculations.
[0079] For example, if the parameter value is {Service Revenue: 1,000,000, Operating Costs: 600,000}, and the formula is “Profit = Service Revenue - Operating Costs”, the server will calculate: Profit = 1,000,000 - 600,000 = 400,000 yuan, and store the result as the profit value of power supply station A under mode 2 in 2023.
[0080] In one or more possible embodiments, after completing the calculation process of the target profit calculation model, the server triggers a profit evaluation mechanism. This mechanism first dynamically loads profit threshold rule sets for different power supply station types, business scenarios, and time dimensions from the system configuration center (such as Apollo or Nacos). The rule sets are stored in the form of decision tables, containing condition fields (such as power supply station level, regional electricity price policy, and calculation period) and result fields (such as minimum profit threshold and alarm level). The server uses a rule engine (such as Drools) to perform condition matching and dynamic threshold parsing.
[0081] During the profit value comparison phase, the server adopts a two-stage verification strategy: First, a basic verification is performed to confirm the data type (e.g., numeric and non-negative), precision range (e.g., retaining two decimal places), and business rationality (e.g., not lower than the fixed cost allocation value); then, the verified profit value is strictly compared with the parsed dynamic threshold. The comparison logic supports a composite judgment of percentage deviation threshold (e.g., lower than the benchmark value by 20%) and absolute value threshold (e.g., lower than 1000 yuan).
[0082] When the detected profit value falls below a threshold, the server initiates an alarm generation process. The alarm content is dynamically rendered using a message template engine (such as FreeMarker). The template embeds contextual information such as the power supply station name, calculation period, actual profit value, threshold, and deviation rate. Simultaneously, it automatically labels the alarm level (e.g., yellow warning / red alert) based on the degree of deviation. The alarm channel configuration adopts an event-driven architecture. The server publishes alarm events to the Kafka message bus, and consumer services subscribed to this topic (such as SMS gateways, email services, and WeChat chatbots) asynchronously process the actual notification actions.
[0083] To ensure the accuracy and traceability of alarms, the server performs anti-duplicate verification before generating alarms. It records the alarm identifiers that have been sent (such as the power supply station ID + the hash value of the calculation period) through the Redis Bitmap data structure to avoid duplicate notifications of the same anomaly. At the same time, the alarm events are persisted to the Elasticsearch cluster, supporting multi-dimensional retrieval and auditing by time, power supply station, alarm level and other dimensions.
[0084] This embodiment achieves accurate identification and differentiated alarms for profit anomalies through dynamic threshold management and multi-level verification mechanisms, effectively reducing the false alarm rate. The event-driven asynchronous notification architecture supports flexible expansion of alarms across multiple channels, ensuring that key users (such as power supply station managers and regional operations managers) can obtain anomaly information in a timely manner. Complete audit logs and anti-duplicate mechanisms enhance the system's reliability and maintainability, providing data-driven decision support for power companies' profit management.
[0085] Furthermore, in some embodiments of this application, the server automatically triggers an intelligent decision optimization process after detecting that the current profit value of the power supply station is lower than a preset threshold. First, an adjustable range of decision variables is dynamically loaded based on a business rule engine (such as Drools), including the electricity sales price fluctuation range (such as ±10% of the benchmark electricity price), equipment operation and maintenance strategy combinations (such as shortening / extending the preventive maintenance cycle, adjusting the spare parts inventory level), etc. These variable ranges are remotely hot-updated through a configuration center (such as Apollo) to adapt to the policy constraints and cost structures of different regions.
[0086] The simulation adjustment phase employs the Monte Carlo Tree Search (MCTS) algorithm framework. The server constructs a four-layer decision tree model: the first layer is the root node, representing the current abnormal profit state; the second layer is the decision variable selection layer, where each node represents an adjustable parameter (e.g., a 5% increase in electricity prices); the third layer is the environmental simulation layer, which predicts key indicators such as adjusted electricity consumption and equipment failure rate by integrating historical data simulation engines (e.g., a time-series-based ARIMA model); and the fourth layer is the profit calculation layer, which calls pre-registered profit calculation models to recalculate the expected profit value. During the search process, the server uses the UCB (Upper Confidence Bound) formula to balance exploration and utilization, prioritizing the expansion of high-potential but under-evaluated decision paths.
[0087] To improve search efficiency, the server employs a parallelization strategy: a thread pool distributes the decision tree expansion and simulation process across multiple worker threads, with each thread independently maintaining its local search state. Simultaneously, a virtual loss mechanism coordinates the search directions between threads, avoiding redundant calculations of the same nodes. Furthermore, the server integrates a domain knowledge constraint module, automatically filtering out clearly unreasonable decisions during the node expansion phase (such as electricity price adjustments exceeding policy limits or maintenance strategies causing equipment lifespan to fall below safety thresholds), reducing the invalid search space.
[0088] Once the preset number of search iterations or time threshold is reached, the server initiates the Pareto optimal solution selection process. Based on multi-objective optimization theory, indicators such as profit value, user satisfaction (indirectly measured by the magnitude of electricity price adjustments), and operation and maintenance costs are constructed into a multi-dimensional objective space. The fast non-dominated sorting algorithm (the core idea of NSGA-II) is used to select the set of solutions that are not strictly dominated by other solutions. The final Pareto front solution set is converted into an interactive chart through a visualization engine (such as ECharts), showing the trade-offs of different decision combinations across various objective dimensions, and highlighting key indicators (such as profit improvement potential and risk level) for user decision-making reference.
[0089] This solution achieves intelligent exploration of the decision space through Monte Carlo tree search, enabling rapid identification of high-value adjustment strategies under complex constraints. Parallel design and domain knowledge constraints significantly improve search efficiency, allowing the server to generate a Pareto solution set containing dozens of feasible solutions within seconds. The multi-objective optimization method avoids the limitations of single-dimensional decision-making, helping users fully understand the combined impact of different strategies, ultimately improving the accuracy and scientific rigor of power supply station profit management.
[0090] S206. Visualize the profit values of the power supply in each time interval and under each profit calculation mode.
[0091] The server aggregates all relevant data from the results database or historical cache, including profit values for different time intervals (e.g., multiple years) and profit calculation models (e.g., models 1, 2, and 3). The aggregation process involves data querying (e.g., GROUP BY operations) and formatting (e.g., converting to time series data). The server calls visualization services (e.g., chart generation libraries or third-party APIs) to generate visualization data objects (e.g., chart descriptions in JSON format). These objects are transmitted to the front end via API and rendered as interactive charts (e.g., line charts displaying time trends, bar charts comparing different models). The visualization process supports dynamic updates and user interaction (e.g., zooming or filtering), ensuring data readability and real-time performance.
[0092] For example, the server queries historical data: In 2023, Power Supply Station A's profit was 500,000 yuan under Mode 1 and 400,000 yuan under Mode 2; in 2024, it was 550,000 yuan under Mode 1 and 450,000 yuan under Mode 2. After generating the visualized data, the front end displays it as a line chart: the X-axis represents the time interval, the Y-axis represents the profit value, and different lines represent different modes, making it easy for users to analyze trends.
[0093] The technical effects of this application include:
[0094] By associating multiple profit calculation modes and automatically matching calculation formulas and elements, the system eliminates repetitive operations such as manual data collection and formula configuration, greatly reducing calculation time and mitigating the risk of human error. It supports users in flexibly selecting calculation modes, dynamically adapting to business changes such as electricity price adjustments and equipment upgrades. The relationships between formulas and elements are configurable and updateable, avoiding secondary system development. Based on the visualization of profit values across time intervals and multiple modes, it intuitively presents profit fluctuations under different operating strategies, providing data-driven decision-making support for power supply stations to optimize electricity sales prices and allocate operation and maintenance resources, thus promoting the transformation of grassroots units from passive accounting to proactive management.
[0095] The following are embodiments of the apparatus described in this application, which can be used to execute the embodiments of the method described in this application. For details not disclosed in the apparatus embodiments of this application, please refer to the embodiments of the method described in this application.
[0096] Please see Figure 3 This illustration shows a schematic diagram of the structure of a profit calculation device for a power supply station provided in an exemplary embodiment of this application, hereinafter referred to as device 3. Device 3 can be implemented as all or part of a server through software, hardware, or a combination of both. Device 3 includes: a determining unit 301, an acquiring unit 302, a data retrieving unit 303, a calculating unit 304, and a pushing unit 305.
[0097] The determining unit 301 is used to determine multiple profit calculation models associated with the power supply station;
[0098] The acquisition unit 302 is used to acquire the time interval input by the user and the target profit calculation mode selected by the user among the multiple profit calculation modes;
[0099] The determining unit 301 is further configured to determine the profit calculation formula associated with the target profit calculation model, and the profit elements associated with the target profit calculation model.
[0100] The data retrieval unit 303 is used to retrieve data from the data source based on the profit elements and the time interval to obtain the profit parameter value;
[0101] The calculation unit 304 is used to calculate the profit value of the target profit calculation mode based on the profit parameter value and the profit calculation formula.
[0102] The push unit 305 is used to visualize the profit value of the power supply in each time interval and under each profit calculation mode.
[0103] In one or more possible embodiments, it also includes:
[0104] The configuration unit is used to configure the profit calculation mode for the power supply station through the configuration interface.
[0105] The profit calculation formula is configured through the profit element selection panel in the configuration interface, and the configured profit calculation formula is associated with the configured profit measurement mode; the profit element selection panel includes multiple candidate profit elements.
[0106] The profit elements in the configured profit calculation formula are analyzed, and the analyzed profit elements are associated with the configured profit measurement model.
[0107] In one or more possible embodiments, determining the multiple profit calculation models associated with the power supply includes:
[0108] After successfully logging into the power supply station, the system queries multiple associated profit calculation modes in a preset mapping relationship based on the power supply station's identity ID.
[0109] In one or more possible embodiments, determining the profit calculation formula associated with the target profit calculation model and the profit elements associated with the target profit calculation model includes:
[0110] Obtain a unique identifier for the target profit calculation model;
[0111] Verify that the unique identifier exists in the system's registered pattern library. If it does, access the blockchain system and retrieve the original expression of the formula in the blockchain system based on the unique identifier.
[0112] The original expression of the formula is broken down into atomic units, which include operators, variables, and constants.
[0113] Generate an abstract syntax tree to determine computation priorities and dependencies;
[0114] Traverse the abstract syntax tree, extract all variable nodes, and form a profit element set.
[0115] In one or more possible embodiments, obtaining the profit parameter value by retrieving data from the data source based on the profit element and the time interval includes:
[0116] The system receives JSON-formatted parameter packets from the front end via a RESTful API. These JSON-formatted parameter packets carry the time interval and profit element set.
[0117] Enable the Apache Shiro framework for parameter validation;
[0118] If the verification is successful, query the metadata center to obtain the corresponding data source information. The data source information represents the data source as a structured data source, a time-series data source, and a file data source.
[0119] If the data source information represents multiple data sources, the profit parameter value is obtained by retrieving data from multiple data sources in a parallel manner.
[0120] In one or more possible embodiments, it also includes:
[0121] The alerting unit is used to alert the user if the profit value of the power supply station under the target profit calculation mode is lower than a preset threshold.
[0122] In one or more possible embodiments, if the profit value of the power supply station under the target profit calculation mode is lower than a preset threshold, an alarm is issued to the user, further comprising:
[0123] The simulation adjusts electricity prices and / or equipment operation and maintenance strategies, evaluates the profit value of different decision paths through Monte Carlo tree search, and finally outputs a Pareto optimal solution set for users to choose from.
[0124] It should be noted that the above-described embodiment of the device 3, when executing the profit calculation method for a power supply station, is only illustrated by the division of the above functional modules. In practical applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the above functions. Furthermore, the profit calculation device for a power supply station and the profit calculation method embodiment provided in the above embodiment belong to the same concept, and their implementation process is detailed in the method embodiment, which will not be repeated here.
[0125] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0126] This application also provides a computer storage medium that can store multiple instructions, which are adapted to be loaded and executed by a processor as described above. Figure 2 The method steps of the illustrated embodiment can be found in the following documentation for detailed execution. Figure 2 The specific details of the illustrated embodiments will not be elaborated here.
[0127] This application also provides a computer program product that stores at least one instruction, which is loaded and executed by the processor to implement the profit calculation method for the power supply station as described in the above embodiments.
[0128] Please see Figure 4 This provides a schematic diagram of a server structure for an embodiment of this application. For example... Figure 4 As shown, the server 400 may include: at least one processor 401, at least one network interface 404, a user interface 403, a memory 405, and at least one communication bus 402.
[0129] The communication bus 402 is used to enable communication between these components.
[0130] The user interface 403 may include a display screen and a camera. Optionally, the user interface 403 may also include a standard wired interface and a wireless interface.
[0131] The network interface 404 may optionally include a standard wired interface or a wireless interface (such as a Wi-Fi interface).
[0132] The processor 401 may include one or more processing cores. The processor 401 connects to various parts within the server 400 using various interfaces and lines, and performs various functions and processes data by running or executing instructions, programs, code sets, or instruction sets stored in the memory 405, and by calling data stored in the memory 405. Optionally, the processor 401 may be implemented using at least one hardware form of Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), or Programmable Logic Array (PLA). The processor 401 may integrate one or a combination of several of the following: Central Processing Unit (CPU), Graphics Processing Unit (GPU), and modem. The CPU primarily handles the operating system, user interface, and applications; the GPU is responsible for rendering and drawing the content to be displayed on the screen; and the modem handles wireless communication. It is understood that the modem may also be implemented as a separate chip, without being integrated into the processor 401.
[0133] The memory 405 may include random access memory (RAM) or read-only memory. Optionally, the memory 405 may include a non-transitory computer-readable storage medium. The memory 405 may be used to store instructions, programs, code, code sets, or instruction sets. The memory 405 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as touch function, sound playback function, image playback function, etc.), instructions for implementing the above-described method embodiments, etc.; the data storage area may store data involved in the above-described method embodiments, etc. Optionally, the memory 405 may also be at least one storage device located remotely from the aforementioned processor 401. Figure 4 As shown, the memory 405, which serves as a computer storage medium, may include an operating system, a network communication module, a user interface module, and application programs.
[0134] exist Figure 4 In the server 400 shown, the user interface 403 is mainly used to provide an input interface for the user and obtain the user input data; while the processor 401 can be used to call the application program stored in the memory 405 and specifically execute, such as Figure 2 The method shown can be referred to for details. Figure 2 As shown, it will not be elaborated further here.
[0135] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. The storage medium can be a magnetic disk, optical disk, read-only memory, or random access memory, etc.
[0136] The above-disclosed embodiments are merely preferred embodiments of this application and should not be construed as limiting the scope of this application. Therefore, any equivalent variations made in accordance with the claims of this application shall still fall within the scope of this application.
Claims
1. A profit calculation method for a power supply station, characterized in that, include: Identify multiple profit calculation models associated with the power supply station; Obtain the time interval input by the user and the target profit calculation mode selected by the user among the multiple profit calculation modes; Determine the profit calculation formula associated with the target profit calculation model, and the profit elements associated with the target profit calculation model; The profit parameter value is obtained by retrieving data from the data source based on the profit elements and the time interval. The profit value of the target profit calculation model is calculated based on the profit parameter value and the profit calculation formula. The profit values of the power supply in each time interval and under each profit calculation mode are visualized.
2. The method according to claim 1, characterized in that, Also includes: Configure the profit calculation mode for the power supply station through the configuration interface; Configure the profit calculation formula through the profit element selection panel in the configuration interface, and associate the configured profit calculation formula with the configured profit measurement mode. The profit element selection panel includes multiple candidate profit elements; The profit elements in the configured profit calculation formula are analyzed, and the analyzed profit elements are associated with the configured profit measurement model.
3. The method according to claim 1 or 2, characterized in that, The determination of multiple profit calculation models associated with the power supply station includes: After successfully logging into the power supply station, the system queries multiple associated profit calculation modes in a preset mapping relationship based on the power supply station's identity ID.
4. The method according to claim 3, characterized in that, The determination of the profit calculation formula associated with the target profit calculation model and the profit elements associated with the target profit calculation model includes: Obtain a unique identifier for the target profit calculation model; Verify that the unique identifier exists in the system's registered pattern library. If it does, access the blockchain system and retrieve the original expression of the formula in the blockchain system based on the unique identifier. The original expression of the formula is broken down into atomic units, which include operators, variables, and constants. Generate an abstract syntax tree to determine computation priorities and dependencies; Traverse the abstract syntax tree, extract all variable nodes, and form a profit element set.
5. The method according to claim 1, 2, or 4, characterized in that, The step of obtaining the profit parameter value by retrieving data from the data source based on the profit elements and the time interval includes: The system receives JSON-formatted parameter packets from the front end via a RESTful API. These JSON-formatted parameter packets carry the time interval and profit element set. Enable the Apache Shiro framework for parameter validation; If the verification is successful, query the metadata center to obtain the corresponding data source information. The data source information represents the data source as a structured data source, a time-series data source, and a file data source. If the data source information represents multiple data sources, the profit parameter value is obtained by retrieving data from multiple data sources in a parallel manner.
6. The method according to claim 5, characterized in that, Also includes: If the profit value of the power supply station under the target profit calculation mode is lower than the preset threshold, an alarm will be issued to the user.
7. The method according to claim 6, characterized in that, If the profit value of the power supply station under the target profit calculation mode is lower than a preset threshold, an alarm will be issued to the user, and the system will also include: The simulation adjusts electricity prices and / or equipment operation and maintenance strategies, evaluates the profit value of different decision paths through Monte Carlo tree search, and finally outputs a Pareto optimal solution set for users to choose from.
8. A profit calculation device for a power supply station, characterized in that, include: The determination unit is used to determine multiple profit calculation models associated with the power supply station; The acquisition unit is used to acquire the time interval input by the user and the target profit calculation mode selected by the user among the multiple profit calculation modes; The determining unit is further configured to determine the profit calculation formula associated with the target profit calculation model, and the profit elements associated with the target profit calculation model. The data retrieval unit is used to retrieve data from the data source based on the profit elements and the time interval to obtain the profit parameter value; A calculation unit is used to calculate the profit value of the target profit calculation model based on the profit parameter value and the profit calculation formula; The push unit is used to visualize the profit values of the power supply in various time intervals and under various profit calculation modes.
9. A computer storage medium, characterized in that, The computer storage medium stores a plurality of instructions, which are adapted to be loaded by a processor and executed as method steps as claimed in any one of claims 1 to 7.
10. A server, characterized in that, include: A processor and a memory; wherein the memory stores a computer program adapted to be loaded by the processor and executed the method steps as claimed in any one of claims 1 to 7.