Auto-coupling step-down starting fan control method and system for data center
Through the combination of strategic gradient algorithm and PID controller, the autotransformer and motor starting are accurately controlled, which solves the current impact and harmonic problems in the autotransformer starting mode in the data center, improves the stability of the power grid and equipment life, and realizes Develop an energy-saving and low-carbon power system.
Patent Information
- Application Number
- CN202410558855.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-08
- Publication Date
- 2024-10-01
- Estimated Expiration
- 2044-05-08
AI Technical Summary
In the existing technology, the auto-coupling step-down starting mode has current impact and harmonic problems in the data center fire protection power grid, which affects the stability of the power grid and the life of the equipment.
The strategy gradient algorithm combined with the PID controller is used to extract the intrinsic modal components and energy entropy of the power grid to accurately control the tap and step-down starting time of the autotransformer, and optimize the motor starting process to reduce current and harmonics.
It effectively reduces the impact on the power grid, extends the service life of the equipment, improves the stability and robustness of the power grid, avoids harmonic pollution, and realizes an energy-saving and low-carbon power system.
Smart Images

Figure CN118399794B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data center power grids, and in particular to a data center fire protection power grid with an auto-coupling step-down starting mode, and in particular to an auto-coupling step-down starting fan control method and system for a data center. Background Art
[0002] Data centers store a large amount of data and carry out key business operations, so their safety is of vital importance. As an important part of the data center fire protection system, fire fans can quickly exhaust smoke when a fire occurs, reduce smoke damage to equipment, and thus ensure the safe operation of the data center.
[0003] The main electrical component of the fire fan is the motor. In the original traditional technology, the motor of the fire fan used in the data center adopts the star-delta step-down starting mode. When starting, the motor first runs in star connection, at which time the current and voltage are small. Then, the motor's star connection is switched to delta connection through a converter, so that the motor can run at a high speed and improve efficiency.
[0004] However, this traditional technology will generate a large starting current, which will cause a certain degree of impact on the power grid system of the data center, and thus easily affect data storage. Therefore, the existing technology further introduces the auto-transformer step-down starting mode, that is, using an autotransformer to reduce the voltage when the motor starts, thereby reducing the impact of the starting current on the power grid. This starting method is particularly suitable for high-power motors, especially in data centers with limited power grid capacity or frequent starting.
[0005] However, the introduction of the autotransformer step-down starting mode also has corresponding technical problems: although the autotransformer can reduce the starting voltage, the starting current will still be relatively high due to the impedance characteristics of the motor. The reason is that the impedance of the motor is mainly composed of resistance and reactance. When the motor starts, the rotor has not yet rotated or the speed is very low, so the reactance value of the rotor is very small, so the overall impedance of the motor is relatively low. Even if the voltage applied to the motor is reduced by the autotransformer, due to the small motor impedance, the current will still be relatively large according to Ohm's law. In addition, the motor needs a large torque and current during the starting process to accelerate from a stationary state to the rated speed.
[0006] In this case, a large current flowing through the power grid will cause a temporary voltage drop, which can easily affect the normal operation of other equipment in the data center. At the same time, transformers, switches and other equipment in the power grid may also be overloaded or even damaged because they cannot withstand the excessive current. In addition, the large current will increase the power loss in the power grid and reduce the efficiency of the power grid.
[0007] Moreover, the motor itself is a nonlinear load, especially in the starting phase. When the current waveform of the motor is not a pure sine wave, harmonics will be generated (that is, although the voltage is reduced, the current is still large. When a large current flows, the waveform of the grid voltage is distorted, which in turn generates harmonics). When the motor starts, if it runs at the same time as these devices, it will interfere with each other, further aggravating the generation of harmonics. If a variable frequency motor is used, the harmonic pollution will be aggravated. Because there are many devices in the data center, various electrical equipment are connected to each other through the power grid. The harmonics generated when the motor starts may be transmitted to other equipment through the power grid, which will interfere with the normal operation of other equipment in the data center.
[0008] To this end, the present invention proposes a control method and system for an auto-coupling step-down starting fan for a data center. Summary of the invention
[0009] In view of this, the embodiments of the present invention hope to provide a method and system for controlling an auto-coupling step-down starting fan for a data center to solve or alleviate the technical problems existing in the prior art, namely:
[0010] (1) How to accurately control the tap selection of the autotransformer to reduce grid shock;
[0011] (2) How to adapt and control the time of step-down starting to reduce the current and torque impact during switching;
[0012] (3) Based on the above two points, the harmonic problem is optimized.
[0013] The technical solution of the present invention is achieved in this way:
[0014] First, a method for controlling a self-coupling step-down starting fan for a data center:
[0015] 1. Overview:
[0016] This technical solution aims to achieve two technical requirements: one is to obtain the step adjustment interval and the vector of the adjustment amount of the tap of the autotransformer, and the other is to control the time of step-down starting so that the motor can smoothly switch to full-voltage operation after reaching the appropriate speed. In this way, the starting current can be effectively reduced by gradually adjusting the voltage, and the time of step-down starting can be accurately controlled to smoothly switch to full-voltage operation after the motor reaches the appropriate speed. The synergy of the two can also optimize the harmonic problem.
[0017] Considering that the tap adjustment of the autotransformer is not a one-time decision, but needs to be continuously adjusted according to the real-time state of the motor and the conditions of the power grid. Each adjustment decision will affect the starting performance of the motor and the stability of the power grid, and in the process of adjusting the tap, the state of the power grid and the motor will change continuously, and these changes can be regarded as the feedback of the environment to the action of the agent. The agent needs to optimize its action strategy based on these feedbacks to achieve better starting performance and power grid stability. Therefore, after the technical problem to be solved by the present invention is abstracted, it is equivalent to a sequential decision problem, so this technical solution chooses to introduce a policy gradient algorithm (Policy Gradient) to solve the technical problem to be solved.
[0018] (ii) Extraction of intrinsic mode components:
[0019] Normally, the input of the policy gradient algorithm should be signals such as the voltage and current of the power grid; however, considering that the original voltage and current signals may contain a large amount of redundant information and noise, the algorithm may be disturbed during the training process, reducing learning efficiency and even affecting the accuracy of the final strategy. In addition, voltage and current signals are the basic representation of the power grid state, but they may not fully reflect the deep characteristics or dynamic behavior of the power grid. Therefore, the present invention needs to first extract the intrinsic mode components in the power grid to solve this technical problem. It includes the following steps:
[0020] 2.1 Signal segmentation:
[0021] First, according to the actual power grid characteristics, the spectrum segmentation of the power grid signal is determined, that is, the spectrum of the signal is divided into several continuous intervals, each interval corresponds to a mode. If the spectrum of the signal is divided into N intervals, the frequency range of the i-th interval can be expressed as:
[0022] ;
[0023] Among them, ω i,min and ω i,max are the minimum and maximum frequencies of the ith interval, respectively.
[0024] 2.2 Wavelet filter design:
[0025] For each spectrum interval, a corresponding wavelet filter is designed to extract the signal components in that interval. The frequency response of the filter is Φ i (ω) is expressed as:
[0026] ;
[0027] 2.3 Signal decomposition:
[0028] The original signal x(t) is decomposed by the designed wavelet filter to obtain a series of intrinsic mode components (IMFs). The i-th intrinsic mode component IMF i (t) can be expressed as:
[0029] ;
[0030] Where F represents Fourier transform, F −1 Represents the inverse Fourier transform.
[0031] 2.4 Perform threshold processing on each IMF to remove noise:
[0032] Assume the threshold of the i-th IMF is τ i , then the denoised IMF' i (t) can be expressed as:
[0033] ;
[0034] Or use soft thresholding:
[0035] ;
[0036] 2.5 Quantitative thinking:
[0037] Based on the above four steps, the IMF' i (t), it is necessary to select the eigenmode components with higher energy expression content, because they may contain more information about the power grid status, and the data feasibility can be further improved on the basis of the eigenmode components.
[0038] Energy entropy can be used to quantify the distribution and complexity of energy in a signal, which helps to identify IMF components that contain important information. Therefore, the following steps are further introduced:
[0039] 2.5.1 Calculate energy distribution:
[0040] First, calculate the energy of each IMF component. This can be done by calculating the sum of squares or integrals of the IMFs:
[0041] ;
[0042] In practical applications, this integral can be approximated by discretely sampling IMF'i(t) and summing them.
[0043] 2.5.2 Normalized energy distribution:
[0044] After calculating the energy of each IMF, these energy values can be normalized to better compare the energy distribution between different IMFs:
[0045] ;
[0046] Here, the denominator is the sum of all IMF energies.
[0047] 2.5.3 Calculate energy entropy:
[0048] With the normalized energy distribution, the energy entropy H can be calculated:
[0049] ;
[0050] This entropy value quantifies the IMF of each intrinsic mode component. i (t) distribution and complexity of energy. A higher entropy value means that the energy distribution is more uniform, while a lower entropy value indicates that some IMF components contain relatively more energy. In this way, the IMF with the highest energy content and the lowest energy entropy is selected from each series of IMFs at each time step. i (t), which is used as the intrinsic mode component IMF in the following steps S100 and S2 i (t), because its components are based on energy entropy, it is considered to contain important information about the state of the power grid.
[0051] (III) Technical solution
[0052] The policy gradient algorithm of the present invention includes the following steps S1 to S6.
[0053] 3.1 Step S1, initialize the policy network:
[0054] A parameterized strategy network is set, whose input is the current state of the power grid and the motor, and whose output is the step adjustment interval of the tap and the vector SDV of the adjustment amount, and the network weight α is initialized. Specifically, the strategy network includes the following steps S100-S101.
[0055] 3.1.1 Step S100, current status:
[0056] Current Status t is an intrinsic mode component IMF i (t). It can be extracted by the method provided above.
[0057] 3.1.2 Step S101, define the policy network:
[0058] The policy network is a neural network PN, which is a multi-layer perceptron (MLP); it is defined as:
[0059] PN = MLP(input dim , hidden dim , output dim);
[0060] Among them, MLP represents a multi-layer perceptron network, input dim is the input state s t The dimension of the vector (i.e., IMF i (t) dimension), hidden dim is the dimension of the hidden layer (can be adjusted according to the complexity of the problem), output dim is the dimension of the output vector SDV.
[0061] The forward propagation strategy of the neural network PN is: the given input state vector is regarded as the intrinsic mode component IMF i (t), the output of the policy network is the vector SDV, and the method for obtaining the vector SDV is:
[0062] SDV = PN(IMF i (t); α);
[0063] Among them, PN represents the forward propagation function of the policy network, and α is the network weight. This function maps the input state to the output vector SDV according to the current weight and network structure.
[0064] The vector SDV is composed of:
[0065] SDV = [Δs1, Δs2, ..., Δs n , i1, i2, ..., i n ];
[0066] Among them, Δs1, Δs2, ..., Δs n Represents the adjustment amount for each tap. Their values can be continuous, indicating the distance or number of steps the tap needs to move, or discrete, indicating which preset position the tap should move to. The adjustment amount can be positive (adjusting upward) or negative (adjusting downward). i1, i2, ..., i n Represents the tap index or number that needs to be adjusted, corresponding to the relative interval of the tap adjustment amount in a continuous time step (in some practical situations, not all taps may need to be adjusted, so these indices indicate which taps should be adjusted according to the corresponding Δs value).
[0067] During the training process, the weight α of the policy network is updated according to the policy gradient algorithm to maximize a certain reward function. The weight update method is expressed as:
[0068] α new = α old + η * ∇α J(α old );
[0069] Where η is the learning rate, ∇α J(α old ) is the reward function J with respect to the original weight α old The gradient of , in the policy gradient algorithm, this gradient is estimated by sampling the trajectory.
[0070] 3.2 Step S2, collecting samples:
[0071] In the actual environment, according to the tap adjustment value Δs output by the current neural network PN i (t) to collect sample s and record the intrinsic mode component IMF of each step of each sample s s (t) i , reward vector A and new intrinsic mode component IMF s (t) i '. It includes the following steps S200~S201.
[0072] 3.2.1 Step S200, adjust according to the output of the neural network PN:
[0073] First, according to the output Δs of the neural network PN at the current time step t i (t) to adjust the tap. This adjustment represents the distance or number of steps the tap should move:
[0074] Δs i (t) = PN(IMF i (t);α);
[0075] Then, the neural network PN outputs a "state-action pair":
[0076] ;
[0077] Among them, π α (a t |s t ) is in state s t Take action a t The probability of is given by the policy network PN. (s t , a t ) is a "state-action pair".
[0078] 3.2.2 Step S201, recording data, including:
[0079] 1) IMF before adjustment s (t) i ;
[0080] 2) The amount of adjustment performed Δs i (t);
[0081] 3) Adjusted new intrinsic mode component IMF s (t) i ';
[0082] 4) Reward vector A, which contains the reward information obtained by performing this adjustment:
[0083] The reward vector A is calculated based on the performance of the system after the adjustment. This includes whether the stability of the power grid system is improved. The stability depends on whether the motor smoothly transitions from low voltage startup to full voltage operation. The design of the reward function is a key part of the policy gradient algorithm, and it should be able to reflect the goals we expect the system to achieve:
[0084] A = R(IMF s (t) i , Δs i (t), IMF s (t) i ');
[0085] Among them, R is the reward function, which calculates the reward based on the intrinsic mode components before and after adjustment and the adjustment amount. It is a reward function based on system stability and transition smoothness.
[0086] The above data constitutes a sample s, which is expressed as:
[0087] s = {IMF s (t) i , Δs i (t), IMF s (t) i ', A};
[0088] 3.3 Step S3, calculate the cumulative reward:
[0089] For each sample s trajectory, calculate the cumulative reward sequence B from the beginning of this step to the end of the trajectory:
[0090] s = {s1, s2, ..., s T};
[0091] Where T is the length of the trajectory;
[0092] Each state s t Corresponding to an immediate reward r t , the way to obtain the cumulative reward sequence B is:
[0093] ;
[0094] Where γ is a discount factor (0<γ≤1) used to adjust the importance of future rewards. When γ=1, future rewards have the same weight as current rewards; when γ<1, the weight of future rewards will gradually decrease. t is the current state s t The time point index in the trajectory, k is the accumulation point.
[0095] 3.4 Step S4, update the neural network PN:
[0096] Use the Actor-Critic algorithm to update the weight α of the neural network PN according to the cumulative reward sequence B to the weight α new The goal is to increase the probability of actions that result in high cumulative rewards and reduce the probability of actions that result in low cumulative rewards. The steps include the following steps S400~S401.
[0097] 3.4.1 Step S400, update weights:
[0098] The weight update method of the neural network PN is implemented through the Actor network, which is represented as:
[0099] ;
[0100] in: is in state s t Take action a t The probability of is given by the Actor network. is the gradient of the log probability with respect to the policy network weights.
[0101] η is the learning rate, which controls the step size of weight update. δ is the TD error (Temporal Difference Error). If δ is positive, it means that the reward obtained is higher than expected, so we should increase this action a t The probability of being selected; if δ is negative, the action a should be reduced t probability.
[0102] The Actor network is responsible for the log-probability Calculate the gradient of the policy network weights, which indicates how to adjust the policy parameters to increase or decrease the specific action a t The probability of being selected.
[0103] 3.4.2 Step S401, Critic network evaluation:
[0104] The critic network predicts the function V(s t ) and prediction function V(s t+1 ) for state s t and the state s at the next time stept+1 That is, it is used to evaluate the state or action state value to help the Actor network know whether its action is good or bad. The Critic network guides the update direction of the Actor network by calculating the TD error δ.
[0105] The Critic network, also known as the value network, is used to evaluate the state or action state value. It helps the Actor network know whether its actions are good or bad, and guides the update direction of the Actor network by calculating the TD error δ:
[0106] ;
[0107] Among them, r t is in state s t Take action a t The immediate reward obtained after t ) and V(s t+1 ) are respectively the Critic network for the state s t and t+1 The prediction function of the value of .
[0108] The weights of the Critic network are updated by minimizing the square of the TD error, which allows the Critic network to predict the value of the state more accurately.
[0109] 3.5 Step S5, iterative optimization:
[0110] Repeat steps S2 to S4 until the performance of the neural network PN reaches a preset standard or the number of iterations reaches an upper limit. It includes the following steps:
[0111] S501, repeated sampling: In each iteration, new state-action pairs (s t , a t ) and the corresponding reward vector A.
[0112] S502, cumulative reward calculation: For each sampled state-action pair (s t , a t ), calculate its cumulative reward:
[0113] ;
[0114] Among them, R t is the cumulative reward at time step t, r t+k is the reward obtained at time step t+k.
[0115] S503, policy network update: using cumulative reward R t To update the weight α of the neural network PN, the purpose is to increase the cumulative reward R tThe action of t and reduce the action a that results in a low cumulative reward t Probability:
[0116] ;
[0117] Among them, the cumulative reward R t is used as a scaling factor to adjust the step size of the gradient update. If an action results in a high cumulative reward, then the gradient update for that action will be strengthened to a greater extent, thereby increasing the probability of this action being selected in the future. Conversely, if the cumulative reward is low, then the magnitude of the gradient update will be reduced, reducing the probability of this action being selected in the future.
[0118] Or, the TD error δ can be viewed as an adjusted cumulative reward that takes into account the difference between the current reward and the expected reward, thereby reducing the variance and accelerating the learning process. Therefore, in the formula for updating the policy network weights, it is preferred to use the TD error to implicitly update the policy network weights.
[0119] S504, stop condition: the iteration process will continue until a certain stop condition is met, which may be that the performance of the neural network PN reaches a preset standard (for example, a certain winning rate or score on the test set), or the number of iterations reaches a set upper limit.
[0120] 3.6 Step S6, perform actual adjustment:
[0121] Calculate the vector SDV and apply it to the autotransformer; then set the parameters of the PID controller and set the target speed and allowable error range of the motor, and accept the vector SDV;
[0122] Dynamically adjust the set point of the PID controller according to the tap adjustment vector;
[0123] 3.6.1 Step S600, application vector SDV:
[0124] After obtaining the vector SDV, reduce its dimension and obtain the step adjustment interval i of the tap i and adjustment value Δs i , and then adjust the autotransformer accordingly:
[0125] SDV = PN(IMF i (t); α new );
[0126] SDV = [i i , Δs i ];
[0127] 3.6.2 Step S601, applying PID controller:
[0128] The basic form is:
[0129] ;
[0130] Where u(t) is the output signal of the controller. e(t) is the deviation between the set point and the actual measured value (the difference between the target speed and the actual speed). K p , K i , K d are the gains of the proportional, integral, and derivative controllers respectively. dτ is a continuous constant.
[0131] The set point is the target speed or switching time of the motor; the strategy is that if the adjustment a is to increase the tap voltage, the set point of the PID controller is increased accordingly to increase the motor speed, thereby shortening the step-down starting time; the adjustment a is vice versa; then, the PID controller calculates the control amount based on the difference between the real-time speed and the target speed. The control amount is used to adjust the step-down starting time of the motor to ensure that the motor smoothly accelerates to the appropriate speed and then switches to full-voltage operation. Set the above conditions as constraints and update the PID controller to:
[0132] ;
[0133] The first constraint is made on the error signal e(t). Dynamically adjusting the set point is actually adjusting the tap adjustment amount Δs at each time step. i To update the set point SP(t) of the PID controller. PV(t) is the process variable (the real-time speed of the motor).
[0134] The second constraint is to limit the output signal u(t). By introducing the maximum and minimum value constraints, it can avoid excessive impact on the system; u max and u min are the maximum and minimum limit values of the control signal respectively.
[0135] Among them, the first constraint can further introduce additional constraints:
[0136] ;
[0137] Where u(t) is the original PID controller output. K c is an adjustment coefficient used to control the influence of the constraint term. sgn(e(t)) is the sign function of the error e(t) and is used to keep the constraint term consistent with the error direction. c (t) is used as the control signal to drive the system.
[0138] If |e(t)|>ϵ, it means that the error exceeds the allowable range, and the above constraint term is introduced to adjust the output of the PID controller. This constraint term is a function based on the error, which is used to reduce the amplitude of the control signal or change its direction to prevent the system from getting out of control.
[0139] (IV) Summary of technical solutions:
[0140] 1) Extraction of intrinsic mode components and their energy entropy: As a preprocessing step of the algorithm, we extract the intrinsic mode components and their energy entropy from the power grid. The purpose of this step is to screen and evaluate the state of the power grid and provide basic data for subsequent control strategies.
[0141] 2) Step S1: Initialize the strategy network: In this step, a strategy network is established and initialized. This strategy network will be used to learn how to adjust the tap of the autotransformer according to the grid state to optimize the starting and operation of the motor.
[0142] 3) Step S2: Collect samples: A series of "state-action pair" samples are collected through interaction with the environment. These samples will be used to train the policy network so that it can learn better control strategies.
[0143] 4) Step S3: Calculate the cumulative reward: For each sample collected, calculate its cumulative reward. This reward function reflects the quality of the control strategy and is the goal of policy network learning.
[0144] 5) Step S4: Update the policy network: Use the collected samples and accumulated rewards to update the policy network. Through continuous iteration and optimization, the policy network gradually learns how to select the optimal control action according to the power grid status.
[0145] 6) Step S5: Iterative optimization: Repeat steps S2 to S4 and perform multiple iterative optimizations until the performance of the policy network reaches a satisfactory level.
[0146] 7) Step S6: PID controller performs actual adjustment: After the strategy network is trained, it is combined with the PID controller to perform the actual adjustment operation. First, the step adjustment interval and the vector (SDV) of the adjustment amount that controls the tap of the autotransformer are obtained according to the output of the strategy network. Then, this vector is applied to adjust the tap of the autotransformer to control the time of the step-down start and the speed of the motor. By accurately controlling the time of the step-down start, it can smoothly switch to full-voltage operation after the motor reaches the appropriate speed. This gradually adjusted voltage can not only effectively reduce the starting current, but also optimize the harmonic problem by working in conjunction with the PID controller.
[0147] Second, the auto-coupling step-down starting fan control system for data centers:
[0148] The invention comprises two fan motors using stator string autotransformer step-down starting control circuits, and the autotransformer is provided in the connection terminal; the control circuit of each fan motor is connected to an EMC controller, the I2C port of the EMC controller is connected to an MCU controller, and the MCU controller is connected to a memory storing program instructions;
[0149] When the program instructions are executed by the MCU controller, the EMC controller controls and implements the auto-coupling step-down starting fan control method for a data center as described above.
[0150] Compared with the prior art, the present invention has the following beneficial effects:
[0151] 1. Intelligent adjustment strategy: Through the iterative optimization process (S1~S5) of the strategy gradient algorithm, the system can autonomously learn and continuously optimize the control strategy, making the tap adjustment of the autotransformer more accurate and efficient. This self-learning and optimization capability enables the motor system to adapt to the grid environment and load conditions, improves the robustness and adaptability of the entire system, and avoids the data center being adversely affected by the harmonics of the motor.
[0152] 2. Energy entropy screening mechanism: The present invention extracts the intrinsic mode components and their energy entropy from the power grid as screening. The algorithm can more accurately evaluate the power grid status and provide key information for subsequent control strategies, thereby ensuring the accuracy and effectiveness of control.
[0153] 3. Automated adjustment strategy: The present invention performs actual adjustment (S6) through a PID controller, and the output of the strategy gradient algorithm is converted into specific control instructions, thereby achieving fine control of the autotransformer tap. This control method can not only effectively reduce the starting current of the motor and extend the service life of the equipment, but also ensure that the motor smoothly switches to full-voltage operation after reaching an appropriate speed, greatly reducing the impact on the power grid.
[0154] 4. Energy saving and optimization of the wind turbine power system: The present invention can make the motor smoothly transition from low-voltage starting to full-voltage operation by gradually adjusting the tap of the autotransformer. This gradually increasing pressure starting method can avoid excessive current shock and mechanical stress when the motor starts, and protect the stable operation of the motor and the power grid; and the present invention can smoothly switch to full-voltage operation after the motor reaches an appropriate speed by accurately controlling the time of step-down starting, so that the impedance of the motor has increased to a certain extent and can withstand a larger current without excessive impact. At the same time, the smooth switching process can also avoid sudden changes in torque, thereby reducing the damage of mechanical stress to the motor and load equipment. At the same time, the form of optimizing the power grid environment and optimizing the input voltage also creates an energy-saving and low-carbon effect. At the same time, the present invention does not rely on any frequency conversion system, which not only avoids harmonic problems, but also is green and low-carbon.
[0155] 5. Optimize the harmonic problem of the power grid: The stable current change achieved by the present invention helps to reduce the voltage fluctuation in the power grid, thereby reducing the harmonics that may be excited by the voltage fluctuation. Therefore, by optimizing the startup process, it can indirectly have a certain positive impact on the harmonic problem.
[0156] 6. Mutual standby automatic closed mechanism: The control system provided by the present invention belongs to a mutual standby automatic closed auto-coupling step-down starting system. When one fan stops running due to a fault, the other fan can automatically start to ensure the normal operation of the system. BRIEF DESCRIPTION OF THE DRAWINGS
[0157] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0158] Figure 1 Schematic diagram of the process of the present invention;
[0159] Figure 2 A motor wiring circuit diagram of the system of the present invention;
[0160] Figure 3 A control loop circuit diagram of the system of the present invention;
[0161] Figure 4 This is a flow chart of the technical solution of Embodiment 2 of the present invention;
[0162] Figure 5 A schematic diagram of the distribution of the eigenmode components extracted by the present invention;
[0163] Figure 6It is a schematic diagram of energy distribution of the eigenmode components extracted by the present invention;
[0164] Figure 7 It is a schematic diagram of the hierarchical structure of the neural network PN of the present invention;
[0165] Figure 8 This is a schematic diagram of a method flow chart of Embodiment 4 of the present invention;
[0166] Fig. 9 It is a schematic diagram of a line comparison of training effects according to the first embodiment of the present invention. DETAILED DESCRIPTION
[0167] In order to make the above-mentioned purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are described in detail below in conjunction with the accompanying drawings. In the following description, many specific details are set forth to facilitate a full understanding of the present invention. However, the present invention can be implemented in many other ways different from those described herein, and those skilled in the art can make similar improvements without violating the connotation of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed below;
[0168] It should be noted that the various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments, and the same or similar parts between the various embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description.
[0169] Example 1: Please refer to Figure 1 This embodiment discloses a control method for an auto-coupling step-down starting fan for a data center. When the fan motor starts, it is necessary to extract the intrinsic mode component IMF of the power grid signal. i (t), and then execute the following steps S1 to S6.
[0170] In this embodiment, regarding step S1, the strategy network is initialized: a parameterized strategy network is set, whose input is the current state of the power grid and the motor, and whose output is the step adjustment interval of the tap and the vector SDV of the adjustment amount, and the network weight α is initialized. This network will decide how to adjust the tap of the autotransformer according to the current state of the power grid and the motor to achieve the purpose of gradually reducing the starting voltage of the motor. It specifically includes the following steps S100~S101.
[0171] Specifically, step S100, current state: current state s t is an intrinsic mode component IMF i (t). That is, the strategy network takes into account the intrinsic modal characteristics of the power grid signal when making decisions.
[0172] Specifically, step S101, define a policy network: the policy network is a neural network PN, which is a multi-layer perceptron (MLP); it is defined as:
[0173] PN = MLP(input dim , hidden dim , output dim );
[0174] Among them, MLP represents a multi-layer perceptron network, input dim is the input state s t The dimension of the vector (i.e., IMF i (t) dimension), hidden dim is the dimension of the hidden layer, output dim is the dimension of the output vector SDV.
[0175] Specifically, the forward propagation strategy of the neural network PN is: given the input state vector is regarded as the intrinsic mode component IMF i (t), the output of the strategy network is the vector SDV. This process can be regarded as the strategy network intelligently calculating how to adjust the tap of the autotransformer according to the current grid state to achieve smooth starting of the motor.
[0176] Furthermore, the method for obtaining the vector SDV is: SDV = PN(IMF i (t); α);
[0177] Among them, PN represents the forward propagation function of the policy network, and α is the network weight. This function maps the input state to the output vector SDV according to the current weight and network structure.
[0178] Furthermore, the vector SDV is composed of: SDV = [Δs1, Δs2, ..., Δs n , i1, i2, ...,i n ];
[0179] Among them, Δs1, Δs2, ..., Δs n Represents the adjustment amount for each tap. Their values can be continuous, indicating the distance or number of steps the tap needs to move, or discrete, indicating which preset position the tap should move to. The adjustment amount can be positive (adjusting upward) or negative (adjusting downward). i1, i2, ..., i n Represents the tap index or number that needs to be adjusted, corresponding to the relative interval of the tap adjustment amount in a continuous time step.
[0180] During the training process, the weight α of the policy network is updated according to the policy gradient algorithm to maximize a certain reward function. The weight update method is expressed as:
[0181] α new = α old + η * ∇α J(α old );
[0182] Where η is the learning rate that controls the step size of the weight update, ∇α J(α old ) is the reward function J with respect to the original weight α old The gradient of , in the policy gradient algorithm, this gradient is estimated by sampling the trajectory.
[0183] Furthermore, for the reward function J, this embodiment provides the following two solutions:
[0184] 1) Cumulative return form: the cumulative return over the entire trajectory or a period of time. If each time step has an immediate return r t , then the cumulative return is expressed as:
[0185] ;
[0186] Where T is the length of the trajectory, r t Represents the quantitative returns of indicators such as the smoothness and energy efficiency of the fan operation at each time step.
[0187] 2) Discounted cumulative return: In order to consider the trade-off between long-term returns and short-term returns, a discount factor γ (0<γ≤1) is introduced, so that the cumulative return becomes: The discount factor makes near-term returns more important than far-term returns.
[0188] In this embodiment, regarding step S2, collecting samples: in the actual environment, according to the tap adjustment amount Δs output by the current neural network PN i (t) to collect sample s and record the intrinsic mode component IMF of each step of each sample s s (t) i , reward vector A and new intrinsic mode component IMF s (t) i These samples s will be used in subsequent training and optimization processes to improve the accuracy and efficiency of the auto-coupling step-down starting fan control. It includes the following steps S200~S201.
[0189] Specifically, step S200 is to adjust according to the output of the neural network PN: first, according to the output Δs of the neural network PN at the current time step t i (t) Adjust the tap. This adjustment indicates the distance or number of steps the tap should move:
[0190] Δs i (t) = PN(IMF i (t);α);
[0191] After completing the tap adjustment, the neural network PN will also output a "state-action pair". t "Actually, it is a description of the current state of the power grid and the motor, while "Action a t ” is the control strategy that should be adopted in this state, that is, the adjustment amount Δs of the tap i (t):
[0192] ;
[0193] Among them, π α (a t |s t ) is in state s t Take action a t The probability of is given by the policy network PN. (s t , a t ) is a "state-action pair".
[0194] It should be pointed out that
[0195] 1) State input: s t Represents the environmental state at time step t, that is, the intrinsic mode component IMF i (t) information.
[0196] 2) Policy network: PNα is a neural network parameterized as α, which accepts the state s t As input, it outputs a probability distribution, which describes the probability of each possible action being selected in the current state.
[0197] 3) Action probability: πα(a t |s t ) means that in a given state s t Under the conditions of and network parameter α, select action a t In the policy gradient algorithm, we usually want to choose the action with the highest probability (because this is considered to be the best action in the current state).
[0198] 4) Decision-making process: In practical applications, the policy network will be based on the current state s t , for each possible action a t Calculate a probability value.
[0199] That is, for every possible state s t, the policy network PN will give a corresponding action a t In practice, we choose the action with the highest probability to execute, that is, we choose the action that makes π α (a t |s t ) The largest action a t as the actual tap adjustment amount.
[0200] It can be understood that by accurately calculating the tap adjustment amount through the neural network PN, accurate control of the motor starting voltage can be achieved. It helps the motor to smoothly transition from low-voltage startup to full-voltage operation, reducing the impact on the power grid and the motor. And because the strategy network PN can adjust the tap according to the real-time power grid and motor status, the method has strong adaptability. Regardless of how the power grid state changes, the tap can be adjusted to ensure smooth starting of the motor. By outputting the "state-action pair" and the corresponding probability, the strategy network PN actually provides guidance for an optimization decision-making process. It helps to make the best control decision when facing complex power grid conditions.
[0201] Specifically, step S201, recording data, includes:
[0202] 1) IMF before adjustment s (t) i ; Represents the oscillation mode of the signal at different frequency scales. During the motor starting process, these components can reflect the real-time status of the power grid and the motor. The purpose of recording the IMFs(t)i before adjustment is to capture the system status before the tap adjustment;
[0203] 2) The amount of adjustment performed Δs i (t); represents the distance or number of steps the tap should move. Recording this adjustment amount is critical for subsequent analysis of the effectiveness of the adjustment strategy;
[0204] 3) Adjusted new intrinsic mode component IMF s (t) i '; After the tap adjustment, the system will present a new state. By recording the adjusted IMFs(t)i', we can analyze the impact of the tap adjustment on the system state;
[0205] 4) Reward vector A, which contains the reward information obtained by performing this adjustment:
[0206] The reward vector A is calculated based on the performance of the system after the adjustment. This includes whether the stability of the power grid system is improved. The stability depends on whether the motor smoothly transitions from low voltage startup to full voltage operation. The design of the reward function is a key part of the policy gradient algorithm, and it should be able to reflect the goals we expect the system to achieve:
[0207] A = R(IMF s (t) i , Δs i (t), IMF s (t) i ');
[0208] Among them, R is the reward function, which calculates the reward based on the intrinsic mode components before and after adjustment and the adjustment amount. It is a reward function based on system stability and transition smoothness:
[0209] R=R stability +R transition ;
[0210] Among them, R stability It is the stability reward part, which is used to evaluate the stability of the power grid system:
[0211] ;
[0212] V max and V min are the maximum and minimum values of the grid voltage during the evaluation period. V nominal is the rated voltage of the power grid. This incentive encourages the system to maintain voltage stability and reduce fluctuations during operation.
[0213] Among them, R transition This is the transition smoothness bonus section, which is used to evaluate the smooth transition of the motor from low voltage starting to full voltage operation:
[0214] ;
[0215] t transition is the actual transition time. expected is the expected transition time. ΔP is the power fluctuation during the transition. P nominal is the rated power of the motor. k is a scaling factor that controls the sensitivity of the transition time to the reward. This reward term is designed to encourage fast smooth transitions and reduce power fluctuations.
[0216] It can be understood that the above data constitutes a sample s, which is expressed as:
[0217] s = {IMF s (t) i , Δs i (t), IMF s (t) i ', A};
[0218] This sample captures the system state before and after the tap adjustment, the adjustment strategy adopted, and the reward obtained, providing the necessary learning material for the policy gradient algorithm.
[0219] It is understandable that by recording detailed data and reward information before and after the adjustment, the policy gradient algorithm can more accurately control the tap of the autotransformer, thereby optimizing the starting process of the motor. Since the algorithm can be adjusted according to the real-time system status and reward information, it has strong adaptability and can cope with different power grid environments and motor conditions. And by continuously optimizing the tap adjustment strategy, the stability of the power grid system and the smoothness of motor starting can be improved, thereby improving the performance of the entire system.
[0220] import numpy as np
[0221] import torch
[0222] import torch.nn as nn
[0223] import torch.optim as optim
[0224] from environments import GridEnvironment # Grid environment class
[0225] #Trained strategy network PN
[0226] class PolicyNetwork(nn.Module):
[0227] def __init__(self):
[0228] super(PolicyNetwork, self).__init__()
[0229] # Read the network structure
[0230] self.fc1 = nn.Linear(in_features, hidden_size)
[0231] self.fc2 = nn.Linear(hidden_size, action_space)
[0232] def forward(self, state):
[0233] x = torch.relu(self.fc1(state))
[0234] action_probs = torch.softmax(self.fc2(x), dim=-1)
[0235] return action_probs
[0236] # Initialize the environment, network and optimizer
[0237] env = GridEnvironment()
[0238] policy_net = PolicyNetwork()
[0239] optimizer = optim.Adam(policy_net.parameters(), lr=0.001)
[0240] # Operations for each time step
[0241] def simulate_timestep(state):
[0242] # Select actions based on the policy network
[0243] state = torch.from_numpy(state).float()
[0244] action_probs = policy_net(state)
[0245] action = torch.multinomial(action_probs, 1).item() # Select actions based on probability
[0246] # Interact with the environment to obtain new states and rewards
[0247] new_state, reward, done = env.step(action)
[0248] # Record data (step S201)
[0249] record = {
[0250] 'state': state.numpy(),
[0251] 'action': action,
[0252] 'new_state': new_state,
[0253] 'reward': reward
[0254] }
[0255] return new_state, record
[0256] In the above program, a policy network PolicyNetwork is defined to predict the probability distribution of each action based on the current state. In this network, the action probability is calculated by forward propagation (forward method). The GridEnvironment class is used to record the behavior of the power grid system (i.e., a series of intrinsic mode components). At each time step, the policy network selects an action (i.e., the adjustment amount of the tap) based on the current state, and then the environment updates the state based on this action and gives a reward value. The current state, executed action, new state, and reward obtained are recorded in the time step function simulate_timestep, and this information will be used for subsequent policy updates and optimizations.
[0257] In this example, see Figure 8 , regarding step S3, calculate the cumulative reward: for each sample s trajectory, calculate the cumulative reward sequence B from the beginning of this step to the end of the trajectory; where the sequence of sample s includes:
[0258] s = {s1, s2, ..., s T};
[0259] Where T is the length of the trajectory;
[0260] Each state s t Corresponding to an immediate reward r t , this reward reflects the immediate return obtained after performing an action in this state. The cumulative reward sequence B (sequence) is obtained as follows:
[0261] ;
[0262] Where γ is a discount factor (0<γ≤1) used to adjust the importance of future rewards.
[0263] 1) When γ = 1, future rewards have the same weight as current rewards, that is, all rewards are treated equally;
[0264] 2) When γ < 1, the weight of future rewards will gradually decrease, which means that the farther the future rewards are, the smaller the impact on the current state.
[0265] 3) The introduction of the discount factor γ is to balance the importance of immediate rewards and future rewards. In practical applications, it is usually necessary to select an appropriate γ value based on the characteristics of the problem and the subjective initiative of technicians in this field.
[0266] For example, during the motor startup process, more attention is paid to the recent smoothness and stability, so a smaller γ value, such as 0.1, can be set to reduce the weight of future rewards.
[0267] It can be understood that by calculating the cumulative reward, we can more comprehensively evaluate the quality of the autotransformer tap adjustment strategy. This not only takes into account the immediate reward r t , and also takes into account possible future rewards, thus more accurately reflecting the long-term effect of the strategy. The introduction of the discount factor γ allows us to flexibly adjust the impact of future rewards on current decisions. According to different application scenarios and requirements, we can adjust the γ value to optimize the learning process of the strategy.
[0268] It should be noted that t in this formula represents the state s currently considered t The time point or index in the trajectory. For example, if we are considering the third state in the trajectory, then t is 3. k is used to accumulate when calculating the cumulative reward. It starts from the current state t and accumulates to the last state T of the trajectory. In each accumulation process, k represents the state time point or index corresponding to the current accumulated reward. For example, when we calculate from state s t Starting cumulative reward B t We will go from state s t All rewards at the end of the trajectory are weighted summed. In this summation process, k is the index used to traverse these rewards. And t is the starting point of our calculation, that is, the position of the current state in the trajectory.
[0269] Further, immediate reward t The preferred assignment method is:
[0270] Solution 1) Voltage Control Accuracy Reward: To encourage the agent to control the voltage within the target range, a reward inversely proportional to the deviation from the target voltage can be set. For example, if the target voltage is V target , the actual voltage is V t , then the reward can be defined as:
[0271] ;
[0272] Among them, this instant reward r t It will approach 1 when the actual voltage is close to the target voltage and decrease when it deviates from the target.
[0273] Solution 2) Smoothness Reward: To encourage smooth starting, a reward can be set that is inversely proportional to the rate of change of voltage or current. t is the voltage change between the current time step and the previous time step, and the reward can be defined as:
[0274] ;
[0275] Among them, this instant reward r t will be close to 1 when the voltage changes are small, and will decrease when the voltage fluctuations are large.
[0276] Furthermore, in the above step S3, the python program is as follows:
[0277] def calculate_cumulative_rewards(rewards, gamma):
[0278] """
[0279] Calculating cumulative rewards
[0280] :param rewards: A list containing the immediate rewards for each state in the trajectory
[0281] :param gamma: discount factor
[0282] :return: List of accumulated rewards
[0283] """
[0284] T = len(rewards) # length of the trajectory
[0285] cumulative_rewards = [0] * T # Initialize the cumulative reward list
[0286] # Calculate the cumulative reward from the last state of the trajectory forward
[0287] cumulative_rewards[T - 1] = rewards[T - 1] # The cumulative reward of the last state is its immediate reward
[0288] for t in range(T - 2, -1, -1): # Traverse forward from the second-to-last state
[0289] cumulative_rewards[t] = rewards[t] + gamma * cumulative_rewards[t + 1] # Apply the cumulative reward formula
[0290] return cumulative_rewards
[0291] In the above program, the calculate_cumulative_rewards function accepts two parameters, rewards is a list containing immediate rewards, and gamma is a discount factor. The function first obtains the length T of the trajectory and initializes a cumulative reward list cumulative_rewards of the same length as the trajectory, with all elements initially set to 0. Starting from the last state of the trajectory, traverse each state forward and calculate the cumulative reward of each state according to the cumulative reward formula. For the last state in the trajectory, its cumulative reward is equal to its immediate reward. For other states, its cumulative reward is equal to its immediate reward plus the cumulative reward of the next state multiplied by the discount factor gamma. This process is implemented through a loop from back to front. Finally, the function returns the calculated cumulative reward list.
[0292] In this embodiment, regarding step S4, the neural network PN is updated: the weight α of the neural network PN is updated to the weight α according to the cumulative reward sequence B using the Actor-Critic algorithm. new The goal is to increase the probability of actions that result in high cumulative rewards and reduce the probability of actions that result in low cumulative rewards. The steps include the following steps S400~S401.
[0293] Specifically, step S400, updating weights: the weight updating method of the neural network PN is implemented through the Actor network, and the Actor network is represented as:
[0294] ;
[0295] in: is in state s t Take action a t The probability of is given by the Actor network. is the gradient of the log probability with respect to the policy network weights. η is the learning rate, which controls the step size of the weight update. δ is the TD error. The Actor network is responsible for the log probability Calculate the gradient of the policy network weights, which indicates how to adjust the policy parameters to increase or decrease the specific action a t The probability of being selected.
[0296] During the update process, the logic is: if an action a t If the reward is higher than expected (i.e., positive TD error), then the probability of this action being selected is increased; conversely, if the reward is lower than expected (i.e., negative TD error), then the probability of this action being selected is reduced. t The probability of being selected.
[0297] Specifically, the TD error δ plays a crucial role in the update process. δ represents the difference between the reward obtained and the expected reward. If δ is positive, it means that the actual reward obtained is higher than our expectation, so we should increase this action a. t The probability of being selected is to make more use of this action in future launches. On the contrary, if δ is negative, it means that the actual reward is lower than expected, and we should reduce the probability of this action a t probability to avoid repeatedly choosing poorly performing actions in future starts.
[0298] It can be understood that the above “increase” and “decrease” are implemented in the following way: when δ is positive, it means that the actual reward is higher than expected. According to the above update formula, the new weight α new A positive amount will be added to the current weight α (because the product of δ and the gradient is positive), which will result in t Next select action a t On the contrary, when δ is negative, it means that the actual reward is lower than expected, and the new weight α new It will reduce the current weight α by an amount (because the product of δ and the gradient is negative), which will result in the state s t Next select action a t The probability of the autotransformer decreasing. This process is gradual. Through multiple iterations, the policy network will gradually learn which actions to choose in which states can obtain higher rewards, thereby optimizing the policy. In the autotransformer step-down starting fan control method, this process is used to accurately control the tap of the autotransformer, gradually reduce the starting voltage of the motor, and make the motor smoothly transition from low-voltage starting to full-voltage operation.
[0299] Furthermore, the log probability Depends on the weight α parameterization of the neural network PN, given the state s t , the network will output a t For discrete action spaces, the neural network PN will output a softmax distribution to represent the probability of each action:
[0300] ;
[0301] Among them, fα(s t,a t ) is the neural network for state s t and action a t The output scores (or logits) of . e is the base of the natural logarithm.
[0302] The gradient of log probability with respect to the weight is expressed as:
[0303] ;
[0304] Substituting the softmax distribution into the above equation and applying the chain rule, we can simplify it to:
[0305] ;
[0306] It can be understood that through this weight update mechanism, we can ensure that the wind turbine can adaptively select the optimal action sequence during the startup process, so as to achieve a smooth transition from low voltage to full voltage. This not only helps to reduce the impact of the power grid, but also improves the service life and operating efficiency of the wind turbine.
[0307] Specifically, step S401, Critic network evaluation: used to evaluate the state or action state value. The Critic network guides the update direction of the Actor network by calculating the TD error δ.
[0308] The core function of the Critic network, also known as the value network, is to evaluate the value of a given state. In this method, the Critic network uses two prediction functions V(s t ) and V(s t+1 ) to respectively analyze the current state s t and the state s at the next time step t+1} to predict the value. The output of these two prediction functions is the estimated value of the state, that is, the expected return that can be obtained in this state. It helps the Actor network know the quality of its actions and guides the update direction of the Actor network by calculating the TD error δ:
[0309]
[0310] Among them, V(s t ) and V(s t+1 ) are respectively the Critic network for the state s t and t+1 The prediction function of the value of .
[0311] It should be noted that the weights of the Critic network are updated by minimizing the square of the TD error, which enables the Critic network to predict the value of the state more accurately.
[0312] It can be understood that the weight update of the Critic network is achieved by minimizing the square of the TD error. This update method is designed to enable the Critic network to predict the value of the state more accurately, thereby providing more reliable feedback to the Actor network. As the prediction accuracy of the Critic network improves, the Actor network can more effectively learn which actions are more beneficial in a specific state, thereby optimizing the start-up strategy of the wind turbine. Through the precise evaluation of the Critic network, the Actor network can learn more quickly which actions are effective and which actions may lead to adverse consequences during the autocoupler step-down starting process. This helps to optimize the start-up process of the wind turbine and reduce unnecessary energy consumption and mechanical wear. The Critic network guides the update of the Actor network by calculating the TD error, so that the wind turbine can smoothly transition from low-voltage start-up to full-voltage operation, avoiding the impact of voltage mutations on the motor and the power grid.
[0313] Preferably, the prediction function s t and the prediction function s t+1 The specific form is:
[0314] ;
[0315] ;
[0316] Among them, NN c represents the Critic network, θ c is the bias of the Critic network. These parameters are optimized during training to minimize the TD error.
[0317] Furthermore, the Python (construction and training) program of the above step S4 is as follows:
[0318] import numpy as np
[0319] import tensorflow as tf
[0320] from tensorflow.keras import layers
[0321] # Set up state space and action space
[0322] state_dim = 10 # Dimension of state space
[0323] action_dim = 1 # Dimension of action space
[0324] # Actor Network Model
[0325] class Actor(tf.keras.Model):
[0326] def __init__(self):
[0327] super(Actor, self).__init__()
[0328] self.dense1 = layers.Dense(64, activation='relu')
[0329] self.dense2 = layers.Dense(32, activation='relu')
[0330] self.dense3 = layers.Dense(action_dim, activation='tanh') # The action is restricted between [-1, 1]
[0331] def call(self, inputs):
[0332] x = self.dense1(inputs)
[0333] x = self.dense2(x)
[0334] return self.dense3(x)
[0335] # Critic network model
[0336] class Critic(tf.keras.Model):
[0337] def __init__(self):
[0338] super(Critic, self).__init__()
[0339] self.dense1 = layers.Dense(64, activation='relu')
[0340] self.dense2 = layers.Dense(32, activation='relu')
[0341] self.dense3 = layers.Dense(1) # Output the state value
[0342] def call(self, inputs):
[0343] x = self.dense1(inputs)
[0344] x = self.dense2(x)
[0345] return self.dense3(x)
[0346] # Initialize the network
[0347] actor = Actor()
[0348] critic = Critic()
[0349] optimizer = tf.keras.optimizers.Adam()
[0350] # A function for interacting with the environment, returning new status, reward, and whether it is finished
[0351] def interact_with_env(state, action):
[0352] next_state = np.random.random(state_dim) # Generate the next state
[0353] reward = np.random.random() # Generate reward
[0354] done = False # Not finished
[0355] return next_state, reward, done
[0356] # Training process
[0357] for episode in range(1000): # Run 1000 episodes
[0358] state = np.random.random(state_dim) # Initialize state
[0359] while True:
[0360] with tf.GradientTape(persistent=True) as tape:
[0361] action = actor(state) # Actor network selects actions based on current state
[0362] next_state, reward, done = interact_with_env(state,action) # interact with the environment
[0363] state_value = critic(state) # Critic evaluates the value of the current state
[0364] next_state_value = critic(next_state) # Critic evaluates the value of the next state
[0365] td_error = reward + 0.99 * next_state_value - state_value# Calculate TD error
[0366] # Update the Critic network to minimize the square of the TD error
[0367] critic_loss = tf.square(td_error)
[0368] critic_grads = tape.gradient(critic_loss, critic.trainable_variables)
[0369] optimizer.apply_gradients(zip(critic_grads, critic.trainable_variables))
[0370] # Update the Actor network, using the TD error provided by Critic as a guide for the policy gradient
[0371] actor_loss = -td_error * action # The advantage function in the policy gradient is approximated by TD error
[0372] actor_grads = tape.gradient(actor_loss, actor.trainable_variables)
[0373] optimizer.apply_gradients(zip(actor_grads, actor.trainable_variables))
[0374] state = next_state # Update state
[0375] if done:
[0376] break # If this round ends, jump out of the loop
[0377] In the above program, the Actor network is responsible for generating actions based on the current state, the input is the state, and the output is the action. The Critic network is responsible for evaluating the state or action state value, the input is the state, and the output is the value estimate of the state. This value estimate is used to calculate the TD error (Temporal Difference Error), which is the difference between the actual reward plus the discounted future state value and the current state value. At each time step, the Actor network generates an action based on the current state and interacts with the environment to obtain the reward and the next state. The Critic network evaluates the value of the current and next states and calculates the TD error. This TD error is then used to update the Critic network (by minimizing the square of the TD error) and the Actor network (through the policy gradient method, that is, using the TD error to guide the update of the action probability). This process is repeated until the training is completed.
[0378] In this embodiment, regarding step S5, iterative optimization: repeating steps S2 to S4 until the performance of the neural network PN reaches a preset standard or the number of iterations reaches an upper limit. It includes the following steps:
[0379] S501, repeated sampling: In each iteration, the system collects new state-action pairs (s t , a t ) and the corresponding reward vector A. This is to obtain more data to train and optimize the policy network. By constantly trying and exploring in the actual environment, the policy network can learn which actions are effective in which states, thereby adjusting the probability distribution of its output actions.
[0380] S502, cumulative reward calculation: For each sampled state-action pair (s t , a t ), the system will calculate its cumulative reward R t The cumulative reward is the sum of the rewards of all future time steps starting from the current time step t, but the future rewards are discounted by a discount factor γ. This is done to reflect the uncertainty of future rewards and keep the cumulative reward within a limited range:
[0381] ;
[0382] Among them, R t is the cumulative reward at time step t, r t+k is the reward obtained at time step t + k. This formula embodies the concept of "delayed reward" in reinforcement learning, that is, the current action affects not only the immediate reward, but also the future reward.
[0383] S503, policy network update: using cumulative reward R t To update the weight α of the neural network PN, the purpose is to increase the cumulative reward R t The action of t and reduce the action a that results in a low cumulative reward t Probability:
[0384] ;
[0385] Among them, the cumulative reward R t is used as a scaling factor to adjust the step size of the gradient update. If an action results in a high cumulative reward, then the gradient update for that action will be strengthened to a greater extent, thereby increasing the probability of this action being selected in the future. Conversely, if the cumulative reward is low, then the magnitude of the gradient update will be reduced, reducing the probability of this action being selected in the future.
[0386] Or, the TD error δ can be viewed as an adjusted cumulative reward that takes into account the difference between the current reward and the expected reward, thereby reducing the variance and accelerating the learning process. Therefore, in the formula for updating the policy network weights, it is preferred to use the TD error to implicitly update the policy network weights.
[0387] S504, stop condition: The iteration process will continue until a certain stop condition is met. The performance of the neural network PN can reach a preset standard (for example, a certain winning rate or score on the test set), or the number of iterations reaches a set upper limit. The stop condition is set to prevent overfitting and infinite loops, and to ensure that the policy network stops training after reaching a certain performance level.
[0388] It can be understood that in the above step S5, the policy network (neural network PN) can dynamically adjust the probability distribution of its output actions according to the feedback of the environment, so as to adapt to different tasks and environments. By using the cumulative reward or TD error to adjust the step size of the gradient update, the policy network can learn effective action strategies faster and improve learning efficiency. By constantly trying and exploring in the actual environment, the policy network can gradually learn which actions are effective in which states, thereby enhancing its robustness and generalization ability.
[0389] Furthermore, the Python program of step S5 above is as follows (the following program must be installed with the TensorFlow library and the PyTorch library to run):
[0390] import numpy as np
[0391] import torch
[0392] import torch.nn as nn
[0393] import torch.optim as optim
[0394] from torch.distributions import Categorical
[0395] # The policy network PN is a neural network defined in PyTorch
[0396] class PolicyNetwork(nn.Module):
[0397] def __init__(self, state_dim, action_dim):
[0398] super(PolicyNetwork, self).__init__()
[0399] self.fc1 = nn.Linear(state_dim, 64)
[0400] self.fc2 = nn.Linear(64, 32)
[0401] self.fc3 = nn.Linear(32, action_dim)
[0402] def forward(self, state):
[0403] x = torch.relu(self.fc1(state))
[0404] x = torch.relu(self.fc2(x))
[0405] action_scores = self.fc3(x)
[0406] return action_scores
[0407] # Initialize the policy network and related parameters
[0408] state_dim = 10 # Dimension of state space
[0409] action_dim = 4 # Dimension of action space
[0410] policy_network = PolicyNetwork(state_dim, action_dim)
[0411] optimizer = optim.Adam(policy_network.parameters(), lr=0.001)
[0412] gamma = 0.99 # discount factor
[0413] max_iter = 1000 # Maximum number of iterations
[0414] # Iterative optimization process
[0415] for iteration in range(max_iter):
[0416] # S501: Repeated sampling (here simplified to obtain states and actions from a certain data set, as well as the corresponding rewards)
[0417] #Datasets and test sets for storing states, actions, and rewards
[0418] states, actions, rewards = sample_data()
[0419] states = torch.tensor(states, dtype=torch.float32)
[0420] actions = torch.tensor(actions, dtype=torch.long)
[0421] rewards = torch.tensor(rewards, dtype=torch.float32)
[0422] # S502: Cumulative reward calculation
[0423] cumulative_rewards = rewards
[0424] # Use the policy network to calculate the probability distribution of actions
[0425] policy_scores = policy_network(states)
[0426] probs = Categorical(logits=policy_scores).probs
[0427] log_probs = Categorical(logits=policy_scores).log_prob(actions)
[0428] # S503: Policy Network Update
[0429] loss = -torch.sum(log_probs * cumulative_rewards) # Policy gradient loss function
[0430] optimizer.zero_grad() # Clear previous gradient information
[0431] loss.backward() # Backward propagation to calculate gradient
[0432] optimizer.step() # Update the weights of the policy network
[0433] # S504: Stop condition (stop after reaching the maximum number of iterations)
[0434] if iteration == max_iter - 1:
[0435] print("Training completed!")
[0436] break
[0437] In the above program, a policy network PolicyNetwork is defined, which accepts the state as input and outputs the score (or logits) of each possible action. These scores can be converted into the probability distribution of actions through the softmax function. For details, see the policy network disclosed in Example 3. The process of sampling from the environment is simulated in each iteration (sample_data function). In practical applications, this will involve interaction with the environment to obtain the real state, the executed actions, and the corresponding rewards. The cumulative reward is usually obtained by accumulating future rewards by the discount factor γ. The policy gradient loss function is then used to calculate the gradient and update the weights of the policy network. By minimizing this loss function, the policy network will gradually learn the strategy of selecting the optimal action under a given state. The results of its training are as follows Fig. 9 shown.
[0438] In this embodiment, with respect to step S6, actual adjustment is performed: the vector SDV is calculated and applied to the autotransformer; then the parameters of the PID controller are set and the target speed and allowable error range of the motor are set, and the vector SDV is accepted; according to the tap adjustment vector, the set point of the PID controller is dynamically adjusted.
[0439] Specifically, in step S600, the application vector SDV is:
[0440] After obtaining the vector SDV, reduce its dimension or split it to obtain the step adjustment interval i of the tap i and adjustment value Δs i , and then adjust the autotransformer accordingly:
[0441] SDV = PN(IMF i (t); α new );
[0442] SDV = [i i , Δs i ];
[0443] Specifically, in step S601, a PID controller is applied:
[0444] ;
[0445] Where u(t) is the output signal of the controller. e(t) is the deviation between the set point and the actual measured value (the difference between the target speed and the actual speed). K p , K i , K d are the gains of the proportional, integral, and derivative controllers respectively. dτ is a continuous constant.
[0446] Preferably, the set point is the target speed or switching time of the motor; the strategy is:
[0447] 1) If the adjustment a is to increase the tap voltage, the set point of the PID controller is increased accordingly to increase the motor speed, thereby shortening the step-down starting time;
[0448] 2) Adjust amount a and vice versa.
[0449] Then, the PID controller calculates the control amount based on the difference between the real-time speed and the target speed. The control amount is used to adjust the motor's reduced-voltage starting time to ensure that the motor smoothly accelerates to the appropriate speed and then switches to full-voltage operation. Set the above conditions as constraints and update the PID controller to:
[0450] ;
[0451] The first constraint is made on the error signal e(t). Dynamically adjusting the set point is actually adjusting the tap adjustment amount Δs at each time step. i To update the set point SP(t) of the PID controller. PV(t) is the process variable (real-time speed of the motor). The output signal u(t) needs to be read by the MCU controller of the fifth embodiment and used to control the motor.
[0452] The second constraint is to limit the output signal u(t). By introducing the maximum and minimum value constraints, it can avoid excessive impact on the system; u max and u min are the maximum and minimum limit values of the control signal respectively.
[0453] Furthermore, the first constraint can further introduce additional constraints:
[0454] ;
[0455] Where u(t) is the original PID controller output. K c is an adjustment coefficient used to control the influence of the constraint term. sgn(e(t)) is the sign function of the error e(t) and is used to keep the constraint term consistent with the error direction. c (t) is used as the control signal to drive the system.
[0456] If |e(t)|>ϵ, it means that the error exceeds the allowable range, and the above constraint term is introduced to adjust the output of the PID controller. This constraint term is a function based on the error, which is used to reduce the amplitude of the control signal or change its direction to prevent the system from getting out of control.
[0457] It is understandable that by combining the strategy gradient algorithm and the PID controller, the motor starting voltage and speed can be accurately controlled, thereby improving the stability and efficiency of the system. The precise adjustment of the autotransformer and the dynamic adjustment of the PID controller jointly ensure the smooth transition of the motor from low-voltage starting to full-voltage operation, reducing mechanical stress and electrical shock. And through the limit processing and error constraint of the PID controller output, the system is effectively prevented from losing control and excessive shock, and the safety of the entire control system is improved.
[0458] In summary, the principle of reducing the impact on the power grid by precisely controlling the tap selection of the autotransformer in this embodiment is that the starting voltage of the motor can be gradually reduced by precisely controlling the tap of the autotransformer. Due to the impedance characteristics of the motor, the impedance is relatively low at the initial start-up, so reducing the voltage can effectively reduce the starting current. Therefore, the motor can start smoothly at a lower current, thereby reducing the impact on the power grid.
[0459] Moreover, by gradually adjusting the tap of the autotransformer, the motor can smoothly transition from low-voltage starting to full-voltage operation. This gradual voltage starting method can avoid excessive current shock and mechanical stress when the motor starts, protecting the stable operation of the motor and the power grid.
[0460] In summary, the principle of controlling the time of reduced voltage starting to reduce the current and torque shock during switching is that during the motor starting process, if the reduced voltage starting time is too long, the motor will accelerate too slowly, affecting efficiency; if the reduced voltage starting time is too short, a large current and torque shock will be generated when switching to full voltage operation. By accurately controlling the time of reduced voltage starting, the motor can be smoothly switched to full voltage operation after reaching the appropriate speed, so that the impedance of the motor has increased to a certain extent and can withstand a larger current without excessive shock. At the same time, the smooth switching process can also avoid sudden changes in torque, thereby reducing the damage of mechanical stress to the motor and load equipment.
[0461] In summary, the principle of optimizing harmonic problems by combining "precisely controlling the tap selection of the autotransformer" and "controlling the time of step-down starting" is:
[0462] Because large currents and rapid voltage changes may exacerbate the generation of harmonics, if the tap selection of the autotransformer is accurately controlled and the time of the step-down start is controlled, it can ensure that the motor smoothly switches to full-voltage operation after reaching the appropriate speed, thereby reducing the current impact during switching. This smooth current change helps to reduce voltage fluctuations in the power grid, thereby reducing harmonics that may be excited by voltage fluctuations. Therefore, by optimizing the starting process, a certain positive impact can be indirectly exerted on the harmonic problem.
[0463] Furthermore, by reducing current and torque shocks, a more stable grid environment can be created, in which the generation and propagation of harmonics are actively suppressed.
[0464] Example 2: Please refer to Figure 4 Based on the first embodiment, this embodiment further provides an IMF for the intrinsic mode components used in step S100 and step S2. i (t) is obtained by the following steps:
[0465] First, signal segmentation:
[0466] First, according to the actual power grid characteristics, the spectrum segmentation of the power grid signal is determined, that is, the spectrum of the signal is divided into several continuous intervals, each interval corresponds to a mode. If the spectrum of the signal is divided into N intervals, the frequency range of the i-th interval can be expressed as:
[0467] ;
[0468] Among them, ω i,min and ω i,max are the minimum and maximum frequencies of the ith interval, respectively.
[0469] Second, wavelet filter design:
[0470] For each spectrum interval, a corresponding wavelet filter is designed to extract the signal components in that interval. The frequency response of the filter is Φ i (ω) is expressed as:
[0471] ;
[0472] Third, signal decomposition:
[0473] The original signal x(t) is decomposed by the designed wavelet filter to obtain a series of intrinsic mode components (IMFs). The i-th intrinsic mode component IMF i (t) can be expressed as:
[0474] ;
[0475] Where F represents Fourier transform, F −1 Represents the inverse Fourier transform.
[0476] Fourth, threshold each IMF to remove noise:
[0477] Assume the threshold of the i-th IMF is τ i , then the denoised IMF' i (t) can be expressed as:
[0478] ;
[0479] Or use soft thresholding:
[0480] ;
[0481] Fifth, quantification:
[0482] Based on the above four steps, the IMF' i (t), it is necessary to select the eigenmode components with higher energy expression content, because they may contain more information about the power grid status, and the data feasibility can be further improved on the basis of the eigenmode components.
[0483] Energy entropy can be used to quantify the distribution and complexity of energy in a signal, which helps to identify IMF components that contain important information. Therefore, the following steps are further introduced:
[0484] 1) Calculate energy distribution:
[0485] First, calculate the energy of each IMF component, such as Figure 6 The energy distribution diagram of the actual calculated grid state is shown. This can be completed and visualized by calculating the square sum or integral of the IMF:
[0486] ;
[0487] In practice, this integral can be approximated by taking discrete samples of IMF'i(t) and summing them. Figure 6 The discretized form is Figure 5 shown (but Figure 5 Only those that have been filtered later are retained).
[0488] 2) Normalized energy distribution:
[0489] After calculating the energy of each IMF, these energy values can be normalized to better compare the energy distribution between different IMFs:
[0490] ;
[0491] Here, the denominator is the sum of all IMF energies.
[0492] 3) Calculate energy entropy:
[0493] With the normalized energy distribution, the energy entropy H can be calculated:
[0494] ;
[0495] This entropy value quantifies the IMF of each intrinsic mode component. i (t) distribution and complexity of energy. A higher entropy value means that the energy distribution is more uniform, while a lower entropy value indicates that some IMF components contain relatively more energy. In this way, the IMF with the highest energy content and the lowest energy entropy is selected from each series of IMFs at each time step. i (t), as the intrinsic mode component IMF in step S100 and step S2 in embodiment 1 i (t), because its components are based on energy entropy, it is considered to contain important information about the state of the power grid.
[0496] It is understandable that an IMF component with high energy content means that it contains most of the energy in the original signal and is therefore more likely to reflect the main characteristics of the power grid state. In signal processing, energy is usually related to the strength or amplitude of the signal, so a high-energy IMF component may correspond to an important event or state change in the power grid. At the same time, energy entropy is an indicator that measures the complexity of the signal energy distribution. The lower the energy entropy, the more concentrated the energy distribution of the IMF component, that is, the component may contain more regular and predictable information. In power grid state monitoring, such information is crucial for accurately judging the power grid state.
[0497] Therefore, it can be understood that compared with the voltage, current and other parameters directly obtained from the power grid, the intrinsic mode component IMF i (t) analysis is essentially obtained by adaptively decomposing the original signal, which can more accurately extract the characteristic components in the power grid signal, thereby more accurately reflecting the actual state of the power grid. Moreover, when selecting the IMF component, by setting the threshold of energy and energy entropy, the noise and low-energy invalid components can be effectively removed to improve the accuracy of signal analysis. And because the IMF component is the main characteristic component extracted from the original signal, the amount of calculation can be greatly reduced and the calculation efficiency can be improved during subsequent analysis. At the same time, by selecting specific IMF components for analysis, it is easier to identify fault signals in the power grid and improve the accuracy and timeliness of fault identification.
[0498] However, the parameters such as voltage and current obtained directly from the power grid often contain a lot of redundant information and noise, which may interfere with the accurate judgment of the power grid status. For example, the instantaneous fluctuations of voltage and current may be caused by a variety of factors, including normal operation fluctuations, equipment failures, external interference, etc., which makes it complicated to directly extract useful information from these data.
[0499] Moreover, voltage and current parameters are global measurement values, which are difficult to directly reflect the local characteristics and dynamic behavior of the power grid.i (t) is obtained through adaptive decomposition, which can more accurately extract the local characteristics and frequency changes of the signal, and help to discover potential problems and anomalies in the power grid. Processing the original voltage and current data at the same time usually requires more complex algorithms and higher computing costs to extract useful information. In contrast, the IMF component is already a refined expression of the original signal, which can simplify the subsequent data processing and analysis process. At the same time, the voltage and current parameters mainly reflect the linear characteristics of the power grid, but the nonlinear dynamic behavior in the power grid is insufficiently described. The IMF component screening technology of this embodiment can better capture these nonlinear characteristics and provide richer information for a comprehensive analysis of the power grid status.
[0500] Furthermore, the Python program used to implement the technical solution of this embodiment is as follows (the pywt library and numpy library must be installed to run):
[0501] import numpy as np
[0502] import pywt
[0503] # A numpy array signal representing the power grid signal
[0504] # signal = np.array(...)
[0505] # Step 1: Signal segmentation
[0506] segment_length = 1024 # adjustable
[0507] segments = [signal[i:i+segment_length] for i in range(0, len(signal),segment_length)]
[0508] # Select a segment to process
[0509] segment = segments[0]
[0510] # Step 2: Wavelet filter design and signal decomposition
[0511] wavelet = 'db1' # Select a wavelet basis, namely 'Daubechies' wavelet
[0512] level = 5 # The number of decomposition levels can be adjusted according to signal characteristics
[0513] coeffs = pywt.wavedec(segment, wavelet, level=level)
[0514] # Step 3: Threshold each IMF to remove noise
[0515] threshold = np.std(coeffs[-1]) * 0.6745 # Noise is Gaussian white noise
[0516] denoised_coeffs = []
[0517] for i, coeff in enumerate(coeffs):
[0518] if i == len(coeffs) - 1: # The last layer is the detail coefficient, which is thresholded
[0519] denoised_detail = pywt.threshold(coeff, threshold, mode='soft')
[0520] denoised_coeffs.append(denoised_detail)
[0521] else:
[0522] denoised_coeffs.append(coeff)
[0523] # Step 4: Signal reconstruction
[0524] reconstructed_signal = pywt.waverec(denoised_coeffs, wavelet)
[0525] # Step 5: Quantification (calculate energy entropy and filter out IMFi(t))
[0526] def calculate_energy(signal):
[0527] return np.sum(np.square(signal))
[0528] def calculate_entropy(signal):
[0529] histogram = np.histogram(signal, bins=50, density=True)[0]
[0530] histogram / = np.sum(histogram) # Normalized histogram
[0531] entropy = -np.sum(histogram * np.log2(histogram + np.finfo(float).eps))
[0532] return entropy
[0533] #IMFs is the list of intrinsic mode components obtained from reconstructed_signal using the EMD method
[0534] IMFs = [...]
[0535] # Select the IMF with the highest energy and lowest entropy
[0536] energies = [calculate_energy(imf) for imf in IMFs]
[0537] entropies = [calculate_entropy(imf) for imf in IMFs]
[0538] # Find the index of the IMF with the highest energy and lowest entropy
[0539] best_imf_index = np.argmax(energies) if np.argmax(energies) ==np.argmin(entropies) \
[0540] else np.argmin(entropies)
[0541] best_imf = IMFs[best_imf_index]
[0542] # best_imf is the best IMF component selected based on energy and entropy
[0543] In the above program, the signal is decomposed into approximate coefficients and detail coefficients at multiple scales through wavelet basis and decomposition layers. The noise mainly exists in the detail coefficients, and the noise is removed by setting a threshold. The program uses soft threshold processing, that is, the coefficients less than the threshold are set to zero, and the coefficients greater than the threshold are subtracted from the threshold. Then the denoised coefficients are used to reconstruct the signal. Finally, the information content of each IMF is quantified by calculating its energy and entropy. High energy means that the IMF contains more signal strength, and low entropy means that the distribution of the IMF is more orderly and predictable. We select the IMF with the highest energy and the lowest entropy as the best component, which is the intrinsic mode component IMF mentioned above. i (t).
[0544] Embodiment 3: Based on Embodiment 1, this embodiment further provides a specific implementation method of the neural network PN; please refer to Figure 7 , the structure of the neural network PN includes:
[0545] 1) Input layer X: a 1*2 matrix containing x axis and axis Two characteristics.
[0546] 2) Hidden layer H: It interacts with the input layer X through a 2*50 weight matrix W1. The hidden layer contains 50 neurons and uses the ReLU activation function.
[0547] 3) Output layer Y: The hidden layer H interacts with the output layer Y through a 50*4 weight matrix W2. The output layer Y has four ports I, II, III and IV, representing four possible outputs. The output is processed using the Softmax function, and the cross entropy error (CEE) is calculated as the loss function.
[0548] Specifically, the MLP network includes:
[0549] 1) Weight matrix from input layer to hidden layer:
[0550] W1∈R 2×50 ;
[0551] 2) Weight matrix from hidden layer to output layer:
[0552] W2∈R 50×4 ;
[0553] 3) Input vector:
[0554] X∈R 1×2 ;
[0555] 4) Hidden layer activation function (ReLU):
[0556] ReLU(x)=max(0,x);
[0557] 5) Output layer activation function (Softmax):
[0558] ;
[0559] Among them, x i is the input of the ith neuron in the output layer.
[0560] Specifically, the forward propagation step of the neural network PN is:
[0561] 1) Hidden layer input:
[0562] H input =X⋅W1;
[0563] 2) Hidden layer output:
[0564] H output =ReLU(H input );
[0565] 3) Output layer input:
[0566] Y input =H output ⋅W2;
[0567] 4) Output layer output (probability distribution):
[0568] Y output =Softmax(Y input );
[0569] Specifically, use the neural network PN:
[0570] Given the input state vector IMFit, the output SDV of the policy network is expressed as:
[0571] SDV=PN(IMF' i (t))=Softmax((ReLU(IMF' i (t)⋅W1))⋅W2);
[0572] Among them, PN(IMF' i (t)) represents the forward propagation function of the policy network, which maps the input state IMFit to the output vector SDV.
[0573] Specifically, the forward propagation function PN(IMF' i (t)) can be expressed as:
[0574] PN(IMF' i(t))=Softmax(H out ⋅W2);
[0575] Where Hout is the output of the hidden layer and is given by:
[0576] H out =ReLU(IMF' i (t)⋅W1+b1)
[0577] Among them, b1 is the bias vector of the hidden layer (size is 1*50).
[0578] H out Substitute the expression into PN(IMF' i (t)), we get the complete forward propagation function:
[0579] PN(IMF' i (t))=Softmax(ReLU(IMF' i (t)⋅W1+b1)⋅W2+b2)
[0580] Among them, b2 is the bias vector of the output layer (size is 1*4).
[0581] Furthermore, the MLP network definition and python neural network architecture are as follows:
[0582] inputdim = 2 (because the input is a 1x2 matrix)
[0583] hiddendim = 50 (the hidden layer has 50 neurons)
[0584] outputdim = 4 (the output layer has four ports)
[0585] class MLP:
[0586] def __init__(self, inputdim, hiddendim, outputdim):
[0587] self.inputdim = inputdim
[0588] self.hiddendim = hiddendim
[0589] self.outputdim = outputdim
[0590] # Initialize the weight matrix
[0591] self.W1 = np.random.randn(inputdim, hiddendim) # 2x50 weight matrix
[0592] self.W2 = np.random.randn(hiddendim, outputdim) # 50x4 weight matrix
[0593] # Activation function
[0594] self.relu = lambda x: np.maximum(0, x)
[0595] self.softmax = lambda x: np.exp(x) / np.sum(np.exp(x), axis=1, keepdims=True)
[0596] def forward(self, IMFi_t):
[0597] # Input layer to hidden layer
[0598] H = self.relu(np.dot(IMFi_t, self.W1))
[0599] # Hidden layer to output layer
[0600] Y = np.dot(H, self.W2)
[0601] # Apply Softmax function
[0602] Y_softmax = self.softmax(Y)
[0603] return Y_softmax
[0604] In the above program, the multilayer perceptron (MLP) consists of multiple fully connected neuron layers, including input layer, hidden layer and output layer. In this definition, an MLP class is initialized, which contains the basic structure and parameters of the network.
[0605] 1) Input layer: responsible for receiving raw data. The input layer has 2 neurons, corresponding to the two features of the input vector (xaxis and yaxis).
[0606] 2) Hidden layer: It plays a role in feature conversion and abstraction in the network. The number of neurons in the hidden layer (50) and the choice of activation function (ReLU) will affect the network's expressiveness and learning effect. The ReLU activation function increases the nonlinearity of the network by setting all negative values to 0.
[0607] 3) Output layer: responsible for generating the final output of the network. The output layer has 4 neurons, corresponding to the four possible output categories (I, II, III, and IV). The activation function of the output layer is usually selected according to the task type. For classification tasks, the Softmax function is often used to convert the output into a probability distribution.
[0608] Furthermore, the forward propagation of the policy network PN and the python neural network architecture are as follows:
[0609] def PN(IMFi_t, mlp):
[0610] # mlp is an instantiated MLP class object
[0611] SDV = mlp.forward(IMFi_t)
[0612] return SDV
[0613] In the above program, during the forward propagation of the policy network PN, the state vector IMFi_t is first received through the input layer, then multiplied by the first layer weight W1 and added with a bias (the bias term is not explicitly included in this example, but it should be added in actual applications), and then the output of the hidden layer is obtained through the ReLU activation function. Next, the output of the hidden layer is multiplied by the second layer weight W2 to obtain the raw score of the output layer. Finally, these raw scores are converted into probability distributions, that is, the possibility of each output category, through the Softmax function.
[0614] Furthermore, the strategy network PN and python neural network architecture are as follows:
[0615] # Instantiate the MLP network
[0616] mlp = MLP(inputdim=2, hiddendim=50, outputdim=4)
[0617] # Input state vector IMFi_t
[0618] IMFi_t = np.array([[xaxis_value, yaxis_value]]) # Replace with actual xaxis_value and yaxis_value
[0619] # Perform forward propagation through the policy network to obtain the output vector SDV
[0620] SDV = PN(IMFi_t, mlp)
[0621] In the above program, an MLP object (i.e., policy network) is first instantiated, and then an input state vector IMFi_t (representing the current state of the environment or observation) is given. This state vector is passed to the policy network, and after forward propagation, the network outputs a probability distribution SDV, which represents the probability of each possible action (i.e., output category) in the current state.
[0622] Example 4: Please refer to Figure 8 Based on step S3 of the first embodiment, this embodiment further provides an intelligent method for assigning a value to the discount factor γ.
[0623] In step S3, the discount factor γ is introduced to balance the immediate reward r t and the importance of future rewards. In practical applications, it is usually necessary to select a suitable γ value based on the characteristics of the problem and the subjective initiative of technicians in this field. However, it is also possible to intelligently assign values to it by introducing the DS evidence theory algorithm; specifically, it includes the following steps S300~S302.
[0624] In this embodiment, regarding step S300, evidence A and evidence B are collected;
[0625] Evidence A and evidence B are two sets of vectors, respectively:
[0626] A=[A1,A2,...,A N ]; B=[B1,B2,...,B N ];
[0627] Among them, A i and B i is an element in evidence A and evidence B respectively, i is the index of the historical time step, and N is the maximum number of elements, that is, the length of evidence A and evidence B must be equal.
[0628] Among them, element A i and B i At time step i, a state s t Instant Rewards t and cumulative reward B t ;
[0629] It can be understood that this method can capture the changes in instant rewards and cumulative rewards over time, providing a data basis for the subsequent determination of discount factors.
[0630] In this embodiment, regarding step S301, evidence A and evidence B are combined by using Dempster's combination principle, and a joint trust function Bel(A∪B) is output; including:
[0631] S3010, merge trust allocation Bel (C):
[0632] ;
[0633] This is done by summing the weights of the elements in evidence A and B that intersect with set C and dividing by the sum of the weights of all elements except those that do not intersect with set C. This process ensures that the combined confidence assignment is reasonable and reflects the common information of the two evidences.
[0634] S3011. Combined uncertainty allocation Pl(C):
[0635] ;
[0636] Among them, mass is the weight (if an immediate reward r t or cumulative reward B t If it has special characteristics, it will be assigned a value, otherwise it will be assigned an intermediate weight, i.e. 0.5); C is the uncertainty set; ∅ represents the empty set;
[0637] It can be understood that the combined uncertainty allocation Pl(C) is calculated by subtracting the sum of the weights of the elements that intersect with the set C from 1. The uncertainty allocation reflects the degree of unknown about the set C, that is, the uncertainty of how much we trust C.
[0638] S3012, obtain the joint trust function Bel(A∪B):
[0639] ;
[0640] Bel(A) and Pl(A) are the confidence and uncertainty distributions of the set of evidence A;
[0641] Bel(B) and Pl(B) are the confidence and uncertainty distributions of the set of evidence B;
[0642] (Pl(A)∩Pl(B)) is the uncertainty distribution of the intersection of evidence A and evidence B respectively.
[0643] It can be understood that the joint trust function Bel(A∪B) is calculated based on the previous trust and uncertainty allocation. This function comprehensively considers the information of evidence A and B and gives a trust measure for the union of sets A and B.
[0644] In this embodiment, regarding step S302, the joint trust function Bel(A∪B) is mapped to an interval value between [0,1] as the discount factor γ through the sigmoid function:
[0645] ;
[0646] Where e is the base of natural logarithms;
[0647] It is understandable that the sigmoid function has the property of mapping any real number to the (0,1) interval, so it is very suitable for determining the discount factor here. In this way, we can get a dynamically adjusted discount factor that can adaptively change according to historical reward information, thereby better balancing the importance of immediate rewards and future rewards.
[0648] It should be pointed out that the above Dempster's combination principle provides a comprehensive measure that reflects the effect of the immediate reward and the cumulative reward on a certain state s. t The overall trust level of the joint trust function Bel(A∪B) not only considers the trust of the immediate reward and the cumulative reward, but also implicitly weighs the uncertainty between the two. In DS evidence theory, the trust function Bel and the likelihood function Pl constitute a trust interval, which indicates the degree of certainty of a hypothesis. The joint trust function is the result of fusing the two evidences under this framework. The discount factor γ is used in reinforcement learning to balance the importance of immediate rewards and future rewards. The traditional γ is usually a fixed value, while the γ value obtained by mapping the joint trust function can be adjusted according to the dynamic changes of the immediate reward and the cumulative reward, making the algorithm more flexible and adaptive. Moreover, the value of the joint trust function Bel(A∪B) integrates the information of the immediate reward and the cumulative reward, so the mapped γ value can better reflect the reward structure in the actual task. When the immediate reward is high, the γ value may be adjusted accordingly to pay more attention to the current reward; when the cumulative reward is more important, the γ value may tend to the future reward.
[0649] Therefore, it can be understood that the discount factor γ obtained by mapping the joint trust function is adaptive and can be dynamically adjusted according to historical reward information, so as to better adapt to different task environments and reward structures. Moreover, the γ value comprehensively considers the impact of immediate rewards and cumulative rewards, so that the algorithm can more comprehensively evaluate the value of different actions when making decisions. At the same time, compared with the traditional fixed discount factor, this dynamic discount factor based on the joint trust function is more flexible and can adjust the emphasis on immediate rewards and future rewards in different situations.
[0650] In this embodiment, the DS evidence theory algorithm is introduced to intelligently assign the discount factor, thereby improving the flexibility and adaptability of the auto-coupling step-down starting fan control method. This method of dynamically determining the discount factor can better reflect the reward structure in the actual task, thereby helping the intelligent agent to learn and optimize its control strategy more effectively. In addition, since the discount factor is dynamically adjusted according to the historical reward information, this method can also adapt to the uncertainty and variability of the environment to a certain extent.
[0651] Example 5: Please refer to Figure 2~3 This embodiment discloses an auto-coupling step-down fan starting control system for a data center; the system is used to execute the auto-coupling step-down fan starting control method provided in all the above embodiments.
[0652] In this example, see Figure 2~3 The system includes two motors 1M and 2M (referred to as "device 1" and "device 2" in the figure) for driving the fan to rotate, an EMC controller and an MCU controller; the EMC controller is connected to and controls the two motors through a control loop; an MCU controller is connected to the I2C port of the EMC controller, and the MCU controller is externally connected to a memory, in which program instructions are stored. When the MCU controller executes the program instructions, the auto-coupling step-down starting fan control method described in all the above embodiments is implemented, and then the two motors are controlled by the EMC controller.
[0653] In this example, see Figure 2 The wiring methods of the two motors are the same, and both belong to the traditional stator string autotransformer step-down starting control circuit, so the wiring diagram and principle are not explained. Only the control process principle of the motor 1M circuit is introduced: after pressing the start button, the coils of contactors 1KM3, 1KM2 and current transformer 1TA are energized, the main contacts of contactors 1KM3 and 1KM2 are closed, and the motor stator winding is connected to the power supply step-down starting through the autotransformer 1T, and is protected by the thermal relay KH during the period; during this period, the current transformer 1TA transmits the current value through the ammeter 1PA, and at the same time, the running transformer 1RUS and the starting transformer 1STS are energized, the former is connected to the 11 and 12 ports of the EMC controller, and the latter is connected to the 3 and 4 ports of the EMC controller, realizing information interaction and control with the EMC controller.
[0654] In this example, see Figure 3Control circuit diagram: 1DV represents device 1, i.e. motor 1M. Its ports 1 and 2 are connected to the motor controller EMC, ports 3 and 4 are connected to the start sensor, port 5 is connected to contactors 1KM1 and 1KM2, port 6 is normally closed and connected to the step-down start button through contactors 1KM1 and 1KM3, port 7 is connected to contactors 1KM1 and 1KM2 normally open to port 43 of the EMC controller, and contactor 1KM2 is connected in series to the port of 1KM3 connected to the step-down start button, and port 8 is provided with the normally open of contactor 1KM3 and normally open to port 43 of the EMC controller, and 1KM3 is connected to the normally closed contactor 1KM1. Ports 11 and 22 of the EMC controller are connected to a control power switching module TE, and the coil of the control transformer 2TC of ports 5 and 6 of the control power switching module TE is connected to ports 7 and 8 of device 2 (the rest of the circuits of device 2 and device 1 are roughly the same); then, the coil of the control transformer 1TC of ports 3 and 4 of the control power switching module TE is connected to ports 7 and 8 of device 1.
[0655] Specifically, regarding device 1 (1DV) / motor 1M (the principle of device 2 is the same):
[0656] Port 1 and 2: connected to the motor controller EMC to receive control signals;
[0657] Ports 3 and 4: connected to the starting sensor to detect the starting status of the motor;
[0658] Port 5: connected to contactors 1KM1 and 1KM2, used for controlling the main circuit of the motor;
[0659] Port 6: connected to the step-down start button through the normally closed contacts of contactors 1KM1 and 1KM3 to achieve the step-down start function;
[0660] Port 7: connected to the normally open contacts of contactors 1KM1 and 1KM2, and connected to port 43 of the EMC controller for feedback of the motor operating status;
[0661] Port 8: Equipped with the normally open contact of contactor 1KM3, it is also connected to port 43 of the EMC controller for feedback of the step-down starting status.
[0662] Specifically, regarding motor controller EMC:
[0663] Ports 11 and 22: connected to the control power switching module TE, used to control the power switching;
[0664] Receive status feedback from device 1 and issue control instructions as needed;
[0665] Specifically, regarding the control power switching module TE:
[0666] Ports 3 and 4: Connect the coil of control transformer 1TC to ports 7 and 8 of device 1 to provide control power.
[0667] Ports 5 and 6: Connect the coil of control transformer 2TC to the corresponding ports of device 2 to provide control power for device 2.
[0668] Specifically, regarding contactors 1KM1, 1KM2, and 1KM3: they are responsible for controlling the on and off of the main circuit and the reduced-voltage starting circuit of the motor according to the EMC control instructions.
[0669] In this example, see Figure 3 , when the circuit is operating normally: When the EMC receives the start signal, it will close the main circuit of the motor by controlling contactors 1KM1 and 1KM2. If reduced voltage starting is required, the EMC will implement the reduced voltage function by controlling 1KM3 and operate through the reduced voltage start button of port 6. The operating status of the equipment will be transmitted back to the EMC through the feedback signals of ports 7 and 8.
[0670] In this example, see Figure 3 , when the fault is switched: If device 1 fails, the control power switching module TE will detect the abnormality and automatically switch to the control power of device 2 to ensure the continuous operation of the system. At the same time, EMC will identify the faulty device based on the feedback signal and control the contactor to perform the corresponding switching operation. That is, TE issues a switching command to prepare to switch the control power from device 1 to device 2. The coil of the control transformer 2TC is connected to ports 7 and 8 of device 2 and is normally in standby mode. When receiving the switching command, 2TC will activate the coil to provide stable control power to device 2, while the coil of the control transformer 1TC disconnects the circuit of device 1, and the thermal relay 2KH is responsible for overload protection. After the control power is successfully switched to device 2, device 2 will receive a stable power supply. Device 2 will then start up and take over the work of device 1 to ensure the continuous operation of the entire system.
[0671] In this example, see Figure 3 Whether the circuit is in normal operation or fault switching state, the EMC controller is connected to an MCU controller based on the I2C port. When the MCU controller executes the methods of all the above embodiments, it can directly control the tap adjustment of the autotransformer 1T, 2T based on the EMC controller, or it can be connected to the MCU controller and a display screen externally, and the tap adjustment value of the autotransformer is fed back through the MCU controller, and the autotransformer 1T, 2T is manually adjusted by external staff. It depends on whether the autotransformer 1T, 2T is mechanical or intelligent.
[0672] In this embodiment, it can be understood that other functions in the above figure, such as the module loop of the signal expansion 1SE, 2SE, the liquid level sensor loop WTS, etc., do not involve the core functions of this embodiment. Therefore, for those skilled in the art, it is sufficient to understand these auxiliary functions through common knowledge.
[0673] All the above embodiments only express the implementation methods of the relevant practical applications of the present invention, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for ordinary technicians in this field, several variations and improvements can be made without departing from the concept of the present invention, which all belong to the protection scope of the present invention. Therefore, the protection scope of the patent of the present invention shall be based on the attached claims.
Claims
1. A method for controlling an auto-transformer step-down fan starter for a data center, comprising an auto-transformer, characterized in that: When the wind turbine motor starts, the intrinsic modal component IMF of the power grid signal is extracted i (t), then perform the following steps: S1, initializing the strategy network: setting a parameterized strategy network, whose input is the current state of the power grid and the motor, and whose output is the vector SDV composed of the step adjustment interval and adjustment amount of the tap of the autotransformer, and initializing the network weight α; In the S1, the current state and the policy network are determined by the following two steps: S100, the current state s t is the intrinsic mode component IMF i (t); S101, the policy network is a multi-layer perceptron neural network PN: PN = MLP(input dim , hidden dim , output dim ); Among them, MLP is a multi-layer perceptron network, input dim is the input state s t The dimension of the vector, hidden dim is the dimension of the hidden layer, output dim is the dimension of the output vector SDV; The forward propagation strategy of the neural network PN is: given the input state is regarded as the intrinsic mode component IMF i (t), the output is the vector SDV: SDV = PN(IMF i (t); α); Among them, PN represents the forward propagation function of the policy network; S2, collect samples: according to the current strategy network output tap adjustment Δs i (t) to collect samples s and record the intrinsic mode component IMF of each sample s at each step s (t) i , reward vector A and new intrinsic mode component IMF s (t) i '; In S2, the output tap adjustment amount Δs i (t) and the recording is achieved through the following two steps: S200, adjusted according to the output of the neural network PN: According to the output Δs of the neural network PN at the current time step t i (t) to adjust the tap: Δs i (t) = PN(IMF i (t);α); Then, the neural network PN outputs a "state-action pair": ; Among them, π α (a t |s t ) is in state s t Take action a t The probability of (s t , a t ) is the state-action pair; S201, record data, including: 1) The intrinsic mode component IMF before adjustment s (t) i ; 2) The adjustment amount Δs performed i (t); 3) The adjusted new intrinsic mode component IMF s (t) i '; 4) a reward vector A containing the reward information obtained by performing the adjustment; The above data constitutes a sample s, which is expressed as: s = {IMF s (t) i , Δs i (t), IMF s (t) i ', A}; In S201, the reward vector A is calculated based on the system performance after the adjustment, and the system performance includes whether the stability of the power grid system is improved, and the stability depends on whether the motor smoothly transitions from low-voltage startup to full-voltage operation: A = R(IMF s (t) i , Δs i (t), IMF s (t) i '); Among them, R is a reward function based on system stability and transition smoothness: R=R stability +R transition ; Among them, R stability is the stability reward part, R transition It is the reward part for smooth transition; S3, calculate the cumulative reward: for each sample s trajectory, calculate the cumulative reward sequence B from the beginning of this step to the end of the trajectory; S4, update the policy network: update the weight α of the policy network to the weight α according to the cumulative reward sequence B new ; The goal is to increase the probability of actions that lead to high cumulative rewards and reduce the probability of actions that lead to low cumulative rewards; In S4, the updating is achieved through the following two steps: S400, update weight: implemented through Actor network: ; in: is in state s t Take action a t probability; is the gradient of the log probability with respect to the policy network weights; η is the learning rate, which controls the step size of the weight update; δ is the TD error. If δ is positive, the action a should be increased. t The probability of being selected; if δ is negative, the action a should be reduced t probability; S401, Critic network evaluation: guiding the update direction of the Actor network by calculating the TD error δ: ; Where γ is the discount factor, r t is in the state s t Take the action a t The immediate reward obtained after t ) and V(s t+1 ) are respectively the Critic network's response to the state s t and the state s at the next time step t+1 The prediction function of the value of ; S5, iterative optimization: repeat steps S2 to S4; S6, performing actual adjustment: calculating the vector SDV, setting the parameters of the PID controller and setting the target speed and the allowable error range of the motor, and accepting the vector SDV; dynamically adjusting the set point of the PID controller according to the adjustment amount of the tap; In S6, the method of obtaining and applying the vector SDV is: After obtaining the vector SDV, reduce its dimension and obtain the step adjustment interval i of the tap i and adjustment value Δs i , and then adjust the tap of the autotransformer accordingly: SDV = PN(IMF i (t); α new ); SDV = [i i , Δs i ]; Where, Δs i represents the adjustment amount of the tap, i i Represents the relative interval of the adjustment amount of the tap in a continuous time step.
2. The fan control method according to claim 1, characterized in that: In S3, the accumulation is implemented as follows: s = {s1, s2, ..., s T }; Where T is the length of the trajectory; Each state s t Corresponding to an immediate reward r t , the way to obtain the cumulative reward sequence B is: ; Among them, γ is the discount factor used to adjust the importance of future rewards; t is the current state s t The time point index in the trajectory, k is the accumulation point.
3. The fan control method according to claim 2, characterized in that: In S5, the iterative steps include: S501, collect the new state-action pairs (s t , a t ) and the corresponding reward vector A; S502, for each state-action pair (s t , a t ), calculate its cumulative reward R t ; S503, using the accumulated reward R t To update the weight α of the neural network PN, the purpose is to increase the cumulative reward R that leads to a high t The action a t The probability of reducing the cumulative reward R t The action a t probability; S504, stop condition: until the number of iterations reaches the upper limit.
4. The fan control method according to claim 1, characterized in that: In S6, the PID controller is in the form of: ; Where u(t) is the output signal of the controller; e(t) is the deviation between the set point and the actual measured value; K p , K i and K d are the gains of the proportional, integral, and derivative controllers, respectively; dτ is a continuous constant; SP(t) is the set point of the PID controller, PV(t) is the process variable, and u max and u min are the maximum and minimum limit values of the control signal respectively.
5. An auto-coupling step-down starting fan control system for a data center, comprising two fan motors using a stator string auto-coupling transformer step-down starting control circuit, characterized in that: The fan motor has an autotransformer in its connection terminal; the control loop of each fan motor is connected to an EMC controller, the I2C port of the EMC controller is connected to an MCU controller, and the MCU controller is connected to a memory storing program instructions; When the program instructions are executed by the MCU controller, the EMC controller controls and implements the fan control method as described in any one of claims 1 to 4.
