Microgrid pre-switching controller based on lightweight temporal neural network and method thereof

CN122951210APending Publication Date: 2026-10-20VILION (SHENZHEN) NEW ENERGY TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611434865.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-09-16
Publication Date
2026-10-20

AI Technical Summary

Technical Problem

[0006]本发明针对现有并离网切换控制器存在的故障响应滞后、切换冲击大、平滑度差的技术问题,提供一种基于轻量级时序神经网络的微电网预切换控制器及方法,通过轻量级时序神经网络预测模块对电网状态进行预测并给出预切换指令,将传统被动切换转变为主动切换,以降低切换滞后性以及切换过程中的电压跌落、频率波动和冲击电流对负载及设备的影响

Benefits of technology

[0017]与现有技术比较,本发明通过轻量级时序神经网络Tiny TCN提前预测电网状态并输出预切换指令,实现了从被动响应到主动预判的切换范式转变,有效降低了切换滞后性;通过预切换指令、分闸指令、离网运行指令的三阶段时序控制,使PCS和开关提前完成切换准备,显著抑制了切换过程中的电压和电流冲击;通过模型参数量小于50KB、推理耗时小于100ms/次的轻量化设计及Int8量化部署至MCU,解决了神经网络在资源受限边缘设备上的实时推理难题;通过三级风险等级划分及多维度电网状态参数结合滑动平均滤波和异常计时器的综合判定机制,有效区分了暂态波动与真实故障,降低了误判率,实现了毫秒级的并离网平滑切换,显著提升了微电网运行的稳定性与供电可靠性。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure FT_1
    Figure FT_1
  • Figure FT_2
    Figure FT_2
  • Figure FT_3
    Figure FT_3
Patent Text Reader

Abstract

This invention provides a microgrid pre-switching controller and method based on a lightweight time-series neural network. The controller includes a status acquisition module, a timing prediction module, a switching decision module, and an execution control module. The timing prediction module uses a Tiny TCN network, which is deployed to the MCU after Int8 quantization. The switching decision module supports two modes: prediction algorithm combined with threshold triggering and threshold triggering only. The strategy management unit performs four-level priority determination for emergency stop, protection, manual / EMS commands, and automatic mode. The fault probability is predicted and three-level risk levels are divided through Tiny TCN. The risk level boundary is adaptively adjusted based on the prediction accuracy to correspond to different pre-switching actions. A three-stage timing control is adopted, consisting of pre-switching command, tripping command, and off-grid operation command. This invention also integrates multi-dimensional electrical parameters with sliding average values ​​and anomaly timers for grid status determination, achieving millisecond-level smooth switching.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of microgrid control technology, specifically to a microgrid pre-switching controller and method based on a lightweight temporal neural network. Background Technology

[0002] With the large-scale integration of distributed energy resources, the application of microgrids is becoming increasingly widespread. Achieving smooth switching between grid-connected and off-grid operation of microgrids has become a key technology for ensuring power supply reliability. Switching a microgrid from grid-connected to off-grid operation can be divided into two scenarios: planned off-grid switching and unplanned off-grid switching. Planned off-grid switching refers to actively disconnecting the microgrid from the main grid upon receiving an off-grid operation command; unplanned off-grid switching refers to passive off-grid switching caused by sudden grid failures or anomalies, requiring rapid and reliable switching in emergency situations.

[0003] However, existing microgrid grid-connected / off-grid switching control technologies mainly have the following problems: First, the response mode is passive and lacks predictive capability. Existing technologies mainly rely on fixed thresholds to determine the grid status, and only respond passively after a fault occurs. This "fault first, switch later" mode inevitably has a response lag, and the threshold setting is difficult, making it prone to misjudgment due to grid disturbances, thus affecting the continuity of power supply.

[0004] Secondly, the switching process is characterized by significant inrush and poor smoothness. During the switch from grid-connected to off-grid operation, mismatches in voltage amplitude, frequency, and phase can trigger large inrush currents, adversely affecting loads and equipment. Simultaneously, voltage dips and frequency fluctuations during the switching process also degrade power quality.

[0005] Third, the deployment of prediction models is difficult. In recent years, although some research has attempted to apply time-series neural networks to the fields of microgrid load and power prediction, existing models have a large number of parameters, making deployment on resource-constrained edge devices (such as microcontrollers, MCUs) difficult. How to achieve lightweight models while ensuring prediction accuracy, and how to deeply integrate them with the microgrid grid-connected / off-grid switching control logic, are currently pressing technical challenges that need to be addressed. Summary of the Invention

[0006] This invention addresses the technical problems of existing grid-connected and off-grid switching controllers, such as delayed fault response, large switching impact, and poor smoothness. It provides a microgrid pre-switching controller and method based on a lightweight time-series neural network. The lightweight time-series neural network prediction module predicts the grid state and issues pre-switching commands, transforming the traditional passive switching into active switching. This reduces switching lag and the impact of voltage drops, frequency fluctuations, and inrush currents on loads and equipment during the switching process.

[0007] To achieve the above-mentioned objectives, this invention provides a microgrid pre-switching controller based on a lightweight temporal neural network. The controller is located at the microgrid grid connection point and includes: The status acquisition module is used to perform ADC sampling on the three-phase voltage on the grid side, the three-phase voltage on the load side, and the three-phase current on the grid side, and to filter and calibrate the acquired data. The time series prediction module is used to construct a lightweight time series neural network and identify and predict the power grid state. At the same time, the trained model is exported after Int8 quantization and adapted for deployment on the microcontroller. The lightweight time series neural network is a Tiny TCN network. The switching decision module includes a strategy management unit, a grid-connected switching off-grid operation strategy unit, and an off-grid switching grid-connected operation strategy unit. The strategy management unit is used to select a prediction algorithm combined with a threshold triggering mode or a threshold triggering mode only. The grid-connected switching off-grid operation strategy unit and the off-grid switching grid-connected operation strategy unit combine the prediction results of the timing prediction module to generate a pre-switching instruction, so as to prepare the switches, circuit breakers, and PCS for switching in advance. The execution control module is used to receive control commands issued by the switching decision module and execute actions, collect equipment status and feed it back to the switching decision module.

[0008] Furthermore, the execution control module includes: An action execution unit is used to receive control commands issued by the switching decision module and output digital control signals; The equipment status feedback unit is used to collect equipment status information and feed it back to the switching decision module; The action interlocking and protection unit is used to interlock and verify the sequence of switch actions and the operating status of the PCS. When an abnormality is detected, it prevents the execution of subsequent switching actions.

[0009] The present invention also provides a microgrid pre-switching control method based on a lightweight temporal neural network, wherein the control is performed based on the microgrid pre-switching control device described in any of the above claims, and the method includes the following steps: S100: Perform ADC sampling on the three-phase voltage on the grid side, the three-phase voltage on the load side, and the three-phase current on the grid side, and perform filtering and calibration processing on the collected voltage and current data; S200. Construct a lightweight temporal neural network to identify and predict the power grid state. Simultaneously, quantize the trained lightweight temporal neural network model using Int8 and export it, then deploy it to the microcontroller. The lightweight temporal neural network is a Tiny TCN network. S300 selects a prediction algorithm combined with threshold triggering mode or threshold triggering mode only, and generates a pre-switching command based on the prediction results of the timing prediction module, thereby controlling the switch, circuit breaker and PCS to prepare for switching in advance. S400 receives control commands from the switching decision module and executes actions, while simultaneously collecting equipment status and feeding it back to the switching decision module, thus forming a closed-loop control.

[0010] Furthermore, in step S100, the filtering and calibration processing of the collected voltage and current data specifically includes: S110. First-order IIR low-pass filter is used to filter the collected voltage and current data to remove high-frequency noise and retain low-frequency effective signals. S120. Perform bias calibration on the filtered data to eliminate zero-point error, then perform gain calibration, and correct the proportional relationship using full scale to obtain the calibrated data.

[0011] Further, step S200 specifically includes: S210. Construct a lightweight Tiny TCN temporal neural network, wherein the Tiny TCN temporal neural network model has fewer than 50KB of parameters and an inference time of less than 100ms / inference. S220. Input the preprocessed data into the constructed Tiny TCN temporal neural network model for training; S230. Perform Int8 quantization on the trained Tiny TCN temporal neural network model; S240, export to a specific format and adapt for deployment to a microcontroller.

[0012] Furthermore, in step S300, the policy management unit executes the following priority determination process: (1) Determine whether an emergency stop is triggered. If it is triggered, execute the emergency stop command and determine whether the execution is successful. Record the abnormal alarm information and report the status of the switch or relay. Otherwise, proceed to the next step. (2) Determine whether protection is triggered. If it is triggered, execute the protection command and determine whether the execution is successful. Record the abnormal alarm information and report the status of the switch or relay. Otherwise, proceed to the next step. (3) Determine whether a manual switching command or an EMS command has been received. If so, execute the manual switching command or the EMS switching command, and determine whether the execution was successful. Record the abnormal alarm information and report the status of the switch or relay. Otherwise, proceed to the next step. (4) When the above steps (1)-(3) are not triggered, execute the prediction algorithm combined with the threshold trigger mode or the threshold trigger mode only, and determine whether the execution is successful, record the abnormal alarm information and feed back the status of the switch or relay; Among them, the grid connection and off-grid switching strategies include timing control and strategies for grid connection to off-grid switching and timing control and strategies for off-grid to grid connection switching.

[0013] Furthermore, the timing control for grid-connected to off-grid switching includes: The prediction algorithm combined with the threshold trigger mode for grid connection switching and off-grid timing control is as follows: First, the timing prediction module provides the prediction result. When the prediction is about to occur, a pre-switching command is issued to the PCS to prepare for the operation. Until the grid fault is detected and confirmed, a trip command is issued to the static transfer switch or circuit breaker, and a status check is performed. After the trip is confirmed, an off-grid operation command is issued to the PCS to realize the off-grid operation switching. The specific timing control for grid-connected switching to off-grid operation under threshold-triggered mode is as follows: when a grid power failure is detected, a tripping command is sent to the static transfer switch or circuit breaker, and a status check is performed. After confirming the tripping, an off-grid operation command is sent to the PCS to realize the switching to off-grid operation.

[0014] Furthermore, the grid-connected to off-grid switching operation strategy includes: S310. Obtain the current voltage time sequence data and input it into the Tiny TCN time sequence neural network model to output the predicted fault probability value; S320: Pre-sets three risk levels—low, medium, and high—corresponding to different fault probability ranges. Each risk level corresponds to a different equipment action. When at a low risk level, it continuously monitors and records data. When at a medium risk level, it reduces the load on non-critical loads and pre-sets the logic of switches. When at a high risk level, the PCS adjusts the voltage or frequency in advance and pre-sets the logic of switches. S330. Statistically analyze the historical prediction accuracy data of the Tiny TCN time-series neural network model over a recent period and calculate its prediction accuracy. Based on the prediction accuracy, generate a correction coefficient and dynamically adjust the fault probability range through the correction coefficient, thereby adaptively and in real time determining the current fault risk level. S340. Obtain the time sequence of the current three-phase voltage, and calculate the effective value, frequency, total harmonic distortion rate, positive sequence component, and negative sequence component of the current three-phase voltage, as well as the voltage imbalance. The formula for calculating the voltage imbalance is: In the formula, Represents the positive sequence voltage component. Indicates the negative sequence voltage component; S350. Set thresholds, including maximum voltage limit, minimum voltage limit, maximum frequency limit, minimum frequency limit, maximum voltage imbalance, negative sequence component limit, and maximum total harmonic distortion rate. The fault risk level is determined in real time based on the comprehensive adaptive judgment and the triggering conditions of the set thresholds, and the power grid status is determined according to the corresponding moving average.

[0015] Furthermore, in step S350, the power grid status determination specifically includes: If the threshold in the set threshold is not triggered, it is determined to be in a normal state and continues to operate in grid connection. When any of the set thresholds is triggered, the moving average is calculated based on the data from the N sampling points closest to the current sampling point. The moving average includes the average voltage, average frequency, average voltage imbalance, average negative sequence component, and average total harmonic distortion. When all moving averages are within their respective preset normal ranges, the abnormal timer is cleared, the system is determined to be in a normal state, and grid-connected operation is maintained. When the abnormal timer exceeds the preset delay threshold, the system is marked as abnormal and an off-grid command is issued. Otherwise, it is classified as a transient fluctuation and grid-connected operation is maintained.

[0016] Furthermore, the off-grid switching and grid-connection operation strategy includes: S310' After a power grid fault is detected and the grid is restored, continue to monitor the power grid parameters, including voltage, frequency, phase and rate of change of frequency, until it is confirmed that the power grid has been stably restored to operation. S320': Send a pre-synchronization command to the PCS until the PCS meets the synchronization conditions, and then feed back the synchronization status of the PCS. S330': Issue a closing command to the static transfer switch or circuit breaker; otherwise, record the alarm and retry or terminate grid connection. S340 sends a grid connection command to the PCS to complete the off-grid to grid connection switch.

[0017] Compared with existing technologies, this invention uses a lightweight temporal neural network, Tiny TCN, to predict the grid state in advance and output pre-switching commands, realizing a shift in the switching paradigm from passive response to active prediction, effectively reducing switching lag. Through three-stage timing control of pre-switching commands, tripping commands, and off-grid operation commands, the PCS and switches complete switching preparations in advance, significantly suppressing voltage and current surges during the switching process. With a lightweight design of less than 50KB model parameters and less than 100ms / inference time, and Int8 quantization deployment to the MCU, the real-time inference challenge of neural networks on resource-constrained edge devices is solved. Through a comprehensive judgment mechanism combining three-level risk classification and multi-dimensional grid state parameters with moving average filtering and anomaly timers, transient fluctuations and real faults are effectively distinguished, reducing the false judgment rate and achieving millisecond-level smooth switching between grid connection and off-grid operation, significantly improving the stability and power supply reliability of microgrid operation. Attached Figure Description

[0018] Various other advantages and benefits will become apparent to those skilled in the art upon reading the detailed description of the embodiments described below. The accompanying drawings are for illustrative purposes only and are not intended to limit the invention. Furthermore, the same reference numerals denote the same parts throughout the drawings. In the drawings: Figure 1 This is a schematic diagram of the microgrid pre-switching controller based on a lightweight temporal neural network in this invention; Figure 2 This is the interaction topology diagram between the controller and external devices in this invention; Figure 3 This is the timing control diagram for the grid-connected to off-grid switching operation in the threshold-triggered mode of this invention. Figure 4 This invention is a sequence control diagram for grid-connected to off-grid switching, which combines a prediction algorithm with a threshold-triggered mode. Figure 5 This is the sequence control diagram for off-grid switching and grid-connection operation in this invention; Figure 6 This is a flowchart of the microgrid pre-switching control method based on a lightweight temporal neural network in this invention. Detailed Implementation

[0019] The technical solution of the present invention will be described in detail below with reference to the accompanying drawings and specific embodiments. The following embodiments are only used to illustrate the present invention and should not be regarded as limiting the scope of the present invention.

[0020] Example 1 See Figure 1 , Figure 2This embodiment provides a microgrid pre-switching controller based on a lightweight time-series neural network. The controller is set at the microgrid grid connection point (also known as a PCC controller). The interaction between the controller and external devices includes: sampling the grid-side voltage and load-side voltage, sampling the grid-side current; controlling the opening and closing of external switches and relays; and communicating with external PCS (Power Conversion System), EMS (Energy Management System) and meters to achieve intelligent grid-connected and off-grid switching control through hardware and software collaboration.

[0021] The controller includes a status acquisition module, a timing prediction module, a switching decision module, and an execution control module.

[0022] The status acquisition module is used to perform ADC sampling on the three-phase voltage on the grid side, the three-phase voltage on the load side, and the three-phase current on the grid side, and to filter and calibrate the acquired data. The time series prediction module is used to build a lightweight time series neural network and identify and predict the power grid state. At the same time, the trained model is quantized with Int8 and exported for deployment on the microcontroller. The lightweight time series neural network is the Tiny TCN network. The switching decision module includes a strategy management unit, a grid-connected switching off-grid operation strategy unit, and an off-grid switching grid-connected operation strategy unit. The strategy management unit is used to select a prediction algorithm combined with a threshold triggering mode or a threshold triggering mode only. The grid-connected switching off-grid operation strategy unit and the off-grid switching grid-connected operation strategy unit combine the prediction results of the timing prediction module to generate pre-switching instructions, so as to prepare the switches, circuit breakers and PCS for switching in advance. The execution control module is used to receive control commands issued by the switching decision module and execute actions, collect equipment status and feed it back to the switching decision module.

[0023] The data interaction relationship between the modules in this controller is as follows: the voltage timing sequence value and real-time voltage effective value obtained by the status acquisition module are input to the core control and prediction algorithm module; the strategy management module selects the control mode or sets the priority; the voltage timing sequence value is input to the timing prediction module, and the real-time voltage effective value is input to the switching decision module; the switching decision module issues PCS control commands to the PCS and issues opening and closing commands to the switch or circuit breaker; the action status of the execution control module is fed back to the switching decision module, forming a closed-loop control.

[0024] In this embodiment, the controller achieves intelligent active control of microgrid grid-to-grid and off-grid switching through the coordinated operation of four modules.

[0025] In this embodiment, the execution control module includes an action execution unit, a device status feedback unit, and an action interlocking and protection unit, wherein: The action execution unit receives control commands (such as tripping command, closing command, PCS mode switching command, etc.) issued by the switching decision module, and converts them into corresponding digital control signals for output, so as to control the opening and closing of the switch, the activation of the relay, and the switching of the PCS working mode. The equipment status feedback unit collects the switch's open / closed status, relay's energized status, PCS operating mode status, and fault alarm information in real time, and uploads the feedback results to the switching decision module for action confirmation, anomaly detection, and subsequent control logic judgment. The action interlocking and protection unit performs interlocking verification on the sequence of switch actions and the operating status of the PCS. For example, during the grid-connected to off-grid switching process, if a switch tripping failure is detected, the PCS has not completed off-grid mode preparation, or there is an equipment malfunction, subsequent switching actions are prevented to ensure system safety.

[0026] Example 2 like Figure 6 As shown, this embodiment provides a microgrid pre-switching control method based on a lightweight temporal neural network, which includes the following steps: S100. Status Acquisition and Data Processing. The three-phase voltage on the grid side, the three-phase voltage on the load side, and the three-phase current on the grid side are sampled by an ADC at a sampling frequency of 20kHz. The acquired voltage and current data are then filtered and calibrated. The filtering process is as follows: A first-order IIR low-pass filter is used to filter the raw voltage and current data obtained by the ADC sampling to remove high-frequency noise and retain low-frequency effective signals. The first-order IIR low-pass filter is expressed by the formula:

[0027] In the formula, This indicates the currently sampled voltage and current values. This indicates the current filter output value. The filtered output value at the previous moment, These represent the filter coefficients, used to control the filter strength. , The larger the value, the faster the filtering response, but the weaker the noise suppression capability; The smaller the value, the smoother the filter response but the stronger the noise suppression capability. Those skilled in the art can select an appropriate value based on the actual sampling frequency and power grid noise characteristics. value.

[0028] The calibration process consists of two steps: bias calibration and gain calibration. First, the filtered data is biased to eliminate zero-point error, which is to subtract the output offset when there is no input signal. Then, gain calibration is performed, and the proportional relationship is corrected using a full-scale standard signal to obtain the calibrated voltage and current data.

[0029] S200, Timing Prediction. A lightweight timing neural network (Tiny TCN) is constructed to identify and predict the power grid state. The trained lightweight timing neural network model is then exported after Int8 quantization and deployed to the microcontroller.

[0030] This step specifically includes: S210. Construct a lightweight Tiny TCN temporal neural network. The Tiny TCN network constructed in this embodiment adopts a structure combining depthwise separable convolution and dilated convolution, which significantly reduces the number of parameters while ensuring the ability to extract temporal features. The Tiny TCN temporal neural network model has less than 50KB of parameters and an inference time of less than 100ms / inference.

[0031] S220. Model Training. The preprocessed voltage time-series data is input into the constructed TinyTCN time-series neural network model for training. The training process includes: acquiring historical voltage time-series data (e.g., three-phase voltage data from the past 10 cycles); cleaning, normalizing, or standardizing the data; dividing the dataset into training, validation, and test sets according to a preset ratio (e.g., 7:2:1); training the model using the training set and adjusting the hyperparameters using the validation set until the TinyTCN time-series neural network model achieves the preset performance requirements on the validation set.

[0032] S230. Model Quantization. The trained Tiny TCN temporal neural network model is quantized using Int8, and the floating-point weights are quantized into 8-bit integers to reduce the model size and computational overhead during inference.

[0033] S240. Model Export and Deployment. The quantized Tiny TCN temporal neural network model is exported to a specific format (such as Keras, TFLite, or .h5) and adapted for deployment in a microcontroller. The microcontroller receives real-time power grid operation data and analyzes and predicts the trend of power grid state changes through a lightweight inference prediction model.

[0034] S300, Switching Decision. Select a prediction algorithm combined with threshold triggering mode or threshold triggering mode only, and generate pre-switching instructions based on the timing prediction results of the off-grid switching strategy, controlling switches, circuit breakers and PCS to prepare for switching in advance.

[0035] The strategy management unit performs the judgment according to the following priority order: (1) Highest priority - emergency stop determination: Determine whether an emergency stop signal is triggered. If it is triggered, immediately execute the emergency stop command, disconnect all switches and stop the PCS operation, record the abnormal alarm information and report the status of the switch or relay, and the process ends; otherwise, proceed to the next determination.

[0036] (2) Second highest priority - protection judgment: Determine whether a protection signal (such as overcurrent protection, overvoltage protection, etc.) is triggered. If it is triggered, execute the protection command, perform the corresponding protection action according to the protection type, record the abnormal alarm information and feed back the status of the switch or relay, and the process ends; otherwise, proceed to the next judgment.

[0037] (3) Medium priority - Manual / EMS instruction determination: Determine whether a manual switching instruction or an EMS switching instruction has been received. If received, execute the corresponding switching instruction, record the abnormal alarm information and provide feedback on the status of the switch or relay, and the process ends; otherwise, proceed to the next determination.

[0038] (4) Lowest priority - automatic mode determination: When the above emergency stop, protection and manual / EMS commands are not triggered, the prediction algorithm is executed in combination with threshold trigger mode or threshold trigger mode only (selected according to system configuration), and it is determined whether the execution is successful, abnormal alarm information is recorded and the status of switch or relay is fed back.

[0039] The above four-level priority determination process ensures priority response and orderly control in emergency situations.

[0040] Among them, grid-connected to off-grid switching includes the following two timing control modes: (i) Predictive algorithm combined with threshold triggering mode for grid connection to off-grid timing control See Figure 4 First, the timing prediction module provides the prediction result. When a fault is predicted to occur, a pre-switching command is sent to the PCS to prepare (such as adjusting voltage and frequency). After receiving the pre-switching command, the PCS completes the preparation work for off-grid mode in advance. Subsequently, when a grid fault is detected and confirmed, a tripping command is quickly sent to the static transfer switch (STS) or circuit breaker, and a status check is performed. After confirming the tripping, an off-grid operation command is sent to the PCS to realize the off-grid operation switchover. In this mode, because the PCS has completed the preparation work in advance, the time from fault detection and confirmation to completion of the switchover is significantly shortened, effectively suppressing the switching inrush current.

[0041] (ii) Grid-connected to off-grid switching timing control in threshold-triggered mode only See Figure 3Upon detecting a power outage, a tripping command is directly issued to the static transfer switch or circuit breaker, and a status check is performed. After confirming the tripping, an off-grid operation command is issued to the PCS to achieve off-grid operation switching. This mode serves as a backup mode, used when the prediction module is unavailable or the system is configured in threshold-only mode.

[0042] The specific operational strategies for grid-connected to off-grid switching include: S310, Fault Probability Prediction. Obtain the current voltage time series data, input it into the Tiny TCN time series neural network model, and output the predicted fault probability value (range 0-1).

[0043] S320, Level 3 Risk Assessment and Pre-Switching Actions. Three risk levels—low, medium, and high—are pre-set, each corresponding to a different fault probability range. Different equipment actions are assigned to each of the three risk levels. When the risk level is low (e.g., the failure probability P satisfies 0≤P<0.3), continuous monitoring and data recording are performed without pre-switch preparation. When the risk level is medium (e.g., the failure probability P satisfies 0.3≤P<0.7), non-critical loads are reduced and switches are pre-positioned logically. When the risk level is high (e.g., the failure probability P satisfies 0.7≤P≤1.0), the PCS adjusts the voltage or frequency and switches in advance for logic pre-positioning.

[0044] The failure probability ranges corresponding to the above risk levels are for illustrative purposes only. The specific values ​​in actual applications can be determined by those skilled in the art based on the actual working conditions.

[0045] S330. Dynamic Adjustment. Statistically analyze the historical prediction accuracy of the Tiny TCN time-series neural network model over a recent period (e.g., one week or one month) and calculate its prediction accuracy. Based on this accuracy, generate a correction coefficient: when the accuracy is high (e.g., above a preset first threshold, such as 90%), it indicates high model prediction reliability; in this case, narrow the fault probability boundaries of each risk range, reduce the frequency of pre-switching actions, and avoid over-preparation. When the accuracy is low (e.g., below a preset second threshold, such as 70%), it indicates a large model prediction deviation; in this case, widen the fault probability boundaries of the risk range, activate pre-switching protection at each level in advance, and ensure safety margins. This correction coefficient dynamically adjusts the fault probability range, thereby adaptively determining the current fault risk level in real time.

[0046] S340. Calculation of multiple parameters of the power grid. Obtain the time sequence of the current three-phase voltage, calculate the effective value, frequency, total harmonic distortion (THD), positive sequence component, and negative sequence component of the current three-phase voltage, and calculate the voltage imbalance. The formula for calculating the voltage imbalance is: In the formula, Represents the positive sequence voltage component. This represents the negative sequence voltage component.

[0047] S350, Threshold Setting and Comprehensive Judgment. Thresholds are set, including maximum voltage limit, minimum voltage limit, maximum frequency limit, minimum frequency limit, maximum voltage imbalance, negative sequence component limit, and maximum total harmonic distortion (THD). The fault risk level is comprehensively and adaptively determined in real-time, along with the triggering conditions of the set thresholds. The grid status is then judged based on the corresponding moving average. The specific grid status judgment process is as follows: If no threshold among the set thresholds is triggered, it is determined to be in a normal state and continues to operate in grid-connected mode; When any of the set thresholds is triggered, the sample is selected based on the closest point to the current sampling point. Calculate the moving average of the data from each sampling point ( The value is determined by those skilled in the art based on the actual sampling frequency and power grid conditions; for example, it can be set to 100-200 sampling points. The moving average includes the voltage average. Average frequency Average voltage imbalance Average value of negative order components and the average total harmonic distortion rate When the following conditions are met simultaneously:

[0048]

[0049]

[0050]

[0051]

[0052] If the abnormal timer is cleared, the system is considered to be in a normal state and continues to operate in grid-connected mode. If the abnormal timer exceeds the preset delay threshold (e.g., 100ms), the system is marked as abnormal and an off-grid command is issued. Otherwise, the system is classified as a transient fluctuation and continues to operate in grid-connected mode.

[0053] By using the aforementioned sliding average and abnormal timer mechanisms, it is possible to effectively distinguish between transient fluctuations in the power grid (such as instantaneous voltage drops caused by lightning strikes or heavy load inputs) and real faults (such as power outages or short circuits), significantly reducing the misjudgment rate and unnecessary switching operations.

[0054] The specific operational strategy for off-grid switching to grid connection is as follows: S310', Power Grid Recovery Monitoring. After a power grid fault is detected to have been recovered, power grid parameters, including voltage, frequency, phase, and rate of change of frequency (ROCOF), are continuously monitored until it is confirmed that the power grid has stably resumed operation (i.e., all parameters are within the normal range for a preset time). S320', Pre-synchronization. A pre-synchronization command is sent to the PCS, causing the PCS to begin synchronization adjustment until the PCS meets the synchronization conditions (voltage amplitude difference, frequency difference, and phase difference are all within the allowable range). The PCS then feeds back the synchronization status to the PCC controller. S330', Closing Operation. A closing command is sent to the static transfer switch or circuit breaker. If closing fails, an alarm is recorded, and the process is retried or terminated based on the fault type. S340', Grid connection complete. After confirming the closing status, a grid connection command is sent to the PCS, causing the PCS to switch to grid-connected operation mode, completing the off-grid to grid-connected switchover.

[0055] See Figure 5 The off-grid to grid connection switching sequence control process is as follows: The system continuously monitors the power grid status. Once the power grid fault is resolved and stable operation is confirmed, a pre-synchronization command is sent to the PCS. The PCS completes a self-check of synchronization conditions (including voltage amplitude, frequency, and phase synchronization) and feeds back the synchronization status to the PCC controller. After confirmation by the PCC, a closing command is sent to the static transfer switch or circuit breaker. After confirming the closing status, a grid connection command is sent to the PCS, thus realizing the off-grid to grid connection operation switching.

[0056] S400, Execution Control. Receives control commands from the switching decision module and executes actions, while simultaneously collecting equipment status data and feeding it back to the switching decision module, forming a closed-loop control.

[0057] In summary, the microgrid pre-switching controller and method based on a lightweight temporal neural network provided by this invention can be widely applied to various microgrid systems, especially in scenarios with high power supply reliability requirements such as industrial parks, commercial complexes, and data centers. This invention deploys a lightweight temporal neural network on an MCU to achieve real-time prediction at the edge, without relying on cloud computing power. It offers flexible deployment, low cost, and good industrial practicality and application prospects.

[0058] The foregoing has provided a detailed description of a microgrid pre-switching controller and method based on a lightweight temporal neural network, as provided by this invention. Specific examples have been used to illustrate the principles and implementation methods of this invention. The descriptions of the embodiments above are merely for the purpose of helping to understand the core ideas of this invention. It should be noted that those skilled in the art can make various improvements and modifications to this invention without departing from its principles, and these improvements and modifications also fall within the protection scope of the claims of this invention.

Claims

1. A microgrid pre-switching controller based on a lightweight temporal neural network, characterized in that, The controller is located at the microgrid connection point and includes: The status acquisition module is used to perform ADC sampling on the three-phase voltage on the grid side, the three-phase voltage on the load side, and the three-phase current on the grid side, and to filter and calibrate the acquired data. The time series prediction module is used to build a lightweight time series neural network and identify and predict the power grid state. At the same time, the trained model is quantized with Int8 and exported for deployment on the microcontroller. The lightweight time series neural network is the Tiny TCN network. The switching decision module includes a strategy management unit, a grid-connected switching off-grid operation strategy unit, and an off-grid switching grid-connected operation strategy unit. The strategy management unit is used to select a prediction algorithm combined with a threshold triggering mode or a threshold triggering mode only. The grid-connected switching off-grid operation strategy unit and the off-grid switching grid-connected operation strategy unit combine the prediction results of the timing prediction module to generate pre-switching instructions, so as to prepare the switches, circuit breakers and PCS for switching in advance. The execution control module is used to receive control commands issued by the switching decision module and execute actions, collect equipment status and feed it back to the switching decision module. The execution control module includes: The action execution unit is used to receive control commands issued by the switching decision module and output digital control signals; The equipment status feedback unit is used to collect equipment status information and feed it back to the switching decision module; The action interlocking and protection unit is used to interlock and verify the sequence of switch actions and the operating status of the PCS. When an abnormality is detected, it prevents the execution of subsequent switching actions.

2. A microgrid pre-switching control method based on a lightweight temporal neural network, characterized in that, Control is performed based on the microgrid pre-switching controller based on a lightweight temporal neural network as described in claim 1. The method includes the following steps: S100: Perform ADC sampling on the three-phase voltage on the grid side, the three-phase voltage on the load side, and the three-phase current on the grid side, and perform filtering and calibration processing on the collected voltage and current data. S200: Construct a lightweight temporal neural network to identify and predict the power grid state. Simultaneously, quantize the trained lightweight temporal neural network model with Int8 and export it, then deploy it to the microcontroller. The lightweight temporal neural network is a Tiny TCN network. S300 selects a prediction algorithm combined with threshold triggering mode or threshold triggering mode only, and generates a pre-switching command based on the prediction results of the timing prediction module, thereby controlling the switch, circuit breaker and PCS to prepare for switching in advance. S400 receives control commands from the switching decision module and executes actions, while simultaneously collecting equipment status and feeding it back to the switching decision module, thus forming a closed-loop control.

3. The microgrid pre-switching control method based on a lightweight temporal neural network as described in claim 2, characterized in that, In step S100, the filtering and calibration processing of the collected voltage and current data specifically includes: S110. A first-order IIR low-pass filter is used to filter the acquired voltage and current data to remove high-frequency noise and retain the effective low-frequency signal. The first-order IIR low-pass filter is expressed by the following formula: In the formula, These represent the filter coefficients, used to control the filter strength. , Indicates the current sampled value. This indicates the current filter output value. The filtered output value at the previous moment; S120. Perform bias calibration on the filtered data to eliminate zero-point error, then perform gain calibration, and correct the proportional relationship using full scale to obtain the calibrated data.

4. The microgrid pre-switching control method based on a lightweight temporal neural network as described in claim 3, characterized in that, Step S200 specifically includes: S210. Construct a lightweight Tiny TCN temporal neural network, wherein the Tiny TCN temporal neural network model has fewer than 50KB of parameters and an inference time of less than 100ms / inference. S220. Input the preprocessed data into the constructed Tiny TCN temporal neural network model for training; S230. Perform Int8 quantization on the trained Tiny TCN temporal neural network model; S240, export to a specific format and adapt for deployment to a microcontroller.

5. The microgrid pre-switching control method based on a lightweight temporal neural network as described in claim 4, characterized in that, In step S300, the policy management unit executes the following priority determination process: (1) Determine whether an emergency stop is triggered. If it is triggered, execute the emergency stop command and determine whether the execution is successful. Record the abnormal alarm information and report the status of the switch or relay. Otherwise, proceed to the next step. (2) Determine whether the protection is triggered. If it is triggered, execute the protection command and determine whether the execution is successful. Record the abnormal alarm information and report the status of the switch or relay. Otherwise, proceed to the next step. (3) Determine whether a manual switching command or an EMS command has been received. If so, execute the manual switching command or the EMS switching command, and determine whether the execution was successful. Record the abnormal alarm information and report the status of the switch or relay. Otherwise, proceed to the next step. (4) When the above steps (1)-(3) are not triggered, execute the prediction algorithm combined with the threshold trigger mode or the threshold trigger mode only, and determine whether the execution is successful, record the abnormal alarm information and feed back the status of the switch or relay; Among them, the grid connection and off-grid switching strategies include the timing control and operation strategies for grid connection to off-grid switching and the timing control and operation strategies for off-grid to grid connection switching.

6. The microgrid pre-switching control method based on a lightweight temporal neural network as described in claim 5, characterized in that, The timing control for grid-connected to off-grid switching includes: The prediction algorithm combined with the threshold trigger mode for grid connection switching and off-grid timing control is as follows: First, the timing prediction module provides the prediction result. When the prediction is about to occur, a pre-switching command is issued to the PCS to prepare for the operation. Until the grid fault is detected and confirmed, a trip command is issued to the static transfer switch or circuit breaker, and a status check is performed. After the trip is confirmed, an off-grid operation command is issued to the PCS to realize the off-grid operation switching. The specific timing control for grid-connected switching to off-grid operation under threshold-triggered mode is as follows: when a grid power failure is detected, a tripping command is sent to the static transfer switch or circuit breaker, and a status check is performed. After confirming the tripping, an off-grid operation command is sent to the PCS to realize the switching to off-grid operation.

7. The microgrid pre-switching control method based on a lightweight temporal neural network as described in claim 5, characterized in that, The grid-connected to off-grid switching operation strategy includes: S310. Obtain the current voltage time sequence data and input it into the Tiny TCN time sequence neural network model to output the predicted fault probability value; S320: Pre-sets three risk levels—low, medium, and high—corresponding to different fault probability ranges. Each risk level corresponds to a different equipment action. When at a low risk level, it continuously monitors and records data. When at a medium risk level, it reduces the load on non-critical loads and pre-sets the logic of switches. When at a high risk level, the PCS adjusts the voltage or frequency in advance and pre-sets the logic of switches. S330. Statistically analyze the historical prediction accuracy data of the Tiny TCN time-series neural network model over a recent period and calculate its prediction accuracy. Based on the prediction accuracy, generate a correction coefficient and dynamically adjust the fault probability range through the correction coefficient, thereby adaptively and in real time determining the current fault risk level. S340. Obtain the time sequence of the current three-phase voltage, and calculate the effective value, frequency, total harmonic distortion rate, positive sequence component, and negative sequence component of the current three-phase voltage, as well as the voltage imbalance. The formula for calculating the voltage imbalance is: In the formula, Represents the positive sequence voltage component. Represents the negative sequence voltage component; S350. Set thresholds, including maximum voltage limit, minimum voltage limit, maximum frequency limit, minimum frequency limit, maximum voltage imbalance, negative sequence component limit, and maximum total harmonic distortion rate. The fault risk level is determined in real time based on the comprehensive adaptive judgment and the triggering conditions of the set thresholds, and the power grid status is determined according to the corresponding moving average.

8. The microgrid pre-switching control method based on a lightweight temporal neural network as described in claim 7, characterized in that, In step S350, the power grid status determination specifically includes: If the threshold in the set threshold is not triggered, it is determined to be in a normal state and continues to operate in grid connection. When any of the set thresholds is triggered, the sample is selected based on the closest point to the current sampling point. The moving average is calculated from the data at each sampling point. The moving average includes the average voltage. Average frequency Average voltage imbalance Average value of negative order components and the average total harmonic distortion rate When the following conditions are met simultaneously: , , , , If the abnormal timer is zero, it is determined to be in a normal state and the grid-connected operation is maintained. If the abnormal timer exceeds the preset delay threshold, it is marked as an abnormal state and an off-grid command is issued. Otherwise, it is classified as a transient fluctuation and the grid-connected operation is maintained.

9. The microgrid pre-switching control method based on a lightweight temporal neural network as described in claim 5, characterized in that, The off-grid switching and grid connection operation strategy includes: S310' After the power grid fault is detected to be restored, the power grid parameters, including voltage, frequency, phase and rate of change of frequency, are continuously monitored until the power grid is confirmed to have been stably restored to operation. S320': Send a pre-synchronization command to the PCS until the PCS meets the synchronization conditions, and then feed back the synchronization status of the PCS. S330': Issue a closing command to the static transfer switch or circuit breaker; otherwise, record the alarm, retry, or terminate grid connection. S340' sends a grid connection command to the PCS to complete the off-grid to grid connection switch.