Motor acceleration and deceleration control method and device, equipment and storage medium
By generating acceleration and deceleration curves and dividing them into stages, extracting pulse parameters, constructing an index data structure, and performing interpolation calculations, the real-time performance and storage space issues of motor acceleration and deceleration control in embedded systems are solved, achieving smooth and efficient motor control.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-23
- Publication Date
- 2026-03-13
AI Technical Summary
Existing motor acceleration and deceleration control methods have high real-time computational complexity in embedded systems, leading to step loss. Lookup table methods consume too much storage space, making it difficult to guarantee the real-time performance and smoothness of motor acceleration and deceleration in resource-constrained embedded systems.
By generating acceleration and deceleration curves and dividing them into multiple stages, extracting pulse parameters based on the rate of change of speed, constructing an indexed data structure, and using interpolation to generate PWM pulse signals to drive the motor, the complexity of real-time calculations is reduced and the storage space is reduced.
While ensuring smooth acceleration and deceleration of the motor, it significantly reduces storage space usage and real-time calculation complexity, achieving efficient operation of motor control.
Smart Images

Figure CN121664064A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data processing technology, and in particular to a method, apparatus, device, and storage medium for controlling motor acceleration and deceleration. Background Technology
[0002] In the field of motor control, to ensure smooth motor start-up and stopping, acceleration and deceleration control methods are typically employed, using PWM pulse signals to control the motor's speed. Existing motor acceleration and deceleration control methods mainly include two technical solutions: real-time calculation and lookup table methods.
[0003] Real-time calculation methods require complex mathematical operations to calculate the frequency parameters of the current pulse at each pulse interruption. When the motor operates at a high frequency, the computing power of the embedded system cannot meet the real-time requirements, leading to missed steps or loss of synchronization. Lookup table methods ensure real-time performance by pre-calculating and storing the frequency parameters of all pulses, but require a large amount of storage space, making them difficult to implement in embedded systems with limited storage resources. Therefore, how to ensure both the real-time performance and smoothness of motor acceleration and deceleration while controlling storage space usage under resource-constrained conditions in embedded systems is a technical problem that urgently needs to be solved by those skilled in the art. Summary of the Invention
[0004] The main objective of this invention is to solve the technical problems of high real-time computational complexity leading to step loss in existing motor acceleration and deceleration control methods in embedded systems, and excessive storage space consumption of lookup table methods. This invention provides a method for controlling the acceleration and deceleration of a motor, the method comprising: Based on the motor's starting frequency, target frequency, and acceleration / deceleration time, an acceleration / deceleration curve is generated. The acceleration / deceleration curve is then divided into multiple stages based on the rate of change of speed of the acceleration / deceleration curve, and the start and end positions of each stage are obtained. Based on the rate of change of velocity in each stage, the pulse parameters in each stage are extracted to obtain the set of extraction points for each stage. Based on the start and end positions of each stage and the set of extraction points, an index data structure is constructed. The index data structure is used to record the extraction information of each stage and the parameter information of the extraction points. Based on the current pulse count, two adjacent sampling points are found through the index data structure, and the frequency values of the two sampling points are interpolated to obtain the output frequency of the current pulse. A PWM pulse signal is then generated based on the output frequency to drive the motor.
[0005] The present invention also provides a motor acceleration / deceleration control device, the motor acceleration / deceleration control device comprising: The curve segmentation module is used to generate an acceleration / deceleration curve based on the motor's starting frequency, target frequency, and acceleration / deceleration time, and to divide the acceleration / deceleration curve into multiple stages based on the rate of change of the acceleration / deceleration curve, thereby obtaining the start and end positions of each stage. The parameter extraction module is used to extract the pulse parameters in each stage based on the rate of change of velocity in each stage, and obtain the extraction point set for each stage. An index building module is used to build an index data structure based on the start and end positions of each stage and the set of extraction points. The index data structure is used to record the extraction information of each stage and the parameter information of the extraction points. The pulse generation module is used to find two adjacent sampling points through the index data structure based on the current pulse count, perform interpolation calculation on the frequency values of the two sampling points to obtain the output frequency of the current pulse, and generate a PWM pulse signal based on the output frequency to drive the motor.
[0006] The present invention also provides a motor acceleration / deceleration control device, comprising: a memory and at least one processor, wherein the memory stores instructions, and the memory and the at least one processor are interconnected via a circuit; the at least one processor invokes the instructions in the memory to cause the motor acceleration / deceleration control device to perform the steps of the above-described motor acceleration / deceleration control method.
[0007] The present invention also provides a computer-readable storage medium storing instructions that, when executed on a computer, cause the computer to perform the steps of the above-described motor acceleration / deceleration control method.
[0008] The aforementioned motor acceleration / deceleration control method, device, equipment, and storage medium generate an acceleration / deceleration curve based on the motor's starting frequency, target frequency, and acceleration / deceleration time. The curve is then divided into multiple stages based on the rate of change of speed, obtaining the start and end positions of each stage. Pulse parameters within each stage are extracted based on the rate of change of speed, resulting in a set of extraction points for each stage. An index data structure is constructed based on the start and end positions of each stage and the set of extraction points. The current pulse count is used to find two adjacent extraction points through the index data structure, and the frequency values of the two extraction points are interpolated to obtain the output frequency of the current pulse. A PWM pulse signal is then generated based on the output frequency to drive the motor. This invention, through staged adaptive extraction and interpolation calculation, significantly reduces storage space usage and real-time computational complexity while ensuring smooth acceleration / deceleration.
[0009] Other features and advantages of the invention will be set forth in the description which follows, and will be apparent in part from the description, or may be learned by practicing the invention. The objects and other advantages of the invention are realized and obtained in accordance with the structures particularly pointed out in the description, claims and drawings.
[0010] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description
[0011] Figure 1 This is a schematic diagram of the first embodiment of the motor acceleration / deceleration control method in this invention; Figure 2 This is a schematic diagram of a second embodiment of the motor acceleration / deceleration control method in this invention. Figure 3 This is a schematic diagram of one embodiment of the motor acceleration / deceleration control device in this invention. Figure 4 This is a schematic diagram of one embodiment of the motor acceleration / deceleration control device in this invention. Detailed Implementation
[0012] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions 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, not all embodiments. 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 the present invention.
[0013] The terms "comprising" and "having," and any variations thereof, used in the embodiments of this invention are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or units is not limited to the steps or units listed, but may optionally include other steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products, or devices.
[0014] To facilitate understanding of this embodiment, a motor acceleration / deceleration control method disclosed in this embodiment of the invention will first be described in detail. For example... Figure 1 As shown, this method includes the following steps: 101. Generate an acceleration / deceleration curve based on the motor's starting frequency, target frequency, and acceleration / deceleration time. Divide the acceleration / deceleration curve into multiple stages based on the rate of change of the acceleration / deceleration curve, and obtain the start and end positions of each stage. In this embodiment, the embedded controller can extract the motor's starting frequency, target frequency, and acceleration / deceleration time parameters based on the received motion control commands. Specifically, the starting frequency can be the motor's current operating frequency or its initial frequency in a stationary state, the target frequency is the desired operating frequency that the motor needs to reach, and the acceleration / deceleration time is the time required for the starting frequency to change to the target frequency.
[0015] It should be noted that various curve planning methods can be used when generating acceleration / deceleration curves. For example, a trapezoidal acceleration / deceleration curve can be used, which divides the acceleration / deceleration process into three stages: uniform acceleration, uniform speed, and uniform deceleration, with the acceleration remaining constant within each stage. Alternatively, an S-shaped acceleration / deceleration curve can be used, which introduces the concept of jerk to allow the acceleration to change continuously, thus achieving a smoother speed transition. This embodiment preferably uses an S-shaped acceleration / deceleration curve to ensure the smoothness of motor operation.
[0016] After generating the S-shaped acceleration / deceleration curve, the controller can analyze the curve and calculate the rate of change of velocity at each point on the curve. Specifically, the rate of change of velocity can be obtained by numerically differentiating the velocity curve, i.e., calculating the velocity difference between adjacent time points or adjacent pulse points. Furthermore, the controller can divide the entire acceleration / deceleration curve into multiple stages based on the magnitude of the rate of change of velocity. For example, the stages can be divided based on whether the rate of change of velocity exceeds a preset threshold, dividing the region with a large rate of change of velocity into the initial acceleration stage and the final deceleration stage, and dividing the region with a small rate of change of velocity into the uniform or near-uniform velocity stage.
[0017] For each defined stage, the controller can extract the start and end position information of that stage. Specifically, the start and end positions can be represented by pulse numbers, that is, recording the first pulse number corresponding to the start time of the stage and the last pulse number corresponding to the end time, or they can be represented by timestamps, recording the start and end times of the stage.
[0018] 102. Based on the rate of change of velocity in each stage, extract the pulse parameters in each stage to obtain the set of extraction points for each stage. In this embodiment, the step of extracting pulse parameters within each stage based on the velocity change rate of each stage to obtain the extraction point set of each stage includes: determining the extraction interval of each stage based on the magnitude of the velocity change rate of each stage, wherein the extraction interval corresponding to the stage with a large velocity change rate is small, and the extraction interval corresponding to the stage with a small velocity change rate is large; selecting pulse points as extraction points sequentially within each stage according to the extraction interval based on the starting position of each stage and the extraction interval to obtain the extraction point sequence of each stage; and extracting the pulse number and corresponding frequency value of each extraction point in the extraction point sequence to obtain the extraction point set of each stage.
[0019] Specifically, after acquiring the speed change rate information for each stage, the controller can allocate different sampling intervals for each stage based on the magnitude of the speed change rate. It should be noted that the speed change rate reflects how quickly the motor speed changes. The larger the speed change rate, the more drastic the change in motor speed within that stage, requiring more densely packed control points to ensure control accuracy and smooth motion. Conversely, the smaller the speed change rate, the more gradual the change in motor speed within that stage, allowing for sparser control points and thus saving storage space.
[0020] When determining the sampling interval, the controller can employ a segmented mapping approach. For example, multiple velocity change rate thresholds, such as a first threshold, a second threshold, and a third threshold, can be pre-set to divide the velocity change rate into high, medium, and low levels. When the velocity change rate in a certain stage is greater than the first threshold, it is determined to be a high change rate stage, and the corresponding sampling interval can be set to 1, meaning each pulse is used as a sampling point. When the velocity change rate is between the first and second thresholds, it is determined to be a medium change rate stage, and the corresponding sampling interval can be set to 5, meaning one point is sampled every 5 pulses. When the velocity change rate is less than the second threshold, it is determined to be a low change rate stage, and the corresponding sampling interval can be set to 10 or greater, meaning one point is sampled every 10 or more pulses. By adaptively adjusting the sampling interval in this way, the amount of data that needs to be stored can be significantly reduced while ensuring curve accuracy.
[0021] Furthermore, the controller can extract pulse points within each stage based on the starting position and the determined extraction interval. Specifically, for a given stage, let's assume the starting pulse number is denoted as the starting number, the ending pulse number as the ending number, and the extraction interval as the interval value. The controller can start from the starting number and sequentially select the pulse points corresponding to the starting number, the starting number plus one interval value, the starting number plus two interval values, the starting number plus three interval values, etc., as extraction points, until the ending number of that stage is reached or exceeded. It should be noted that to ensure continuity at the stage boundaries, the starting and ending pulse points of each stage should generally be extracted, even if these points might be skipped when calculating according to the extraction interval.
[0022] After extracting the pulse points, the controller arranges these extracted points in order of pulse number, forming the extraction point sequence for this stage. Each extraction point in this sequence corresponds to a pulse number, which uniquely identifies the position of that point throughout the entire acceleration and deceleration process.
[0023] Subsequently, the controller needs to extract key parameter information for each extraction point. In this embodiment, the main parameters extracted include the pulse number and the corresponding frequency value. The pulse number has already been determined during the extraction process, while the frequency value needs to be obtained from the acceleration / deceleration curves generated in step S101. Specifically, the controller can find the frequency value corresponding to the pulse number in the acceleration / deceleration curve data based on the pulse number of the extraction point. This frequency value represents the target frequency at which the motor should operate at that pulse moment, and the unit is usually Hertz or pulses per second.
[0024] In addition to the frequency value, in some embodiments, the controller can also extract other relevant parameters, such as the timer period value and acceleration value corresponding to the pulse. The timer period value can be calculated by dividing the timer clock frequency by the frequency value, and this value is directly used to configure the hardware timer to generate PWM pulses of the corresponding frequency. The acceleration value can be obtained by numerically differentiating the rate of change of velocity or from pre-calculated data.
[0025] The controller organizes the extracted pulse numbers and frequency values into data pairs, forming a set of extraction points for each stage. This set of extraction points can be stored using an array, linked list, or other data structures. For example, a structure can be defined with two members: a pulse number field and a frequency value field. Each extraction point corresponds to one instance of this structure, and multiple instances constitute the set of extraction points for that stage.
[0026] 103. Based on the start and end positions of each stage and the set of extraction points, construct an index data structure, which is used to record the extraction information of each stage and the parameter information of the extraction points; In this embodiment, constructing the index data structure based on the start and end positions of each stage and the set of extraction points includes: extracting the start pulse number and end pulse number of each stage based on the start and end positions of each stage; calculating the start index position and end index position of each stage in the pulse parameter table based on the number of extraction points in each stage of the extraction point set; constructing a stage index table based on the start pulse number, end pulse number, extraction interval, and start index position in the pulse parameter table of each stage, wherein the stage index table contains index records for each stage; arranging the extraction points of each stage in the extraction point set in pulse number order, extracting the pulse number and frequency value of each extraction point, and constructing the pulse parameter table; and constructing the index data structure based on the stage index table and the pulse parameter table.
[0027] Specifically, after acquiring the start and end position information of each stage, the controller first needs to extract the start pulse number and end pulse number of each stage. It should be noted that the start and end position information has already been determined in step S101, and each stage has a clearly defined start and end boundary. The controller can traverse each stage, sequentially reading the start and end position data of each stage, and recording the pulse number corresponding to the start position as the start pulse number of that stage, and the pulse number corresponding to the end position as the end pulse number of that stage. This numbering information will serve as an important field for subsequently constructing the stage index table.
[0028] The controller needs to calculate the index position of each stage in the pulse parameter table. In this embodiment, the pulse parameter table is a continuously stored data structure used to store the extraction point parameters of all stages. In order to quickly locate the storage position of the extraction point of a certain stage in the parameter table, it is necessary to record the starting index position of each stage in the parameter table. Specifically, the controller can count the number of extraction points of each stage, which can be directly obtained from the extraction point set obtained in step S102. Assume that the number of extraction points in the first stage is N1, the number of extraction points in the second stage is N2, the number of extraction points in the third stage is N3, and so on. Then the starting index position of the first stage in the pulse parameter table is 0, and the ending index position is N1 minus 1; the starting index position of the second stage is N1, and the ending index position is N1 plus N2 minus 1; the starting index position of the third stage is N1 plus N2, and the ending index position is N1 plus N2 plus N3 minus 1; and so on to complete the calculation of the index position of all stages. Through this cumulative calculation method, a mapping relationship between stages and the storage position of the pulse parameter table can be established.
[0029] The controller can begin constructing the stage index table. The stage index table is a structured data table, with each row corresponding to the index information of a stage. In this embodiment, each index record contains multiple fields, specifically including: a start pulse number field, used to record the start pulse number of the stage; an end pulse number field, used to record the end pulse number of the stage; an extraction interval field, used to record the extraction interval value used in the stage, which has been determined in step S102; and a start index position field, used to record the storage location of the first extraction point of the stage in the pulse parameter table. The controller can sequentially fill the various fields of the stage index table according to the stage order, forming a complete stage index table. This table can be stored in memory as an array or a structure array for easy subsequent fast lookup and access.
[0030] While constructing the phase index table, the controller also needs to construct the pulse parameter table. The pulse parameter table stores detailed parameter information for all extraction points and is a core data structure frequently accessed during real-time pulse generation. Specifically, the controller first integrates the extraction point sets of each phase, arranging all extraction points into a unified sequence according to the pulse number order. Since the extraction points of each phase were already organized in numerical order in step S102, it is only necessary to connect the extraction point sets of each phase sequentially. Then, the controller sequentially extracts the pulse number and frequency value of each extraction point from this sequence and stores this data in the pulse parameter table as records. Each record contains a pulse number field and a frequency value field, and multiple records are arranged sequentially according to the extraction point order to form a complete pulse parameter table. This table can be stored using a contiguous array to ensure access efficiency.
[0031] The controller combines the constructed stage index table and pulse parameter table to form a complete index data structure. This index data structure has a two-layer feature: the upper-layer stage index table provides the ability to quickly locate stages, and the lower-layer pulse parameter table stores detailed extraction point parameters. The two are linked through the starting index position field, allowing the controller to quickly locate the corresponding stage based on the current pulse number during runtime, and then quickly find the adjacent extraction point parameters based on the stage information.
[0032] 104. Based on the current pulse count, find two adjacent sampling points through the index data structure, perform interpolation calculation on the frequency values of the two sampling points to obtain the output frequency of the current pulse, and generate a PWM pulse signal based on the output frequency to drive the motor.
[0033] In this embodiment, the step of finding two adjacent descent points based on the current pulse count using the index data structure, interpolating the frequency values of the two descent points to obtain the output frequency of the current pulse, and generating a PWM pulse signal to drive the motor based on the output frequency includes: determining the stage to which the current pulse count belongs based on the current pulse count and the start pulse number and end pulse number of each stage in the stage index table, obtaining the descent interval of the corresponding stage and the start index position in the pulse parameter table; and calculating the frequency relative to the current pulse count based on the current pulse count, the start pulse number of the corresponding stage, the descent interval, and the start index position. The index positions of the preceding and following sampling points in the pulse parameter table are determined. Based on the index positions of the preceding and following sampling points, the pulse number and frequency value of the preceding sampling point, as well as the pulse number and frequency value of the following sampling point, are obtained from the pulse parameter table. Based on the current pulse count, the pulse number and frequency value of the preceding and following sampling points, the output frequency of the current pulse is calculated using a linear interpolation formula. Based on the output frequency, the timer period value is calculated, and a PWM timer is configured based on the timer period value to generate a PWM pulse signal to drive the motor.
[0034] Specifically, during the actual operation of the motor, the controller generates PWM pulse signals through a hardware timer. Each time a pulse is generated, the timer interrupt service routine is triggered, and the current pulse count automatically increments. It should be noted that the current pulse count is an accumulator counter that records the total number of pulses sent from the start of acceleration / deceleration to the current moment. In the interrupt service routine, the controller first reads the current pulse count value and then determines the stage to which the current pulse belongs based on that count value.
[0035] When determining the stage, the controller can access the stage index table constructed in step S103 and read the index records of each stage sequentially. For each index record, the controller compares the current pulse count value with the start pulse number and end pulse number of that stage. When the current pulse count value is found to be greater than or equal to the start pulse number of a stage and less than or equal to the end pulse number of that stage, it can be determined that the current pulse belongs to that stage. Then, the controller extracts the extraction interval value and the start index position of that stage in the pulse parameter table from the index record of that stage. These two parameters will be used for subsequent extraction point location calculations.
[0036] Subsequently, the controller needs to calculate the specific storage locations of the preceding and following sampling points adjacent to the current pulse in the pulse parameter table. Specifically, the controller first calculates the offset of the current pulse relative to the start position of its stage, which is equal to the current pulse count value minus the start pulse number of the stage. Then, the controller divides this offset by the sampling interval value and takes the integer part to obtain a position index difference. This position index difference indicates how many sampling points precede the current pulse. Furthermore, the controller adds this position index difference to the start index position of the stage in the pulse parameter table to obtain the index position of the preceding sampling point in the pulse parameter table. The index position of the following sampling point is the index position of the preceding sampling point plus 1. Through this calculation method, the controller can complete the location of the sampling points in constant time, avoiding a traversal search throughout the entire parameter table.
[0037] After obtaining the index positions of the two sampling points, the controller can directly access the pulse parameter table and read the corresponding data records according to the index positions. It extracts the pulse number and frequency value from the record of the previous sampling point, and extracts the pulse number and frequency value from the record of the next sampling point. At this point, the controller has obtained all the data required for interpolation calculations.
[0038] Furthermore, the controller employs a linear interpolation algorithm to calculate the output frequency of the current pulse. Linear interpolation is a simple and efficient numerical approximation method, its basic idea being the assumption that the functional relationship between two known points is linear. Specifically, the controller first calculates the pulse interval between the two decimation points, which is equal to the pulse number of the later decimation point minus the pulse number of the earlier decimation point. Then, the controller calculates the pulse offset of the current pulse relative to the earlier decimation point, which is equal to the current pulse count value minus the pulse number of the earlier decimation point. Next, the controller calculates the interpolation scaling factor, which is equal to the pulse offset divided by the pulse interval. Simultaneously, the controller calculates the frequency difference between the two decimation points, which is equal to the frequency value of the later decimation point minus the frequency value of the earlier decimation point. Finally, the controller adds the frequency value of the earlier decimation point to the product of the interpolation scaling factor and the frequency difference to obtain the output frequency of the current pulse. The entire interpolation calculation process involves only addition, subtraction, and multiplication operations, and its computational complexity is far lower than the exponential and division operations required for real-time calculation of the sigmoid function.
[0039] After obtaining the current pulse output frequency, the controller needs to convert this frequency into the period value of the hardware timer. The timer period value is calculated by dividing the timer's input clock frequency by the target output frequency. For example, if the timer's input clock frequency is 84 MHz and the target output frequency is 20 kHz, then the timer period value is 4200. The controller writes the calculated period value into the timer's auto-reload register, and the timer hardware automatically generates a PWM pulse signal of the corresponding frequency based on this period value. This PWM pulse signal is sent to the motor driver through the controller's output pin, and the driver controls the motor speed according to the pulse signal, thereby completing the entire acceleration and deceleration control process.
[0040] Furthermore, the step of calculating the output frequency of the current pulse using a linear interpolation formula based on the current pulse count, the pulse number and frequency value of the previous sampling point, and the pulse number and frequency value of the next sampling point includes: calculating the pulse interval between the two sampling points based on the pulse number of the previous sampling point and the pulse number of the next sampling point; calculating the pulse offset of the current pulse count relative to the previous sampling point based on the current pulse count and the pulse number of the previous sampling point; calculating the interpolation ratio coefficient based on the pulse offset and the pulse interval, and calculating the frequency difference between the two sampling points based on the frequency value of the previous sampling point and the frequency value of the next sampling point; and calculating the output frequency of the current pulse using a linear interpolation formula based on the frequency value of the previous sampling point, the frequency difference, and the interpolation ratio coefficient.
[0041] Specifically, after obtaining complete information about the previous and next sampling points, the controller first needs to calculate the pulse interval between the two sampling points. This pulse interval represents the distance between two adjacent sampling points in the pulse sequence. The controller obtains the pulse interval value by subtracting the pulse number of the previous sampling point from the pulse number of the next sampling point. It should be noted that this pulse interval value is usually equal to or close to the sampling interval set for that stage. However, at stage boundaries or when boundary adjustments are involved, the actual pulse interval may differ slightly from the sampling interval. Therefore, it needs to be calculated accurately based on the actual pulse numbers of the sampling points.
[0042] The controller needs to calculate the pulse offset of the current pulse count relative to the previous sampling point. This offset reflects the relative position of the current pulse between the two sampling points. The controller obtains the pulse offset by subtracting the pulse number of the previous sampling point from the current pulse count value. The value of this offset ranges from 0 to an integer between 0 and the pulse interval. When the offset is 0, it means that the current pulse is exactly at the previous sampling point; when the offset is equal to the pulse interval, it means that the current pulse is at the next sampling point; when the offset is between the two, it means that the current pulse is at some position between the two sampling points.
[0043] The controller needs to calculate the interpolation scaling factor. The interpolation scaling factor is a core parameter of the linear interpolation algorithm, representing the relative position ratio of the current pulse between two decimation points. The controller obtains the interpolation scaling factor by dividing the pulse offset by the pulse interval. This factor ranges from 0 to 1, and can be either a floating-point or fixed-point number. When the factor is 0, it indicates that the current pulse is located at the previous decimation point, and the interpolation result should be equal to the frequency value of the previous decimation point. When the factor is 1, it indicates that the current pulse is located at the next decimation point, and the interpolation result should be equal to the frequency value of the next decimation point. When the factor is between 0 and 1, the interpolation result will transition proportionally between the frequency values of the two decimation points. It is important to note that in embedded environments, to improve computational efficiency, fixed-point arithmetic can be used instead of floating-point arithmetic. For example, the interpolation scaling factor can be magnified by 1024 times and rounded to obtain an integer scaling factor. After subsequent multiplication operations, it can be right-shifted by 10 bits to restore the original precision, thus avoiding the overhead of floating-point division and multiplication.
[0044] Simultaneously, the controller also needs to calculate the frequency difference between the two sampling points. This frequency difference represents the change in frequency between the two sampling points. The controller obtains the frequency difference by subtracting the frequency value of the previous sampling point from the frequency value of the later sampling point. This difference can be positive, negative, or zero. When the difference is positive, it indicates that the frequency is increasing, i.e., in the acceleration phase; when the difference is negative, it indicates that the frequency is decreasing, i.e., in the deceleration phase; when the difference is zero or close to zero, it indicates that the frequency remains basically constant, i.e., in the uniform speed phase.
[0045] The controller calculates the output frequency of the current pulse using a linear interpolation formula based on the interpolation ratio and frequency difference obtained from the previous calculations. The basic form of the linear interpolation formula is: the output frequency equals the frequency value of the previous decimation point plus the product of the interpolation ratio and the frequency difference. Physically, this formula means that based on the frequency value of the previous decimation point, a corresponding proportion of the frequency change is added according to the relative position of the current pulse between the two decimation points to obtain the expected frequency value of the current pulse. When the controller performs this calculation, it first multiplies the interpolation ratio by the frequency difference to obtain the frequency increment to be added, and then adds this increment to the frequency value of the previous decimation point to obtain the final output frequency.
[0046] In this embodiment, an acceleration / deceleration curve is generated based on the motor's starting frequency, target frequency, and acceleration / deceleration time. The curve is then divided into multiple stages based on the rate of change of speed, obtaining the start and end positions of each stage. Pulse parameters within each stage are extracted based on the rate of change of speed, resulting in a set of extraction points for each stage. An index data structure is constructed based on the start and end positions of each stage and the set of extraction points. The current pulse count is used to find two adjacent extraction points through the index data structure, and the frequency values of the two extraction points are interpolated to obtain the output frequency of the current pulse. A PWM pulse signal is then generated based on the output frequency to drive the motor. This invention, through staged adaptive extraction and interpolation calculation, significantly reduces storage space usage and real-time computational complexity while ensuring smooth acceleration / deceleration.
[0047] Please see Figure 2 Another embodiment of the motor acceleration / deceleration control method in this application includes: 201. Based on the starting frequency, target frequency, and acceleration / deceleration time, construct an S-shaped function mapping relationship, generate an acceleration / deceleration curve from the starting frequency to the target frequency through the S-shaped function mapping relationship, and obtain the frequency value of each pulse point on the acceleration / deceleration curve; In this embodiment, the step of constructing an S-shaped function mapping relationship based on the starting frequency, target frequency, and acceleration / deceleration time, and generating an acceleration / deceleration curve from the starting frequency to the target frequency through the S-shaped function mapping relationship to obtain the frequency value of each pulse point on the acceleration / deceleration curve includes: calculating the frequency change range based on the starting frequency and target frequency, and mapping the frequency change range to the value range of the S-shaped function to obtain the value range mapping parameter; calculating the total number of pulses in the acceleration / deceleration process based on the acceleration / deceleration time and a preset sampling frequency, and mapping the total number of pulses to the domain of the independent variable of the S-shaped function to obtain the domain mapping parameter; constructing an S-shaped function mapping relationship from pulse number to frequency value based on the value range mapping parameter and the domain mapping parameter; generating a pulse number sequence from the 1st pulse to the Nth pulse based on the total number of pulses, where N is the total number of pulses; and substituting each pulse number in the pulse number sequence into the S-shaped function mapping relationship to calculate the frequency value corresponding to each pulse number to obtain the frequency value of each pulse point on the acceleration / deceleration curve.
[0048] Specifically, the controller first needs to calculate the frequency variation range. This range represents the total change in frequency from the starting frequency to the target frequency. The controller obtains the frequency variation range by subtracting the starting frequency from the target frequency. For example, if the starting frequency is 100 Hz and the target frequency is 20000 Hz, the frequency variation range is 19900 Hz. It should be noted that the S-shaped function typically uses the Sigmoid function or its variants, whose standard output value range is between 0 and 1. To map the actual frequency variation range to this standard value range, the controller needs to determine the range mapping parameters. Specifically, the range mapping parameters include two parameters: a scaling factor and an offset. The scaling factor equals the frequency variation range and is used to scale the normalized value from 0 to 1 to the actual frequency variation; the offset equals the starting frequency and is used to shift the normalized frequency value to the actual frequency range. These two parameters establish the correspondence between the standard S-shaped function output value and the actual frequency value.
[0049] Next, the controller needs to calculate the total number of pulses during acceleration and deceleration. In this embodiment, the total number of pulses can be calculated using the acceleration / deceleration time and a preset sampling frequency. The preset sampling frequency can be the average frequency of the motor during acceleration and deceleration or a reference frequency preset based on experience. For example, if the acceleration / deceleration time is 0.5 seconds and the average frequency is 10050 Hz, the total number of pulses is approximately 5025. After obtaining the total number of pulses, the controller needs to map this number to the domain of the independent variable of the S-shaped function. Commonly used S-shaped functions, such as the Sigmoid function, typically select the domain of the independent variable between -7 and +7, within which the function value smoothly transitions from near 0 to near 1. The controller needs to determine the domain mapping parameters, including the initial value of the independent variable, the final value of the independent variable, and the step size of the independent variable. The initial value of the independent variable is usually set to -7, the final value of the independent variable is set to +7, and the step size of the independent variable is equal to the total length of the domain divided by the number of pulses minus 1. For example, if the total number of pulses is 5025, then the step size of the independent variable is approximately 14 divided by 5024, which is approximately equal to 0.00279.
[0050] After obtaining the range mapping parameters and the domain mapping parameters, the controller constructs a S-shaped function mapping relationship from pulse number to frequency value based on these parameters. This mapping relationship maps discrete pulse numbers to corresponding frequency values on a continuous S-shaped curve. Specifically, for any pulse number i, the controller first calculates the independent variable x of the S-shaped function corresponding to that pulse based on the domain mapping parameters. This independent variable x is equal to the initial value of the independent variable plus the pulse number i minus 1, multiplied by the step size of the independent variable. The controller substitutes the independent variable x into the Sigmoid function to calculate the normalized function value. The Sigmoid function is calculated as 1 divided by 1 plus the negative x power of the natural constant e. In an embedded environment, the calculation of the exponential function can be approximated using methods such as lookup tables or Taylor series expansion. The controller converts the normalized function value into the actual frequency value based on the range mapping parameters. The actual frequency value is equal to the initial frequency plus the product of the normalized function value and the frequency variation range. Through the above mapping process, the controller establishes a complete mapping relationship from pulse number to frequency value.
[0051] After establishing the mapping relationship, the controller needs to generate a pulse number sequence. This sequence contains all pulse numbers from the first pulse to the Nth pulse, where N is the total number of pulses calculated above. The controller can use a loop to generate the complete sequence numbered 1, 2, 3, up to N. This sequence provides input data for subsequent batch frequency value calculations.
[0052] The controller sequentially substitutes each pulse number in the pulse number sequence into the S-shaped function mapping relationship to calculate the frequency value corresponding to each pulse number. For each pulse number in the sequence, the controller completes three steps in sequence according to the established mapping relationship: independent variable calculation, Sigmoid function evaluation, and frequency value conversion, to obtain the frequency value of that pulse point. The controller stores all the calculated frequency values in pulse number order to form a complete acceleration / deceleration curve frequency value sequence. This sequence describes the smooth transition process from the starting frequency to the target frequency. The curve shape exhibits a typical S-shaped characteristic, with slower speed changes at the beginning and end stages and faster speed changes in the middle stage, thus ensuring the smoothness of the motor acceleration / deceleration process. In some embodiments, to improve computational efficiency, the controller can use parallel computing or segmented computing to distribute the frequency value calculation task across multiple processing cycles, avoiding the impact of excessively long single calculation time on the execution of other real-time tasks.
[0053] 202. Perform a difference operation on the frequency values of adjacent pulse points on the acceleration / deceleration curve to obtain the rate of change of velocity at each pulse point; In this embodiment, after obtaining the frequency values of each pulse point on the acceleration / deceleration curve, the controller needs to perform a differential operation on the frequency values of adjacent pulse points to calculate the rate of change of speed at each pulse point. It should be noted that the rate of change of speed reflects how quickly the motor speed changes over time and is an important basis for subsequent curve segmentation. Specifically, the controller uses a numerical differentiation method to calculate the rate of change of speed. For pulse point i, the controller reads the frequency value of that point and the frequency value of the next adjacent pulse point, i.e., the pulse point numbered i plus 1. The controller subtracts the frequency value of the current pulse point from the frequency value of the next pulse point to obtain the frequency difference between the two adjacent points. Dividing this frequency difference by the time interval between the two pulse points yields the rate of change of speed at that pulse point. In a pulse sequence, the time interval between adjacent pulse points can be approximated by dividing 1 by the frequency value of the current pulse point. In some embodiments, to simplify the calculation, the controller can also directly use the frequency difference as a representation of the rate of change of speed, omitting the step of dividing by the time interval. The controller performs differential operations on all pulse points on the acceleration / deceleration curve sequentially to obtain an array of rate of change of speed for each pulse point. It should be noted that for the last pulse point, since there is no next adjacent point, the controller can set its velocity change rate to 0 or use the velocity change rate of the previous pulse point.
[0054] 203. Based on a preset velocity change rate threshold, the velocity change rate of each pulse point is divided into intervals, and consecutive pulse points with velocity change rates within the same interval are grouped into one stage to obtain multiple stages; In this embodiment, the controller divides the velocity change rate of each pulse point into intervals based on a preset velocity change rate threshold. It should be noted that the velocity change rate threshold is used to divide continuous velocity change rate values into several discrete intervals, each interval corresponding to a different rate of change. Specifically, the controller can preset multiple thresholds, such as a first threshold, a second threshold, and a third threshold, arranged in ascending order. The controller divides the velocity change rate into multiple intervals based on these thresholds, such as intervals less than the first threshold, intervals greater than or equal to the first threshold and less than the second threshold, intervals greater than or equal to the second threshold and less than the third threshold, and intervals greater than or equal to the third threshold. The controller iterates through the velocity change rates of each pulse point, determining the interval to which each velocity change rate value belongs. For consecutive pulse points with velocity change rates within the same interval, the controller groups them into one stage. Specifically, starting from the first pulse point, the controller determines the interval to which its velocity change rate belongs and records the interval identifier. The controller continues to determine the rate of change of velocity for the next pulse point. If the rate of change of velocity is still within the same range, then the pulse point belongs to the current stage; if the rate of change of velocity is within a different range, then the current stage ends and a new stage begins. The controller processes all pulse points in this manner, dividing the entire acceleration / deceleration curve into multiple stages. Pulse points within each stage have similar velocity change characteristics, while the velocity change characteristics differ significantly between different stages.
[0055] 204. Extract the pulse number of the first pulse point in each stage as the starting position of the corresponding stage, and extract the pulse number of the last pulse point in each stage as the ending position of the corresponding stage to obtain the start and end positions of each stage. In this embodiment, after completing the stage division, the controller needs to extract the start and end position information of each stage. This start and end position information is used to clearly define the boundary range of each stage, facilitating subsequent data organization and access. Specifically, for each stage obtained in step S203, the controller needs to determine the first and last pulse points contained in that stage. The controller extracts the pulse number of the first pulse point in the stage and records this number as the start position of the stage. Similarly, the controller extracts the pulse number of the last pulse point in the stage and records this number as the end position of the stage. It should be noted that the start and end positions are represented by pulse numbers, which are consecutive integers starting from 1, uniquely identifying the position of the pulse in the entire acceleration / deceleration sequence. The controller extracts the start and end positions for all stages sequentially, forming the start and end position data for each stage. This data can be stored in the form of an array or a list, with each stage corresponding to a pair of start and end position values. For example, the first stage starts at position 1 and ends at position 2000, indicating that this stage contains all pulse points numbered from 1 to 2000; the second stage starts at position 2001 and ends at position 4000, indicating that this stage contains all pulse points numbered from 2001 to 4000.
[0056] 205. Based on the rate of change of velocity in each stage, extract the pulse parameters in each stage to obtain the set of extraction points for each stage. 206. Based on the start and end positions of each stage and the set of extraction points, construct an index data structure, which is used to record the extraction information of each stage and the parameter information of the extraction points; 207. Based on the current pulse count, find two adjacent sampling points through the index data structure, perform interpolation calculation on the frequency values of the two sampling points to obtain the output frequency of the current pulse, and generate a PWM pulse signal based on the output frequency to drive the motor.
[0057] In this embodiment, steps 205-207 are similar to steps 102-104 in the first embodiment, and will not be described again here.
[0058] In this embodiment, an acceleration / deceleration curve is generated based on the motor's starting frequency, target frequency, and acceleration / deceleration time. The curve is then divided into multiple stages based on the rate of change of speed, obtaining the start and end positions of each stage. Pulse parameters within each stage are extracted based on the rate of change of speed, resulting in a set of extraction points for each stage. An index data structure is constructed based on the start and end positions of each stage and the set of extraction points. The current pulse count is used to find two adjacent extraction points through the index data structure, and the frequency values of the two extraction points are interpolated to obtain the output frequency of the current pulse. A PWM pulse signal is then generated based on the output frequency to drive the motor. This invention, through staged adaptive extraction and interpolation calculation, significantly reduces storage space usage and real-time computational complexity while ensuring smooth acceleration / deceleration.
[0059] The above describes the motor acceleration / deceleration control method in the embodiments of the present invention. The following describes the motor acceleration / deceleration control device in the embodiments of the present invention. Please refer to [link to relevant documentation] for details on this motor acceleration / deceleration control device. Figure 3 One embodiment of the motor acceleration / deceleration control device in this invention includes: The curve segmentation module 301 is used to generate an acceleration / deceleration curve based on the motor's starting frequency, target frequency, and acceleration / deceleration time, and to divide the acceleration / deceleration curve into multiple stages based on the rate of change of the acceleration / deceleration curve, thereby obtaining the start and end positions of each stage. The parameter extraction module 302 is used to extract the pulse parameters in each stage according to the rate of change of velocity in each stage, so as to obtain the set of extraction points in each stage. The index building module 303 is used to build an index data structure based on the start and end positions of each stage and the set of extraction points. The index data structure is used to record the extraction information of each stage and the parameter information of the extraction points. The pulse generation module 304 is used to find two adjacent sampling points through the index data structure according to the current pulse count, perform interpolation calculation on the frequency values of the two sampling points to obtain the output frequency of the current pulse, and generate a PWM pulse signal to drive the motor according to the output frequency.
[0060] In this embodiment of the invention, the motor acceleration / deceleration control device operates the aforementioned motor acceleration / deceleration control method. The device generates an acceleration / deceleration curve based on the motor's starting frequency, target frequency, and acceleration / deceleration time. It then divides the curve into multiple stages based on the rate of change of speed, obtaining the start and end positions of each stage. Based on the rate of change of speed in each stage, it extracts pulse parameters within that stage, obtaining a set of extraction points for each stage. An index data structure is constructed based on the start and end positions of each stage and the set of extraction points. Using the current pulse count, it searches for two adjacent extraction points through the index data structure, interpolates the frequency values of the two extraction points to obtain the output frequency of the current pulse, and generates a PWM pulse signal based on the output frequency to drive the motor. This invention, through staged adaptive extraction and interpolation calculation, significantly reduces storage space usage and real-time computational complexity while ensuring smooth acceleration / deceleration.
[0061] above Figure 3 The motor acceleration / deceleration control device in this embodiment of the invention will be described in detail from the perspective of unitized functional entities. The motor acceleration / deceleration control device in this embodiment of the invention will be described in detail from the perspective of hardware processing.
[0062] Figure 4 This is a schematic diagram of a motor acceleration / deceleration control device 300 provided in an embodiment of the present invention. The motor acceleration / deceleration control device 300 can vary significantly due to different configurations or performance characteristics. It may include one or more central processing units (CPUs) 410 (e.g., one or more processors) and a memory 420, and one or more storage media 430 (e.g., one or more mass storage devices) storing application programs 333 or data 432. The memory 420 and storage media 430 can be temporary or persistent storage. The program stored in the storage media 430 may include one or more units (not shown in the diagram), each unit may include a series of instruction operations on the motor acceleration / deceleration control device 400. Furthermore, the processor 410 may be configured to communicate with the storage media 430 and execute the series of instruction operations in the storage media 430 on the motor acceleration / deceleration control device 400 to implement the steps of the above-described motor acceleration / deceleration control method.
[0063] The motor acceleration / deceleration control device 400 may also include one or more power supplies 440, one or more wired or wireless network interfaces 450, one or more input / output interfaces 460, and / or one or more operating systems 431, such as Windows Server, Mac OS X, Unix, Linux, FreeBSD, etc. Those skilled in the art will understand that... Figure 4The illustrated motor acceleration / deceleration control device structure does not constitute a limitation on the motor acceleration / deceleration control device provided by the present invention. It may include more or fewer components than illustrated, or combine certain components, or have different component arrangements.
[0064] The present invention also provides a computer-readable storage medium, which can be a non-volatile computer-readable storage medium or a volatile computer-readable storage medium, wherein the computer-readable storage medium stores instructions that, when the instructions are executed on a computer, cause the computer to perform the steps of the motor acceleration / deceleration control method.
[0065] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the system, device, or unit described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0066] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0067] The above-described embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for controlling the acceleration and deceleration of a motor, characterized in that, The motor acceleration / deceleration control method includes: Based on the motor's starting frequency, target frequency, and acceleration / deceleration time, an acceleration / deceleration curve is generated. The acceleration / deceleration curve is then divided into multiple stages based on the rate of change of speed of the acceleration / deceleration curve, and the start and end positions of each stage are obtained. Based on the rate of change of velocity in each stage, the pulse parameters in each stage are extracted to obtain the set of extraction points for each stage. Based on the start and end positions of each stage and the set of extraction points, an index data structure is constructed. The index data structure is used to record the extraction information of each stage and the parameter information of the extraction points. Based on the current pulse count, two adjacent sampling points are found through the index data structure, and the frequency values of the two sampling points are interpolated to obtain the output frequency of the current pulse. A PWM pulse signal is then generated based on the output frequency to drive the motor.
2. The motor acceleration / deceleration control method according to claim 1, characterized in that, The process involves generating an acceleration / deceleration curve based on the motor's starting frequency, target frequency, and acceleration / deceleration time. The acceleration / deceleration curve is then divided into multiple stages based on its rate of change, with the start and end positions of each stage determined as follows: Based on the starting frequency, target frequency, and acceleration / deceleration time, an S-shaped function mapping relationship is constructed. An acceleration / deceleration curve from the starting frequency to the target frequency is generated through the S-shaped function mapping relationship, and the frequency value of each pulse point on the acceleration / deceleration curve is obtained. The frequency values of adjacent pulse points on the acceleration / deceleration curve are differentially calculated to obtain the rate of change of velocity at each pulse point. Based on a preset velocity change rate threshold, the velocity change rate of each pulse point is divided into intervals, and consecutive pulse points with velocity change rates within the same interval are grouped into one stage, resulting in multiple stages. Extract the pulse number of the first pulse point in each stage as the starting position of the corresponding stage, and extract the pulse number of the last pulse point in each stage as the ending position of the corresponding stage, thus obtaining the start and end positions of each stage.
3. The motor acceleration / deceleration control method according to claim 2, characterized in that, The step involves constructing an S-shaped function mapping relationship based on the initial frequency, target frequency, and acceleration / deceleration time. An acceleration / deceleration curve from the initial frequency to the target frequency is generated through this S-shaped function mapping relationship. The frequency values of each pulse point on the acceleration / deceleration curve are obtained as follows: Based on the starting frequency and the target frequency, the frequency variation range is calculated, and the frequency variation range is mapped to the range of the S-shaped function to obtain the range mapping parameter. Based on the acceleration / deceleration time and the preset sampling frequency, the total number of pulses during the acceleration / deceleration process is calculated, and the total number of pulses is mapped to the domain interval of the independent variable of the S-shaped function to obtain the domain mapping parameter; Based on the range mapping parameters and the domain mapping parameters, an S-shaped function mapping relationship from pulse number to frequency value is constructed. Based on the total number of pulses, a pulse number sequence from the 1st pulse to the Nth pulse is generated, where N is the total number of pulses; Substitute each pulse number in the pulse number sequence into the S-shaped function mapping relationship in turn, calculate the frequency value corresponding to each pulse number, and obtain the frequency value of each pulse point on the acceleration / deceleration curve.
4. The motor acceleration / deceleration control method according to claim 1, characterized in that, The step of extracting pulse parameters within each stage based on the rate of change of velocity at each stage, resulting in a set of extraction points for each stage, includes: The sampling interval for each stage is determined based on the magnitude of the rate of change of velocity in each stage. The sampling interval for stages with a large rate of change of velocity is small, and the sampling interval for stages with a small rate of change of velocity is large. Based on the starting position of each stage and the extraction interval, pulse points are selected sequentially as extraction points within each stage according to the extraction interval to obtain the extraction point sequence of each stage. Extract the pulse number and corresponding frequency value of each extraction point in the extraction point sequence to obtain the extraction point set for each stage.
5. The motor acceleration / deceleration control method according to claim 1, characterized in that, The step of constructing the index data structure based on the start and end positions of each stage and the set of extraction points includes: Based on the start and end positions of each stage, extract the start pulse number and end pulse number of each stage; Based on the number of extraction points in each stage of the extraction point set, calculate the start index position and end index position of each stage in the pulse parameter table; A stage index table is constructed based on the starting pulse number, ending pulse number, extraction interval, and starting index position in the pulse parameter table for each stage. The stage index table contains index records for each stage. Arrange the extraction points of each stage in the extraction point set in order of pulse number, extract the pulse number and frequency value of each extraction point, and construct a pulse parameter table; The index data structure is constructed based on the stage index table and the pulse parameter table.
6. The motor acceleration / deceleration control method according to claim 5, characterized in that, The step of finding two adjacent sampling points based on the current pulse count using the index data structure, interpolating the frequency values of the two sampling points to obtain the output frequency of the current pulse, and generating a PWM pulse signal based on the output frequency to drive the motor includes: Based on the current pulse count and the start pulse number and end pulse number of each stage in the stage index table, the stage to which the current pulse count belongs is determined, and the extraction interval of the corresponding stage and the starting index position in the pulse parameter table are obtained. Based on the current pulse count, the starting pulse number of the corresponding stage, the extraction interval, and the starting index position, calculate the index positions of the previous and next extraction points adjacent to the current pulse count in the pulse parameter table. Based on the index positions of the previous and next extraction points, the pulse number and frequency value of the previous extraction point, as well as the pulse number and frequency value of the next extraction point, are obtained from the pulse parameter table. Based on the current pulse count, the pulse number and frequency value of the previous sampling point, and the pulse number and frequency value of the next sampling point, the output frequency of the current pulse is calculated using a linear interpolation formula. The timer period value is calculated based on the output frequency, and the PWM timer is configured based on the timer period value to generate a PWM pulse signal to drive the motor.
7. The motor acceleration / deceleration control method according to claim 6, characterized in that, The step of calculating the output frequency of the current pulse using a linear interpolation formula based on the current pulse count, the pulse number and frequency value of the previous sampling point, and the pulse number and frequency value of the next sampling point includes: Calculate the pulse interval between the two extraction points based on the pulse number of the previous extraction point and the pulse number of the next extraction point; Based on the current pulse count and the pulse number of the previous extraction point, calculate the pulse offset of the current pulse count relative to the previous extraction point; Based on the pulse offset and the pulse interval, the interpolation ratio coefficient is calculated, and based on the frequency value of the previous sampling point and the frequency value of the next sampling point, the frequency difference between the two sampling points is calculated. The output frequency of the current pulse is calculated using a linear interpolation formula based on the frequency value of the previous sampling point, the frequency difference, and the interpolation ratio coefficient.
8. A motor acceleration / deceleration control device, characterized in that, The motor acceleration / deceleration control device includes: The curve segmentation module is used to generate an acceleration / deceleration curve based on the motor's starting frequency, target frequency, and acceleration / deceleration time, and to divide the acceleration / deceleration curve into multiple stages based on the rate of change of the acceleration / deceleration curve, thereby obtaining the start and end positions of each stage. The parameter extraction module is used to extract the pulse parameters in each stage based on the rate of change of velocity in each stage, and obtain the extraction point set for each stage. An index building module is used to build an index data structure based on the start and end positions of each stage and the set of extraction points. The index data structure is used to record the extraction information of each stage and the parameter information of the extraction points. The pulse generation module is used to find two adjacent sampling points through the index data structure based on the current pulse count, perform interpolation calculation on the frequency values of the two sampling points to obtain the output frequency of the current pulse, and generate a PWM pulse signal based on the output frequency to drive the motor.
9. A motor acceleration / deceleration control device, characterized in that, The motor acceleration / deceleration control device includes: a memory and at least one processor, wherein the memory stores instructions; The at least one processor invokes the instructions in the memory to cause the motor acceleration / deceleration control device to perform the steps of the motor acceleration / deceleration control method as described in any one of claims 1-7.
10. A computer-readable storage medium storing instructions thereon, characterized in that, When the instruction is executed by the processor, it implements the steps of the motor acceleration / deceleration control method as described in any one of claims 1-7.