Charging station intelligent control method and system based on RAG
By establishing a matching mapping relationship between events and processes in the charging station, dynamically allocating control weights and optimizing power allocation, the control contradictions in multi-event concurrent scenarios are resolved, and the operational efficiency and adaptability of the charging station are improved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- 国网(山东)电动汽车服务有限公司
- Filing Date
- 2026-04-16
- Publication Date
- 2026-05-15
AI Technical Summary
Existing RAG-based charging station control methods cannot effectively coordinate V2G revenue targets and clean energy consumption targets in multi-event concurrent scenarios, leading to conflicting control commands and operational efficiency losses.
By establishing a systematic matching mapping relationship between event-driven tasks and process-driven tasks, a matching relationship matrix is generated, a continuous sequence of event-driven tasks is constructed, and based on this, control weight coefficients for V2G events and clean energy events are dynamically allocated. Power allocation is optimized by combining a quadratic programming algorithm, and a balance point power vector is generated for intelligent control.
It achieves dynamic trade-offs and precise coordination in the face of multiple conflicting objectives, and improves the overall operational efficiency and adaptive control capabilities of charging stations in vehicle-grid interaction and fluctuating clean energy environments.
Smart Images

Figure CN122043970A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of charging station operation optimization decision technology, and in particular to a charging station intelligent control method and system based on RAG. Background Technology
[0002] As a core platform supporting the interaction between electric vehicles and the power grid, the accuracy and real-time performance of the intelligent control system for charging stations directly affect operational economy and grid stability. Existing technologies, by introducing a retrieval-enhanced generation framework and integrating historical operating data, equipment knowledge bases, and expert rules, have achieved significant results in generating response strategies for single-event scenarios. This enables knowledge-driven preliminary decision optimization and improves the data processing and scheduling capabilities of charging stations.
[0003] However, existing RAG-based control methods face fundamental limitations when dealing with concurrent scenarios involving multiple events such as vehicle-to-grid interaction and fluctuating clean energy. Traditional methods typically treat various events independently, lacking a systematic analysis of the inherent relationships between events and their coupling with the charging service process. This results in an inability to dynamically weigh and generate a globally optimal coordinated control strategy when V2G revenue targets and clean energy consumption targets overlap in time or conflict in energy flow, easily leading to conflicting control commands and operational efficiency losses.
[0004] Therefore, there is an urgent need to study an intelligent decision-making method that can deeply analyze the event-process correlation and dynamically allocate control weights based on this, so as to solve the real-time coordination and control problem under multi-objective conflict and achieve precise optimization of the comprehensive operation efficiency of charging stations. Summary of the Invention
[0005] To overcome the shortcomings of poor performance in multi-objective dynamic collaborative control, this invention provides a smart control method and system for charging stations based on RAG.
[0006] The technical implementation scheme of the present invention is as follows: a smart control method for charging stations based on RAG, comprising the following steps: S1: Obtain the process-driven tasks and event-driven tasks of the charging station, match and map each stage of the event-driven tasks and process-driven tasks to generate a set of mapping pairs; S2: Obtain a matching relationship matrix based on the set of mapping pairs, and construct a continuous sequence of event-driven tasks based on the matching relationship matrix; S3: Based on the continuous sequence, perform compression and reservation operations on the RAG data corresponding to the event-driven task to obtain the compression priority and reservation priority, and obtain the control weight coefficients of the V2G event-driven task and the clean energy event-driven task based on the compression priority and reservation priority. S4: Determine the equilibrium point power vector based on the control weight coefficients of the V2G event-driven task and the clean energy event-driven task, and perform intelligent control of the charging station based on the actual power vector and the equilibrium point power vector.
[0007] Preferably, the process-driven task and event-driven task for obtaining the charging station include: The process-driven task is a control task that is executed in a preset step sequence and where there are dependencies between the steps. The event-driven task is a priority control task that is triggered by a specific external event and executed immediately and independently. For each event-driven task, the event triggering conditions are parsed and a set of event conditions is generated; For each stage of a process-driven task, the stage operation objects and execution status are parsed and a stage context set is generated. Match each event-driven task with the execution conditions of each stage in the process-driven task. If the event condition set and the stage context set have the same attribute, and the attribute value in the stage context set satisfies the logical relationship specified by the corresponding attribute in the event condition set, then add the corresponding stage to the preliminary impact stage list of the corresponding event-driven task. For each event-driven task, the initial impact phase list is sorted according to the order of the phases in the original process phases of the process-driven task, generating an ordered initial impact phase list.
[0008] Preferably, the step of matching and mapping the event-driven task with each stage of the process-driven task to generate a set of mapping pairs includes: Set a similarity threshold T; for each event-driven task, obtain an ordered list of preliminary impact stages of the event-driven task, and check whether the ordered list of preliminary impact stages constitutes a continuous subsequence of the original process stage sequence. The continuous subsequence refers to a continuous and uninterrupted segment in the original process stage sequence. When the inspection result is a continuous subsequence, the continuous subsequence matching mapping operation is performed. The matching mapping operation is to establish a matching mapping between the current event-driven task and all stages in the current ordered list of initial impact stages. When the inspection result is not a continuous subsequence, a similarity calculation matching mapping operation is performed. The matching mapping operation is as follows: the description text of the event-driven task is vectorized and defined as the first vector, and the description text of each stage in the ordered list of preliminary impact stages is vectorized and defined as the second vector. The cosine similarity between the first vector and the second vector is calculated respectively. For stages with a cosine similarity greater than or equal to T, a matching mapping between the event-driven task and the stage is established; for stages with a cosine similarity less than T, no matching mapping is established. Record the matching mapping results of each event-driven task and each stage in the process-driven task, and generate a set of mapping pairs.
[0009] Preferably, obtaining the matching relationship matrix based on the set of mapping pairs includes: Create a two-dimensional matrix. The number of rows in the two-dimensional matrix is the total number of event-driven tasks, and the number of columns in the two-dimensional matrix is the total number of process-driven task stages. The initial value of each cell in the matrix is 0. Traverse the set of mapping pairs. For each mapping pair between an event-driven task and a stage in a process-driven task, fill in 1 in the corresponding event-driven task row and the corresponding stage column cell in the process-driven task in the two-dimensional matrix. The final two-dimensional matrix is output and defined as a matching relationship matrix. The first row of the matching relationship matrix is the identifier of each stage in the process-driven task, and the first column is the identifier of the event-driven task.
[0010] Preferably, the step of constructing a continuous sequence of event-driven tasks based on the matching relationship matrix includes: Extract the non-zero column index corresponding to each event-driven task in the matching relationship matrix, and generate the impact stage sequence of each event-driven task based on the order of each stage in the original process of the process-driven task corresponding to the non-zero column index. Event-driven tasks that form a continuous subsequence in the original process stage sequence are selected; the selected event-driven tasks are sorted according to the order of the earliest appearing stage in the affected stage sequence in the original process to form a continuous sequence of event-driven tasks.
[0011] Preferably, the step of performing compression and reservation operations on the RAG data corresponding to the event-driven task based on the continuous sequence to obtain compression priority and reservation priority includes: For each event-driven task in the matching relationship matrix, count the number of cells with a value of 1 in the corresponding row and use this as the number of impact stages; Traverse the continuous sequence. If the event-driven task appears in the continuous sequence, record its position index in the continuous sequence; if it does not appear, mark it as not in the continuous sequence and record its position index as 0. For event-driven tasks existing in a continuous sequence, calculate the compression priority of the corresponding RAG data, and set the reserved priority to 0. The compression priority is calculated as follows: the compression priority is the product of the location index, the number of affected stages, and the difference between 1 and the urgency level. For event-driven tasks that are not in a continuous sequence, calculate the reserved priority of the corresponding RAG data, and set the compression priority to 0. The formula for calculating the reservation priority is: Reservation Priority = (Total number of process stages - Number of stages affected) × Event frequency × (1 - Urgency); The urgency level is dynamically calculated based on the specific response time limit requirements of the event and is used to characterize the urgency of the event. The lower the value, the more urgent the event.
[0012] Preferably, obtaining the control weight coefficients for the V2G event-driven task and the clean energy event-driven task based on the compression priority and the reservation priority includes: Normalize the compression priority and the reservation priority respectively to obtain normalized compression priority and normalized reservation priority; V2G event-driven tasks are marked as stable event types, and clean energy event-driven tasks are marked as volatile event types. Assign normalized compression priority as a control weight coefficient to stability event types, and set normalized reserved priority to 0; Assign normalization reserved priority as a control weight coefficient to volatility event types, and set the normalization compression priority to 0.
[0013] Preferably, determining the equilibrium point power vector based on the control weight coefficients of the V2G event-driven task and the clean energy event-driven task includes: The V2G discharge power vector, the clean energy charging power vector, and the energy storage system regulation power vector are used as the set of decision variables for balance point optimization. The objective function is optimized with economic benefit target, clean energy consumption target, grid support target and battery health target as the balance point. The objective function is in the form of weighted summation. Among them, the weight coefficient of economic benefit target is weighted by normalized compressed priority, and the weight coefficient of clean energy consumption target is weighted by normalized reserved priority. The set of constraints for balance point optimization is based on power balance constraints, equipment capacity constraints, battery charging and discharging mutual exclusion constraints, and power grid safe operation constraints. Using a quadratic programming algorithm, the V2G discharge power setpoint, the clean energy charging power setpoint, and the energy storage system regulation power setpoint that optimize the objective function under all constraints are calculated. These three together constitute the equilibrium point power vector. The equilibrium point is a power allocation benchmark calculated to achieve the optimal balance between economic efficiency, environmental protection, grid security, and equipment health when the time overlaps and the demand for clean energy consumption conflicts with the V2G discharge revenue.
[0014] Preferably, the intelligent control of the charging station based on the actual power vector and the equilibrium point power vector includes: Collect actual V2G discharge power, actual clean energy charging power, and actual energy storage system power; For each sampling time, the Euclidean distance between the actual power vector and the equilibrium point power vector is calculated as the instantaneous deviation, and the instantaneous deviations are sorted according to the sampling time to obtain the instantaneous deviation sequence. The average and maximum deviations of the instantaneous deviation sequence within a continuous time window are statistically analyzed. If the average deviation is greater than a preset average deviation threshold or the maximum deviation is greater than a preset maximum deviation threshold, the corresponding time window is marked as a control misalignment point. When a control misalignment is detected, the RAG knowledge base is searched based on the misalignment type. Correction strategies, implementation records, and effect evaluation reports of similar historical misalignment cases are retrieved from the RAG knowledge base. By combining the retrieved case strategies with the current system status, a large language model is used to generate natural language descriptions of correction strategies and multiple sets of candidate instructions.
[0015] Preferably, a smart control system for charging stations based on RAG includes: The event flow matching and mapping module is used to obtain flow-driven tasks and event-driven tasks, and generate a set of mapping pairs between events and flow stages through condition matching and similarity calculation. The continuous sequence construction module is used to construct a matching relationship matrix based on a set of mapping pairs, extract the event impact stage sequence, and sort it to form a continuous sequence of event-driven tasks. The RAG data optimization and weight allocation module is used to calculate compression and reservation priorities based on continuous sequences, and then allocate control weight coefficients for V2G and clean energy events after normalization. The equilibrium point control and correction module is used to solve the equilibrium point power vector through quadratic programming based on the control weight coefficients, monitor the actual power deviation, and generate correction instructions using the RAG knowledge base and large language model.
[0016] Beneficial Effects: This invention establishes a systematic matching mapping relationship between event-driven tasks and process-driven tasks, generates a matching relationship matrix representing the event-process influence spectrum, and constructs a continuous sequence reflecting the inherent temporal regularity of event occurrence based on this matrix. This technical approach fundamentally solves the problems of control command contradictions and operational efficiency losses caused by isolated event processing in multi-event concurrent scenarios using traditional methods. By dynamically calculating and allocating control weight coefficients for V2G events and clean energy events based on the continuous sequence, and integrating these weights into a balance point power optimization model centered on multiple objectives such as economic benefits and clean energy consumption, dynamic trade-offs and precise coordination are achieved when objectives conflict. Finally, by monitoring power deviations in real time and generating correction strategies using the RAG knowledge base and large language model, the overall operational efficiency and adaptive control capabilities of charging stations in vehicle-grid interaction and fluctuating clean energy access environments are significantly improved. Attached Figure Description
[0017] Figure 1 This is a flowchart of a smart control method for charging stations based on RAG according to the present invention; Figure 2 This is a structural diagram of a smart control system for charging stations based on RAG according to the present invention. Detailed Implementation
[0018] The present invention will be further described below with reference to specific embodiments. The illustrative embodiments and descriptions herein are used to explain the present invention, but are not intended to limit the present invention.
[0019] Example 1: A smart control method for charging stations based on RAG, such as Figure 1 As shown, it includes the following steps: S1-1: Obtain the process-driven and event-driven tasks of the charging station, including: The process-driven task is a control task that is executed in a preset step sequence and where there are dependencies between the steps. The event-driven task is a priority control task that is triggered by a specific external event and executed immediately and independently. For each event-driven task, the event triggering conditions are parsed and a set of event conditions is generated; For each stage of a process-driven task, the stage operation objects and execution status are parsed and a stage context set is generated. Match each event-driven task with the execution conditions of each stage in the process-driven task. If the event condition set and the stage context set have the same attribute, and the attribute value in the stage context set satisfies the logical relationship specified by the corresponding attribute in the event condition set, then add the corresponding stage to the preliminary impact stage list of the corresponding event-driven task. For each event-driven task, the initial impact phase list is sorted according to the order of the phases in the original process phases of the process-driven task, generating an ordered initial impact phase list.
[0020] It's important to note that efficient charging station operation relies on the accurate identification and collaborative management of two core tasks: process-driven tasks and event-driven tasks. To achieve precise identification and collaboration, the first step is to collect and manage all data across the charging station, including basic charging pile attributes, real-time operating status, historical maintenance records, customer service dialogue logs, real-time alarms, and historical order data. Through automated extraction, standardized reorganization, and vectorized encoding, this data is constructed into a highly integrated and responsive dynamic RAG knowledge base, providing unified knowledge support for subsequent event analysis and decision-making. Based on this knowledge, one type of task is process-driven tasks, which are essentially predefined, interconnected standard operating procedures, such as a complete charging service sequence covering vehicle authentication, energy transfer, and payment settlement, with a clear sequential dependency in their execution logic. Their corresponding stage definitions, operating rules, and static knowledge of equipment interfaces are stored in the RAG knowledge base in a structured manner, serving as a stable benchmark for system execution and event matching. Process-driven tasks are automatically executed sequentially by the system scheduling engine according to preset logic, forming the foundation for the steady-state operation of the charging station. Another type is event-driven tasks, which are activated instantly by sudden internal or external conditions, such as frequency regulation requirements from the power grid or fault alarms from the equipment itself. These tasks have the highest execution priority and usually require rapid system intervention. Past operational strategies often viewed these two types of tasks separately, failing to delve into the mechanisms of their interaction.
[0021] To address this limitation, this method first performs structured parsing of event-driven tasks. Key control parameters and response rules are extracted from the event source data, such as specific power adjustment values, safety thresholds, or action time limits, to construct a set of event conditions characterizing the nature of the event. Simultaneously, for each stage of the process-driven task, the controlled equipment entities and their real-time operating states are defined in detail, forming a set of stage contexts describing the stage's attributes. Both the event condition set and the stage context set are represented using attribute-value pairs.
[0022] The matching process specifically involves: identifying identical attributes (i.e., attribute pairs with the same key name) in the event condition set and the stage context set. For each identified identical attribute, verifying that the value of that attribute in the stage context set satisfies the logical relationship specified by the corresponding attribute in the event condition set. If at least one identical attribute satisfies its logical relationship, it is determined that the event-driven task has a potential impact on the current process stage, and the stage is added to the preliminary impact stage list of the corresponding event-driven task.
[0023] For example, the condition set for a grid load reduction event is represented as {"target power":"<100kW","response period":"<10s"}, while the context set for the energy transfer phase in the charging process is represented as {"real-time power":"150kW","adjustable capacity":"50kW"}. The system identifies "power" as a relevant attribute (for ease of understanding, the example uses semantically consistent attribute names. In actual systems, "target power" and "real-time power" are identified as the same attribute through a preset attribute mapping table or semantic similarity calculation). Subsequently, the system checks the match between the "real-time power" value (150kW) in the phase context and the logical relationship (<100kW) specified by the "target power" in the event conditions. In this example, the condition is not met, so the event does not affect this phase. If the phase context is {"real-time power":"80kW",...}, then the condition is met, and the phase is added to the impact list.
[0024] All identified affected stages were initially compiled into a preliminary list of impact stages for the event, depicting its potential scope from a business perspective. To ensure the accuracy of subsequent time-series analysis, this list was ultimately rearranged according to the natural order of each stage in the original service flow, generating an ordered preliminary list of impact stages. This ordered structure clearly indicates the unfolding path of the event's impact along the timeline, providing crucial input for gaining deeper insights into conflict patterns under multi-task concurrency and implementing dynamic resource allocation.
[0025] S1-2: Match and map the event-driven task with each stage in the process-driven task to generate a set of mapping pairs, including: Set a similarity threshold T; for each event-driven task, obtain an ordered list of preliminary impact stages of the event-driven task, and check whether the ordered list of preliminary impact stages constitutes a continuous subsequence of the original process stage sequence. The continuous subsequence refers to a continuous and uninterrupted segment in the original process stage sequence. When the inspection result is a continuous subsequence, the continuous subsequence matching mapping operation is performed. The matching mapping operation is to establish a matching mapping between the current event-driven task and all stages in the current ordered list of initial impact stages. When the inspection result is not a continuous subsequence, a similarity calculation matching mapping operation is performed. The matching mapping operation is as follows: the description text of the event-driven task is vectorized and defined as the first vector, and the description text of each stage in the ordered list of preliminary impact stages is vectorized and defined as the second vector. The cosine similarity between the first vector and the second vector is calculated respectively. For stages with a cosine similarity greater than or equal to T, a matching mapping between the event-driven task and the stage is established; for stages with a cosine similarity less than T, no matching mapping is established. Record the matching mapping results of each event-driven task and each stage in the process-driven task, and generate a set of mapping pairs.
[0026] It should be noted that this step aims to establish a precise matching mapping relationship between each event-driven task and each stage of the process-driven task. Its core is to filter and confirm the actual impact points of events on the process. In practice, each independent event-driven task is traversed, and its correlation with each stage of the charging service process is determined one by one. The matching mapping aims to confirm the actual impact of events on specific process stages and record this correspondence.
[0027] To achieve accurate filtering, a similarity threshold T is set in this step. Text vectorization uses the pre-trained model all-MiniLM-L6-v2 (sentence-BERT, outputting a 384-dimensional vector). An empirical initial value is set during system initialization, and after accumulating a certain number of running cycles, the similarity threshold T is automatically and dynamically adjusted based on the statistical distribution of historical similarity data. This threshold is determined based on statistical analysis of a large number of cosine similarity values calculated after vectorizing historical event and stage description texts. All historical similarity values are arranged in ascending order, and the value in the upper quartile is used as the benchmark for threshold T. This method utilizes the distribution characteristics of the data itself, ensuring the objectivity and repeatability of the threshold setting. This reflects the RAG technology paradigm upon which the solution relies: vectorizing event and stage description texts and calculating similarity is essentially a vector retrieval process targeting "task-knowledge" associations.
[0028] During the matching process, the initial list of impact stages of an event is examined. If the stages in this list form a continuous subsequence in the original process sequence (i.e., containing at least two or more stages), and their order is completely consistent with the original process and their positions are adjacent, then it means that the impact of the event is systematic and continuous. For example, a grid load reduction command simultaneously affects three consecutive stages: charging parameter negotiation, energy transfer, and process monitoring. In this case, a matching mapping between the event and all three stages will be directly established.
[0029] If the stages in the initial list are discontinuous in the original process, it indicates that their impact is discrete or local. In this case, more refined semantic similarity calculations are needed. Using text vectorization techniques, the event description and the description of each stage to be determined are transformed into high-dimensional vectors, and the cosine similarity between them is calculated. If the similarity is greater than or equal to a threshold T, it indicates a strong semantic association between the event description and the core function or operation of that stage, thus establishing a mapping; conversely, if it is less than the threshold T, it indicates a weak association, belonging to accidental matching or mismatch, and no mapping is established. For example, a "charging gun head overheating" event has low semantic similarity to the "energy transfer" stage, but high similarity to the "charging process monitoring" stage.
[0030] Ultimately, all successfully established event-stage correspondences were recorded as a set of mapping pairs. This set, in a structured data format, clearly depicts the impact spectrum of different types of events in the charging service process, providing indispensable factual evidence for subsequent analysis of the temporal patterns of event occurrences and coordination of concurrent event conflicts, overcoming the shortcomings of traditional methods that isolate events and processes for analysis.
[0031] S2-1: Obtain the matching relationship matrix based on the set of mapping pairs, including: Create a two-dimensional matrix. The number of rows in the two-dimensional matrix is the total number of event-driven tasks, and the number of columns in the two-dimensional matrix is the total number of process-driven task stages. The initial value of each cell in the matrix is 0. Traverse the set of mapping pairs. For each mapping pair between an event-driven task and a stage in a process-driven task, fill in 1 in the corresponding event-driven task row and the corresponding stage column cell in the process-driven task in the two-dimensional matrix. The final two-dimensional matrix is output and defined as a matching relationship matrix. The first row of the matching relationship matrix is the identifier of each stage in the process-driven task, and the first column is the identifier of the event-driven task.
[0032] It's important to note that creating a two-dimensional matrix transforms the discrete matching mapping relationships between events and process stages into a structured mathematical expression, facilitating systematic analysis and calculation. The rows of this matrix correspond to all event-driven tasks, and the columns correspond to all process-driven task stages, thus forming a complete relational index framework. The assignment of values to each cell in the matrix follows binary logic: a default value of 0 indicates that there is no confirmed matching mapping relationship between the corresponding event and stage; a value of 1 explicitly indicates that the event will have an actual impact on the stage. This 0-1 setting essentially abstracts complex business impact relationships into concise Boolean logic, laying the data foundation for subsequent quantitative statistics and pattern mining.
[0033] The matching matrix is stored in a sparse matrix format, with row and column identifiers corresponding to event IDs (e.g., E001) and stage IDs (e.g., S01), respectively. The total number of events and stages is loaded from the configuration file during system initialization. The core function and meaning of this matching matrix is to comprehensively and intuitively depict the impact of various unforeseen events on each stage of the standard service process within the entire charging station operation scenario. It surpasses traditional analysis methods that rely on experience or isolated cases, providing a global, data-driven relational view. The first row of the matrix is filled with all process stage identifiers, and the first column is filled with all event identifiers. These identifiers serve as crucial header indexes, ensuring that each value "1" in the matrix has clear business semantics, allowing for rapid location and interpretation. For example, scanning a row immediately reveals which stages an event affects; observing a column reveals which events interfere with a stage. This structured representation directly supports subsequent in-depth analysis of event timing patterns and concurrent conflicts.
[0034] S2-2: Construct a continuous sequence of event-driven tasks based on the matching relation matrix, including: Extract the non-zero column index corresponding to each event-driven task in the matching relationship matrix, and generate the impact stage sequence of each event-driven task based on the order of each stage in the original process of the process-driven task corresponding to the non-zero column index. Event-driven tasks that form a continuous subsequence in the original process stage sequence are selected; the selected event-driven tasks are sorted according to the order of the earliest appearing stage in the affected stage sequence in the original process to form a continuous sequence of event-driven tasks.
[0035] It should be noted that, to gain insight into the potential sequence of different events within the operational process, this step involves in-depth analysis of the matching matrix. First, non-zero elements in each event row of the matrix are identified; the column positions of these elements directly indicate the various process stages affected by that event. Based on the chronological relationship of the stages in the original business process, these stage identifiers are organized to obtain a sequence of event-affected stages, which clearly depicts the time window of action for each individual event.
[0036] Subsequently, to construct a "continuous sequence" representing the temporal pattern of events, this method performs a key screening: from all events, it selects event-driven tasks whose impact phase sequences constitute a "continuous subsequence" in the original process phase sequence. Only when the impact phase sequence of an event constitutes a continuous and uninterrupted segment in the original process (i.e., contains at least two consecutive phases) is the event considered to have a predictable temporal impact pattern and eligible to be included in this sequence. Then, based on the order of the earliest appearing phase in the original process of these screened event impact phase sequences, they are sorted to construct the continuous sequence of events. After the impact phase sequence is generated, it is sorted in ascending order by the index of the phase in the original process; if the order of the event continuous sequences has the same starting point, it is sorted in ascending order by the lexicographical order of the event ID to ensure sequence determinism.
[0037] This sequence reflects the inherent relationship between event types with temporal regularity and business process progress. For example, load adjustment instructions are often detected during the charging parameter negotiation stage. By establishing this time-series model based on business logic, the concurrent trends of regular events can be predicted, providing a core basis for the formulation of forward-looking resource allocation and conflict resolution strategies.
[0038] S3-1: Based on the continuous sequence, perform compression and reservation operations on the RAG data corresponding to the event-driven task to obtain compression priority and reservation priority, including: For each event-driven task in the matching relationship matrix, count the number of cells with a value of 1 in the corresponding row and use this as the number of impact stages; Traverse the continuous sequence. If the event-driven task appears in the continuous sequence, record its position index in the continuous sequence; if it does not appear, mark it as not in the continuous sequence and record its position index as 0. For event-driven tasks existing in a continuous sequence, calculate the compression priority of the corresponding RAG data, and set the reserved priority to 0. The compression priority is calculated as follows: the compression priority is the product of the location index, the number of affected stages, and the difference between 1 and the urgency level. For event-driven tasks that are not in a continuous sequence, calculate the reserved priority of the corresponding RAG data, and set the compression priority to 0. The formula for calculating the reservation priority is: Reservation Priority = (Total number of process stages - Number of stages affected) × Event frequency × (1 - Urgency); The urgency level is dynamically calculated based on the specific response time limit requirements of the event and is used to characterize the urgency of the event. The lower the value, the more urgent the event.
[0039] The response time limit requirement is set during system initialization based on the preset urgency level of the event type (e.g., high, medium, low) and the typical response capabilities of the charging station control system actuators (e.g., communication delay, controller cycle, and equipment action time), and is adjusted according to the strategy during operation. The urgency calculation formula is: Urgency = 1 - min(1, Response Time Limit Requirement / Maximum Allowable System Response Time). This formula is designed to transform the response time limit requirement into a standardized indicator representing the 'system's available response time margin'. The ratio of 'Response Time Limit Requirement / Maximum Allowable System Response Time' in the formula quantifies the time share occupied by the event; the difference between '1' and this ratio directly reflects the system's remaining time margin for responding to this event. This 'time margin' indicator is named 'urgency', and the logical conversion from sufficiency to urgency is completed by defining 'the lower the urgency value, the more urgent the event'. This core design ensures that the urgency factor (1 - urgency) in subsequent calculations is exactly equivalent to the original 'time pressure ratio', thereby ensuring that time-critical events receive higher processing priority linearly and automatically. The maximum permissible response time of the system is a system-level constant, determined by analyzing the statistical upper limit of the total delay time (including communication, calculation, and control cycles) from the issuance of the command to the actual power adjustment by the actuator. The frequency of an event is calculated as the proportion of the number of times the event is triggered relative to the total number of events, based on a rolling time window (e.g., the most recent 30 days or a certain number of historical events). For newly occurring events without historical records, the initial frequency is set to a conservative intermediate value, such as 50% of the historical average frequency or a fixed small positive value (e.g., 0.01).
[0040] It should be noted that this step implements targeted knowledge data management strategies based on the temporal patterns exhibited by events within the business process. Its fundamental goal is to optimize the responsiveness of the RAG knowledge base. Firstly, by counting the number of non-zero units in the matching relationship matrix rows of an event, the number of impact stages is obtained. This metric directly reflects the scope and complexity of the event's intervention in the business chain.
[0041] For event-driven tasks that have been selected and sorted according to the rules described in S2-2, i.e., those occupying a place in the continuous sequence (whose impact phase sequence constitutes a continuous subsequence, indicating a clear temporal pattern), their position index in the sequence is recorded. The compression priority is determined by the position index, the number of impact phases, and (1 - urgency). A large position index means the event is often triggered later in the process, at which point the system has accumulated sufficient runtime state information, creating conditions for knowledge data compression or dynamic synthesis. A large number of impact phases indicates a considerable original data size, where compression can bring significant storage benefits. The lower the urgency (i.e., the more urgent the event), the lower the compression priority, thus avoiding over-compression of key knowledge associated with urgent events and ensuring response speed. Therefore, data with high compression priority will be subjected to stronger compression processing to optimize storage efficiency, and its reserved priority is fixed at 0.
[0042] Conversely, for event-driven tasks that are not included in the continuous sequence because their impact phase sequences do not constitute a continuous subsequence (their occurrence is more random or specific), the immediate availability of their knowledge data is crucial. A reservation priority is calculated for such events, its value determined by the product of (total number of process phases - number of impact phases), event frequency, and (1 - urgency). The larger the difference between the total number of phases and the number of impact phases, the more focused and specific the event's impact, and the more difficult it is to derive solutions from conventional process knowledge. A higher event frequency indicates a higher historical occurrence of the event, increasing the likelihood of its knowledge being invoked. A lower urgency indicates a more pressing event, requiring rapid access to its knowledge. Therefore, event knowledge with high reservation priority will be preferentially stored in the cache or optimized using a hybrid retrieval mode to ensure rapid response, with its compression priority fixed at 0.
[0043] By defining compression and reservation priorities for regular events (in a continuous sequence) and random / specific events (not in a continuous sequence), and setting another priority to zero, this method clearly separates the data management objectives: pursuing storage efficiency for the former and ensuring access speed for the latter, thereby optimizing the overall response performance and resource consumption of the knowledge base.
[0044] S3-2: Based on the compression priority and reserved priority, obtain the control weight coefficients for V2G event-driven tasks and clean energy event-driven tasks, including: Normalize the compression priority and the reservation priority respectively to obtain normalized compression priority and normalized reservation priority; V2G event-driven tasks are marked as stable event types, and clean energy event-driven tasks are marked as volatile event types. Assign normalized compression priority as a control weight coefficient to stability event types, and set normalized reserved priority to 0; Assign normalization reserved priority as a control weight coefficient to volatility event types, and set the normalization compression priority to 0.
[0045] It should be noted that V2G event-driven tasks refer to the operation instructions of electric vehicles discharging into the grid according to grid demand or electricity price signals, while clean energy event-driven tasks refer to the operation instructions of adjusting charging power to absorb the fluctuating power generation of photovoltaic or wind power. Since the original numerical ranges of compressed priorities and reserved priorities differ, they need to be normalized separately for easier subsequent comparison and coefficient allocation. Specifically, each priority is divided by the maximum value in its category, mapping the result to between zero and one. When normalizing compressed priorities, the compressed priorities of all "in-sequence events" are divided by their maximum value; when normalizing reserved priorities, the reserved priorities of all "out-of-sequence events" are divided by their maximum value. If there is only one event of a certain type, its normalized priority is directly set to 1.
[0046] Given that V2G operations typically follow grid dispatch plans or time-of-use pricing mechanisms, their occurrence time and power range exhibit certain regularity and predictability; therefore, they are categorized as stable events. Knowledge data for such events is more suitable for compressed storage. Conversely, clean energy output is significantly affected by weather, exhibiting strong intermittency and randomness; therefore, it is categorized as fluctuating events, and its response strategies must ensure immediate availability. Thus, a normalized compression priority is assigned to stable events as a control weight coefficient in multi-objective optimization, while the normalized reserved priority is set to zero. This reflects a strategy that prioritizes storage efficiency optimization for regular events. Conversely, a normalized reserved priority is assigned to fluctuating events as a control weight coefficient, while the normalized compression priority is set to zero. This ensures rapid access to knowledge data when dealing with sudden events. This differentiated weight allocation mechanism provides a quantitative decision-making basis for balancing the conflicts between economic benefits and clean energy consumption, among other multi-objectives.
[0047] S4-1: Determine the equilibrium point power vector based on the control weight coefficients of the V2G event-driven task and the clean energy event-driven task, including: The V2G discharge power vector, the clean energy charging power vector, and the energy storage system regulation power vector are used as the set of decision variables for balance point optimization. The objective function is optimized with economic benefit target, clean energy consumption target, grid support target and battery health target as the balance point. The objective function is in the form of weighted summation. Among them, the weight coefficient of economic benefit target is weighted by normalized compressed priority, and the weight coefficient of clean energy consumption target is weighted by normalized reserved priority. The set of constraints for balance point optimization is based on power balance constraints, equipment capacity constraints, battery charging and discharging mutual exclusion constraints, and power grid safe operation constraints. Using a quadratic programming algorithm, the V2G discharge power setpoint, the clean energy charging power setpoint, and the energy storage system regulation power setpoint that optimize the objective function under all constraints are calculated. These three together constitute the equilibrium point power vector. The equilibrium point is a power allocation benchmark calculated to achieve the optimal balance between economic efficiency, environmental protection, grid security, and equipment health when the time overlaps and the demand for clean energy consumption conflicts with the V2G discharge revenue.
[0048] It's important to note that the core of this step lies in solving a multi-objective optimization problem. The solution defines the optimal power allocation among V2G discharge, clean energy charging, and energy storage system regulation, i.e., the equilibrium point power vector. This optimization model is solved based on real-time system states (such as current power and electricity price signals), breaking the limitations of traditional offline static models and achieving real-time adaptive control. Specifically, the V2G discharge power vector represents the power sequence of each electric vehicle's feedback network, the clean energy charging power vector represents the power allocation for charging using intermittent renewable energy sources, and the energy storage system regulation power vector describes the charging and discharging power used by the energy storage devices to smooth out fluctuations. This set of decision variables together constitutes the core operational command to be optimized.
[0049] The optimization model aims to comprehensively improve multiple operational benefits. Therefore, the objective function integrates four key indicators: economic benefits, clean energy consumption, grid support services, and battery health maintenance. The importance of each indicator is reflected by weight coefficients, which are not fixed but dynamically correlated with event attributes: the weight of the economic benefits target is derived from the normalized compressed priority of V2G events, while the weight of the clean energy consumption target is taken from the normalized reserved priority of clean energy events, thus transforming event characteristics into optimization preferences. Grid support and battery health, as safeguard objectives, are typically preset with fixed constant values based on operational strategies to ensure their stable influence during the optimization process. All weights are normalized before integration to eliminate dimensional differences.
[0050] To ensure the optimization results are practically applicable in engineering, the model must adhere to a series of physical and safety constraints. Power balance constraints maintain the instantaneous conservation of energy within the charging station; equipment capacity constraints ensure that all operations remain within the limits allowed by the hardware; battery charging and discharging mutual exclusion constraints avoid logical contradictions in battery management; and grid safety operation constraints guarantee that local operations do not affect the stable operation of the regional power grid. These constraints collectively define the feasible decision space.
[0051] Given the mathematical form of this optimization problem—a quadratic objective function and linear constraints—quadratic programming becomes an efficient solution tool. The quadratic programming objective function is in the form of weighted least squares, specifically: ,in, For the first The actual power decision variables for each optimization objective The weighting coefficients are for the corresponding objectives. The reference power value is used. The solution is obtained by calling the quadprog (MATLAB) or cvxopt (Python) libraries, with an iteration tolerance of 1e-6. Through systematic numerical iteration, the algorithm ultimately outputs the optimal solution for a set of decision variables: the V2G discharge power setpoint, the clean energy charging power setpoint, and the energy storage system regulation power setpoint. The equilibrium power vector is composed of these three setpoints, representing the optimal trade-off solution derived through rigorous mathematical derivation among multiple conflicting operational objectives. For example, during periods simultaneously facing high electricity prices driving discharge and high photovoltaic output expected to be absorbed, this vector will provide a specific power allocation benchmark that balances revenue and absorption.
[0052] S4-2: Intelligent control of the charging station based on the actual power vector and the equilibrium point power vector, including: Collect actual V2G discharge power, actual clean energy charging power, and actual energy storage system power; For each sampling time, the Euclidean distance between the actual power vector and the equilibrium point power vector is calculated as the instantaneous deviation, and the instantaneous deviations are sorted according to the sampling time to obtain the instantaneous deviation sequence. The average and maximum deviations of the instantaneous deviation sequence within a continuous time window are statistically analyzed. If the average deviation is greater than a preset average deviation threshold or the maximum deviation is greater than a preset maximum deviation threshold, the corresponding time window is marked as a control misalignment point. When a control misalignment is detected, the RAG knowledge base is searched based on the misalignment type. Correction strategies, implementation records, and effect evaluation reports of similar historical misalignment cases are retrieved from the RAG knowledge base. By combining the retrieved case strategies with the current system status, a large language model is used to generate natural language descriptions of correction strategies and multiple sets of candidate instructions.
[0053] It should be noted that the purpose of collecting actual V2G discharge power, clean energy charging power, and energy storage system power is to monitor the charging station's operational status in real time, constructing an actual power vector reflecting the system's instantaneous operating point. Calculating the Euclidean distance between this vector and the equilibrium point power vector quantifies the overall deviation between the current actual operation and the optimized theoretical benchmark; this value is the instantaneous deviation. The larger the instantaneous deviation value, the further the system's operating state deviates from the optimal benchmark, and the worse the control effect; the smaller the deviation value, the closer the operating state is to the ideal equilibrium point.
[0054] The instantaneous deviations at each sampling time are arranged in chronological order to form an instantaneous deviation sequence. This sequence depicts the trajectory of system control deviation over time. By statistically analyzing the average and maximum deviations of this sequence within a continuous time window, the severity of this systemic control offset and the intensity of sudden abnormal shocks are assessed, respectively. A persistently large average deviation indicates a systematic error in the control strategy or a significant change in the external environment; a sudden increase in the maximum deviation indicates equipment failure or a sudden disturbance in the power grid.
[0055] Preset thresholds provide quantitative standards for judging anomalies. The average deviation threshold is set as a certain percentage of the equilibrium point power vector magnitude, such as 10%; the maximum deviation threshold is set as a higher percentage of the magnitude, such as 20%. These two thresholds are determined by analyzing the statistical distribution of deviations in historical normal operation data. For example, twice the standard deviation of the historical average deviation can be used as the average deviation threshold, and the 95th percentile of the historical maximum deviation can be used as the maximum deviation threshold. When the real-time statistical value exceeds either threshold, it is determined that a control misalignment has occurred within that time window, meaning that the system operation has significantly deviated from the predetermined optimized trajectory.
[0056] Once a control misalignment is detected, the aforementioned intelligent correction process is immediately initiated. For example, when a misalignment type of "transformer load rate consistently exceeding 90%" is detected, a RAG retrieval will be triggered based on this. The RAG knowledge base employs a combination of vector retrieval (FAISS index) and keyword retrieval. In vector retrieval, the multidimensional features of the current misalignment (such as deviation type, power range, and time window) are vectorized and their similarity is calculated with the feature vectors of historical cases in the knowledge base. Based on a similarity threshold set separately for case retrieval, historical cases with high relevance are returned first. The method for setting this threshold is consistent with the statistical idea of threshold T: an empirical value (such as 0.8) is used during system initialization, and after accumulating a certain number of historical case retrieval records, it is automatically and dynamically adjusted based on the statistical distribution of these historical retrieval similarity values (for example, taking the upper quartile of all historical case retrieval similarity values).
[0057] First, based on the current misalignment characteristics (such as the main source of the deviation and the time period of occurrence), the RAG knowledge base is retrieved to obtain successful correction cases and their detailed reports for similar historical scenarios (such as historical similar high-load alarm records and handling strategies). Then, these case strategies, along with current real-time grid electricity prices, equipment status, weather forecasts, and other multi-dimensional system status information, are input into the large language model. This large language model employs a pre-trained generative model based on the Transformer architecture and undergoes supervised fine-tuning using text from historical correction reports, grid dispatching procedures, and equipment manuals to endow it with professional knowledge and semantic understanding capabilities in the field of charging station operation and control.
[0058] Based on its powerful semantic understanding and context generation capabilities, the model performs the following steps: analyzing the root cause of the misalignment, comparing the applicable conditions of different historical cases, and comprehensively generating a natural language strategy report that includes causal analysis and risk assessment. For example, regarding the aforementioned transformer high load misalignment, the model-generated report includes the following analysis and recommendations: "The current transformer load rate is 92%. Based on the analysis of similar high load alarm records from the same period in history, the main reason is that the power concentration in the circuit where the CZ-05 charging pile is located is too high. It is recommended to immediately initiate a power flexible load reduction procedure for the charging pile." Such specific operational recommendations in the report constitute candidate control command schemes. Subsequently, the selected scheme is automatically converted into a standardized JSON format command set, such as {"adjustment object":"energy storage power","adjustment amount":"-10kW"} or {"adjustment object":"charging pile power","target device":"CZ-05","adjustment mode":"load reduction"}, and sent to the underlying controller for execution, thereby completing the intelligent correction of the control misalignment.
[0059] Example 2: Based on Example 1, a smart control system for charging stations based on RAG, such as... Figure 2 As shown, it includes: The event flow matching and mapping module is used to obtain flow-driven tasks and event-driven tasks, and generate a set of mapping pairs between events and flow stages through condition matching and similarity calculation. The continuous sequence construction module is used to construct a matching relationship matrix based on a set of mapping pairs, extract the event impact stage sequence, and sort it to form a continuous sequence of event-driven tasks. The RAG data optimization and weight allocation module is used to calculate compression and reservation priorities based on continuous sequences, and then allocate control weight coefficients for V2G and clean energy events after normalization. The equilibrium point control and correction module is used to solve the equilibrium point power vector through quadratic programming based on the control weight coefficients, monitor the actual power deviation, and generate correction instructions using the RAG knowledge base and large language model.
[0060] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. 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 smart control method for charging stations based on RAG, characterized in that, Includes the following steps: S1: Obtain the process-driven tasks and event-driven tasks of the charging station, match and map each stage of the event-driven tasks and process-driven tasks to generate a set of mapping pairs; S2: Obtain a matching relationship matrix based on the set of mapping pairs, and construct a continuous sequence of event-driven tasks based on the matching relationship matrix; S3: Based on the continuous sequence, perform compression and reservation operations on the RAG data corresponding to the event-driven task to obtain the compression priority and reservation priority, and obtain the control weight coefficients of the V2G event-driven task and the clean energy event-driven task based on the compression priority and reservation priority. S4: Determine the equilibrium point power vector based on the control weight coefficients of the V2G event-driven task and the clean energy event-driven task, and perform intelligent control of the charging station based on the actual power vector and the equilibrium point power vector.
2. The intelligent control method for charging stations based on RAG as described in claim 1, characterized in that, The process-driven and event-driven tasks for acquiring charging stations include: The process-driven task is a control task that is executed in a preset step sequence and where there are dependencies between the steps. The event-driven task is a priority control task that is triggered by a specific external event and executed immediately and independently. For each event-driven task, the event triggering conditions are parsed and a set of event conditions is generated; For each stage of a process-driven task, the stage operation objects and execution status are parsed and a stage context set is generated. Match each event-driven task with the execution conditions of each stage in the process-driven task. If the event condition set and the stage context set have the same attribute, and the attribute value in the stage context set satisfies the logical relationship specified by the corresponding attribute in the event condition set, then add the corresponding stage to the preliminary impact stage list of the corresponding event-driven task. For each event-driven task, the initial impact phase list is sorted according to the order of the phases in the original process phases of the process-driven task, generating an ordered initial impact phase list.
3. The intelligent control method for charging stations based on RAG as described in claim 1, characterized in that, The step of matching and mapping the event-driven task with each stage of the process-driven task to generate a set of mapping pairs includes: Set a similarity threshold T; for each event-driven task, obtain an ordered list of preliminary impact stages of the event-driven task, and check whether the ordered list of preliminary impact stages constitutes a continuous subsequence of the original process stage sequence. The continuous subsequence refers to a continuous and uninterrupted segment in the original process stage sequence. When the inspection result is a continuous subsequence, the continuous subsequence matching mapping operation is performed. The matching mapping operation is to establish a matching mapping between the current event-driven task and all stages in the current ordered list of initial impact stages. When the inspection result is not a continuous subsequence, a similarity calculation matching mapping operation is performed. The matching mapping operation is as follows: the description text of the event-driven task is vectorized and defined as the first vector, and the description text of each stage in the ordered list of preliminary impact stages is vectorized and defined as the second vector. The cosine similarity between the first vector and the second vector is calculated respectively. For stages with a cosine similarity greater than or equal to T, a matching mapping between the event-driven task and the stage is established; for stages with a cosine similarity less than T, no matching mapping is established. Record the matching mapping results of each event-driven task and each stage in the process-driven task, and generate a set of mapping pairs.
4. The intelligent control method for charging stations based on RAG as described in claim 1, characterized in that, The process of obtaining the matching relationship matrix based on the set of mapping pairs includes: Create a two-dimensional matrix. The number of rows in the two-dimensional matrix is the total number of event-driven tasks, and the number of columns in the two-dimensional matrix is the total number of process-driven task stages. The initial value of each cell in the matrix is 0. Traverse the set of mapping pairs. For each mapping pair between an event-driven task and a stage in a process-driven task, fill in 1 in the corresponding event-driven task row and the corresponding stage column cell in the process-driven task in the two-dimensional matrix. The final two-dimensional matrix is output and defined as a matching relationship matrix. The first row of the matching relationship matrix is the identifier of each stage in the process-driven task, and the first column is the identifier of the event-driven task.
5. The intelligent control method for charging stations based on RAG as described in claim 1, characterized in that, The step of constructing a continuous sequence of event-driven tasks based on the matching relationship matrix includes: Extract the non-zero column index corresponding to each event-driven task in the matching relationship matrix, and generate the impact stage sequence of each event-driven task based on the order of each stage in the original process of the process-driven task corresponding to the non-zero column index. Event-driven tasks that form a continuous subsequence in the original process stage sequence are selected; the selected event-driven tasks are sorted according to the order of the earliest appearing stage in the affected stage sequence in the original process to form a continuous sequence of event-driven tasks.
6. The intelligent control method for charging stations based on RAG as described in claim 1, characterized in that, The step of performing compression and reservation operations on the RAG data corresponding to the event-driven task based on the continuous sequence, and obtaining the compression priority and reservation priority, includes: For each event-driven task in the matching relationship matrix, count the number of cells with a value of 1 in the corresponding row and use this as the number of impact stages; Traverse the continuous sequence. If the event-driven task appears in the continuous sequence, record its position index in the continuous sequence; if it does not appear, mark it as not in the continuous sequence and record its position index as 0. For event-driven tasks existing in a continuous sequence, calculate the compression priority of the corresponding RAG data, and set the reserved priority to 0. The compression priority is calculated as follows: the compression priority is the product of the location index, the number of affected stages, and the difference between 1 and the urgency level. For event-driven tasks that are not in a continuous sequence, calculate the reserved priority of the corresponding RAG data, and set the compression priority to 0. The formula for calculating the reservation priority is: Reservation Priority = (Total number of process stages - Number of stages affected) × Event frequency × (1 - Urgency); The urgency level is dynamically calculated based on the specific response time limit requirements of the event and is used to characterize the urgency of the event. The lower the value, the more urgent the event.
7. The intelligent control method for charging stations based on RAG as described in claim 1, characterized in that, The process of obtaining the control weight coefficients for V2G event-driven tasks and clean energy event-driven tasks based on the compression priority and the reservation priority includes: Normalize the compression priority and the reservation priority respectively to obtain normalized compression priority and normalized reservation priority; V2G event-driven tasks are marked as stable event types, and clean energy event-driven tasks are marked as volatile event types. Assign normalized compression priority as a control weight coefficient to stability event types, and set normalized reserved priority to 0; Assign normalization reserved priority as a control weight coefficient to volatility event types, and set the normalization compression priority to 0.
8. The intelligent control method for charging stations based on RAG as described in claim 1, characterized in that, The determination of the equilibrium point power vector based on the control weight coefficients of the V2G event-driven task and the clean energy event-driven task includes: The V2G discharge power vector, the clean energy charging power vector, and the energy storage system regulation power vector are used as the set of decision variables for balance point optimization. The objective function is optimized with economic benefit target, clean energy consumption target, grid support target and battery health target as the balance point. The objective function is in the form of weighted summation. Among them, the weight coefficient of economic benefit target is weighted by normalized compressed priority, and the weight coefficient of clean energy consumption target is weighted by normalized reserved priority. The set of constraints for balance point optimization is based on power balance constraints, equipment capacity constraints, battery charging and discharging mutual exclusion constraints, and power grid safe operation constraints. Using a quadratic programming algorithm, the V2G discharge power setpoint, the clean energy charging power setpoint, and the energy storage system regulation power setpoint that optimize the objective function under all constraints are calculated. These three together constitute the equilibrium point power vector. The equilibrium point is a power allocation benchmark calculated to achieve the optimal balance between economic efficiency, environmental protection, grid security, and equipment health when the time overlaps and the demand for clean energy consumption conflicts with the V2G discharge revenue.
9. The intelligent control method for charging stations based on RAG as described in claim 1, characterized in that, The intelligent control of the charging station based on the actual power vector and the equilibrium point power vector includes: Collect actual V2G discharge power, actual clean energy charging power, and actual energy storage system power; For each sampling time, the Euclidean distance between the actual power vector and the equilibrium point power vector is calculated as the instantaneous deviation, and the instantaneous deviations are sorted according to the sampling time to obtain the instantaneous deviation sequence. The average and maximum deviations of the instantaneous deviation sequence within a continuous time window are statistically analyzed. If the average deviation is greater than a preset average deviation threshold or the maximum deviation is greater than a preset maximum deviation threshold, the corresponding time window is marked as a control misalignment point. When a control misalignment is detected, the RAG knowledge base is searched based on the misalignment type. Correction strategies, implementation records, and effect evaluation reports of similar historical misalignment cases are retrieved from the RAG knowledge base. By combining the retrieved case strategies with the current system status, a large language model is used to generate natural language descriptions of correction strategies and multiple sets of candidate instructions.
10. A smart control system for charging stations based on RAG, used to implement the smart control method for charging stations based on RAG as described in any one of claims 1-9, characterized in that, include: The event flow matching and mapping module is used to obtain flow-driven tasks and event-driven tasks, and generate a set of mapping pairs between events and flow stages through condition matching and similarity calculation. The continuous sequence construction module is used to construct a matching relationship matrix based on a set of mapping pairs, extract the event impact stage sequence, and sort it to form a continuous sequence of event-driven tasks. The RAG data optimization and weight allocation module is used to calculate compression and reservation priorities based on continuous sequences, and then allocate control weight coefficients for V2G and clean energy events after normalization. The equilibrium point control and correction module is used to solve the equilibrium point power vector through quadratic programming based on the control weight coefficients, monitor the actual power deviation, and generate correction instructions using the RAG knowledge base and large language model.