Electric scooter intelligent speed control method, device, equipment and storage medium
By combining the multi-head temporal self-attention mechanism and the spatial cross-attention mechanism, the target speed sequence is generated, and the system state observation and control is performed through a robust extended state observer and adaptive PID control parameters, the problem that the existing electric scooter speed control system is difficult to accurately predict the cyclist intentions under complex road conditions, achieving high-precision speed control and safe and reliable system operation.
Patent Information
- Application Number
- CN202510022521.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-07
- Publication Date
- 2025-04-04
- Estimated Expiration
- 2045-01-07
AI Technical Summary
The existing electric scooter speed control system is difficult to accurately predict the cyclist's intentions under complex road conditions, resulting in uneven speed control and the inability to effectively integrate multi-source sensor data and environmental information, affecting the riding experience and safety.
The multi-head temporal self-attention mechanism and spatial cross-attention mechanism are used to deeply mine the riding historical data, extract the correlation between timing characteristics and spatial characteristics, generate the target speed sequence through the multi-feature fusion module and the intention-inspiring control module, and perform system state observation and control through the robust extended state observer and adaptive PID control parameters.
Accurate prediction of riding intentions is achieved, the system's observation accuracy and control accuracy under complex operating conditions are improved, and the accuracy of motor control and the safe and reliable operation of the system is ensured.
Smart Images

Figure CN119408424B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of intelligent speed control, and in particular to an intelligent speed control method, device, equipment and storage medium for an electric scooter. Background Art
[0002] Traditional electric scooter speed control systems mainly use methods based on sliding mode observers and adaptive controllers. Although this method is simple and effective, it is difficult to accurately predict the rider's intentions under complex road conditions, which can easily cause uneven speed control.
[0003] When processing historical riding data, current electric scooter speed control systems often ignore the correlation between temporal and spatial features, resulting in insufficient prediction accuracy of riding intentions. Especially during speed changes, due to the inability to effectively integrate multi-source sensor data and environmental information, the system is difficult to respond to the rider's control needs in a timely manner, affecting the riding experience and safety. In addition, the existing control methods are easily affected by external interference such as changes in road conditions and load fluctuations. Traditional PID control parameters are difficult to adaptively adjust according to actual working conditions, resulting in a decrease in speed control accuracy, insufficient system robustness, and inability to meet the intelligent control needs in different scenarios. Summary of the invention
[0004] The main purpose of the present invention is to provide an electric scooter intelligent speed control method, device, equipment and storage medium, which ensures the accuracy of motor control and ensures the safe and reliable operation of the system under various working conditions.
[0005] To achieve the above object, the present invention provides an intelligent speed control method for an electric scooter, comprising the following steps:
[0006] The riding history data of the electric scooter is collected and filtered to obtain a time series feature matrix;
[0007] Based on the time series feature matrix, a multi-head temporal self-attention mechanism and a spatial cross-attention mechanism are constructed to obtain a temporal feature vector and a spatial feature vector;
[0008] Inputting the time feature vector and the space feature vector into a multi-feature fusion module for weighted fusion to obtain a fused feature vector, and generating a target speed sequence through an intention-inspired control module based on the fused feature vector;
[0009] Constructing a state observer for the target speed sequence to obtain a system state vector;
[0010] Based on the system state vector, an observer gain matrix is calculated by solving a linear matrix inequality, and an outer loop speed controller and an inner loop current controller are constructed to obtain adaptive PID control parameters;
[0011] The adaptive PID control parameters are input into the PWM modulator to calculate the motor control amount, obtain the speed control execution instruction, and output the motor drive signal according to the speed control execution instruction.
[0012] The present invention also provides an intelligent speed control device for an electric scooter, comprising:
[0013] The acquisition module is used to collect and filter the riding history data of the electric scooter to obtain a time series feature matrix;
[0014] A processing module, used to construct a multi-head temporal self-attention mechanism and a spatial cross-attention mechanism based on the temporal feature matrix to obtain a temporal feature vector and a spatial feature vector;
[0015] A fusion module, used for inputting the time feature vector and the space feature vector into a multi-feature fusion module for weighted fusion to obtain a fused feature vector, and generating a target speed sequence through an intention-inspired control module based on the fused feature vector;
[0016] A construction module, used for constructing a state observer for the target speed sequence to obtain a system state vector;
[0017] A solution module is used to calculate the observer gain matrix based on the system state vector by solving the linear matrix inequality, and to construct an outer loop speed controller and an inner loop current controller to obtain adaptive PID control parameters;
[0018] The output module is used to input the adaptive PID control parameters into the PWM modulator to calculate the motor control quantity, obtain the speed control execution instruction, and output the motor drive signal according to the speed control execution instruction.
[0019] The present invention also provides a computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of any one of the above methods when executing the computer program.
[0020] The present invention also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above-mentioned methods are implemented.
[0021] In summary, the technical solution provided by the present invention deeply mines the riding history data through the combination of multi-head temporal self-attention mechanism and spatial cross-attention mechanism, establishes the correlation between temporal features and spatial features, and effectively extracts the riding intention features; adopts the design of multi-feature fusion module and intention-inspired control module to realize accurate prediction of riding intention, and generates a target speed sequence that meets the constraints of the actual scene through the cooperation of LSTM sequence predictor and scene adapter; based on the design of robust extended state observer and combined with the linear matrix inequality solution method, a state observation system with anti-interference ability is constructed, which improves the observation accuracy of the system under complex working conditions; through the cascade control structure of the outer loop speed controller and the inner loop current controller, the adaptive adjustment of the control parameters is realized, and the SVPWM modulation strategy is adopted to ensure the accuracy of motor control; a complete protection mechanism is integrated, including current limiting, dead zone compensation and intermittent protection functions, to ensure the safe and reliable operation of the system under various working conditions, and significantly improve the overall performance of the system. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] Figure 1 This is a schematic diagram of the steps of an intelligent speed control method for an electric scooter in one embodiment of the present invention;
[0023] Figure 2 This is a structural block diagram of an intelligent speed control device for an electric scooter in one embodiment of the present invention;
[0024] Figure 3 It is a schematic block diagram of the structure of a computer device according to an embodiment of the present invention.
[0025] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0026] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.
[0027] Reference Figure 1 , this embodiment provides an electric scooter intelligent speed control method, comprising the following steps:
[0028] S1, collect and filter the riding history data of the electric scooter to obtain a time series feature matrix;
[0029] Among them, the data of multiple key sensors are sampled and preprocessed. The data types collected and processed include speed, acceleration, position, posture, road environment images and other aspects. For the speed data collection of electric scooters, the speed sampler is used to obtain the original speed data. The original speed data is processed by digital low-pass filtering to effectively weaken the high-frequency noise, retain only the low-frequency components in the data, and obtain relatively smooth speed time series data. At the same time, the original acceleration data collected by the acceleration sensor of the electric scooter is processed by Gaussian filtering. Gaussian filtering is a method based on weighted average. It uses Gaussian function to smooth the data, which can significantly reduce the interference of noise while retaining the main features of the data. This filtering method is suitable for processing acceleration data, can remove random noise, and maintain a high response speed when the acceleration data changes greatly, and obtain acceleration time series data. For the location information of the electric scooter, the GPS module is used to collect the original location data. GPS data is accompanied by various noises, such as errors caused by multipath effects and satellite signal blocking, and the original location data is processed by Kalman filtering. Kalman filtering is a state estimation method that can combine system models and sensor measurement information to dynamically correct data in a recursive manner. Through Kalman filtering, the noise of GPS data is significantly reduced, the stability and accuracy of position data are improved, and the position information of the electric scooter is more continuous and accurate in the time and space dimensions. For the collection of attitude information, a gyroscope sensor is installed on the electric scooter to measure its attitude data. The gyroscope is easily affected by temperature changes, resulting in zero drift errors, which leads to inaccurate attitude measurement results. In order to eliminate this error, a temperature compensation model is used to correct the original attitude data. By modeling the temperature characteristics of the gyroscope, its measurement results are adjusted in real time, the zero drift error caused by temperature changes is eliminated, and accurate and reliable attitude data is obtained. At the same time, the electric scooter is equipped with a camera to collect environmental image sequences of the surrounding roads. The collected original images are normalized, and the brightness, contrast and other parameters of the images are adjusted so that the images collected at different times and under different lighting conditions have consistent features, thereby improving the accuracy of subsequent visual feature extraction and analysis. Through image normalization, the visual information deviation caused by changes in lighting conditions is eliminated, and a road environment image sequence is obtained. The speed time series data, acceleration time series data, position data, posture data and road environment image sequence are time synchronized to obtain a complete time series feature matrix.
[0030] S2, constructs a multi-head temporal self-attention mechanism and a spatial cross-attention mechanism based on the temporal feature matrix to obtain the temporal feature vector and the spatial feature vector;
[0031] Specifically, the time series feature matrix is linearly transformed to convert the original time series features into feature expressions suitable for the attention mechanism. The time series feature matrix is linearly transformed to obtain eight sets of independent attention head features, each of which includes a query matrix (Query), a key matrix (Key) and a value matrix (Value). Linear transformation can map the original features to a higher-dimensional space to facilitate the operation and processing of the attention mechanism. For each set of attention head features, a scaled dot product operation is performed to calculate the degree of association between different features. The dot product between the query matrix and the key matrix is calculated, and the result is scaled. Then, the softmax function is applied to obtain the importance weight of each feature to form an attention weight matrix. Based on the attention weight matrix, the corresponding value matrix is weighted and summed to obtain eight sets of independent time series correlation features, which capture the dependency between electric scooters in different time segments, so that important information in the time dimension during scooter riding can be extracted. The eight sets of time series correlation features are feature spliced, the outputs of all attention heads are connected, and then they are mapped to a unified feature space through linear mapping transformation to obtain a time feature vector. The temporal feature vector contains the key features of the temporal information during the riding of the electric scooter. At the same time, the road environment image sequence features and riding posture features in the temporal feature matrix are processed to obtain spatial feature information. The road environment image sequence features are processed by the first attention branch. In this attention branch, the road environment features are used as query vectors and the riding posture features are used as key-value pairs. The correlation between the road environment and the posture is extracted through the attention mechanism to obtain feature information directly related to the riding environment, forming the road environment attention features. This method enables the model to reasonably associate the riding posture of the scooter according to the characteristics of the current road environment, and then capture the interactive relationship between the scooter riding and the external environment. At the same time, the riding posture features are processed by the second attention branch, using the riding posture features as query vectors and the road environment features as key-value pairs, and the riding posture attention features are obtained through the attention mechanism. This enables the model to identify the dependency between the riding posture and the road environment, and helps understand the posture adjustment under different road environments. The cross-processing attention mechanism can fully capture the interactive characteristics of the electric scooter and the surrounding environment in the spatial dimension. The road environment attention features and riding posture attention features are spliced, and the correlation between the road environment and riding posture is integrated into the same feature expression to form a spatial interaction feature. The spliced spatial interaction features are linearly mapped and mapped to the target feature space to obtain the final spatial feature vector.
[0032] S3, inputting the time feature vector and the space feature vector into the multi-feature fusion module for weighted fusion to obtain a fused feature vector, and generating a target speed sequence through the intention-inspired control module based on the fused feature vector;
[0033] It should be noted that the temporal feature vector is input into the first channel attention network to calculate the feature importance and obtain the weight coefficient of the temporal feature. In the first channel attention network, the features are transformed and weighted layer by layer through three fully connected layers, where the first and second fully connected layers use the ReLU activation function, which has nonlinear characteristics and can enable the network to better fit complex feature relationships. In the third fully connected layer, the Sigmoid activation function is used, and its output range is 0 to 1, which can normalize the feature importance and obtain the temporal feature weight coefficient suitable for feature weighting. Similarly, the spatial feature vector is input into the second channel attention network to calculate the importance weight coefficient of the spatial feature. The structure of the second channel attention network is the same as that of the first channel attention network, including three fully connected layers, the first two layers use the ReLU activation function, and the last layer uses the Sigmoid activation function. The temporal feature weight coefficient is subjected to feature weighting processing with the original temporal feature vector, and each feature is weighted and multiplied to obtain the weighted temporal feature. Similarly, the spatial feature weight coefficient is subjected to weighted processing with the spatial feature vector to obtain the weighted spatial feature. Feature weighting can highlight more important features in a specific scenario, while reducing the influence of unimportant or noise features, making the final fused features more representative and robust. The weighted temporal features and weighted spatial features are input into a fusion module containing a three-layer fully connected neural network for feature fusion. The number of nodes in the three layers of the fully connected neural network is 256, 128 and 64 respectively. The number of nodes reduced layer by layer realizes the gradual compression and abstraction of features, thereby extracting important information from high-dimensional features and obtaining a fused feature vector. The fused feature vector is input into the LSTM sequence predictor to generate a speed sequence. The LSTM sequence predictor contains two layers of LSTM units, each containing 128 hidden nodes. LSTM (Long Short-Term Memory Network) is a recurrent neural network structure that can process time series data, has a memory and forgetting mechanism, and is suitable for processing feature data with long-term dependencies. The role of the LSTM sequence predictor is to use the fused feature vector to predict the speed change trend of the electric scooter at future moments and generate an initial speed prediction sequence. Through the memory capacity of LSTM, the dynamic law of speed change during scooter riding is captured, and reasonable predictions are made based on the fusion features. The initial speed prediction sequence is input into the scene adapter for speed correction to generate a scene-constrained speed sequence. The scene adapter makes reasonable speed corrections based on the current riding environment, such as slowing down on a slope and accelerating appropriately on a flat road. The scene adapter adapts the initial speed according to different riding scenarios to ensure the riding safety and stability of the electric scooter in different environments. The scene-constrained speed sequence is smoothed to reduce the drastic fluctuations in speed changes and obtain the final target speed sequence.
[0034] S4, construct a state observer for the target speed sequence to obtain the system state vector;
[0035] Specifically, the dynamic model of the electric scooter is discretized. The dynamic model of the electric scooter is described by a continuous physical system, such as speed, motor speed, control input, and external disturbance. The continuous dynamic model is converted into a discrete state space equation by numerical discretization. The discrete state space equation contains the system state matrix, the control input matrix, and the disturbance matrix, which describe the relationship between the state evolution and the input and output of the system at each discrete moment. Through discretization, the continuous control problem is converted into a discrete control problem suitable for implementation on a digital computer. The discrete state space equation is analyzed for observability. Observability is an important concept in system control theory, which is used to determine whether the internal state of the system can be completely reconstructed through the output of the system. By calculating and analyzing the observable matrix of the discrete state space equation, it is evaluated whether the system is observable under given input and output conditions. If the system is observable, the internal state of the system is inferred based on the output. Based on the observable matrix, a robust extended state observer is constructed to deal with the uncertainty and external disturbance in the system. The robust extended state observer is constructed by designing an observer state equation containing an observer gain term and a disturbance compensation term. The observer gain term is used to adjust the observer's sensitivity to errors, while the disturbance compensation term is used to offset the state estimation deviation caused by external disturbances, thereby improving the robustness and accuracy of the observer. The error between the expected speed and the actual speed in the target speed sequence is calculated to obtain the speed observation error. The speed observation error reflects the deviation between the actual motion state of the electric scooter and the expected target. This information is helpful for the state estimation and subsequent control of the observer. At the same time, in order to cope with the influence of load disturbances, the boundedness analysis of the load disturbance is performed, that is, the amplitude and variation range of the load disturbance are analyzed to obtain the disturbance boundary conditions. The disturbance boundary conditions can provide the observer with a reasonable interval for estimating disturbances, which is convenient for effective compensation during the observation process. The speed observation error and the disturbance boundary conditions are input into the observer state equation, and the state update calculation is performed to obtain the updated system state. In the state update process, the observer uses the speed observation error to correct the system state, and uses the disturbance boundary conditions to compensate for the disturbance in the system, so as to achieve a more accurate estimation of the system state. The state update process is dynamic. As time goes by, the observer will continuously adjust the estimate of the system state to ensure that it is consistent with the actual situation. The updated system state also needs to be digitally filtered to eliminate high-frequency noise and unnecessary fluctuations in the system state, making the system state quantity smoother and more stable, and obtaining the filtered state quantity. The filtered state quantities are combined to obtain the system state vector. The system state vector contains multiple key state components of the electric scooter, including the actual speed component, the motor speed component, and the load disturbance component.The actual speed component reflects the current speed of the scooter, the motor speed component describes the working state of the motor, and the load disturbance component characterizes the impact of the external load on the system. Through the combination of these components, the system state vector can fully describe the current operating state of the electric scooter.
[0036] S5, based on the system state vector, the observer gain matrix is calculated by solving the linear matrix inequality, and the outer loop speed controller and the inner loop current controller are constructed to obtain the adaptive PID control parameters;
[0037] Among them, the error dynamic modeling of the system state vector is carried out to obtain the error dynamic equation. The error dynamic equation describes the dynamic error evolution process between the actual state of the system and the ideal target state, and its form includes the observer gain matrix, the system state matrix, the observation matrix and the disturbance matrix. The error dynamic equation is converted into the linear matrix inequality (LMI) form and solved to obtain the observer gain matrix. The linear matrix inequality is an optimization tool suitable for stability analysis and gain design problems in control systems. By converting the error dynamic equation into the LMI form, the stability and controller gain of the system are constrained to ensure that the system still has good dynamic response under different disturbances. The LMI solution process includes positive definite matrix variables and gain matrix variables. Through numerical solution, the observer gain matrix that minimizes the system error and is stable is determined. The observer gain matrix is pole-configured to ensure the stability and fast response of the system. Through pole configuration, the characteristic equation of the system is obtained, which can describe the dynamic characteristics of the system. Based on the system characteristic equation, the speed error signal is adaptively gained to obtain the initial parameters of the speed loop PID. These initial parameters include proportional, integral and differential gains, which can provide an initial control scheme for the speed controller and achieve effective adjustment of the speed error. The initial parameters of the speed loop PID are updated online through the sign function to obtain the parameters of the outer loop speed controller. The process of online parameter update includes proportional coefficient update, integral coefficient update and differential coefficient update, that is, during the actual operation of the scooter, the gain parameters of the controller are dynamically adjusted according to the current speed error signal, so that the PID controller can adapt to different riding conditions. For example, in the acceleration and deceleration stages, the controller automatically adjusts the proportional coefficient and integral coefficient to achieve a smoother speed transition, thereby avoiding overshoot and oscillation and ensuring the stable operation of the scooter under various working conditions. The outer loop speed controller parameters are used as input, and the motor current is transformed to obtain the d-axis current component and the q-axis current component. The d-axis and q-axis current components represent the current distribution of the motor in the direct axis and quadrature axis directions, respectively. This coordinate transformation uses Park transformation to simplify the originally complex three-phase AC current into a DC current in a two-axis coordinate system, which is easy to control and calculate. The d-axis current component and the q-axis current component are calculated by sliding mode control to obtain the parameters of the inner loop current controller. Sliding mode control is a robust control method that can maintain good control performance in the presence of system uncertainties and disturbances. By performing sliding mode control on the current, the motor current can be quickly and accurately tracked, and the dynamic performance of the system can be enhanced. The parameters of the outer loop speed controller and the parameters of the inner loop current controller are hierarchically combined to obtain the final adaptive PID control parameters.The hierarchical combination ensures tight coupling between the speed loop and the current loop, so that the outer loop speed controller can adjust the reference current of the motor according to the speed error, while the inner loop current controller can accurately control the motor drive current according to the reference current. Through the collaborative work of the dual-loop structure, the entire control system can maintain a high degree of responsiveness and stability in complex riding environments, and realize intelligent and adaptive adjustment of the speed of the electric scooter.
[0038] S6, inputting the adaptive PID control parameters into the PWM modulator to calculate the motor control quantity, obtaining the speed control execution instruction, and outputting the motor drive signal according to the speed control execution instruction.
[0039] Specifically, the current command in the adaptive PID control parameter is subjected to current limiting processing to obtain a limited current command. The current limiting processing limits the current command to within the range of plus or minus 10 times the rated current of the electric scooter motor, which can effectively prevent the excessive current caused by the malfunction of the control system or in extreme cases, thereby causing damage to the motor and related power electronic equipment, and ensure the safety and reliability of the system. The current command after limiting is subjected to three-phase stationary coordinate system transformation processing to obtain a three-phase current command. Inverse Park transformation and inverse Clarke transformation are used. Inverse Park transformation is used to convert the current components of the d-axis and q-axis back to the two-phase stationary coordinate system, while inverse Clarke transformation further converts the current in the two-phase stationary coordinate system into the current in the three-phase stationary coordinate system to obtain the three-phase current command required by the motor. The control command is converted into the three-phase AC current actually required by the motor to achieve effective control of the motor. The three-phase current command is calculated by SVPWM (space vector pulse width modulation) strategy to obtain the basic voltage vector action time series. SVPWM modulation is a motor control method that can maximize the use of DC bus voltage and improve the efficiency and torque density of the motor. In SVPWM modulation, sector discrimination is performed, that is, the sector where the voltage vector is located is determined according to the current current command, and then vector synthesis is performed, that is, the target voltage vector is synthesized using the adjacent basic voltage vectors. By calculating the action time of the basic voltage vector, a time series is formed to determine the opening and closing time of each switch tube in order to generate the desired PWM signal. Based on the basic voltage vector action time series, the switch timing calculation is performed to determine the specific switch timing of each upper and lower bridge arm in the motor inverter. In order to prevent the switch tubes of the upper and lower bridge arms from being turned on at the same time and causing a short circuit, the switch timing of the upper and lower bridge arms is processed by dead time insertion to obtain a PWM waveform after dead time compensation. The dead time insertion is to leave a small time interval when the upper and lower bridge arms are switched, so as to ensure that the upper and lower tubes of the same bridge arm will not be turned on at the same time, avoiding the risk of DC bus short circuit. The PWM waveform after dead time compensation is input into the MOS driver chip for level conversion to obtain a driving level signal for driving the power tube. The function of the MOS driver chip is to convert the control signal into a level suitable for driving the MOSFET power tube. This conversion process is very critical because the signal level output by the controller is usually not enough to directly drive the power switch device. In order to ensure the reliability of the system, the power tube drive level signal is intermittently protected to obtain a protected drive signal. The intermittent protection measures include overcurrent protection thresholds and overvoltage protection thresholds. Through these protection measures, when the current or voltage in the system exceeds the set safety range, the drive signal will be temporarily cut off to prevent device damage or system loss of control due to excessive current or voltage. The protected drive signal is output to the motor winding through the power amplifier circuit to form a motor drive signal.The function of the power amplifier circuit is to amplify the drive signal to a level sufficient to drive the motor, thereby supplying power to the motor windings and generating drive torque.
[0040] In one example, the riding history data of an electric scooter is collected and filtered to obtain a time series feature matrix, including:
[0041] The original speed data collected by the speed sampler of the electric scooter is digitally low-pass filtered to obtain speed time series data; the original acceleration data collected by the acceleration sensor of the electric scooter is Gaussian filtered to obtain acceleration time series data; the original position data collected by the GPS module of the electric scooter is Kalman filtered to obtain position data; the original attitude data collected by the gyroscope of the electric scooter is zero-drift error corrected through a temperature compensation model to obtain attitude data; the road environment image sequence collected by the camera of the electric scooter is image normalized to obtain a road environment image sequence;
[0042] The speed time series data, acceleration time series data, position data, posture data and road environment image sequence are time synchronized to obtain a time series feature matrix.
[0043] In this example, the original speed data collected by the speed sampler is digitally low-pass filtered to remove high-frequency noise in the signal and retain only the main low-frequency information to accurately reflect the actual speed change of the scooter. The following filtering formula is used:
[0044] ;
[0045] in, Indicates The filtered velocity data of time steps, For the The original velocity data collected in time steps, is the filter coefficient, and its value range is .coefficient Controls the smoothness of the filter, larger Values correspond to stronger smoothing effects, while smaller The value retains more details of speed changes. The raw acceleration data collected by the acceleration sensor is processed to remove random noise. The Gaussian filter method is used. Gaussian filtering is a linear smoothing method that can well smooth the acceleration signal and remove sharp random noise. The formula of Gaussian filtering is:
[0046] ;
[0047] in, represents the filtered acceleration data, It is The raw acceleration data of sampling points, is the Gaussian weighting coefficient, which usually satisfies the Gaussian distribution:
[0048] ;
[0049] In the above formula, Control the width of the Gaussian filter to determine the distribution range of the weighting coefficient. By using Gaussian filtering, smooth and accurate acceleration time series data can be obtained to reduce measurement errors caused by external vibration or environmental interference. For the original position data collected by the GPS module, since the GPS signal is easily affected by environmental factors (such as building occlusion, multipath effect, etc.), there are large errors in the measurement data. Kalman filtering is used to process the position data. Kalman filtering is a recursive estimation method that estimates a more accurate position state by combining the system model and measurement data. The state update equation of Kalman filtering is:
[0050] ;
[0051] ;
[0052] in, It is in The prior state estimate at time t, is the updated state estimate, Indicates The actual observation data at the time, is the observation matrix, is the Kalman gain, is the forecast error covariance matrix, is the covariance matrix of the observation noise. Through Kalman filtering, the difference between the GPS observation value and the predicted value is used to continuously correct the position state to obtain smoother and more accurate position data. For the original attitude data collected by the gyroscope, due to the zero drift error of the gyroscope, especially when the temperature changes greatly, the error will significantly affect the accuracy of the attitude measurement. The original attitude data is corrected by the temperature compensation model to eliminate the influence of temperature on the measurement results. Assume that the original attitude data is , the temperature influence function is , the corrected posture data is expressed as:
[0053] ;
[0054] in, It is a temperature-dependent function used to describe the variation of zero drift error with temperature. By calibrating the gyroscope, we can obtain The specific expression of is used to effectively correct the posture at different temperatures and obtain accurate posture data. For the road environment image sequence collected by the camera, image normalization is performed to eliminate the impact of different lighting conditions on image quality and improve the image availability and stability of feature extraction. Assume that the original image pixel value is , the normalized pixel value is , the normalized formula is:
[0055] ;
[0056] in, and are the minimum and maximum values of all pixels in the image, respectively. By linearly transforming the pixel values of the original image to the range of [0,1], the impact of illumination changes on the image can be effectively reduced, so that the image has consistent brightness and contrast under different illumination conditions. The speed time series data, acceleration time series data, position data, posture data and road environment image sequence are synchronized. Assume that the speed data time series is , the acceleration data time series is , the time series of location data is , the posture data time series is , the image sequence timestamp is , aligning data of different time scales to the same time axis through interpolation methods On the top, we get a unified time series feature matrix:
[0057] ;
[0058] in, Indicates at time The temporal feature matrix at each moment includes various features such as speed, acceleration, position, posture and image.
[0059] In one example, a multi-head temporal self-attention mechanism and a spatial cross-attention mechanism are constructed based on the temporal feature matrix to obtain a temporal feature vector and a spatial feature vector, including:
[0060] Perform linear transformation on the time series feature matrix to obtain eight sets of independent attention head features. Each set of attention head features includes a query matrix, a key matrix, and a value matrix.
[0061] Perform a scaled dot product operation on each set of attention head features to obtain an attention weight matrix, and weight the value matrix based on the attention weight matrix to obtain the temporal correlation feature;
[0062] Perform feature concatenation and linear mapping on eight groups of time series related features to obtain a time feature vector;
[0063] The first attention branch processes the road environment image sequence features in the time series feature matrix to obtain the road environment attention features. The first attention branch uses the road environment features as query vectors and the riding posture features as key-value pairs.
[0064] The riding posture features in the time series feature matrix are processed by the second attention branch to obtain the riding posture attention features. The second attention branch uses the riding posture features as query vectors and the road environment features as key-value pairs.
[0065] The road environment attention features and the riding posture attention features are processed by feature splicing to obtain spatial interaction features, and the spatial interaction features are linearly mapped to obtain spatial feature vectors.
[0066] In this example, a linear transformation is performed on the time series feature matrix to extract features of different dimensions and transform them into a representation suitable for attention mechanism processing. Assume that the time series feature matrix is represented as ,in represents the number of time steps, Represents the dimension of the feature. By performing linear transformation on the feature matrix, eight sets of independent attention head features are obtained. Each set of attention head features includes a query matrix (Query), a key matrix (Key), and a value matrix (Value). Perform three linear transformations respectively to obtain the query matrix , key matrix Sum Matrix :
[0067] ;
[0068] in, is the weight matrix of the linear transformation, is the corresponding bias vector, Representing the dimensions of each attention head, we get eight independent query, key, and value matrices, represented as , and , these matrices are used for subsequent attention calculations. A scaled dot product operation is performed on each set of attention head features to calculate the attention weight matrix. The formula for the scaled dot product operation is as follows:
[0069] ;
[0070] in, It is The attention weight matrix of the attention head is obtained by taking the dot product of the query matrix and the key matrix to obtain the correlation degree between different time steps, and then divided by Scaling is performed to reduce the impact of large numerical dot products on model training and prevent gradients from disappearing or exploding. The results are normalized using the softmax function to ensure that the sum of each row in the weight matrix is 1. Using the attention weight matrix Weight the value matrix to obtain the time series correlation features :
[0071] ;
[0072] in, It is The time-series correlation features of the attention heads. Through weighted summation, the features most relevant to the query position can be aggregated, so that the output of each time step contains the most relevant global information. The eight groups of time-series correlation features are concatenated, and then the final time feature vector is obtained through linear mapping. The formula for feature concatenation is:
[0073] ;
[0074] in, It means that the output features of the eight attention heads are concatenated by columns. and are the weight matrix and bias vector of the linear transformation respectively. Through linear mapping, the time feature vector obtained is represents the multi-head attention aggregation result of the original time series features. At the same time, the road environment image sequence features and riding posture features in the time series feature matrix are processed to extract the correlation information in the spatial dimension. The road environment image sequence features are processed by the first attention branch to obtain the road environment attention features. In this attention branch, the road environment features are used as the query vector , and the riding posture features are used as key-value pairs The attention calculation formula is as follows:
[0075] ;
[0076] ;
[0077] in, is the weight matrix of road environment attention, which represents the correlation between road environment features and riding posture features. is the road environment attention feature, obtained by weighted summation. Similarly, the riding posture feature is processed by the second attention branch to obtain the riding posture attention feature. The riding posture feature is used as the query vector , and the road environment features are used as key-value pairs The attention calculation formula is as follows:
[0078] ;
[0079] ;
[0080] in, is the attention weight matrix between riding posture and road environment, is the riding posture attention feature, which describes the relationship between riding posture and environmental information. and riding posture attention characteristics Perform feature splicing to obtain spatial interaction features. The formula for feature splicing is:
[0081] ;
[0082] in, It means that the road environment attention features and riding posture attention features are concatenated in columns to obtain a spatial feature matrix containing the correlation information between the two. The concatenated spatial interaction features are linearly mapped to obtain the spatial feature vector:
[0083] ;
[0084] in, and is the weight matrix and bias vector of the linear transformation. Through linear mapping, the spatial interaction features are mapped to a more compact feature space to obtain the final spatial feature vector .
[0085] In one example, the time feature vector and the space feature vector are input into a multi-feature fusion module for weighted fusion to obtain a fused feature vector, and a target speed sequence is generated through an intention-inspired control module based on the fused feature vector, including:
[0086] The time feature vector is input into the first channel attention network to calculate the feature importance and obtain the time feature weight coefficient. The first channel attention network contains three fully connected layers. The first and second layers use the ReLU activation function, and the third layer uses the Sigmoid activation function.
[0087] The spatial feature vector is input into the second channel attention network to calculate the feature importance and obtain the spatial feature weight coefficient. The structure of the second channel attention network is the same as that of the first channel attention network.
[0088] Performing feature weighting processing on the time feature vector and the time feature weight coefficient to obtain a weighted time feature, and performing feature weighting processing on the space feature vector and the space feature weight coefficient to obtain a weighted space feature;
[0089] The weighted time features and weighted spatial features are input into a three-layer fully connected neural network for feature fusion to obtain a fused feature vector. The number of nodes in the three layers of the fully connected neural network are 256, 128, and 64 respectively.
[0090] The fused feature vector is input into the LSTM sequence predictor to generate the speed sequence and obtain the initial speed prediction sequence. The LSTM sequence predictor contains two layers of LSTM units, each layer contains 128 hidden nodes.
[0091] The initial speed prediction sequence is input into the scene adapter for speed correction to obtain the scene constraint speed sequence, and the scene constraint speed sequence is speed smoothed to obtain the target speed sequence.
[0092] In this example, the time feature vector is input into the first channel attention network to calculate the importance of the time feature and obtain the time feature weight coefficient. The first channel attention network contains three fully connected layers. This network structure effectively mines the importance relationship between different time features. Assume that the time feature vector is ,in represents the number of time steps, Represents the dimension of the feature. Time feature vector After the first fully connected layer, a linear transformation is performed, and the formula is as follows:
[0093] ;
[0094] in, is the first layer output feature matrix, is the weight matrix, is the bias term, is the dimension of the first layer output feature. The ReLU activation function is used to introduce nonlinearity, thereby improving the network's ability to learn complex feature relationships. Through the second fully connected layer:
[0095] ;
[0096] in, and are the weight matrix and bias term of the second layer, respectively. is the dimension of the second layer output feature. After the second layer, the output Through the third fully connected layer, and apply the Sigmoid activation function, to obtain the weight coefficient of the time feature:
[0097] ;
[0098] in, represents the weight coefficient of time characteristics, and are the weight matrix and bias term of the third layer respectively. The Sigmoid activation function limits the output to the range of [0,1] to indicate the importance of each temporal feature. Input to the second channel attention network for feature importance calculation to obtain the spatial feature weight coefficient. The structure of the second channel attention network is the same as the first channel attention network, which contains three fully connected layers. The first two layers use the ReLU activation function, and the last layer uses the Sigmoid activation function. The specific formula is as follows:
[0099] ;
[0100] ;
[0101] ;
[0102] in, is the weight coefficient of the spatial feature, indicating the importance of different spatial features in the overall feature fusion. and spatial feature weight coefficient , perform feature weighting processing on the time feature vector and the space feature vector respectively to obtain weighted time feature and weighted space feature. The weighted processing formula is as follows:
[0103] ;
[0104] in, represents the multiplication of corresponding elements (Hadamard product), is the weighted time feature, is the weighted spatial feature. This weighting method effectively highlights the important features while weakening the influence of unimportant features. and weighted spatial features Input into a feature fusion module containing a three-layer fully connected neural network to obtain a fused feature vector. Assume that the number of nodes in the three layers of the fully connected neural network is 256, 128, and 64 respectively, and perform the first layer of full connection transformation:
[0105] ;
[0106] in, Indicates the splicing of temporal features and spatial features. is the weight matrix of the first layer, is the bias term. The ReLU activation function is used to improve the model's ability to fit nonlinear features. The calculations of the second and third layers are similar, respectively:
[0107] ;
[0108] ;
[0109] in, , is the weight matrix and bias term of the second layer, , is the weight matrix and bias term of the third layer. The final fusion feature vector is , this fused feature vector contains the comprehensive information of temporal and spatial features. The input is sent to the LSTM sequence predictor to generate the speed sequence to obtain the initial speed prediction sequence. LSTM (Long Short-Term Memory Network) is a recurrent neural network suitable for processing time series data and can capture the time dependency of data. The LSTM sequence predictor contains two layers of LSTM units, each layer contains 128 hidden nodes. Time steps, the state update formula of the first layer LSTM is as follows:
[0110] ;
[0111] in, and They are respectively the first layer LSTM at time step The hidden state and cell state of Represents the first layer LSTM unit. The state of the second layer LSTM is updated as follows:
[0112] ;
[0113] The output at each time step After a linear transformation, the initial velocity prediction value is generated :
[0114] ;
[0115] in, and are the weight matrix and bias term of the linear transformation, Indicates The speed prediction value of each time step. , and get the initial speed prediction sequence. The initial speed prediction sequence is input into the scene adapter for speed correction to get the scene-constrained speed sequence. The role of the scene adapter is to make appropriate adjustments to the speed prediction according to the current riding scene (such as uphill, downhill, flat road, etc.) to ensure that the predicted speed sequence meets the requirements of the real physical scene. Suppose the initial speed prediction sequence is , the scene adapter is based on the scene parameters Correct the speed of each time step to get the scene constraint speed :
[0116] ;
[0117] in, represents the scene correction function, Contains scene information, such as slope, road friction coefficient, etc. The scene constraint speed sequence is smoothed to obtain the final target speed sequence. The purpose of speed smoothing is to reduce the drastic fluctuations in the speed sequence, thereby providing a more stable and comfortable riding experience. Suppose the scene constraint speed sequence is , target speed sequence Obtained by smoothing filtering, for example using the weighted moving average method:
[0118] ;
[0119] in, is the target velocity sequence at time step The value of Represents the length of the filter window. The smoothed target speed is obtained by averaging the speed values of the surrounding time steps.
[0120] In one example, a state observer is constructed for the target speed sequence to obtain a system state vector, including:
[0121] The dynamic model of the electric scooter is discretized to obtain a discrete state space equation, which includes a system state matrix, a control input matrix and a disturbance matrix.
[0122] The observability analysis of the discrete state space equation is performed to obtain the observable matrix, and a robust extended state observer is constructed based on the observable matrix to obtain the observer state equation, which includes the observer gain term and the disturbance compensation term.
[0123] The error between the expected speed and the actual speed in the target speed sequence is calculated to obtain the speed observation error, and the boundedness of the load disturbance is analyzed to obtain the disturbance boundary condition;
[0124] The speed observation error and disturbance boundary conditions are input into the observer state equation to perform state update calculation to obtain the updated system state, and the updated system state is digitally filtered to obtain the filtered state quantity;
[0125] The filtered state quantities are combined to obtain a system state vector, which includes an actual speed component, a motor speed component, and a load disturbance component.
[0126] In this example, the dynamic model of an electric scooter is discretized for real-time control on a digital controller. The dynamic model of the electric scooter describes the state changes of the system, including factors such as position, velocity, motor speed, and control input. The model initially exists in a continuous form, using state space equations as:
[0127] ;
[0128] in, Indicates system status The time derivative, is the system state vector, is the control input, is the external disturbance, is the system state matrix, is the control input matrix, is the disturbance matrix. In order to realize control in digital systems, the above continuous state space equations are discretized so that the system can be described in the form of discrete time steps. Suppose the sampling period is , through numerical integration (such as Euler method or Z transform, etc.), the continuous system model is transformed into a discrete model. The state space equation after discretization is:
[0129] ;
[0130] in, Indicated in The system status at each sampling time is Indicates The control input at each moment, is the external disturbance, is the discrete system state matrix, and are the discrete control input matrix and the discrete disturbance matrix, respectively, which are calculated by numerical approximation methods. After obtaining the discrete state space equation, the observability of the system is analyzed to determine whether the internal state of the system can be inferred from the input and output information of the system. The observability of the discrete system is calculated by constructing the observable matrix To verify, the formula is:
[0131] ;
[0132] in, is the output matrix of the system, describing the relationship between the system output and state. If the rank of the observable matrix is , then the system is observable, which means that the entire state of the system can be inferred through input and output data. Based on the observable matrix , a robust extended state observer is constructed to estimate the system state and resist the influence of external disturbances. The role of the extended state observer is to estimate the internal state of the system in real time by using the input and output information of the system. The state equation of the extended state observer is:
[0133] ;
[0134] in, For the The estimated state value at the moment, is the observer gain matrix. By selecting a suitable gain matrix, the observer error is minimized. is the output of the system, is the estimated value of the disturbance. The observer gain matrix L is determined by the linear matrix inequality (LMI) solution method or the pole placement method to ensure that the system's observation error converges and has a certain robustness. The error between the expected speed and the actual speed in the target speed sequence is calculated to obtain the speed observation error. Assume that the target speed is The actual speed is , velocity observation error for:
[0135] ;
[0136] The boundedness of the load disturbance is analyzed to obtain the disturbance boundary conditions. Assume that the load disturbance is , assuming that the perturbation satisfies the boundedness condition, that is:
[0137] ;
[0138] in, is the upper bound of the disturbance. Through boundedness analysis, a reasonable estimation range of disturbance is provided for the observer, which enhances the observer's ability to compensate for unknown disturbances. and perturbation boundary conditions Input into the observer state equation for state update calculation to obtain the updated system state The updated state vector contains the latest estimate of the system dynamics, including speed, motor speed and other information. The updated system state is digitally filtered to obtain the filtered state quantity. Using a low-pass filter, the filtered state quantity It is expressed as:
[0139] ;
[0140] in, is the filter coefficient, usually taken as . This filtering process effectively reduces the noise in the state estimation and obtains a smoother and more accurate state quantity. The filtered state quantities are combined to obtain the system state vector of the system. The system state vector contains multiple important state information of the electric scooter, including the actual speed component, the motor speed component, and the load disturbance component. Assume that the system state vector is:
[0141] ;
[0142] in, represents the actual speed of the scooter, Indicates the motor speed, is the load disturbance.
[0143] In one example, the observer gain matrix is calculated by solving the linear matrix inequality based on the system state vector, and the outer loop speed controller and the inner loop current controller are constructed to obtain the adaptive PID control parameters, including:
[0144] Perform error dynamic modeling on the system state vector to obtain the error dynamic equation, which includes the observer gain matrix, the system state matrix, the observation matrix and the disturbance matrix;
[0145] The error dynamic equation is converted into a linear matrix inequality form and solved to obtain the observer gain matrix. The linear matrix inequality contains positive definite matrix variables and gain matrix variables.
[0146] The poles of the observer gain matrix are configured to obtain the system characteristic equation, and the speed error signal is adaptively calculated based on the system characteristic equation to obtain the initial parameters of the speed loop PID.
[0147] The initial parameters of the speed loop PID are updated online through the symbolic function to obtain the parameters of the outer loop speed controller. The online parameter update includes the update of the proportional coefficient, the integral coefficient and the differential coefficient.
[0148] The outer loop speed controller parameters are used as input, coordinate transformation is performed on the motor current to obtain the d-axis current component and the q-axis current component, and sliding mode control calculation is performed on the d-axis current component and the q-axis current component to obtain the inner loop current controller parameters;
[0149] The parameters of the outer loop speed controller and the inner loop current controller are hierarchically combined to obtain the adaptive PID control parameters.
[0150] In this example, the error dynamics modeling is performed on the system state vector to construct the error dynamics equation. The system state vector describes the current state information of the electric scooter, including variables such as speed and motor speed. Assume that the actual state of the system is , the estimated state of the observer is , the state error of the system is defined as:
[0151] ;
[0152] in, Indicates at time In order to describe the dynamic behavior of the error, the original system state equation and the observer state equation are subtracted to obtain the error dynamic equation. Assume that the state equation of the system is:
[0153] ;
[0154] The state estimation equation of the observer is:
[0155] ;
[0156] in, is the observer gain matrix, is the output of the system, is the observation matrix, describing the relationship between the output and the state. Subtracting these two equations, we get the error dynamic equation:
[0157] ;
[0158] In the above equation, Represents the state matrix of the error system, including the system state matrix and the observer gain matrix relationship, is the influence of external disturbance on system error. Through the error dynamic equation, analyze and design the observer gain so that the error converges to zero, that is, to achieve accurate estimation of the system state. In order to obtain a suitable observer gain matrix , the error dynamics equation is transformed into a linear matrix inequality (LMI) form for solution. LMI is used to describe the optimization problem of system stability and constraints. In order to make the error dynamics system asymptotically stable, a positive definite matrix is solved and the observer gain matrix , so that the following inequality holds:
[0159] ;
[0160] in, is a positive definite matrix, representing the Lyapunov function of the system. By solving this LMI, we can find the appropriate gain matrix , so that the error dynamic system is stable and the error gradually converges to zero. Pole configuration is performed to provide a basis for control system design. The purpose of pole configuration is to select appropriate observer gains so that the closed-loop poles of the error dynamic system are located at the specified position, thereby meeting the response performance requirements of the system. Assume that the characteristic equation of the error dynamic system is:
[0161] ;
[0162] By configuring the poles, the closed-loop characteristic roots of the system are determined, thereby affecting the dynamic performance of the system, such as stability, response speed, etc. Based on the characteristic equation of the system, the speed error signal is adaptively calculated to obtain the initial parameters of the speed loop PID. These initial parameters include the proportional gain , integral gain and differential gain , they are initially set according to the error dynamic characteristics of the system to ensure that the controller has good response characteristics at startup. In order to adapt to different working conditions during operation, the initial parameters of the speed loop PID are updated online through the sign function to obtain the parameters of the outer loop speed controller. The online parameter update includes the adjustment of the proportional coefficient, integral coefficient and differential coefficient. The sign function is used to distinguish the sign of the error to dynamically adjust the controller gain. For example, assuming the current speed error is , judge the positive or negative of the error through the sign function, and then adjust the PID parameters:
[0163] ;
[0164] ;
[0165] ;
[0166] in, is a sign function used to determine the sign of the error, , , are the step sizes of gain adjustment respectively. In this way, adaptive adjustment of controller parameters is achieved, so that the controller can maintain good control effect under different working conditions. The outer loop speed controller parameters are used as input to perform coordinate transformation on the motor current to obtain the d-axis current component and the q-axis current component. The motor is controlled using the dq coordinate system to simplify the control process of the three-phase AC current. Assume that the three-phase current is , the three-phase current is converted to a two-phase stationary coordinate system through Clarke transformation and Park transformation ( coordinate system), and then transform it to the rotated coordinate system ( Coordinate system):
[0167] ;
[0168] in, and are the d-axis current component and the q-axis current component respectively, is the position angle of the rotor. The d-axis current is used to control the magnetic field of the motor, while the q-axis current is used to control the torque of the motor. The d-axis current component and the q-axis current component are subjected to sliding mode control calculation to obtain the parameters of the inner loop current controller. Sliding mode control is a robust control method that can cope with system uncertainties and external disturbances. Assume that the sliding surface is:
[0169] ;
[0170] in, and are the reference values of d-axis and q-axis currents, respectively. and The sliding mode surface is designed to converge to zero by designing a suitable sliding mode control law, so that the actual current tracks the reference current. The sliding mode control law is designed as:
[0171] ;
[0172] in, and are the control inputs for the d-axis and q-axis respectively, is the sliding mode gain, and the sliding mode surface is adjusted by the sign function to ensure the fast tracking performance of the current. The parameters of the outer loop speed controller and the inner loop current controller are hierarchically combined to obtain the adaptive PID control parameters. The outer loop speed controller is used to control the speed of the scooter to minimize the speed error, while the inner loop current controller is used to accurately control the motor current so that the torque generated by the motor meets the speed requirements of the outer loop. The control method of the dual-loop structure enables the system to simultaneously meet the requirements of fast speed response and precise current control, thereby realizing intelligent speed regulation of the electric scooter.
[0173] In one example, the adaptive PID control parameter is input into the PWM modulator to calculate the motor control amount, obtain the speed control execution instruction, and output the motor drive signal according to the speed control execution instruction, including:
[0174] The current command in the adaptive PID control parameter is current limited to obtain a limited current command. The current limiting process limits the current command to within a range of plus or minus 10 times the rated current of the electric scooter motor.
[0175] The limiting current command is transformed into a three-phase stationary coordinate system to obtain a three-phase current command. The three-phase stationary coordinate system transformation adopts an inverse Park transformation and an inverse Clarke transformation.
[0176] The SVPWM modulation strategy is calculated for the three-phase current command to obtain the basic voltage vector action time series. The SVPWM modulation strategy includes sector discrimination and vector synthesis.
[0177] The switch timing is calculated based on the basic voltage vector action time sequence to obtain the upper and lower bridge arm switch timing, and the upper and lower bridge arm switch timing is processed by dead time insertion to obtain the PWM waveform after dead time compensation;
[0178] The PWM waveform after dead zone compensation is input into the MOS driver chip for level conversion to obtain a power tube drive level signal, and the power tube drive level signal is intermittently protected to obtain a protected drive signal. The intermittent protection includes an overcurrent protection threshold and an overvoltage protection threshold.
[0179] The protected driving signal is output to the motor winding through the power amplifier circuit to obtain the motor driving signal.
[0180] In this example, the current command output by the adaptive PID controller is limited to ensure the safety of the system and the stable operation of the motor. The current command is limited to the rated current range of the electric scooter motor to avoid motor overload or damage to other power electronic devices due to excessive controller output. Assume that the rated current of the motor is , the current limit range is . Assume the current command is , current command after limiting It is expressed as:
[0181] ;
[0182] Through the limiting process, the current command is ensured not to exceed the physical limit of the system, protecting the motor and other power electronic devices. The current command after limiting is transformed into a three-phase stationary coordinate system to obtain a three-phase current command. This process includes inverse Park transformation and inverse Clarke transformation. Axis and The rotating coordinate system of the axis is converted back to the two-phase stationary coordinate system , the formula used is:
[0183] ;
[0184] in, and They are Axis and The shaft current component, is the rotation angle of the motor rotor, and They are the current components in the two-phase stationary coordinate system. The inverse Clarke transformation is used to convert the current components in the two-phase stationary coordinate system into three-phase AC current instructions:
[0185] ;
[0186] in, is the three-phase current command. Through these two steps of coordinate transformation, the limited Axis and The shaft current command is converted into a three-phase AC current command for controlling the three-phase winding of the motor. The three-phase current command is modulated by SVPWM (space vector pulse width modulation) to generate a voltage vector for driving the motor. SVPWM is an effective motor control method that converts the three-phase current command into a suitable switch control signal so that the motor can obtain the desired output. First, sector discrimination is performed, that is, the sector where the voltage vector is located is determined based on the current current command. Space vector modulation divides the space into six sectors, each of which corresponds to a different voltage vector combination. Assume that the spatial position corresponding to the current command is in the first sectors, the vector synthesis is performed through the adjacent basic voltage vectors. Assume that the basic voltage vector is The corresponding action times are , then the vector synthesis is performed by the following formula:
[0187] ;
[0188] in, is the reference voltage vector, is the modulation period, is the action time of the basic voltage vector, and the desired output voltage is obtained by adjusting the action time of each basic voltage vector. Based on the basic voltage vector action time sequence, the switching timing calculation is performed to obtain the switching timing of the upper and lower bridge arms. The motor drive adopts inverter control to achieve the desired output voltage by controlling the switching state of each bridge arm. In the switching timing calculation, it is ensured that the upper and lower tubes of the same bridge arm are not turned on at the same time to avoid the DC bus short circuit. In order to ensure safety, the dead time insertion processing is performed on the switching timing of the upper and lower bridge arms to obtain the PWM waveform after dead time compensation. Assume that the dead time is , then after the upper tube is turned off, the delay Then turn on the lower tube, and vice versa, to ensure that the upper and lower tubes of the same bridge arm are not turned on at the same time. The PWM waveform after dead zone compensation is input into the MOS driver chip for level conversion to obtain the power tube drive level signal. The function of the MOS driver chip is to increase the level of the PWM control signal to a level that can drive the power MOSFET, because the logic level output by the controller is usually not enough to directly drive the power switching device. In order to ensure the safety of the system, the power tube drive level signal is intermittently protected to obtain a protected drive signal. Intermittent protection includes overcurrent protection threshold and overvoltage protection threshold. When it is detected that the current or voltage exceeds the set safety range, the drive signal will be temporarily cut off to prevent damage to the power device or system loss of control. The protected drive signal is output to the three-phase winding of the motor through the power amplifier circuit to obtain the motor drive signal. The function of the power amplifier circuit is to amplify the power of the drive signal to a level sufficient to drive the motor, and to achieve the rotation of the motor by controlling the current of the three-phase winding. Assume that the three-phase currents are , these currents pass through the three-phase windings of the motor to generate a rotating magnetic field, thereby driving the rotor of the motor to rotate and generate power to drive the electric scooter.
[0189] Reference Figure 2 , this embodiment provides an intelligent speed control device for an electric scooter, comprising:
[0190] The acquisition module 1 is used to collect and filter the riding history data of the electric scooter to obtain a time series feature matrix;
[0191] Processing module 2 is used to construct a multi-head temporal self-attention mechanism and a spatial cross-attention mechanism based on the temporal feature matrix to obtain a temporal feature vector and a spatial feature vector;
[0192] Fusion module 3, used for inputting the time feature vector and the space feature vector into the multi-feature fusion module for weighted fusion to obtain a fused feature vector, and generating a target speed sequence through the intention-inspired control module based on the fused feature vector;
[0193] Construction module 4 is used to construct a state observer for the target speed sequence to obtain a system state vector;
[0194] A solution module 5 is used to calculate the observer gain matrix based on the system state vector by solving the linear matrix inequality, and to construct an outer loop speed controller and an inner loop current controller to obtain adaptive PID control parameters;
[0195] The output module 6 is used to input the adaptive PID control parameters into the PWM modulator to calculate the motor control quantity, obtain the speed control execution instruction, and output the motor drive signal according to the speed control execution instruction.
[0196] In this embodiment, for the specific implementation of each unit in the above device embodiment, please refer to the above method embodiment, which will not be repeated here.
[0197] Reference Figure 3 In an embodiment of the present invention, a computer device is also provided. The computer device may be a server, and its internal structure may be as follows: Figure 3 As shown. The computer device includes a processor, a memory, a display screen, an input device, a network interface and a database connected through a system bus. Among them, the processor designed by the computer is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store the corresponding data in this embodiment. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, the above method is implemented.
[0198] Those skilled in the art will understand that Figure 3 The structure shown in the figure is merely a block diagram of a portion of the structure related to the solution of the present invention, and does not constitute a limitation on the computer device to which the solution of the present invention is applied.
[0199] An embodiment of the present invention further provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the above method is implemented. It can be understood that the computer-readable storage medium in this embodiment can be a volatile readable storage medium or a non-volatile readable storage medium.
[0200] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media provided by the present invention and used in the embodiments may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in a variety of forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double-speed data rate SDRAM (SSRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM.
[0201] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, device, article or method including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, device, article or method. In the absence of further restrictions, an element defined by the sentence "includes a ..." does not exclude the presence of other identical elements in the process, device, article or method including the element.
[0202] The above description is only a preferred embodiment of the present invention, and does not limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made by using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. An intelligent speed control method for an electric scooter, characterized in that: The following steps are involved: The riding history data of the electric scooter is collected and filtered to obtain a time series feature matrix; Based on the time series feature matrix, a multi-head time self-attention mechanism and a spatial cross-attention mechanism are constructed to obtain a time feature vector and a spatial feature vector; specifically, the following steps are performed: linear transformation is performed on the time series feature matrix to obtain eight groups of independent attention head features, each group of attention head features includes a query matrix, a key matrix and a value matrix; scaling dot product operation is performed on each group of the attention head features to obtain an attention weight matrix, and the value matrix is weighted based on the attention weight matrix to obtain a time series correlation feature; feature concatenation and linear mapping are performed on the eight groups of time series correlation features to obtain a time feature vector; the road loop in the time series feature matrix is transformed into a linear transformation ... The first attention branch processes the features of the environment image sequence to obtain the road environment attention features, wherein the first attention branch uses the road environment features as the query vector and the riding posture features as the key-value pair; the second attention branch processes the riding posture features in the time series feature matrix to obtain the riding posture attention features, wherein the second attention branch uses the riding posture features as the query vector and the road environment features as the key-value pair; the road environment attention features and the riding posture attention features are subjected to feature splicing processing to obtain the spatial interaction features, and the spatial interaction features are subjected to linear mapping processing to obtain the spatial feature vector; Inputting the time feature vector and the space feature vector into a multi-feature fusion module for weighted fusion to obtain a fused feature vector, and generating a target speed sequence through an intention-inspired control module based on the fused feature vector; Constructing a state observer for the target speed sequence to obtain a system state vector; Based on the system state vector, an observer gain matrix is calculated by solving a linear matrix inequality, and an outer loop speed controller and an inner loop current controller are constructed to obtain adaptive PID control parameters; The adaptive PID control parameters are input into the PWM modulator to calculate the motor control amount, obtain the speed control execution instruction, and output the motor drive signal according to the speed control execution instruction.
2. The electric scooter intelligent speed control method according to claim 1, characterized in that: The riding history data of the electric scooter is collected and filtered to obtain a time series feature matrix, including: The original speed data collected by the speed sampler of the electric scooter is digitally low-pass filtered to obtain speed time series data; the original acceleration data collected by the acceleration sensor of the electric scooter is Gaussian filtered to obtain acceleration time series data; the original position data collected by the GPS module of the electric scooter is Kalman filtered to obtain position data; the original attitude data collected by the gyroscope of the electric scooter is zero-drift error corrected through a temperature compensation model to obtain attitude data; the road environment image sequence collected by the camera of the electric scooter is image normalized to obtain a road environment image sequence; The speed time series data, the acceleration time series data, the position data, the posture data and the road environment image sequence are time synchronized to obtain a time series feature matrix.
3. The electric scooter intelligent speed control method according to claim 1, characterized in that: The step of inputting the time feature vector and the space feature vector into a multi-feature fusion module for weighted fusion to obtain a fused feature vector, and generating a target speed sequence through an intention-inspired control module based on the fused feature vector includes: Inputting the time feature vector into the first channel attention network to calculate the feature importance and obtain the time feature weight coefficient, wherein the first channel attention network comprises three fully connected layers, the first and second layers use the ReLU activation function, and the third layer uses the Sigmoid activation function; Inputting the spatial feature vector into a second channel attention network to calculate feature importance, and obtaining a spatial feature weight coefficient, wherein the structure of the second channel attention network is the same as that of the first channel attention network; Performing feature weighting processing on the time feature vector and the time feature weight coefficient to obtain a weighted time feature, and performing feature weighting processing on the space feature vector and the space feature weight coefficient to obtain a weighted space feature; Inputting the weighted time feature and the weighted space feature into a three-layer fully connected neural network for feature fusion to obtain a fused feature vector, wherein the number of nodes in the three layers of the fully connected neural network is 256, 128, and 64 respectively; Inputting the fused feature vector into an LSTM sequence predictor to generate a speed sequence to obtain an initial speed prediction sequence, wherein the LSTM sequence predictor comprises two layers of LSTM units, each layer comprising 128 hidden nodes; The initial speed prediction sequence is input into the scene adapter for speed correction to obtain a scene constraint speed sequence, and the scene constraint speed sequence is subjected to speed smoothing to obtain a target speed sequence.
4. The electric scooter intelligent speed control method according to claim 3, characterized in that: The state observer is constructed for the target speed sequence to obtain a system state vector, including: Discretizing the dynamic model of the electric scooter to obtain a discrete state space equation, wherein the discrete state space equation includes a system state matrix, a control input matrix, and a disturbance matrix; Performing observability analysis on the discrete state space equation to obtain an observable matrix, and constructing a robust extended state observer based on the observable matrix to obtain an observer state equation, wherein the observer state equation includes an observer gain term and a disturbance compensation term; Performing error calculation on the expected speed and the actual speed in the target speed sequence to obtain the speed observation error, and performing boundedness analysis on the load disturbance to obtain the disturbance boundary condition; Inputting the speed observation error and the disturbance boundary condition into the observer state equation to perform state update calculation to obtain an updated system state, and digitally filtering the updated system state to obtain a filtered state quantity; The filtered state quantities are combined to obtain a system state vector, wherein the system state vector includes an actual speed component, a motor speed component, and a load disturbance component.
5. The electric scooter intelligent speed control method according to claim 4, characterized in that: The observer gain matrix is calculated by solving the linear matrix inequality based on the system state vector, and an outer loop speed controller and an inner loop current controller are constructed to obtain adaptive PID control parameters, including: Performing error dynamic modeling on the system state vector to obtain an error dynamic equation, wherein the error dynamic equation includes an observer gain matrix, a system state matrix, an observation matrix, and a disturbance matrix; The error dynamic equation is converted into a linear matrix inequality form for solving to obtain an observer gain matrix, wherein the linear matrix inequality includes positive definite matrix variables and gain matrix variables; Performing pole configuration on the observer gain matrix to obtain a system characteristic equation, and performing adaptive gain calculation on the speed error signal based on the system characteristic equation to obtain initial parameters of the speed loop PID; The speed loop PID initial parameters are updated online through a sign function to obtain the outer loop speed controller parameters, wherein the online parameter update includes a proportional coefficient update, an integral coefficient update, and a differential coefficient update; Taking the outer loop speed controller parameters as input, performing coordinate transformation processing on the motor current to obtain a d-axis current component and a q-axis current component, and performing sliding mode control calculation on the d-axis current component and the q-axis current component to obtain inner loop current controller parameters; The outer loop speed controller parameters and the inner loop current controller parameters are hierarchically combined to obtain adaptive PID control parameters.
6. The electric scooter intelligent speed control method according to claim 5, characterized in that: The step of inputting the adaptive PID control parameter into a PWM modulator to calculate the motor control amount, obtaining a speed control execution instruction, and outputting a motor drive signal according to the speed control execution instruction comprises: Performing current limiting on the current command in the adaptive PID control parameter to obtain a limited current command, wherein the current limiting process limits the current command to within a range of plus or minus 10 times the rated current of the electric scooter motor; Performing a three-phase stationary coordinate system transformation process on the amplitude limiting current instruction to obtain a three-phase current instruction, wherein the three-phase stationary coordinate system transformation adopts an inverse Park transformation and an inverse Clarke transformation; Performing SVPWM modulation strategy calculation on the three-phase current command to obtain a basic voltage vector action time series, wherein the SVPWM modulation strategy includes sector discrimination and vector synthesis; Performing switch timing calculation based on the basic voltage vector action time sequence to obtain upper and lower bridge arm switch timings, and performing dead time insertion processing on the upper and lower bridge arm switch timings to obtain a PWM waveform after dead time compensation; Input the dead zone compensated PWM waveform into the MOS driver chip for level conversion to obtain a power tube drive level signal, and perform intermittent protection on the power tube drive level signal to obtain a protected drive signal, wherein the intermittent protection includes an overcurrent protection threshold and an overvoltage protection threshold; The protected driving signal is output to the motor winding through a power amplifier circuit to obtain a motor driving signal.
7. An intelligent speed control device for an electric scooter, characterized in that: For implementing the steps of the method according to any one of claims 1 to 6, the device comprises: The acquisition module is used to collect and filter the riding history data of the electric scooter to obtain a time series feature matrix; A processing module, used to construct a multi-head temporal self-attention mechanism and a spatial cross-attention mechanism based on the temporal feature matrix to obtain a temporal feature vector and a spatial feature vector; A fusion module, used for inputting the time feature vector and the space feature vector into a multi-feature fusion module for weighted fusion to obtain a fused feature vector, and generating a target speed sequence through an intention-inspired control module based on the fused feature vector; A construction module, used for constructing a state observer for the target speed sequence to obtain a system state vector; A solution module is used to calculate the observer gain matrix based on the system state vector by solving the linear matrix inequality, and to construct an outer loop speed controller and an inner loop current controller to obtain adaptive PID control parameters; The output module is used to input the adaptive PID control parameters into the PWM modulator to calculate the motor control quantity, obtain the speed control execution instruction, and output the motor drive signal according to the speed control execution instruction.
8. A computer device comprising a memory and a processor, wherein a computer program is stored in the memory, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Electric scooter speed self-adaptive control system and method
CN116985803A
Vehicle motion control method, device and equipment and storage medium
CN117533335A
Multi-time scale traffic flow speed prediction method based on vehicle-road cloud cooperation
CN118447684A