A method, apparatus, device and medium for generating a sinusoidal signal

By storing the sine function value within 1/4 period in the sine signal generator and selecting uniform sampling or Taylor series interpolation according to the frequency relationship, the problems of storage space and accuracy and speed are solved, and the efficient generation of sine signals of specific frequencies is achieved.

CN112803896BActive Publication Date: 2025-10-21PEITIAN ROBOTICS CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202110019484.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-01-07
Publication Date
2025-10-21
Estimated Expiration
2041-01-07

AI Technical Summary

Technical Problem

When generating a sinusoidal signal of a specific frequency, an existing sinusoidal signal generator has the problems of large storage space occupation, low output accuracy and slow speed.

Method used

The sine signal generator pre-stores the sine function value within 1/4 sampling period, and generates the target sine signal by using uniform sampling or Taylor series interpolation method by judging the relationship between the target frequency and the preset frequency.

Benefits of technology

Significantly reduce storage space usage, improve output accuracy and speed, and reduce calculation errors.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112803896B_ABST
    Figure CN112803896B_ABST
Patent Text Reader

Abstract

The application discloses a method, device, equipment and medium for generating a sinusoidal signal, which comprises the following steps: when a trigger instruction for a servo driver to obtain a target sinusoidal signal is received, a preset sinusoidal signal stored in advance is called from the sinusoidal signal generator itself; the preset sinusoidal signal only records the sinusoidal function value corresponding to each sampling point in 1 / 4 sampling period; it is judged whether the target sampling frequency of the target sinusoidal signal is greater than or equal to the preset sampling frequency of the preset sinusoidal signal; if yes, the sampling points of the preset sinusoidal signal are uniformly sampled to obtain the target sinusoidal signal; if not, the Taylor series is used to uniformly interpolate between the adjacent two sampling points of the preset sinusoidal signal to obtain the target sinusoidal signal, and the target sinusoidal signal is sent to the servo driver. By the method, the storage space of the sinusoidal signal generator can be reduced, and the precision and speed of the output sinusoidal signal can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of digital signal technology, and in particular to a method, device, equipment and medium for generating a sinusoidal signal. Background Art

[0002] Currently, servo drives typically use sinusoidal signals to trigger servo motor movement. Since servo drives cannot generate sinusoidal signals themselves, they typically obtain these signals from a sinusoidal signal generator. In existing technologies, if a sinusoidal signal generator is to output a sinusoidal signal of a specific frequency, the corresponding calculation program must be stored in the generator. Commonly used sinusoidal signal generation methods include table lookup, Taylor series expansion, and iterative methods.

[0003] Among them, the table lookup method is to store the required sine function values ​​in the signal generator in advance, and then use the table lookup method to find the sine function value of the sine signal at each sampling point of the specific sampling frequency to output the corresponding sine signal. Although this method has the advantages of fast output speed and high accuracy of the sine signal, it requires a large amount of storage space in the sine signal generator. The Taylor series expansion method is a method of approximating the true sine signal by expanding the Taylor series polynomial to output a sine signal of a specific frequency. However, this method requires a long calculation time and cannot meet the requirements of real-time output signal. The iterative method uses a recursive formula to calculate the sine function value of the sine signal at each sampling point of the specific sampling frequency. Since this method will generate a large amount of error accumulation during the recursive process, the iterative method cannot meet the requirements of the sine signal for output accuracy.

[0004] Therefore, it can be seen that how to provide a method for generating a sinusoidal signal so as to reduce the storage space occupied by the sinusoidal signal generator while also improving the accuracy and speed of the sinusoidal signal output by the sinusoidal signal generator is a technical problem that needs to be solved urgently by those skilled in the art. Summary of the Invention

[0005] In view of this, the present invention aims to provide a method, apparatus, device, and medium for generating a sinusoidal signal, thereby reducing the storage space occupied by the sinusoidal signal generator while also improving the accuracy and speed of the sinusoidal signal output by the sinusoidal signal generator. The specific solution is as follows:

[0006] A method for generating a sinusoidal signal, applied to a sinusoidal signal generator, comprising:

[0007] When a trigger instruction for the servo driver to obtain a target sinusoidal signal is received, a pre-stored preset sinusoidal signal is retrieved from the sinusoidal signal generator itself; wherein the preset sinusoidal signal only records the sinusoidal function value corresponding to each sampling point of the preset sinusoidal signal within a 1 / 4 sampling period;

[0008] Determining whether a target sampling frequency of the target sinusoidal signal is greater than or equal to a preset sampling frequency of the preset sinusoidal signal;

[0009] If the target sampling frequency is greater than or equal to the preset sampling frequency, uniformly sampling the sampling points of the preset sinusoidal signal to obtain the target sinusoidal signal, and sending the target sinusoidal signal to the servo driver;

[0010] If the target sampling frequency is less than the preset sampling frequency, Taylor series is used to perform uniform interpolation between two adjacent sampling points of the preset sinusoidal signal to obtain the target sinusoidal signal, and the target sinusoidal signal is sent to the servo driver.

[0011] Preferably, the process of uniformly sampling the sampling points of the preset sinusoidal signal to obtain the target sinusoidal signal includes:

[0012] Obtaining a first target ratio between the target sampling frequency and the preset sampling frequency;

[0013] First sampling points are uniformly extracted from the sampling points of the preset sinusoidal signal according to the first target ratio, and the target sinusoidal signal is acquired using the first sampling points.

[0014] Preferably, the mathematical expression of the first sampling point is:

[0015] sin(i'×N)%f0,i<f0;

[0016] Wherein, i' is the serial number of the first sampling point, % represents the remainder, N is the target ratio, and f0 is the preset sampling frequency.

[0017] Preferably, the process of uniformly interpolating between two adjacent sampling points of the preset sinusoidal signal using a Taylor series to obtain the target sinusoidal signal includes:

[0018] Obtaining a second target ratio between the target sampling frequency and the preset sampling frequency;

[0019] Based on the Taylor series, the second target ratio of second sampling points is uniformly inserted between two adjacent sampling points of the preset sinusoidal signal to obtain the target sinusoidal signal using the sampling points of the preset sinusoidal signal and the second sampling points.

[0020] Preferably, the mathematical expression of the second sampling point is:

[0021] sin(i)+j×K1×cos(i)-j×j×K2×sin(i);

[0022] Where, K1=2π / [f0×(N+1)], i is the serial number of the sampling point in the preset sinusoidal signal, and j is the serial number of the second sampling point inserted between the i-th sampling point and the (i+1)-th sampling point of the preset sinusoidal signal.

[0023] Preferably, it also includes:

[0024] The mapping relationship between the sine function value of the preset sine signal at each sampling point and the corresponding sampling point is stored in the sine signal generator in advance in the form of a table.

[0025] Correspondingly, the present invention also discloses a sinusoidal signal generating device, which is applied to a sinusoidal signal generator and includes:

[0026] a signal retrieval module, configured to retrieve a pre-stored preset sinusoidal signal from the sinusoidal signal generator upon receiving a trigger instruction from the servo drive to obtain a target sinusoidal signal; wherein the preset sinusoidal signal only records the sinusoidal function value corresponding to each sampling point within a 1 / 4 sampling period of the preset sinusoidal signal;

[0027] a signal determination module, configured to determine whether a target sampling frequency of the target sinusoidal signal is greater than or equal to a preset sampling frequency of the preset sinusoidal signal;

[0028] a first sending module, configured to uniformly sample the sampling points of the preset sinusoidal signal to obtain the target sinusoidal signal if the target sampling frequency is greater than or equal to the preset sampling frequency, and send the target sinusoidal signal to the servo driver;

[0029] The second sending module is used to use Taylor series to perform uniform interpolation between two adjacent sampling points of the preset sinusoidal signal if the target sampling frequency is less than the preset sampling frequency to obtain the target sinusoidal signal, and send the target sinusoidal signal to the servo drive.

[0030] Preferably, it also includes:

[0031] The relationship storage module is used to store the mapping relationship between the sine function value of the preset sine signal at each sampling point and the corresponding sampling point in the form of a table in the sine signal generator in advance.

[0032] Correspondingly, the present invention also discloses a sinusoidal signal generating device, comprising:

[0033] memory for storing computer programs;

[0034] A processor is used to implement the steps of the method for generating a sinusoidal signal as disclosed above when executing the computer program.

[0035] Correspondingly, the present invention further discloses a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the method for generating a sinusoidal signal as disclosed above are implemented.

[0036] It can be seen that in the present invention, when the sine signal generator receives a trigger instruction from the servo driver to obtain a target sine signal, it retrieves a pre-stored preset sine signal from itself; wherein the preset sine signal only records the sine function value corresponding to each sampling point of the preset sine signal within a 1 / 4 sampling period; then, the sine signal generator determines whether the target sampling frequency of the target sine signal is greater than or equal to the preset sampling frequency of the preset sine signal; if the target sampling frequency is greater than or equal to the preset sampling frequency, the sine signal generator only needs to uniformly sample the sampling points of the preset sine signal to obtain a target sine signal with a sampling frequency of the target sampling frequency. When the sine signal generator obtains the target sine signal, it sends the target sine signal to the servo driver; if the target sampling frequency is less than the preset sampling frequency, the sine signal generator uses a Taylor series to uniformly interpolate between two adjacent sampling points of the preset sine signal to obtain a target sine signal with a sampling frequency of the target sampling frequency. When the sine signal generator obtains the target sine signal, it sends the target sine signal to the servo driver. Obviously, because the sinusoidal signal has axisymmetry, the sinusoidal function value of the preset sinusoidal signal within the entire sampling period can be obtained by only storing the sinusoidal function value corresponding to each sampling point of the preset sinusoidal signal within 1 / 4 sampling period in the sinusoidal signal generator. This can significantly reduce the space occupied by the sinusoidal signal generator. In addition, in the process of obtaining the target sinusoidal signal using this method, since a large amount of calculation is not required and calculation errors are not generated, this method can also significantly improve the accuracy and speed of the sinusoidal signal output by the sinusoidal signal generator. Accordingly, the sinusoidal signal generation device, equipment and medium provided by the present invention also have the above-mentioned beneficial effects. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are merely embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.

[0038] Figure 1 A flow chart of a method for generating a sinusoidal signal provided by an embodiment of the present invention;

[0039] Figure 2 The embodiment of the present invention is a flow chart of obtaining the sine function value of a preset sine signal at each sampling point within a complete sampling period;

[0040] Figure 3 2 is a flow chart of extracting sampling points with an interval of N from a preset sinusoidal signal when the target sampling frequency of the target sinusoidal signal is lower than the preset sampling frequency of the preset sinusoidal signal;

[0041] Figure 4 Schematic diagram of a flow chart of inserting N second sampling points between the i-th sampling point and the i+1-th sampling point of the preset sinusoidal signal when the target sampling frequency of the target sinusoidal signal is lower than the preset sampling frequency of the preset sinusoidal signal;

[0042] Figure 5 A structural diagram of a sinusoidal signal generating device provided by an embodiment of the present invention;

[0043] Figure 6 This is a structural diagram of a sinusoidal signal generating device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0044] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.

[0045] See Figure 1 , Figure 1 A flow chart of a method for generating a sinusoidal signal provided by an embodiment of the present invention, the method comprising:

[0046] Step S11: when a trigger instruction for the servo driver to obtain a target sinusoidal signal is received, a pre-stored preset sinusoidal signal is retrieved from the sinusoidal signal generator itself;

[0047] The preset sinusoidal signal only records the sinusoidal function value corresponding to each sampling point of the preset sinusoidal signal within a 1 / 4 sampling period;

[0048] Step S12: determining whether the target sampling frequency of the target sinusoidal signal is greater than or equal to the preset sampling frequency of the preset sinusoidal signal;

[0049] Step S13: If the target sampling frequency is greater than or equal to the preset sampling frequency, uniformly sampling the sampling points of the preset sinusoidal signal to obtain a target sinusoidal signal, and sending the target sinusoidal signal to the servo driver;

[0050] Step S14: If the target sampling frequency is less than the preset sampling frequency, a Taylor series is used to perform uniform interpolation between two adjacent sampling points of the preset sinusoidal signal to obtain a target sinusoidal signal, and the target sinusoidal signal is sent to the servo driver.

[0051] In this embodiment, a method for generating a sinusoidal signal is provided. This method can reduce the storage space occupied by a sinusoidal signal generator while also improving the accuracy and speed of the sinusoidal signal output by the sinusoidal signal generator. Specifically, the method is described using a sinusoidal signal generator as the execution subject. The sinusoidal signal generator pre-stores the sine function value corresponding to each sampling point of a preset sinusoidal signal within a quarter sampling period.

[0052] When the sine signal generator receives a trigger instruction from the servo drive to obtain a target sine signal, the sine signal generator will retrieve a preset sine signal stored in advance from itself and compare the target sampling frequency of the target sine signal with the preset sampling frequency of the preset sine signal. If the target sampling frequency of the target sine signal is greater than or equal to the preset sampling frequency of the preset sine signal, the sine signal generator only needs to uniformly sample the sampling points of the preset sine signal to obtain the sine function value corresponding to each sampling point of the target sine signal within a 1 / 4 sampling period.

[0053] It can be understood that since the sinusoidal signal has axisymmetry, the sinusoidal function value of the target sinusoidal signal in the entire sampling period can be obtained based on the sinusoidal function value corresponding to each sampling point in the 1 / 4 sampling period, thereby obtaining the target sinusoidal signal with the target sampling frequency. When the sinusoidal signal generator generates the target sinusoidal signal with the target sampling frequency, the sinusoidal signal generator will feed the target sinusoidal signal back to the servo driver.

[0054] If the target sampling frequency of the target sinusoidal signal is less than the preset sampling frequency of the preset sinusoidal signal, the sinusoidal signal generator will use the Taylor series to perform uniform interpolation between two adjacent sampling points of the preset sinusoidal signal, so that the sinusoidal function value corresponding to each sampling point of the target sinusoidal signal within a 1 / 4 sampling period can be obtained. It can be imagined that when the sinusoidal function value of the target sinusoidal signal at each sampling point within a 1 / 4 sampling period is obtained, the sinusoidal function value of the target sinusoidal signal at each sampling point within the entire sampling period can be obtained. In this case, the sinusoidal signal generator will obtain a target sinusoidal signal with a sampling frequency of the target sampling frequency. When the sinusoidal signal generator generates a target sinusoidal signal with a sampling frequency of the target sampling frequency, the sinusoidal signal generator will feed the target sinusoidal signal back to the servo drive.

[0055] Obviously, in the sinusoidal signal generation method provided in this embodiment, since only the sinusoidal function value of the preset sinusoidal signal at each sampling point in a 1 / 4 sampling period is stored in the sinusoidal signal generator, compared with the table lookup method in the prior art, the space occupied by the sinusoidal signal generator can be significantly reduced.

[0056] Furthermore, when the target sampling frequency of the target sinusoidal signal is greater than or equal to the preset sampling frequency of the preset sinusoidal signal, the sinusoidal signal generator only needs to uniformly sample the sampled signals in the preset sinusoidal signal to obtain the target sinusoidal signal with the target sampling frequency. This not only reduces the computational effort required by the sinusoidal signal generator in generating the target sinusoidal signal, but also increases the speed at which the sinusoidal signal generator generates the target sinusoidal signal. Furthermore, when the target sampling frequency of the target sinusoidal signal is less than the preset sampling frequency of the preset sinusoidal signal, the sinusoidal signal generator only needs to uniformly interpolate between two adjacent sampling points of the preset sinusoidal signal according to the Taylor series to obtain the target sinusoidal signal with the target sampling frequency. This reduces the computational effort required by the sinusoidal signal generator and increases the speed at which the sinusoidal signal generator generates the target sinusoidal signal, compared to the prior art method of simply using the Taylor series expansion method to obtain the target sinusoidal signal with the target sampling frequency. In summary, the sinusoidal signal generation method provided in this embodiment can not only reduce the space occupied by the sinusoidal signal generator, but also significantly improve the accuracy and speed of the sinusoidal signal generator in outputting sinusoidal signals.

[0057] It can be seen that in this embodiment, when the sine signal generator receives a trigger instruction from the servo driver to obtain a target sine signal, it retrieves a pre-stored preset sine signal from itself; wherein the preset sine signal only records the sine function value corresponding to each sampling point of the preset sine signal within a 1 / 4 sampling period; then, the sine signal generator determines whether the target sampling frequency of the target sine signal is greater than or equal to the preset sampling frequency of the preset sine signal; if the target sampling frequency is greater than or equal to the preset sampling frequency, the sine signal generator only needs to uniformly sample the sampling points of the preset sine signal to obtain a target sine signal with a sampling frequency of the target sampling frequency. When the sine signal generator obtains the target sine signal, it sends the target sine signal to the servo driver; if the target sampling frequency is less than the preset sampling frequency, the sine signal generator uses a Taylor series to uniformly interpolate between two adjacent sampling points of the preset sine signal to obtain a target sine signal with a sampling frequency of the target sampling frequency. When the sine signal generator obtains the target sine signal, it sends the target sine signal to the servo driver. Obviously, because the sinusoidal signal has axial symmetry, the sinusoidal function value of the preset sinusoidal signal in the entire sampling period can be obtained by only storing the sinusoidal function value corresponding to each sampling point of the preset sinusoidal signal in 1 / 4 sampling period in the sinusoidal signal generator. This can significantly reduce the space occupied by the sinusoidal signal generator. Moreover, in the process of obtaining the target sinusoidal signal using this method, since a large amount of calculation is not required and no calculation error will be generated, this method can also significantly improve the accuracy and speed of the sinusoidal signal output by the sinusoidal signal generator.

[0058] Based on the above embodiment, this embodiment further illustrates and optimizes the technical solution. As a preferred implementation, the above step of uniformly sampling the sampling points of the preset sinusoidal signal to obtain the target sinusoidal signal includes:

[0059] Obtaining a first target ratio between the target sampling frequency and the preset sampling frequency;

[0060] First sampling points are uniformly extracted from the sampling points of the preset sinusoidal signal according to the first target ratio, and the target sinusoidal signal is acquired using the first sampling points.

[0061] In this embodiment, a specific implementation method for a sinusoidal signal generator to generate a target sinusoidal signal is provided. That is, when uniformly sampling the sampling points of a preset sinusoidal signal, the sinusoidal signal generator first obtains a first target ratio between a target sampling frequency of the target sinusoidal signal and a preset sampling frequency of the preset sinusoidal signal. The purpose of this operation step is to determine the most appropriate sampling point to be selected every few sampling points in the process of uniformly sampling the sampling points of the preset sinusoidal signal. When the sinusoidal signal generator obtains the first target ratio between the target sampling frequency and the preset sampling frequency, the sinusoidal signal generator uniformly extracts first sampling points from the sampling points of the preset sinusoidal signal according to the first target ratio.

[0062] It can be understood that after the sine signal generator uniformly extracts the first sampling point from the sampling points of the preset sine signal according to the first target ratio, the sine signal generator is equivalent to obtaining the sine function of the target sine signal with a sampling frequency of the target sampling frequency at each sampling point within a 1 / 4 sampling period. In this case, the sine signal generator can use the first sampling point to obtain the target sine signal with a sampling frequency of the target sampling frequency based on the axial symmetry of the sine signal.

[0063] Specifically, the mathematical expression of the first sampling point is:

[0064] sin(i'×N)%f0,i<f0;

[0065] Wherein, i' is the serial number of the first sampling point, % represents the remainder, N is the first target ratio, and f0 is the preset sampling frequency.

[0066] In this embodiment, a mathematical model expression of the first sampling point is provided to further increase the accuracy of the first sampling point selection process. Here, a specific example is used to illustrate. Assume that a preset sinusoidal signal with a preset sampling frequency of 16000 Hz is pre-stored in the sinusoidal signal generator. In other words, assuming that the sampling period of a standard preset sinusoidal signal is 1s, when the sampling frequency of the preset sinusoidal signal is 16000 Hz, one cycle of the preset sinusoidal signal will be evenly divided into 16000 points. Due to the axial symmetry of the sinusoidal signal, the sinusoidal signal generator only needs to store the sinusoidal function values ​​of the preset sinusoidal signal at the first 4000 sampling points. For details, please refer to Figure 2 , Figure 2 The embodiment of the present invention is a flow chart of obtaining the sine function value of a preset sine signal at each sampling point within a complete sampling period.

[0067] The mathematical expression of the sine function value at the i-th sampling point in the preset sine signal is:

[0068] table(i)=sin(2π·i / 16000), 0≤i≤4000;

[0069] Where i is the serial number of the sampling point in the preset sinusoidal signal.

[0070] When the target sampling frequency of the target sinusoidal signal is an integer multiple of the preset sampling frequency, that is, 1Hz of the preset sampling frequency corresponds to NHz of the target sampling frequency, the sinusoidal signal generator only needs to continuously extract sampling points with an interval of N from the preset sinusoidal signal to obtain the first sampling point. After that, the target sinusoidal signal can be obtained based on the first sampling point. Figure 3 , Figure 3 3 is a flow chart of extracting sampling points with an interval of N from a preset sinusoidal signal when the target sampling frequency of the target sinusoidal signal is lower than the preset sampling frequency of the preset sinusoidal signal.

[0071] Obviously, the technical solution provided by this embodiment can make the process of acquiring the target sinusoidal signal simpler and easier.

[0072] Based on the above embodiment, this embodiment further illustrates and optimizes the technical solution. As a preferred implementation, the above step of using the Taylor series to uniformly interpolate between two adjacent sampling points of the preset sinusoidal signal to obtain the target sinusoidal signal includes:

[0073] Obtaining a second target ratio between the target sampling frequency and the preset sampling frequency;

[0074] Based on the Taylor series, a second target ratio of second sampling points is uniformly inserted between two adjacent sampling points of the preset sinusoidal signal, so as to obtain a target sinusoidal signal using the sampling point of the preset sinusoidal signal and the second sampling point.

[0075] In this embodiment, a specific implementation method is provided for a sinusoidal signal generator to uniformly interpolate a preset sinusoidal signal based on a Taylor series to obtain a target sinusoidal signal. This method first obtains a second target ratio between a target sampling frequency of the target sinusoidal signal and a preset sampling frequency of the preset sinusoidal signal. It will be appreciated that once the second target ratio between the target sampling frequency and the preset sampling frequency is obtained, the sinusoidal signal generator can determine the number of sampling points required to be interpolated between two adjacent sampling points of the preset sinusoidal signal to obtain the target sinusoidal signal having the target sampling frequency.

[0076] When the sine signal generator obtains the second target ratio, the sine signal generator will uniformly insert second sampling points equal to the second target ratio between two adjacent sampling points of the preset sine signal according to the Taylor series. It is conceivable that when the sine signal generator inserts the second target ratio of second sampling points between two adjacent sampling points of the preset sine signal, the sine signal generator will obtain the sine function value of the target sine signal having the target sampling frequency at each sampling point within a 1 / 4 sampling period. Then, based on the axial symmetry of the sine function, the sine signal generator can obtain the target sine signal for the entire sampling period.

[0077] Specifically, the mathematical expression of the second sampling point is:

[0078] sin(i)+j×K1×cos(i)-j×j×K2×sin(i);

[0079] Where, K1=2π / [f0×(N+1)], i is the serial number of the sampling point in the preset sinusoidal signal, and j is the serial number of the second sampling point inserted between the i-th sampling point and the i+1-th sampling point of the preset sinusoidal signal.

[0080] Corresponding to the mathematical expression of the first sampling point disclosed in the above embodiment, in this embodiment, a mathematical expression of the second sampling point is also provided. Figure 4 , Figure 4 This is a flow chart illustrating inserting N second sampling points between the i-th sampling point and the i+1-th sampling point of a preset sinusoidal signal when the target sampling frequency of the target sinusoidal signal is less than the preset sampling frequency of the preset sinusoidal signal. When the sampling period of the target sinusoidal signal is N+1 times the sampling period of the preset sinusoidal signal, the sinusoidal signal generator can insert N second sampling points between the i-th sampling point and the i+1-th sampling point of the preset sinusoidal signal to obtain the target sinusoidal signal, wherein the inserted second sampling points are sampling points corresponding to Taylor series expansion of the i-th sampling point in the preset sinusoidal signal.

[0081] Because the Taylor series expansion expression of the function f(x) at point x0 is:

[0082] f(x)=f(x0)+f'(x0)(x-x0)+f 2 (x0) / 2! (x-x0)+...;

[0083] Where x is the independent variable.

[0084] Therefore, the Taylor series expansion corresponding to the sine function is:

[0085] sin(i)+j×K1×cos(i)-j×j×K2×sin(i)+...;

[0086] Where, K1=2π / [f0×(N+1)], i is the serial number of the sampling point in the preset sinusoidal signal, and j is the serial number of the second sampling point inserted between the i-th sampling point and the (i+1)-th sampling point of the preset sinusoidal signal.

[0087] It should be noted that extensive experimental verification has shown that by expanding only the first three terms of the sine function in the Taylor series, the interpolation error of the target sinusoidal signal remains within 0 to 0.0000000019, fully meeting the requirements of practical applications. Therefore, in this embodiment, only the first three terms of the Taylor series of the sine function are expanded. Of course, in practical applications, if higher interpolation accuracy is desired, the Taylor series of the sine function can be expanded to a larger number of terms, which will not be detailed here.

[0088] Obviously, the technical solution provided by this embodiment can relatively reduce the consumption of computing resources of the sinusoidal signal generator.

[0089] Based on the above embodiment, this embodiment further illustrates and optimizes the technical solution. As a preferred implementation, the above method for generating a sinusoidal signal further includes:

[0090] The mapping relationship between the sine function value of the preset sine signal at each sampling point and the corresponding sampling point is stored in the sine signal generator in advance in the form of a table.

[0091] In practical applications, in order to further improve the speed of the sine signal generator in generating the target sine signal, the mapping relationship between the sine function value of the preset sine signal at each sampling point and the corresponding sampling point can be stored in the sine signal generator in advance in the form of a table.

[0092] It is understandable that, because such a setting method allows the sinusoidal signal generator to more quickly retrieve the sinusoidal function value of the preset sinusoidal signal at each sampling point from its own memory, the speed of the sinusoidal signal generator in generating the target sinusoidal signal can be further improved.

[0093] See Figure 5 , Figure 5 A structural diagram of a sinusoidal signal generating device provided by an embodiment of the present invention, the generating device comprising:

[0094] The signal retrieval module 21 is configured to retrieve a pre-stored preset sinusoidal signal from the sinusoidal signal generator upon receiving a trigger instruction from the servo driver to obtain a target sinusoidal signal. The pre-stored sinusoidal signal only records the sinusoidal function value corresponding to each sampling point within a quarter sampling period of the pre-stored sinusoidal signal.

[0095] A signal determination module 22 is configured to determine whether a target sampling frequency of a target sinusoidal signal is greater than or equal to a preset sampling frequency of a preset sinusoidal signal;

[0096] A first sending module 23 is configured to uniformly sample the sampling points of the preset sinusoidal signal to obtain a target sinusoidal signal if the target sampling frequency is greater than or equal to the preset sampling frequency, and send the target sinusoidal signal to the servo driver;

[0097] The second sending module 24 is used to use Taylor series to uniformly interpolate between two adjacent sampling points of the preset sinusoidal signal if the target sampling frequency is less than the preset sampling frequency to obtain the target sinusoidal signal, and send the target sinusoidal signal to the servo driver.

[0098] Preferably, it also includes:

[0099] The relationship storage module is used to store the mapping relationship between the sine function value of the preset sine signal at each sampling point and the corresponding sampling point in the sine signal generator in the form of a table.

[0100] An embodiment of the present invention provides a device for generating a sinusoidal signal, which has the beneficial effects of the aforementioned method for generating a sinusoidal signal.

[0101] See Figure 6 , Figure 6 A structural diagram of a sinusoidal signal generating device provided in an embodiment of the present invention, the generating device comprising:

[0102] Memory 31, for storing computer programs;

[0103] The processor 32 is configured to implement the steps of the method for generating a sinusoidal signal as disclosed above when executing a computer program.

[0104] A sinusoidal signal generating device provided by an embodiment of the present invention has the beneficial effects of the sinusoidal signal generating method disclosed above.

[0105] Correspondingly, an embodiment of the present invention further discloses a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the method for generating a sinusoidal signal as disclosed above are implemented.

[0106] A computer-readable storage medium provided by an embodiment of the present invention has the beneficial effects of the aforementioned method for generating a sinusoidal signal.

[0107] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from the other embodiments. Reference can be made to the descriptions of the identical or similar parts between the various embodiments. For the devices disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the descriptions are relatively simple, and the relevant parts can be referred to the descriptions of the methods.

[0108] Finally, it should be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article, or device comprising the element.

[0109] The above is a detailed introduction to the method, device, equipment and medium for generating a sinusoidal signal provided by the present invention. Specific examples are used herein to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only intended to help understand the method and core ideas of the present invention. At the same time, for those skilled in the art, according to the ideas of the present invention, there may be changes in the specific implementation methods and application scopes. In summary, the contents of this specification should not be understood as limiting the present invention.

Claims

1. A method for generating a sinusoidal signal, characterized in that: Applications in sine signal generators, including: When a trigger instruction for the servo driver to obtain a target sinusoidal signal is received, a pre-stored preset sinusoidal signal is retrieved from the sinusoidal signal generator itself; wherein the preset sinusoidal signal only records the sinusoidal function value corresponding to each sampling point of the preset sinusoidal signal within a 1 / 4 sampling period; Determining whether a target sampling frequency of the target sinusoidal signal is greater than or equal to a preset sampling frequency of the preset sinusoidal signal; If the target sampling frequency is less than the preset sampling frequency, uniformly sampling the sampling points of the preset sinusoidal signal to obtain the target sinusoidal signal, and sending the target sinusoidal signal to the servo driver; If the target sampling frequency is not less than the preset sampling frequency, Taylor series is used to perform uniform interpolation between two adjacent sampling points of the preset sinusoidal signal to obtain the target sinusoidal signal, and the target sinusoidal signal is sent to the servo driver.

2. The generation method according to claim 1, characterized in that The process of uniformly sampling the sampling points of the preset sinusoidal signal to obtain the target sinusoidal signal includes: Obtaining a first target ratio between the target sampling frequency and the preset sampling frequency; First sampling points are uniformly extracted from the sampling points of the preset sinusoidal signal according to the first target ratio, and the target sinusoidal signal is acquired using the first sampling points.

3. The generation method according to claim 2, characterized in that The mathematical expression of the first sampling point is: ; Where, is the serial number of the first sampling point, Indicates the remainder. is the target ratio, is the preset sampling frequency.

4. The generation method according to claim 1, characterized in that The process of uniformly interpolating between two adjacent sampling points of the preset sinusoidal signal using the Taylor series to obtain the target sinusoidal signal includes: Obtaining a second target ratio between the target sampling frequency and the preset sampling frequency; Based on the Taylor series, the second target ratio of second sampling points is uniformly inserted between two adjacent sampling points of the preset sinusoidal signal to obtain the target sinusoidal signal using the sampling points of the preset sinusoidal signal and the second sampling points.

5. The generation method according to claim 4, characterized in that The mathematical expression of the second sampling point is: ; Where, , , is the serial number of the sampling point in the preset sinusoidal signal, In the preset sinusoidal signal sampling points and The sequence number of the second sampling point is inserted between the sampling points.

6. The generation method according to any one of claims 1 to 5, characterized in that: Also includes: The mapping relationship between the sine function value of the preset sine signal at each sampling point and the corresponding sampling point is stored in the sine signal generator in advance in the form of a table.

7. A device for generating a sinusoidal signal, characterized in that: Applications in sine signal generators, including: a signal retrieval module, configured to retrieve a pre-stored preset sinusoidal signal from the sinusoidal signal generator upon receiving a trigger instruction from the servo drive to obtain a target sinusoidal signal; wherein the preset sinusoidal signal only records the sinusoidal function value corresponding to each sampling point within a 1 / 4 sampling period of the preset sinusoidal signal; a signal determination module, configured to determine whether a target sampling frequency of the target sinusoidal signal is greater than or equal to a preset sampling frequency of the preset sinusoidal signal; a first sending module, configured to uniformly sample the sampling points of the preset sinusoidal signal to obtain the target sinusoidal signal if the target sampling frequency is less than the preset sampling frequency, and send the target sinusoidal signal to the servo driver; The second sending module is used to use Taylor series to perform uniform interpolation between two adjacent sampling points of the preset sinusoidal signal if the target sampling frequency is not less than the preset sampling frequency to obtain the target sinusoidal signal, and send the target sinusoidal signal to the servo drive.

8. The generating device according to claim 7, characterized in that Also includes: The relationship storage module is used to store the mapping relationship between the sine function value of the preset sine signal at each sampling point and the corresponding sampling point in the form of a table in the sine signal generator in advance.

9. A device for generating a sinusoidal signal, characterized in that: include: memory for storing computer programs; A processor, configured to implement the steps of a method for generating a sinusoidal signal as claimed in any one of claims 1 to 6 when executing the computer program.

10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method for generating a sinusoidal signal according to any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • Digital realization method for sine wave signal

    CN105974997A

  • Apparatus and method for generating sinusoidal waves, and system for driving piezo actuator using the same

    US20150168989A1