An electric motorcycle posture safety control method and system and an electric motorcycle

CN122881680APending Publication Date: 2026-10-09JIANGSU DADIAN ELECTROMECHANICAL CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611123862.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-28
Publication Date
2026-10-09

AI Technical Summary

Technical Problem

同时,该方案未考虑车速与倾角风险的耦合关系,低速时20°倾角仍可控、高速时10°倾角已危险,单一阈值无法适配不同车速

Benefits of technology

[0027]1、通过电摩上电后延时启动校准、采集MEMS六轴陀螺仪静态原始数据、剔除异常抖动后计算偏移均值并写入存储器,建立了每次上电专属的水平基准,消除了MEMS六轴陀螺仪的逐次上电零偏随机性、温度漂移及安装偏差,解决了出厂一次性校准在电摩全生命周期中逐步失效的问题。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122881680A_ABST
    Figure CN122881680A_ABST
Patent Text Reader

Abstract

The application discloses a kind of electric motorcycle posture safety control method, system and electric motorcycle, after power-on, the offset mean of the static original data of MEMS six-axis gyroscope is calculated as zero point compensation value, establish horizontal reference, real-time sampling data is zero point compensated in normal operation stage;After compensation, the data is filtered by the filter according to the measured road spectrum of electric motorcycle and is carried out compound Kalman filtering noise reduction;Synchronous acquisition vehicle speed, attitude angle, bus current;Based on vehicle speed and pitch angle data, pitch buffer torque curve slope is matched, and current regulation amount is accumulated to basic vector current instruction;Based on vehicle speed and roll angle data, according to the three-level threshold value of vehicle speed calibration, three-level protection of early warning, torque limiting, self-locking is executed in stages;When torque limiting or self-locking is triggered, the current instruction is linearly down-regulated according to the current down-regulation rate calibrated by the test bench, to avoid the boundary of BMS hardware protection tripping, while sending synchronous state frame to BMS;According to manual operation or working condition automatic identification result, mode switching and parameter storage are completed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of electric motorcycle posture safety control technology, and in particular to an electric motorcycle posture safety control method, system, and electric motorcycle. Background Technology

[0002] Electric motorcycle attitude safety control systems typically use MEMS six-axis gyroscopes to detect the vehicle's pitch and roll angles. When the detected vehicle tilt exceeds a set threshold, the motor controller performs torque limiting or power-off protection.

[0003] Currently, gyroscope zero-point calibration is typically performed as a one-time static calibration before the electric motorcycle leaves the factory, with the compensation values ​​stored in the controller's flash memory. However, MEMS six-axis gyroscopes exhibit zero-bias randomness; the offset varies with different power-ups, and the reference value changes due to installation tolerances, temperature drift, and controller disassembly / repair. The factory calibration values ​​gradually become invalid throughout the electric motorcycle's lifespan. Once the reference value deviates, all subsequent tilt angle detection values ​​carry a fixed error, causing the trigger point for safety strategies to shift, leading to false triggers or missed triggers.

[0004] In terms of attitude signal noise reduction, existing solutions typically use low-pass filters to smooth the raw gyroscope data. However, the cutoff frequency of the low-pass filter is fixed, while the vibration noise spectrum of an electric motorcycle changes in real time with vehicle speed and road conditions. Setting the cutoff frequency too low increases the attitude signal delay and the response lag can reach more than 100ms, while setting it too high results in insufficient noise suppression and severe attitude data jumps. It is difficult to achieve both goals simultaneously.

[0005] Regarding roll safety strategies, existing solutions generally set a single tilt angle threshold, typically between 25° and 30°, cutting off motor power when this value is reached. This single-threshold strategy does not intervene below the threshold until a sudden power cut at the critical point, and the sudden power change itself constitutes a new disturbance. Furthermore, this solution does not consider the coupling relationship between vehicle speed and tilt angle risk; a 20° tilt angle is still controllable at low speeds, but a 10° tilt angle is dangerous at high speeds, and a single threshold cannot adapt to different vehicle speeds.

[0006] In terms of system collaborative control, in the existing solution, the motor controller and the battery management system execute protection logic independently. When the controller limits torque, the battery management system does not limit current. The response time constants of the two are also mismatched, resulting in a mismatch between the bus current and the state of the battery power devices. This can cause voltage fluctuations at best, and trigger the battery management system's overcurrent protection to malfunction or cause unexpected power outages while the electric motorcycle is in motion at worst. Summary of the Invention

[0007] In order to address the problems existing in the prior art to a certain extent, the present invention provides an electric motorcycle posture safety control method, system, and electric motorcycle, the technical solution of which is as follows.

[0008] A method for controlling the posture safety of an electric motorcycle includes the following steps:

[0009] S1. After the electric motorcycle is powered on, a delayed calibration is started. Static raw data from the MEMS six-axis gyroscope is collected. After removing abnormal jitter data from the raw data, the static offset mean is calculated. This offset mean is written into the memory as the zero-point compensation value to establish the current horizontal reference. During the normal operation of the electric motorcycle, the real-time sampled data of the MEMS six-axis gyroscope is corrected by subtracting the zero-point compensation value from the sampled value to obtain the real-time sensing data after zero-point compensation.

[0010] S2 performs composite Kalman filtering noise reduction on the real-time sensing data after zero-point compensation. The filter is tuned according to the measured road spectrum of the electric motorcycle and is used to separate high-frequency vibration noise from the real attitude signal.

[0011] S3 synchronously collects three types of operating parameters: vehicle speed, attitude angle, and bus current, and outputs them in a unified time scale.

[0012] S4, based on the pitch angle data in the vehicle speed and attitude angle output by S3, matches the slope of the pitch buffer torque curve according to the vehicle speed range, calculates the current adjustment amount after the pitch angle change exceeds the dead zone, and adds the adjustment amount to the basic vector current command corresponding to the driver's throttle request.

[0013] S5, based on the roll angle data in the vehicle speed and attitude angle output by S3, performs graded judgment according to the three-level threshold of the vehicle speed calibration, and sequentially executes three-level protection actions: warning prompt, progressive torque limiting, and tilt self-locking. At the same time, the tilt angle change rate is introduced as an auxiliary judgment variable. When the tilt angle change rate exceeds the preset value, the threshold is triggered in advance, and the protection mode status is output.

[0014] S6, based on the protection mode status output by S5, linearly reduces the current command according to the current reduction rate calibrated by the bench when the torque limiting or self-locking is triggered, so as to actively avoid the hardware protection tripping boundary of the BMS. At the same time, it sends a synchronization status frame to the BMS through the CAN bus to realize the vehicle-level collaborative protection between the MCU and the BMS.

[0015] S7: When the user manually switches or the MCU automatically identifies the current operating conditions, the MCU completes the switching of three sets of preset mode parameters and persistently stores the current mode parameters to achieve automatic recovery upon power-up.

[0016] Further, in step S1, after the electric motorcycle is powered on, the MCU delays and starts the calibration process, collecting the raw static acceleration and angular velocity data of the MEMS six-axis gyroscope within a preset time window; calculating the standard deviation of the data for each of the six axes of the MEMS six-axis gyroscope, removing outliers that deviate from the mean by more than ±3 times the standard deviation, and obtaining valid raw data; using the arithmetic mean of the valid raw data as the static offset for this power-on, which is used as the subsequent zero-point compensation value; writing the above zero-point compensation value into the dedicated calibration area of ​​the MCU's internal memory; after calibration, reading the attitude angles of the electric motorcycle parked on a horizontal ground; if the initial values ​​of pitch and roll angles fall within ±0.5°, the calibration is valid; otherwise, the calibration is marked as invalid, and the calibration is performed again after power-on.

[0017] Furthermore, in step S2, the MCU reads the data from the MEMS six-axis gyroscope in real time, and after zero-point compensation in step S1, it sends the data to the composite Kalman filter; the process noise covariance matrix Q and the observation noise covariance matrix R are tuned, and the initial values ​​of Q and R are tuned according to the measured road spectrum of the electric motorcycle; the composite Kalman filter runs continuously and outputs a set of optimal attitude estimates every 10ms.

[0018] Furthermore, the method for tuning the process noise covariance matrix Q and the observation noise covariance matrix R is as follows: the electric motorcycle is placed on a four-channel road simulation test bench, and three types of road excitation spectra are input respectively: urban asphalt pavement, unpaved gravel pavement, and speed bump impact pavement; under each type of road excitation spectrum, the amplitude of the attitude signal noise and the signal delay time at the output of the composite Kalman filter are measured; the diagonal elements in Q and R are repeatedly adjusted to minimize the weighted trade-off between noise suppression and signal delay of the filter under the three types of road excitation spectra.

[0019] Furthermore, in step S3, the MCU starts synchronous acquisition with a period of 10ms, triggering vehicle speed pulse reading, attitude angle register reading, and ADC sampling start at the same time; vehicle speed signal is acquired through wheel speed Hall sensor; pitch angle and roll angle data are directly taken from the first two dimensions of the current attitude estimation value of Kalman filter in step S2; motor bus current is acquired through Hall effect current sensor; and the three types of parameters are combined into a data packet and stored in the MCU's RAM buffer.

[0020] Furthermore, in step S5, the three threshold levels are discrete functions of vehicle speed, ranging from low to high as: Level 1 warning threshold, Level 2 torque limiting threshold, and Level 3 self-locking threshold. When the real-time roll angle reaches or exceeds the Level 1 warning threshold, an instrument warning is triggered, but powertrain intervention is not performed. When the real-time roll angle reaches the Level 2 torque limiting threshold, the upper limit of the q-axis current command is compressed to the corresponding ratio, and executed gradually at a rate of 2% reduction in rated torque every 10ms. When the real-time roll angle reaches the Level 3 self-locking threshold, the q-axis current command is forcibly returned to zero within 10ms, and the self-locking state is maintained until the roll angle falls below the Level 2 torque limiting threshold and remains below it for more than 500ms before being released. When the rate of change of the real-time roll angle exceeds 30° / s, the next level protection threshold that has not yet been triggered is automatically triggered 3° in advance. The next level protection threshold is: when a warning has already been triggered, it is the torque limiting threshold; when the torque limiting has already been triggered, it is the self-locking threshold.

[0021] Furthermore, in step S6, the MCU continuously receives standard status frames broadcast by the BMS via the CAN bus at 100ms intervals, which include hardware overcurrent protection thresholds. The MCU internally stores a set of trip characteristic calibration parameters corresponding to the current BMS model, and sets the torque limiting slope to a safe value based on the calibration results. During the torque limiting process, the MCU sends a synchronization status frame to the BMS via the CAN bus, which includes the current torque limiting ratio, the estimated bus current value, and the torque limiting status flag. Each time a warning, torque limiting, or self-locking action is triggered, the MCU records a fault log to the preset storage area of ​​the MCU's internal memory in an event-triggered manner. The MCU sends an attitude status frame to the instrument via the CAN bus.

[0022] Furthermore, in step S6, if the BMS firmware has the capability to cooperate, the BMS will extend the overcurrent determination window and increase the current change rate trigger threshold after receiving the synchronization status frame, providing additional time margin for the MCU torsion limiting action; if the BMS firmware cannot be modified, the synchronization status frame is only used for instrument data display and not for protection determination; the torsion limiting slope avoidance operation is executed independently.

[0023] This invention also describes an electric motorcycle posture safety control system for executing the above-mentioned method, comprising: a MEMS six-axis gyroscope installed in the middle of the frame for collecting static and real-time acceleration and angular velocity data of the electric motorcycle; a wheel speed Hall sensor installed on the gear ring inside the rear wheel brake disc for collecting wheel speed pulse signals; a Hall effect current sensor connected in series with the DC bus input terminal inside the motor controller for collecting motor bus current; and a motor controller that is communicatively connected to the MEMS six-axis gyroscope, wheel speed Hall sensor, Hall effect current sensor, instrument, and BMS, and configured to execute the method according to any one of claims 1 to 8; the motor controller includes a processor and a memory, the memory storing a computer program, and the processor executing the computer program to implement the above-mentioned method.

[0024] The present invention also describes an electric motorcycle, including a vehicle body and an electric motorcycle posture safety control system installed on the vehicle body; the vehicle body includes a frame, a front wheel, a rear wheel, a suspension system, a battery pack, and an instrument panel; the front wheel is installed at the front end of the frame, the rear wheel is installed at the rear end of the frame, and the hub motor is integrated inside the rear wheel or installed on one side of the rear wheel; the suspension system includes a front suspension and a rear suspension, which respectively connect the front wheel to the frame and the rear wheel to the frame; the battery pack is installed at the bottom of the frame or under the footrests.

[0025] Beneficial effects

[0026] Compared with the prior art, the method described in this invention has the following beneficial effects:

[0027] 1. By delaying the start calibration after the electric motorcycle is powered on, collecting static raw data from the MEMS six-axis gyroscope, and calculating the average offset after eliminating abnormal jitter and writing it into the memory, a dedicated horizontal reference is established for each power-on. This eliminates the randomness of zero bias, temperature drift and installation deviation of the MEMS six-axis gyroscope with each power-on, and solves the problem of the gradual failure of the factory calibration throughout the electric motorcycle's life cycle.

[0028] 2. By applying composite Kalman filtering to the zero-point compensated data for noise reduction, and using a filter specifically tuned for the electric motorcycle's vibration spectrum, high-frequency vibration noise is separated from the true attitude signal, eliminating the interference of driving vibration on attitude detection. The noise covariance matrix is ​​determined through a dedicated tuning process. Covariance matrix of observation noise The value of ...

[0029] 3. By using a three-tiered threshold system calibrated based on vehicle speed in the roll dimension for graded judgment, a progressive safety protection system is achieved, consisting of three levels of protection actions: early warning, gradual torque limiting, and tilt self-locking. This solves the problems of existing single-threshold strategies, such as zero intervention below the threshold and sudden power cut-off upon reaching the threshold, which leads to abrupt power changes and exacerbates disturbances. Simultaneously, the tilt angle change rate is introduced as an auxiliary judgment variable, triggering the threshold in advance during rapid tilting to compensate for execution delays, thus balancing safety and driving freedom.

[0030] 4. By linearly reducing the current command according to the slope calibrated on the bench when torque limiting or self-locking is triggered, the tripping boundary of the BMS hardware protection is actively avoided. At the same time, a synchronization status frame is sent to the BMS via the CAN bus, realizing vehicle-level collaborative protection between the MCU and the BMS. Without modifying the BMS hardware, avoiding the BMS tripping boundary through torque limiting slope calibration reduces the failure rate of the collaboration between the MCU torque limiting and the BMS hardware protection, avoiding unexpected power outages caused by BMS overcurrent protection malfunctions during electric motorcycle operation.

[0031] 5. By matching the slope of the pitch buffer torque curve based on vehicle speed and pitch angle data in the pitch dimension, and linearly adjusting the motor current increment after the pitch angle change exceeds the dead zone, and accumulating the adjustment amount to the basic vector current command corresponding to the driver's throttle request, the gap between the fast response characteristics of the hub motor and the driver's control expectations is eliminated, and a smooth power transition under pitch attitude is achieved.

[0032] 6. By responding to user manual operation or the system's automatic condition recognition results based on the standard deviation of vehicle speed and the standard deviation of pitch angle change, the system completes the switching of three sets of preset mode parameters, realizing parameter management of multiple riding modes and automatic recovery upon power-on. This enables the electric motorcycle to adapt to different riding scenarios and user preferences, improving the product's scenario adaptability and user experience. Attached Figure Description

[0033] Figure 1 This is a schematic diagram of the overall process of the electric motorcycle posture safety control method. Detailed Implementation

[0034] The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments.

[0035] The following description of at least one exemplary embodiment is merely illustrative and is not intended to limit the invention or its application or use in any way.

[0036] Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this disclosure.

[0037] Unless otherwise defined, the technical or scientific terms used in this invention shall have the ordinary meaning as understood by one of ordinary skill in the art to which this invention pertains.

[0038] Techniques, methods, and equipment known to those skilled in the art may not be discussed in detail, but where appropriate, such techniques, methods, and equipment should be considered part of the specification.

[0039] In all examples shown and discussed herein, any specific value should be interpreted as merely exemplary and not as a limitation; therefore, other examples of exemplary embodiments may have different values.

[0040] Example 1

[0041] In this embodiment, MCU refers to the Microcontroller Unit, BMS refers to the Battery Management System, and CAN refers to the Controller Area Network. The attitude control algorithm is integrated into the MCU and directly controls the motor current output.

[0042] The aforementioned MCU, BMS, and CAN bus are all well-known technologies in the field of electric motorcycles. Their hardware architecture and basic communication protocols are common knowledge in this field. This embodiment does not improve the structural principles of the above devices, so they will not be described in detail here.

[0043] All instrument prompts in this embodiment are illustrative. The actual displayed content can be adjusted according to the vehicle model's UI design, and will not be repeated when the relevant content appears below.

[0044] For ease of description, the term "electric motorcycle" is used in this article as an abbreviation for electric motorcycle.

[0045] As attached Figure 1 As shown in the figure, this embodiment provides a method for controlling the posture safety of an electric motorcycle, including the following steps.

[0046] S1, after the electric motor is powered on, a delayed start calibration is initiated, static raw data of the MEMS six-axis gyroscope is collected, abnormal jitter is removed, the average offset is calculated and written into the memory, and the current horizontal reference is established, that is, the initial values ​​of pitch angle and roll angle are zero, eliminating the randomness of successive power-on zero bias, temperature drift and installation deviation of MEMS six-axis gyroscope.

[0047] Specifically, the following steps are included:

[0048] S101, after the electric motor is powered on, the MCU starts the calibration process after a 2-second delay. The delay is implemented by the MCU's internal timer to avoid the interference of voltage fluctuations in the 12V low-voltage system on the power supply of the MEMS six-axis gyroscope and the I2C / SPI communication interface at the moment of power-on.

[0049] After the delay ends, the MCU immediately begins to collect raw data of static acceleration and angular velocity from the MEMS six-axis gyroscope within a 1-second time window. The sampling frequency is 100Hz, and a total of 100 sets of raw data are acquired.

[0050] As a preferred embodiment, the MEMS six-axis gyroscope described in this embodiment is the InvenSense ICM-42605. Operators can also make replacements according to the actual situation, such as compatible models like BMI088 or LSM6DSR, which will not be elaborated further.

[0051] S102, abnormal jitter is removed from the 100 sets of raw data. The method is as follows: calculate the standard deviation σ of the data of each of the six axes of the MEMS six-axis gyroscope, namely the three acceleration axes and the three angular velocity axes, and remove outliers that deviate from the mean by more than ±3 times the standard deviation to obtain the valid raw data.

[0052] If there are fewer than 50 sets of valid raw data, the calibration will be marked as invalid. The MCU will display a message on the instrument such as "Insufficient calibration data, please power on again" and wait for the user to power on again to perform the calibration.

[0053] The arithmetic mean of the valid raw data is used as the static offset for this power-on, and this offset is used as the subsequent zero-point compensation value, including the triaxial acceleration offset. , , ) and triaxial angular velocity offset ( , , A total of six compensation values.

[0054] S103 writes the above six compensation values ​​into the dedicated calibration area of ​​the MCU's internal Flash memory in IEEE 754 single-precision floating-point format. At this point, the power-on calibration phase is complete.

[0055] During the subsequent normal operation phase, each time the MCU reads a set of real-time sampling data from the MEMS six-axis gyroscope, it first performs a correction operation of "subtracting the zero-point compensation value from the sampled value" to complete the zero-point compensation, obtains the real-time sensing data after zero-point compensation, and then sends the data to the subsequent step S2.

[0056] The above-mentioned zero-point compensation correction calculation is a well-known technique in the field. This embodiment does not improve its specific calculation method, so it will not be described in detail here.

[0057] S104 sets the acceptance criteria for calibration validity, specifically as follows:

[0058] After step S103 is completed, the MCU reads the attitude angle of the electric motorcycle parked on the horizontal ground. The initial values ​​of pitch angle and roll angle should fall within the range of ±0.5°.

[0059] If the initial values ​​of pitch or roll angle deviate from ±0.5°, the MCU will display a message on the instrument screen similar to "Attitude reference abnormal, please stop on a flat surface and power on again". This calibration is marked as invalid, and the operator will have to power on again to perform the calibration. If the verification passes, the calibration process is complete and the MCU will enter normal operation.

[0060] The total time for this calibration procedure is approximately 3 seconds, and this time window can be executed in parallel while the user is powering on, putting on the helmet, and organizing their gear, so it will not take up additional riding waiting time.

[0061] S2 performs composite Kalman filtering noise reduction on the zero-point compensated data. It separates high-frequency vibration noise from the real attitude signal through a filter specifically tuned for the electric motorcycle vibration spectrum, eliminating the interference of driving vibration on attitude detection.

[0062] The specific steps are as follows:

[0063] S201, establish the state equation and observation equation of the filter. The MCU reads the raw data of the three-axis acceleration and three-axis angular velocity of the MEMS six-axis gyroscope in real time at a sampling frequency of 100Hz. After zero-point compensation in step S1, the data is sent to the composite Kalman filter.

[0064] The mathematical model of the composite Kalman filter consists of a state equation and an observation equation. The state equation describes the change of attitude angle over time, while the observation equation describes the mapping relationship between the accelerometer and MEMS six-axis gyroscope measurements and the actual attitude angle.

[0065] State variables Defined as a four-dimensional vector ,in, The vehicle body pitch angle, The roll angle of the vehicle body. For pitch angular velocity offset, For roll rate offset, This is the matrix transpose. State transition matrix. Based on the rigid body kinematics equations, the state variables at the current moment are mapped to the prior estimates at the next moment.

[0066] Observed variables Defined as a two-dimensional vector ,in, The pitch angle observation value is calculated from the accelerometer data. These are the observed roll angle values ​​calculated from accelerometer data. Observation matrix. Map the state variables to the observation space.

[0067] Based on the aforementioned state and observation variables, the iterative calculation of the Kalman filter comprises the following five core equations, which are executed sequentially:

[0068] State prediction equation:

[0069] ,

[0070] in, These are state variables, i.e., four-dimensional vectors; This is the index of the discrete time step at the current moment; This is the index of the discrete time step of the previous moment; Indicates based on the previous Information about time Time estimation; Indicates based on the previous The optimal estimate of time Predicted The predicted values ​​of pitch angle, roll angle and angular velocity bias at time t is the prior estimate in Kalman filtering; Let be the state transition matrix.

[0071] Covariance prediction equation:

[0072] ,

[0073] in, It is the covariance matrix; The process noise covariance matrix; This is the matrix transpose. Indicates based on the previous Information from time to time is predicted The covariance matrix of the time-state estimation error, i.e., the prior estimate in the Kalman foil. A measure of confidence level; Indicates the preceding The posterior covariance matrix of the state estimation error at time step, i.e., using the first... After correcting the predicted values ​​based on the observed values ​​at time 1, the state estimate at that time is... A measure of confidence level.

[0074] Kalman gain calculation:

[0075] ,

[0076] in, Indicates Kalman gain; The observation matrix; To observe the noise covariance matrix.

[0077] State update equation:

[0078] ,

[0079] in, Indicates the first The posterior estimate of the state variable at time (i.e., the current time); Indicates the first The observed variable at time (i.e., the current time).

[0080] Covariance update equation:

[0081] ,

[0082] in, Indicates the first The posterior covariance matrix of the state estimation error at time (i.e., the current time).

[0083] The iteration period mentioned above is consistent with the sampling period, which is 10ms, meaning that a complete prediction-update-correction three-step operation is completed every 10ms. After each iteration, the state variables... The first two dimensions represent the pitch angle at the current moment. With roll angle The optimal estimate.

[0084] S202, regarding the process noise covariance matrix and the observation noise covariance matrix Tuning is the process of repeatedly adjusting parameters to achieve optimal filter performance. and The initial values ​​are not the default parameters of the general Kalman filter, but are specially tuned based on the measured road spectrum of the electric motorcycle.

[0085] The specific steps are as follows:

[0086] S202-1, Place the electric motorcycle on a four-channel road simulation test bench (this test bench is an industry standard testing equipment for electric motorcycles and can reproduce different road surface excitation spectra), and input three typical road surface excitation spectra respectively:

[0087] The vibration frequency of urban asphalt pavement is approximately 60Hz to 80Hz, corresponding to the electromagnetic excitation of the motor running at a constant speed and the tire tread pitch excitation.

[0088] The vibration frequency peak of unpaved gravel pavement is about 100Hz to 150Hz, corresponding to random pavement unevenness excitation.

[0089] When a speed bump impacts the road surface, its vibration spectrum is relatively wide, with energy distribution extending to over 200Hz, corresponding to transient impact excitation.

[0090] S202-2, Under each path spectrum excitation, measure the attitude signal noise amplitude (in standard deviation) and signal delay time (in standard deviation) at the output of the composite Kalman filter in step S201. (Rising edge delay measurement of step input).

[0091] Repeatedly adjust the process noise covariance matrix The diagonal elements, especially the covariance terms corresponding to the angular velocity bias state variables, and the observation noise covariance matrix. The diagonal elements, especially the covariance terms corresponding to the accelerometer observation variables, optimize the overall performance of the filter under the three path spectra, that is, minimize the weighted trade-off between noise suppression and signal delay.

[0092] The process noise covariance matrix obtained in this embodiment is calibrated. The order of magnitude of the diagonal elements is approximately to ; Observation noise covariance matrix The order of magnitude of the diagonal elements is approximately to ; Observation noise covariance matrix In this study, the noise covariance term of the accelerometer is approximately 10 to 30 times that of the noise covariance term of the MEMS six-axis gyroscope.

[0093] The S203 composite Kalman filter operates continuously at a sampling rate of 100Hz, outputting a set of optimal attitude estimates every 10ms.

[0094] Preferably, when the vehicle speed is ≤3km / h, the MCU temporarily reduces the covariance term of the corresponding accelerometer observation in the observation noise covariance matrix R to 1 / 10 of the normal value, so that the filter gives higher weight to the accelerometer observation when calculating the Kalman gain, thereby suppressing the influence of MEMS six-axis gyroscope bias drift on attitude estimation at low speed.

[0095] As a preferred option, a series amplitude limiter is used at the output of the composite Kalman filter for redundant protection. Specifically, when the change in the single filter output value from the previous moment exceeds 5° / 10ms, it is determined to be an abnormal spike, and the output is clamped to the previous moment value plus a limit value of 5° to prevent extreme noise spikes from directly entering the subsequent safety judgment logic.

[0096] S3 synchronously collects three types of operating parameters: vehicle speed, attitude angle, and bus current, and outputs them in a unified time scale to provide synchronous data input for the control logic in both pitch and roll dimensions.

[0097] Specifically, it includes the following sub-steps:

[0098] The S301 MCU initiates a synchronous acquisition every 10ms. The start time of this cycle is used as the synchronous trigger point. At the same time, the vehicle speed pulse reading, attitude angle register reading, and ADC sampling start are triggered to ensure that the three types of parameters are aligned at the same timestamp, and to avoid parameter misalignment in subsequent control logic due to inconsistent sampling times.

[0099] The S302 uses a wheel speed Hall sensor to acquire vehicle speed signals. The wheel speed Hall sensor is installed on the toothed ring inside the rear wheel brake disc, and the toothed ring has 24 teeth.

[0100] The Hall sensor outputs a square wave pulse signal, and the MCU capture unit measures the time interval between the rising edges of two adjacent pulses. (unit: Based on the number of teeth N and the rolling radius of the rear wheel. (Unit: m, 0.3 m in this embodiment), calculate the linear velocity of the electric friction using the following formula:

[0101]

[0102] in, The linear velocity of the electric motor; The radius of the rolling wheel of the electric motorcycle; This refers to the number of teeth on the gear ring. The time interval between the rising edges of two adjacent pulses; Pi is the mathematical constant of a circle.

[0103] The effective range for vehicle speed measurement is 0 to 120 km / h, with a resolution of 0.1 km / h. When the vehicle speed is below 3 km / h, the speed value is marked as "near zero speed," and the logic for the low-speed range in subsequent steps S4 and S5 is processed at the lowest level.

[0104] S303, Read the filtered attitude angles. The pitch and roll angle data are directly taken from the optimal state estimate of the Kalman filter in step S2. The first two dimensions do not require additional processing.

[0105] S304 uses a Hall effect current sensor to acquire the motor bus current. This sensor is connected in series at the DC bus input terminal inside the controller. The output analog voltage signal is sampled and digitized by the MCU's built-in 12-bit ADC, with a sampling rate consistent with the main control cycle of 100Hz. The current sample value is low-pass filtered (cutoff frequency 200Hz) and then stored in RAM. Preferably, the Hall effect current sensor used in this embodiment is the Allegro ACS772.

[0106] S305: After the vehicle speed signal, filtered attitude angle, and motor bus current collected in steps S302 to S304 are acquired, they are combined into a data packet and stored in the MCU's RAM buffer for subsequent control logic to call within the same 10ms control cycle. If a parameter fails to update successfully within the 10ms acquisition cycle (e.g., Hall sensor pulse loss), the parameter value saved in the previous cycle is used in the current cycle, and the corresponding continuous timeout count is incremented by 1. When the continuous timeout count exceeds 5, the MCU triggers an alarm for "vehicle speed signal loss" or "current sensor failure" via the instrument panel.

[0107] S4, based on vehicle speed and pitch angle data, matches the slope of the pitch buffer torque curve according to the vehicle speed range. When the pitch angle change exceeds the dead zone, it calculates the current adjustment amount and adds this adjustment to the base vector current command corresponding to the driver's throttle request, achieving a smooth power transition in pitch positions. This function aims to eliminate the gap between the fast response characteristics of the in-wheel motor and the driver's expected control, primarily serving riding comfort and linear control. Details are as follows:

[0108] S401, the curve slopes for each speed range are obtained through actual vehicle calibration. The speed ranges are divided into: low speed range, 0 to 20 km / h (inclusive); medium speed range, 20 km / h to 40 km / h (inclusive); and high speed range, above 40 km / h.

[0109] A pitch damping torque curve is independently calibrated for each vehicle speed range. The curve format is as follows: the horizontal axis represents the pitch angle change. Positive values ​​correspond to the front of the vehicle tilting upwards (uphill), and negative values ​​correspond to the front of the vehicle tilting downwards (downhill); the vertical axis represents the adjustment of the motor output current. Unit: A, positive values ​​correspond to increased torque, negative values ​​correspond to decreased torque.

[0110] The calibration values ​​in this embodiment are: low speed range curve slope 0.5A / °, medium speed range curve slope 1.0A / °, and high speed range curve slope 1.8A / °.

[0111] S402, when the MCU detects a change in pitch angle When the vehicle exceeds the dead zone (in this embodiment, it is set to ±1°, meaning pitch angle fluctuations within 1° are considered sensor noise or minor road surface undulations and are not responded to), the vehicle speed range is matched according to the current vehicle speed, and the corresponding curve slope is read. Calculate the current regulation amount as follows:

[0112] like A positive value indicates that the front of the vehicle is tilted upwards, corresponding to an uphill driving condition. deducting from Multiply by the slope after the dead zone The expression is as follows:

[0113] ,

[0114] in, This refers to the adjustment amount of the motor output current. The slope of the pitch buffer torque curve; This represents the change in pitch angle.

[0115] like If the value is negative, meaning the front of the vehicle is tilted down, corresponding to a downhill driving condition, then subtract it from its absolute value. Multiply by the slope after the dead zone The expression is:

[0116] ,

[0117] The above two scenarios can also be expressed using the following formula:

[0118] ,

[0119] S403 sets the saturation zone of the pitch buffer torque curve. When Exceed hour, Instead of increasing the current at a steeper rate, the current is limited to an upper limit of +15A or a lower limit of -15A to prevent excessive adjustment from causing motor overcurrent or excessive regenerative braking. The upper and lower limits are calibrated based on 30% of the motor's rated current (in this embodiment, the rated current is 50A, so 30% is 15A) to ensure the motor operates within a safe current range and prevent current commands from exceeding the hardware tolerance of the motor or controller.

[0120] S404, at a rate where the change per cycle (10ms) does not exceed 2A, adjust the amount calculated in step S402. The current is gradually accumulated to the base vector current command, achieving linear and progressive increases and decreases in power. The 2A / cycle limit is derived from engineering tuning experience; that is, a 2A change every 10ms corresponds to an actual torque change of approximately... This level of change in a single step is imperceptible during riding, thus ensuring a "stepless" feeling of power adjustment.

[0121] S5, based on vehicle speed and roll angle data, performs a graded judgment according to the three-level thresholds calibrated by vehicle speed linkage, and sequentially executes three levels of protection actions: warning prompt, progressive torque limiting, and tilt self-locking, to achieve progressive safety protection from warning to self-locking under roll posture; at the same time, the tilt angle change rate is introduced as an auxiliary judgment variable to trigger the threshold in advance during rapid tilting to compensate for the execution delay. Steps S4 and S5 run in parallel and are not coupled.

[0122] Specifically, it includes the following sub-steps:

[0123] S501, the roll angle safety threshold is calibrated as a discrete function of vehicle speed. The test electric motorcycle is fixed at two speeds, 20 km / h and 40 km / h, respectively. A mechanical push rod mechanism is used to slowly tilt the motorcycle to different angles at a rate of approximately 5° / s. Based on observation data from two dimensions—tire contact with the ground (i.e., the rear wheel vertical load drops below 30% of the unloaded value) and the rollover threshold (i.e., the intersection of roll moment and restoring moment)—three levels of thresholds are determined for each speed (from low to high: Level 1 warning threshold, Level 2 torque limiting threshold, and Level 3 self-locking threshold). Typical values ​​obtained in this embodiment are as follows:

[0124] When the vehicle speed is ≤20km / h, the first-level warning threshold is about 10°, the second-level torque limiting threshold is about 20°, and the third-level self-locking threshold is about 30°.

[0125] When the vehicle speed is between 20km / h and 40km / h, the first-level warning threshold is about 7°, the second-level torque limiting threshold is about 13°, and the third-level self-locking threshold is about 21°.

[0126] When the vehicle speed is greater than 40 km / h, the first-level warning threshold is about 5°, the second-level torque limiting threshold is about 10°, and the third-level self-locking threshold is about 16°.

[0127] The threshold values ​​between each speed range are obtained through linear interpolation and rounded down with a minimum step size of 0.5°. It should be noted that the above values ​​are directly related to the vehicle's center of gravity height, track width, tire type, and suspension stiffness; different vehicle models should be recalibrated.

[0128] S502, when the real-time roll angle When the Level 1 warning threshold is reached or exceeded, the MCU determines that the vehicle body has tilted significantly and is perceptible to the driver, triggering the following actions: the instrument panel attitude indicator light flashes yellow at a frequency of 2Hz, the buzzer sounds an intermittent alarm at a frequency of 1Hz, and the instrument screen displays a warning message such as "Vehicle tilt, please be careful." At this level, no powertrain intervention is performed, aiming to preserve the driver's right to actively correct the vehicle's position and reaction time.

[0129] S503, when the real-time roll angle When the torque is further increased to the level 2 torque limit threshold, the MCU matches the corresponding torque limit ratio according to the current vehicle speed: when the vehicle speed is ≤20km / h, the torque limit is set to 80% of the rated torque; when the vehicle speed is between 20km / h and 40km / h, the torque limit is set to 60%; when the vehicle speed is >40km / h, the torque limit is set to 40%.

[0130] The physical implementation of torque limiting is as follows: In the motor vector control... The shaft current command upper limit is compressed to the corresponding ratio. Torque limiting is executed incrementally at a rate of 2% reduction in rated torque every 10ms, not an instantaneous jump. For example, if torque needs to be limited to 60% at 30km / h, it is reduced by 40%, with a transition time of [time missing]. .

[0131] S504, when the real-time roll angle When the level three self-locking threshold is reached, the electric motorcycle is determined to be in a critical tipping state. The MCU will [action] within 10ms. The shaft current command is forced to zero, cutting off the motor drive force output; then the brake light signal is triggered within 50ms; subsequently, a brake assist request message is sent to the electric motorcycle's electronic braking system via the CAN bus.

[0132] If the electric motorcycle is not equipped with an electronic braking system, regenerative braking will be used, that is: the motor will... Setting the axis command to a negative value causes the motor to generate a reverse drag torque while simultaneously feeding energy back to the battery, applying a reverse drag torque of approximately 20% of the rated torque. The self-locking state is maintained until the roll angle falls below the secondary torque limit threshold and remains below it for at least 500 ms before being released. Upon release, torque recovery is performed gradually at a rate of 2% increase every 10 ms.

[0133] S505, Inclination rate of change As an auxiliary decision variable.

[0134] When the real-time roll angle When the rate of change exceeds 30° / s, the MCU automatically advances the triggering condition of the next-level protection threshold (if a warning has already been triggered, the next level is the torque limiting threshold; if torque limiting has already been triggered, the next level is the self-locking threshold). That is, the corresponding threshold is triggered 3° ahead of the current angle. For example, if the secondary torque limiting threshold is 16.5° at the current vehicle speed of 30km / h, and the rate of change exceeds 30° / s while the current angle has reached 13.5°, the torque limiting is triggered immediately without waiting for it to reach 16.5°. This advance design is based on the fact that it takes 100ms for the angle to rise from 13.5° to 16.5° at a rate of 30° / s. Subtracting the 30ms filtering delay in step S2 and the approximately 20ms execution delay in step S6, a safety margin of approximately 50ms remains.

[0135] The protection mode status output in this step includes the current protection level and the torque limit target value; the current protection level is one of four states: 0 Normal, 1 Warning, 2 Torque Limit, and 3 Self-locking. The torque limit target value is output when the torque limit is triggered and set to zero in other states.

[0136] S6, when triggered by torque limiting or self-locking, presses the test bench (the test platform used to calibrate the BMS tripping characteristics) to linearly reduce the current command by the calibrated slope, so as to actively avoid the hardware protection tripping boundary of the BMS. At the same time, it sends a synchronization status frame to the BMS through the CAN bus to realize vehicle-level collaborative protection between the MCU and the BMS, writes the fault log to the local flash memory, and pushes the attitude status to the instrument display.

[0137] Specifically, the following steps are included:

[0138] The S601 MCU continuously receives standard status frames broadcast by the BMS via the CAN bus (CAN2.0B protocol, 500kbps) at 100ms intervals. These frames include battery voltage, SOC (State of Charge), battery pack temperature, and hardware overcurrent protection threshold. .

[0139] The MCU maintains a software timer to record the timestamp of the most recent successful reception of a BMS status frame. If no valid frame is received for more than 500ms, it is determined that the CAN bus is disconnected or the BMS communication is faulty, and the most conservative approach is taken. The value (e.g., 2.5 times the nominal continuous current specified in the battery specifications) is used in subsequent calculations, and a "BMS communication abnormality" alarm is displayed on the instrument.

[0140] The S602 MCU internally stores a set of trip characteristic calibration parameters for the current BMS model. These parameters are obtained through bench testing, that is, by connecting the BMS under test to an electronic load, testing the trip probability with different initial current values ​​and different current drop rates, and plotting a three-dimensional curve.

[0141] This embodiment focuses on a certain 13-cell lithium iron phosphate battery BMS (BMS). Trip window The actual test results show that the tripping probability is <1% when the descent rate is <5A / ms; and close to 100% when the descent rate is >20A / ms. Based on these calibration results, this embodiment sets the torsion limit slope to 5A / ms, i.e., the current is reduced by 5A every millisecond. It takes 8ms to reduce the peak current from 80A to the target value of 40A, which is far below the 80ms tripping window; simultaneously, the di / dt of 5A / ms is far below the false trigger boundary of 20A / ms. This slope value needs to be recalibrated after changing the BMS model.

[0142] In the S603, during torque limiting, the MCU sends a synchronization status frame to the BMS via the CAN bus. This frame's data field encodes the current torque limiting ratio, the estimated bus current value, and the torque limiting status flag. The purpose of this frame is to allow the BMS to perform cross-validation between the estimated current value and its own ADC sampled value. If the BMS firmware supports this, the BMS will open the overcurrent determination window upon receiving this frame. Extended from 80ms to 120ms, and The trigger threshold is increased from 20A / ms to 30A / ms, thus providing additional time margin for the MCU's torque limiting action. If the BMS firmware cannot be modified, this function is downgraded to instrument data display and does not participate in the protection logic. However, regardless of whether the BMS firmware can be modified, the torque limiting slope avoidance strategy in step S602 takes effect independently. Even if the BMS does not extend the judgment window, a slope of 5A / ms ensures that the adjustment is completed within 8ms, which is much shorter than the 80ms window, and the avoidance strategy itself is effective enough.

[0143] S604: Each time a warning, torque limiting, or self-locking action is triggered, the MCU records a fault log to a dedicated sector of the MCU's built-in Flash (capacity 128KB, each log is 128 bytes, and can store approximately 1000 records) in an event-triggered manner.

[0144] The log content includes fault codes (0x01 warning, 0x02 torque limiting, 0x03 self-locking), system operation time stamps at the trigger time (in milliseconds), vehicle speed (km / h), pitch angle (°), roll angle (°), bus current (A), torque limiting ratio (%), battery SOC (%), and a 16-byte CRC checksum. The write strategy is a circular overwrite, meaning it first reads the write pointer position of the current sector, appends the new log, and when the pointer reaches the end of the sector, it returns to the starting address to overwrite the oldest historical record. The write operation is completed within 200ms after the fault is triggered, with a lower priority than the main control task (100Hz sampling and filtering), ensuring that the write operation does not block real-time control.

[0145] The S605 MCU sends attitude status frames to the instrument via the CAN bus at 50ms intervals, including roll angle, pitch angle, current protection mode (0 Normal, 1 Warning, 2 Torque Limit, 3 Self-Locking), and fault status. Upon receiving the frames, the instrument refreshes its digital display, LED indicators, and buzzer. If the instrument fails to receive an attitude status frame for 500ms, it displays an "Attitude Signal Loss" alarm and extinguishes all attitude-related indicator lights.

[0146] The S7 responds to user manual operation or automatic condition recognition results based on the standard deviation of vehicle speed and the standard deviation of pitch angle change, and switches between three sets of preset mode parameters. It also persistently stores the current mode parameters for automatic recovery upon power-up, adapting to different riding scenarios and user preferences. Details are as follows:

[0147] The S701 MCU has three preset parameter configurations, each corresponding to different riding scenarios and user preferences:

[0148] Comfort mode: Compared to the reference slope calibrated in step S401, the pitch torque curve slope is reduced by 30% overall (i.e., 0.35A / ° at low speed, 0.7A / ° at medium speed, and 1.26A / ° at high speed). The roll threshold adopts the calibration value of step S501 without additional adjustment, and the torque limit slope is 3A / ms.

[0149] Motion mode: Compared with the reference slope calibrated in step S401, the pitch curve slope is increased by 20% overall (0.6A / ° at low speed, 1.2A / ° at medium speed, and 2.16A / ° at high speed), the roll threshold is tightened by 2° overall based on the value calibrated in step S501, and the torque limit slope is increased to 8A / ms.

[0150] Safety protection mode: The pitch curve reuses the slope of the comfort mode, the roll threshold is tightened by 3° on the basis of the calibration value in step S501, and when the torque limit is triggered, the synchronization status frame in step S603 is sent directly. Even if the level 3 self-locking threshold is not reached, the BMS window extension strategy is activated synchronously as long as the torque limit is triggered.

[0151] The S702 supports two triggering methods for mode switching. The first is manual switching: the driver can cycle through modes by lightly touching the instrument panel button and confirming the switch by long-pressing. The second is automatic recognition switching: the MCU calculates the standard deviation of the vehicle speed over the past 30 seconds. Standard deviation of pitch angle change (All data were calculated using standard statistical methods, and the sampling window consisted of valid data within the last 30 seconds.) and If the driver detects a persistent rain signal via the CAN bus, a prompt will appear on the instrument panel suggesting switching to Sport mode. This suggestion will take effect upon driver confirmation. If the MCU detects continuous rain via the CAN bus, a pop-up window will automatically suggest switching to Safety Mode. Automatic identification only provides suggestions and will not force a switch without driver confirmation.

[0152] S703, the currently valid mode parameters are stored in a separate parameter area of ​​the MCU Flash (separate from the calibration and log areas) in the form of data packets. Due to the physical characteristics of Flash memory, this sector (4KB sector) must be erased before data is written. The parameter area has a write endurance of 100,000 times. Considering that mode switching is typically used 1 to 2 times per day, this endurance meets the needs of the entire vehicle's lifecycle. Upon the next power-on, after completing the zero-point calibration in step S1, the MCU immediately reads the historical mode parameters from the parameter area and loads them into effect, without requiring user reset.

[0153] It should be noted that all specific values ​​involved in the above steps, including but not limited to the slope, threshold, time window and other parameters calibrated in each step, should be obtained by bench and field calibration based on the specific vehicle model, motor specifications, BMS model and matching sensors used. Under different vehicle models, different motor power levels and different BMS suppliers, the above values ​​should be re-obtained by the same calibration method, rather than directly applying the specific figures of this embodiment.

[0154] Example 2

[0155] This embodiment describes an electric motorcycle posture safety control system for executing the method described in Embodiment 1.

[0156] The electric motorcycle attitude safety control system described in this embodiment includes: a MEMS six-axis gyroscope, a wheel speed Hall sensor, a Hall effect current sensor, a motor controller (MCU), a battery management system (BMS), instruments, and a CAN bus.

[0157] The MEMS six-axis gyroscope is installed in the middle of the vehicle frame and is used to collect raw data of static acceleration and angular velocity of the electric motorcycle, as well as real-time acceleration and angular velocity data.

[0158] The wheel speed Hall sensor is installed on the gear ring inside the rear wheel brake disc and is used to collect wheel speed pulse signals;

[0159] The Hall effect current sensor is connected in series with the DC bus input terminal inside the motor controller to collect the motor bus current;

[0160] The motor controller is connected to the MEMS six-axis gyroscope, wheel speed Hall sensor, Hall effect current sensor, instrument and BMS respectively.

[0161] The motor controller is configured to perform the following steps:

[0162] Step 1, as in step S1 of Example 1, involves a delayed start calibration after the electric motor is powered on, collecting static raw data from the MEMS six-axis gyroscope, calculating the average offset after removing abnormal jitter and writing it into the memory, establishing the current horizontal reference, and eliminating the randomness of the zero bias during successive power-on of the MEMS six-axis gyroscope, temperature drift, and installation deviation.

[0163] Step two, as in step S2 of Example 1, performs composite Kalman filtering noise reduction on the zero-point compensated data. High-frequency vibration noise and the real attitude signal are separated by a filter specifically tuned for the electric motorcycle vibration spectrum, eliminating the interference of driving vibration on attitude detection.

[0164] Step 3, as in step S3 of Example 1, synchronously collect three types of operating parameters: vehicle speed, attitude angle, and bus current, and output them in a unified time scale.

[0165] Step four, as in step S4 of embodiment 1, based on vehicle speed and pitch angle data, the slope of the pitch buffer torque curve is matched according to the vehicle speed range. After the pitch angle change exceeds the dead zone, the current adjustment amount is calculated and added to the basic vector current command corresponding to the driver's throttle request to achieve a smooth power transition under pitch attitude.

[0166] Step 5, as in step S5 of Example 1, is based on vehicle speed and roll angle data, and is classified according to the three-level threshold of vehicle speed linkage calibration. The three-level protection actions of warning prompt, progressive torque limiting and tilt self-locking are executed in sequence to achieve graded safety protection under roll posture.

[0167] Step six, as in step S6 of embodiment 1, when the torque limiting or self-locking is triggered, the current command is linearly reduced according to the slope calibrated on the bench to actively avoid the hardware protection tripping boundary of the BMS. At the same time, a synchronization status frame is sent to the BMS via the CAN bus to realize vehicle-level collaborative protection between the motor controller and the BMS, and the fault log is written to the local flash memory and the attitude status is pushed to the instrument display.

[0168] Step seven, as in step S7 of embodiment 1, in response to user manual operation or the system's automatic condition identification results based on the standard deviation of vehicle speed and the standard deviation of pitch angle change, completes the switching of three sets of preset mode parameters, and persistently stores the current mode parameters to achieve automatic recovery upon power-on.

[0169] The specific implementation methods of steps one to seven above correspond to steps S1 to S7 in embodiment 1, and will not be repeated here.

[0170] As a preferred embodiment:

[0171] (1) The motor controller includes a processor and a memory. The memory stores a computer program. When the processor executes the computer program, it performs the functions of steps one to seven above.

[0172] (2) The MEMS six-axis gyroscope is connected to the motor controller via an I2C or SPI communication interface.

[0173] (3) The wheel speed Hall sensor is connected to the motor controller via the GPIO interface.

[0174] (4) The Hall effect current sensor is connected to the motor controller via the ADC interface.

[0175] (5) The motor controller is connected to the instrument via a CAN bus, and the motor controller is connected to the BMS via a CAN bus.

[0176] The working principle of each functional module in the system described in this embodiment is exactly the same as the processing logic of the corresponding steps in Embodiment 1, and the data flow relationship between each module corresponds one-to-one with the upstream and downstream relationship of each step in Embodiment 1. Those skilled in the art can fully understand the structure and working principle of the system described in this embodiment based on reading Embodiment 1, therefore, the specific data processing process of each module of the system will not be described again.

[0177] Example 3

[0178] This embodiment provides an electric motorcycle, including a vehicle body and the electric motorcycle posture safety control system described in Embodiment 2, which is installed on the vehicle body.

[0179] The vehicle body includes a frame, front wheels, rear wheels, suspension system, battery pack, and instrument panel.

[0180] The front wheel is mounted at the front of the frame, and the rear wheel is mounted at the rear of the frame. The hub motor is integrated inside the rear wheel or mounted on one side of the rear wheel, and is used to drive the electric motorcycle. The suspension system includes a front suspension and a rear suspension, which connect the front wheel to the frame and the rear wheel to the frame, respectively. The battery pack is installed at the bottom of the frame or under the footrests, and is used to provide power to the entire vehicle.

[0181] The MEMS six-axis gyroscope of the electric motorcycle attitude safety control system is installed in the middle of the frame, the wheel speed Hall sensor is installed on the gear ring inside the rear wheel brake disc, the Hall effect current sensor is connected in series to the DC bus input terminal inside the motor controller, and the motor controller, BMS and instruments are respectively installed in corresponding positions on the vehicle body.

[0182] Regarding connectivity, the MEMS six-axis gyroscope is connected to the motor controller via an I2C or SPI communication interface; the wheel speed Hall sensor is connected to the motor controller via a GPIO interface; the Hall effect current sensor is connected to the motor controller via an ADC interface; the motor controller is connected to the instrument via a CAN bus; and the motor controller is connected to the BMS via a CAN bus. The motor controller is configured to implement the method described in Embodiment 1 to achieve safe attitude control of the electric motorcycle.

[0183] The components and their connections of the electric motorcycle described in this embodiment are all known technologies in the field. This embodiment does not improve the structure of the above components, so their specific structure and working principle will not be described in detail.

[0184] The electric motorcycle, by employing the method described in Embodiment 1 or the system described in Embodiment 2, achieves multi-dimensional and hierarchical posture safety control, thereby improving driving stability and riding safety.

[0185] It should be noted that the above embodiments 1 to 3 describe the present invention from three perspectives: method, system, and electric motor. These three embodiments belong to different implementations under the same inventive concept and can be referred to and cited interchangeably. Those skilled in the art should understand that the specific values, models, parameters, etc., recorded in the above embodiments are illustrative and should not be construed as limiting the scope of protection of the present invention. The scope of protection of the present invention is determined by the claims, and any equivalent substitutions or modifications based on the inventive concept fall within the scope of protection of the present invention.

[0186] The foregoing has shown and described the basic principles, main features, and advantages of the present invention. Those skilled in the art should understand that the present invention is not limited to the above embodiments. The embodiments and descriptions in the specification are merely illustrative of the principles of the invention. Various changes and modifications can be made to the invention without departing from its spirit and scope, and all such changes and modifications fall within the scope of the claimed invention.

Claims

1. A method for controlling the posture safety of an electric motorcycle, characterized in that, Includes the following steps: S1. After the electric motorcycle is powered on, a delayed start calibration is performed. Static raw data from the MEMS six-axis gyroscope is collected. After removing abnormal jitter data from the raw data, the static offset mean is calculated. This offset mean is written into the memory as the zero-point compensation value to establish the current horizontal reference. During the normal operation of the electric motorcycle, the real-time sampled data of the MEMS six-axis gyroscope is subjected to a correction operation by subtracting the zero-point compensation value from the sampled value to obtain the real-time sensing data after zero-point compensation. S2 performs composite Kalman filtering noise reduction on the real-time sensing data after zero-point compensation. The filter is tuned according to the measured road spectrum of the electric motorcycle and is used to separate high-frequency vibration noise from the real attitude signal. S3 synchronously collects three types of operating parameters: vehicle speed, attitude angle, and bus current, and outputs them in a unified time scale. S4, based on the pitch angle data in the vehicle speed and attitude angle output by S3, matches the slope of the pitch buffer torque curve according to the vehicle speed range, calculates the current adjustment amount after the pitch angle change exceeds the dead zone, and adds the adjustment amount to the basic vector current command corresponding to the driver's throttle request. S5, based on the roll angle data in the vehicle speed and attitude angle output by S3, performs graded judgment according to the three-level threshold of the vehicle speed calibration, and sequentially executes three-level protection actions: warning prompt, progressive torque limiting, and tilt self-locking. At the same time, the tilt angle change rate is introduced as an auxiliary judgment variable. When the tilt angle change rate exceeds the preset value, the threshold is triggered in advance, and the protection mode status is output. S6, based on the protection mode status output by S5, linearly reduces the current command according to the current reduction rate calibrated by the bench when the torque limiting or self-locking is triggered, so as to actively avoid the hardware protection tripping boundary of the BMS. At the same time, it sends a synchronization status frame to the BMS through the CAN bus to realize the vehicle-level collaborative protection between the MCU and the BMS. S7: When the user manually switches or the MCU automatically identifies the current operating conditions, the MCU completes the switching of three sets of preset mode parameters and persistently stores the current mode parameters to achieve automatic recovery upon power-up.

2. The electric motorcycle posture safety control method according to claim 1, characterized in that, In step S1, after the electric motor is powered on, the MCU starts the calibration process after a delay and collects the raw data of static acceleration and angular velocity of the MEMS six-axis gyroscope within a preset time window. Calculate the standard deviation of the data for each of the six axes of the MEMS six-axis gyroscope, remove outliers that deviate from the mean by more than ±3 standard deviations, and obtain the valid raw data; The arithmetic mean of the valid raw data is used as the static offset for this power-on, and this offset is used as the subsequent zero-point compensation value. Write the above zero-point compensation value into the dedicated calibration area of ​​the MCU's internal memory. After calibration, read the attitude angle of the electric motorcycle parked on a horizontal ground. If the initial values ​​of pitch and roll angles fall within ±0.5°, the calibration is valid. Otherwise, the calibration is marked as invalid and the calibration will be performed again after power is turned on.

3. The electric motorcycle posture safety control method according to claim 1, characterized in that, In step S2, the MCU reads the data from the MEMS six-axis gyroscope in real time, and sends it to the composite Kalman filter after zero-point compensation in step S1. The process noise covariance matrix Q and the observation noise covariance matrix R are tuned, and the initial values ​​of Q and R are determined based on the measured road spectrum of the electric motorcycle. The composite Kalman filter runs continuously, outputting a set of optimal attitude estimates every 10ms.

4. The electric motorcycle posture safety control method according to claim 3, characterized in that, The method for tuning the process noise covariance matrix Q and the observation noise covariance matrix R is as follows: The electric motorcycle was placed on a four-channel road simulation test bench, and three types of road excitation spectra were input respectively: urban asphalt road surface, unpaved gravel road surface, and speed bump impact road surface. Under each road surface excitation spectrum, the amplitude of the attitude signal noise and the signal delay time at the output of the composite Kalman filter were measured. By repeatedly adjusting the diagonal elements in Q and R, the weighted trade-off between noise suppression and signal delay of the filter under the three road surface excitation spectra is minimized.

5. The electric motorcycle posture safety control method according to claim 1, characterized in that, In step S3, the MCU starts synchronous acquisition with a period of 10ms, triggering vehicle speed pulse reading, attitude angle register reading, and ADC sampling start at the same time; vehicle speed signal is acquired through wheel speed Hall sensor; pitch angle and roll angle data are directly taken from the first two dimensions of the current attitude estimation value of Kalman filter in step S2; motor bus current is acquired through Hall effect current sensor; the three types of parameters are combined into a data packet and stored in the MCU's RAM buffer.

6. The electric motorcycle posture safety control method according to claim 1, characterized in that, In step S5, the three thresholds are discrete functions of vehicle speed, and from low to high they are the first-level warning threshold, the second-level torque limiting threshold, and the third-level self-locking threshold. When the real-time roll angle reaches or exceeds the first-level warning threshold, an instrument warning is triggered, and no powertrain intervention is performed. When the real-time roll angle reaches the secondary torque limit threshold, the upper limit of the q-axis current command is compressed to the corresponding ratio, and executed gradually at a rate of 2% reduction in rated torque every 10ms. When the real-time roll angle reaches the level 3 self-locking threshold, the q-axis current command is forced to zero within 10ms. The self-locking state is maintained until the roll angle falls below the level 2 torque limit threshold and remains below it for more than 500ms before being released. When the rate of change of the real-time roll angle exceeds 30° / s, the next level protection threshold that has not yet been triggered will be automatically triggered 3° in advance. The next level protection threshold is: the torque limit threshold when the current warning has been triggered, and the self-locking threshold when the current torque limit has been triggered.

7. The electric motorcycle posture safety control method according to claim 1, characterized in that, In step S6, the MCU continuously receives standard status frames broadcast by the BMS via the CAN bus at 100ms intervals, which include hardware overcurrent protection thresholds. ; The MCU internally stores a set of trip characteristic calibration parameters corresponding to the current BMS model, and sets the torsion limit rate to a safe value based on the calibration results. During the torque limiting process, the MCU sends a synchronization status frame to the BMS via the CAN bus, which includes the current torque limiting ratio, the estimated bus current value, and the torque limiting status flag. Each time a warning, torque limiting, or self-locking action is triggered, the MCU records a fault log to a preset storage area in the MCU's internal memory in an event-triggered manner. The MCU sends attitude status frames to the instrument via the CAN bus.

8. The electric motorcycle posture safety control method according to claim 1, characterized in that, In step S6, if the BMS firmware has the capability to cooperate, the BMS will extend the overcurrent determination window and increase the current change rate trigger threshold after receiving the synchronization status frame, providing additional time margin for the MCU torsion limiting action; if the BMS firmware cannot be modified, the synchronization status frame is only used for instrument data display and not for protection determination; the torsion limiting slope avoidance operation is executed independently.

9. An electric motorcycle posture safety control system, used to execute the method according to any one of claims 1 to 8, characterized in that, include: The MEMS six-axis gyroscope is installed in the middle of the frame and is used to collect static and real-time acceleration and angular velocity data of the electric motorcycle. The wheel speed Hall sensor is installed on the toothed ring inside the rear wheel brake disc to collect wheel speed pulse signals; A Hall effect current sensor is connected in series with the DC bus input terminal inside the motor controller to collect the motor bus current. The motor controller is connected to a MEMS six-axis gyroscope, a wheel speed Hall sensor, a Hall effect current sensor, an instrument, and a BMS, and is configured to perform the method of any one of claims 1 to 8. The motor controller includes a processor and a memory, the memory storing a computer program, and the processor executing the computer program to implement the method of any one of claims 1 to 8.

10. An electric motorcycle, characterized in that, The electric motorcycle includes a vehicle body and the posture safety control system of claim 9, which is installed on the vehicle body; the vehicle body includes a frame, a front wheel, a rear wheel, a suspension system, a battery pack, and an instrument panel; the front wheel is installed at the front end of the frame, the rear wheel is installed at the rear end of the frame, and the hub motor is integrated inside the rear wheel or installed on one side of the rear wheel; the suspension system includes a front suspension and a rear suspension, which respectively connect the front wheel to the frame and the rear wheel to the frame; the battery pack is installed at the bottom of the frame or under the footrests.