Model verification tool dynamic library function function test verification method
By using the dynamic library function function test verification method in the civil aircraft flight control system, the filter transfer function and input signal are constructed, the reset signal sequence is generated, and the high security and reliability of the dynamic library function is solved in the existing technology, and the effect of improving the safety and reliability of the civil aircraft flight control system is achieved.
Patent Information
- Application Number
- CN202411897761.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-23
- Publication Date
- 2025-04-25
- Estimated Expiration
- 2044-12-23
AI Technical Summary
In civil aircraft flight control systems, it is difficult for the existing technology to effectively verify the high security and reliability of the dynamic library functions of the model verification tool, which makes it difficult to ensure the safety and reliability of the system.
A dynamic library function function test verification method for model verification tools is proposed. By constructing the transfer function of the filter and the input signal based on the time series, a reset signal sequence covering all scenarios is generated, and the transfer function is discrete according to the requirements of the model verification tool. Then, the input signal and reset signal are injected into the discrete differential equation and dynamic library function of the model verification tool, calculate the expected output and the actual output, and determine whether the set tolerance is met.
This method can effectively ensure that the dynamic library functions of the model verification tool have high security and reliability, thereby improving the safety and reliability of civil aircraft flight control systems.
Smart Images

Figure CN119883894A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of civil aircraft flight control software testing, and in particular to a model verification tool dynamic library function function testing and verification method. Background Art
[0002] As the complexity of embedded systems increases, the scale of systems continues to increase, and the software code of civil aircraft flight control systems is very large. Manually writing code is difficult to meet application requirements. Model-based software development and verification (MBD&V) technology is an effective way to solve this problem. In the consistency verification stage of the verification model and system requirements, the model verification tool provides a highly secure and reliable library function, which can help testers greatly improve the efficiency of verification work, thereby improving the reliability and safety of civil aircraft flight control systems.
[0003] The core function of the model verification tool is to provide high-security and high-reliability library functions. In addition, dynamic links are used extensively for control in the field of civil aircraft flight control. Therefore, this patent proposes a functional testing and verification method for dynamic library functions of model verification tools in high-security critical areas to ensure that the dynamic library functions of the model verification tool have high security and reliability. Summary of the invention
[0004] Purpose of the invention: To provide a method for testing and verifying the function of a dynamic library function of a model verification tool. Before the testers of a civil aircraft flight control system use the model verification tool to test the system, it can be ensured that the dynamic library function in the model verification tool has high security and reliability, thereby improving the security and reliability of the civil aircraft flight control system.
[0005] Technical solution:
[0006] A model verification tool dynamic library function function test verification method, the method is used to test civil aircraft flight control software, wherein the test verification method of the reset function of the dynamic library function includes:
[0007] S1, construct the filter transfer function and the input signal based on the time series;
[0008] S2, construct a reset signal sequence covering all scenarios;
[0009] S3, discretizing the transfer function of the constructed filter according to the requirements of the model verification tool to obtain a difference equation;
[0010] S4, injecting the input signal based on the time series and the reset signal sequence into the discretized difference equation to calculate the expected output of the transfer function;
[0011] S5, injecting the input signal based on the time series and the reset signal sequence into the dynamic library function of the model verification tool, and calculating and obtaining the actual output of the dynamic library function of the model verification tool under test;
[0012] S6, judging whether the expected output and the actual output meet the set tolerance. If they are within the set tolerance range, the reset function test result passes, otherwise it fails.
[0013] Furthermore, S1 includes:
[0014] Determine the parameters of the filter transfer function, including the time constant, the damping coefficient, and the natural frequency, set the filter sampling time, and construct the time series-based input signal to be processed by the filter according to the sampling time.
[0015] Furthermore, S2 includes:
[0016] S2-1: According to the sampling time set in step S1, a reset signal is constructed to trigger the filtering function, that is, the value of the reset signal in the first beat is 0, the reset function is not performed, and the filtering calculation starts at the initial moment;
[0017] S2-2: Construct a scenario where the reset signal goes from 0 to 0, that is, to ensure that the dynamic link filter continues to perform filtering calculations;
[0018] S2-3: Construct the scenario where the reset signal rises from 0 to 1, that is, ensure that the dynamic link filter is converted from the filtering calculation to the reset state at the current moment;
[0019] S2-4: Construct a scenario where the reset signal goes from 1 to 1, that is, ensure that the dynamic link filter can be continuously reset without performing filtering calculations;
[0020] S2-5: Construct the scenario of the falling edge of the reset signal from 1 to 0, that is, to ensure that the dynamic link filter is converted from the reset state to the filter calculation state;
[0021] S2-6: Construct a scenario in which the reset signal is 1 at the first beat, that is, ensure that the dynamic link filter triggers reset at the first beat.
[0022] Furthermore, S3 includes:
[0023] S3-1: Determine whether to perform pre-distortion frequency correction at a specific frequency point according to the model verification tool requirements;
[0024] S3-2: If pre-distortion correction is performed at a specific frequency point, use Matlab's own API interface to add pre-distortion correction to the constructed transfer function at the specific frequency point, and then use the API interface to perform Tustin discretization, otherwise Tustin discretization is performed directly.
[0025] A model verification tool dynamic library function function test verification method, the method is used to test civil aircraft flight control software, wherein the dynamic library function filter function test verification method includes:
[0026] S1, set the filter parameters of the dynamic link library function of the model verification tool, and use the API interface of Matlab to construct a discretized filter according to the filter parameters;
[0027] S2, using Matlab's standard frequency sweep API function to sweep the discretized filter constructed in step S1 to obtain first frequency characteristic data of the discretized filter;
[0028] S3, automatically sweeping the filter of the dynamic link library function of the model verification tool to obtain frequency characteristic data of the filter of the library function;
[0029] S4, automatically sweeping the frequency of the discretized filter constructed in step S1 to obtain second frequency characteristic data of the discretized filter in step S1;
[0030] S5, determining whether the first frequency characteristic data of the discretized filter is consistent with the filter parameter performance set in step S1;
[0031] S6, determining whether the frequency characteristic data of the filter of the model verification tool library function obtained in step S3 is consistent with the second frequency characteristic data of the discretized filter obtained in step S4;
[0032] S7, if the judgment of step S5 is consistent and step S6 is also consistent, the dynamic characteristic test result of the filter of the dynamic link library function of the model verification tool passes, otherwise it fails.
[0033] Furthermore, S3 includes:
[0034] S3-1: Set the frequency range of the sweep signal. The sweep signal frequency w(i) starts at 0.1 Hz, increases in intervals of 0.1 Hz, and ends at 80 Hz.
[0035] S3-2: Set the sampling time, and construct a cosine input signal based on the time series according to the sampling time. The angular frequency of the cosine input signal is w(i);
[0036] S3-3: Perform fast Fourier transform on the cosine input signal to calculate the amplitude and phase of the cosine input signal in the frequency domain;
[0037] S3-4: inject the cosine input signal into the dynamic link library function of the model verification tool to obtain the output signal of the dynamic library function of the model verification tool, perform fast Fourier transform on the output signal, and calculate the amplitude and phase of the dynamic library function output signal in the frequency domain;
[0038] S3-5: Find the amplitude and phase of the cosine input signal and the output signal at the frequency point of step S3-2;
[0039] S3-6: Divide the amplitude of the output signal obtained in step S3-5 by the amplitude of the input signal in step S3-5 to obtain the amplitude-frequency characteristic of the model verification tool dynamic library function at the frequency point of step S3-2, and subtract the phase of the output signal obtained in step S3-5 from the phase of the input signal in step S3-5 to obtain the phase-frequency characteristic of the model verification tool dynamic library function at the frequency point of step S3-2;
[0040] S3-7: Increase w(i) by 0.1 Hz and return to step S3-2 until w(i) reaches 80 Hz. This will give the amplitude-frequency characteristics of the dynamic library function from 0.1 Hz to 80 Hz and the amplitude-frequency characteristics of the discrete filter constructed by MATLAB API from 0.1 Hz to 80 Hz.
[0041] Furthermore, S4 includes:
[0042] S4-1: inject the cosine input signal in S3-2 into the discretization filter constructed in step S1 to obtain the output signal of the discretization filter, perform fast Fourier transform on the output signal, and calculate the amplitude and phase of the output signal of the discretization filter in the frequency domain;
[0043] S4-2: Find the amplitude and phase of the output signal in S4-1 at the frequency point of step S3-2;
[0044] S4-3: Divide the amplitude of the output signal obtained in step S4-2 by the amplitude of the cosine input signal in step S3-5 to obtain the amplitude-frequency characteristic of the discretized filter at the frequency point of step S3-2, and subtract the phase of the output signal obtained in step S4-2 from the phase of the input signal in step S3-5 to obtain the phase-frequency characteristic of the discretized filter at the frequency point of step S3-2.
[0045] Furthermore, S3-2 includes:
[0046] S3-2-1: Set the number of cycles N and sampling time of the cosine input signal;
[0047] S3-2-2: Sampling frequency F corresponding to sampling time s , the cosine signal angular frequency w(i) and the number of cosine input signal cycles N, calculate the number of sampling points L of the input signal:
[0048]
[0049] S3-2-3: round up the number of sampling points L in step S3-2-2, and determine whether it is an even number after rounding. If it is not an even number, add 1 to make it an even number;
[0050] S3-2-4: Based on the number of sampling points L and sampling frequency w(i) obtained in S3-2-3, the time series of the input signal is calculated, and a cosine input signal based on the time series can be constructed.
[0051] Furthermore, S3-5 includes:
[0052] S3-5-1: Search the position index number k of the input signal and the output signal at the frequency point in step S3-2:
[0053]
[0054] Among them: round means round down.
[0055] S3-5-2: Take out the amplitude and phase of the cosine input signal sequence and the output signal sequence at the kth point, and you can get the amplitude and phase of the input signal and the output signal at the frequency point of step S3-2.
[0056] Furthermore, the frequency characteristics of the signal calculated by the fast Fourier transform in step S4-1 include:
[0057] S4-1-1: Use the API function fft provided by Matlab to perform Fourier transform on the signal to obtain the Y complex vector;
[0058] S4-1-2: Normalize the complex vector Y and calculate the amplitude of the complex vector Y;
[0059]
[0060] S4-1-3: Take the 1st to (L / 2+1)th elements in the amplitude vector to get the amplitude vector of the signal in the frequency domain;
[0061] S4-1-4: Take the 1st to (L / 2+1)th elements in the Y complex vector and calculate the complex angle of each element to obtain the phase vector of the signal in the frequency domain.
[0062] Beneficial effects:
[0063] The present application provides a method for testing and verifying the dynamic library function of a model verification tool for a high safety-critical field, which can ensure that the dynamic library function in the model verification tool has high safety and reliability, thereby improving the safety and reliability of the civil aircraft flight control system. BRIEF DESCRIPTION OF THE DRAWINGS
[0064] In order to more clearly explain the technical solution implemented by the present invention, the following will be a simple explanation of the drawings needed in the description of the present invention. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0065] Figure 1 It is a schematic diagram of the principle of a method for testing and verifying a reset function of a dynamic library function of a model verification tool for a high safety-critical field according to an embodiment of the present invention;
[0066] Figure 2 It is a schematic diagram of the principle of a dynamic feature test and verification method of a dynamic library function of a model verification tool for a high safety-critical field according to an embodiment of the present invention;
[0067] Figure 3 It is a flowchart of a method for testing and verifying dynamic characteristics of a dynamic library function of a model verification tool for a high safety-critical field according to an embodiment of the present invention. DETAILED DESCRIPTION
[0068] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are 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 work are within the scope of protection of the present invention.
[0069] The features of various aspects of the embodiments of the present invention will be described in detail below. In the detailed description below, many specific details are proposed to fully understand the present invention. However, it is obvious to those skilled in the art that the present invention can also be implemented without these specific details. The following description of the embodiments is only for a better understanding of the present invention by illustrating examples of the present invention. The present invention is not limited to any specific settings and methods provided below, but covers all product structures, any improvements, replacements, etc. of the methods covered without departing from the spirit of the present invention. In the various drawings and the following description, known structures and technologies are not shown to avoid unnecessary ambiguity of the present invention.
[0070] It should be noted that, in the absence of conflict, the embodiments of the present invention and the features in the embodiments may be combined with each other, and the embodiments may refer to and quote each other. The present invention will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0071] like Figures 1 to 3As shown, the present application provides a method for testing and verifying the function of a dynamic library function of a model verification tool for a high safety-critical field, wherein the method for testing and verifying the function of a dynamic library function for testing civil aircraft flight control software includes:
[0072] S1, construct the filter transfer function and the input signal based on the time series;
[0073] S2, construct a reset signal sequence covering all scenarios;
[0074] S3, discretizing the transfer function of the constructed filter according to the requirements of the model verification tool to obtain a difference equation;
[0075] S4, injecting the input signal based on the time series and the reset signal sequence into the discretized difference equation to calculate the expected output of the transfer function;
[0076] S5, injecting the input signal based on the time series and the reset signal sequence into the dynamic library function of the model verification tool, and calculating and obtaining the actual output of the dynamic library function of the model verification tool under test;
[0077] S6, judging whether the expected output and the actual output meet the set tolerance. If they are within the set tolerance range, the reset function test result passes, otherwise it fails.
[0078] Specifically, S1 includes:
[0079] Determine the parameters of the filter transfer function, including the time constant, the damping coefficient, and the natural frequency, set the filter sampling time, and construct the time series-based input signal to be processed by the filter according to the sampling time.
[0080] Specifically, S2 includes:
[0081] S2-1: According to the sampling time set in step S1, a reset signal is constructed to trigger the filtering function, that is, the value of the reset signal in the first beat is 0, the reset function is not performed, and the filtering calculation starts at the initial moment;
[0082] S2-2: Construct a scenario where the reset signal goes from 0 to 0, that is, to ensure that the dynamic link filter continues to perform filtering calculations;
[0083] S2-3: Construct the scenario where the reset signal rises from 0 to 1, that is, ensure that the dynamic link filter is converted from the filtering calculation to the reset state at the current moment;
[0084] S2-4: Construct a scenario where the reset signal goes from 1 to 1, that is, ensure that the dynamic link filter can be continuously reset without performing filtering calculations;
[0085] S2-5: Construct the scenario of the falling edge of the reset signal from 1 to 0, that is, to ensure that the dynamic link filter is converted from the reset state to the filter calculation state;
[0086] S2-6: Construct a scenario in which the reset signal is 1 at the first beat, that is, ensure that the dynamic link filter triggers reset at the first beat.
[0087] Specifically, S3 includes:
[0088] S3-1: Determine whether to perform pre-distortion frequency correction at a specific frequency point according to the model verification tool requirements;
[0089] S3-2: If pre-distortion correction is performed at a specific frequency point, use Matlab's own API interface to add pre-distortion correction to the constructed transfer function at the specific frequency point, and then use the API interface to perform Tustin discretization, otherwise Tustin discretization is performed directly.
[0090] In the second aspect, the dynamic characteristics test verification method of the dynamic library function of the model verification tool in this application includes:
[0091] S1, set the filter parameters of the dynamic link library function of the model verification tool, and use the API interface of Matlab to construct a discretized filter according to the filter parameters;
[0092] S2, using Matlab's standard frequency sweep API function to sweep the discretized filter constructed in step S1 to obtain first frequency characteristic data of the discretized filter;
[0093] S3, automatically sweeping the filter of the dynamic link library function of the model verification tool to obtain frequency characteristic data of the filter of the library function;
[0094] S4, automatically sweeping the frequency of the discretized filter constructed in step S1 to obtain second frequency characteristic data of the discretized filter in step S1;
[0095] S5, determining whether the first frequency characteristic data of the discretized filter is consistent with the filter parameter performance set in step S1;
[0096] S6, determining whether the frequency characteristic data of the filter of the model verification tool library function obtained in step S3 is consistent with the second frequency characteristic data of the discretized filter obtained in step S4;
[0097] S7, if the judgment of step S5 is consistent and step S6 is also consistent, the dynamic characteristic test result of the filter of the dynamic link library function of the model verification tool passes, otherwise it fails.
[0098] Specifically, S3 includes:
[0099] S3-1: Set the frequency range of the sweep signal. The sweep signal frequency w(i) starts at 0.1 Hz, increases in intervals of 0.1 Hz, and ends at 80 Hz.
[0100] S3-2: Set the sampling time, and construct a cosine input signal based on the time series according to the sampling time. The angular frequency of the cosine input signal is w(i);
[0101] S3-3: Perform fast Fourier transform on the cosine input signal to calculate the amplitude and phase of the cosine input signal in the frequency domain;
[0102] S3-4: inject the cosine input signal into the dynamic link library function of the model verification tool to obtain the output signal of the dynamic library function of the model verification tool, perform fast Fourier transform on the output signal, and calculate the amplitude and phase of the dynamic library function output signal in the frequency domain;
[0103] S3-5: Find the amplitude and phase of the cosine input signal and the output signal at the frequency point of step S3-2;
[0104] S3-6: Divide the amplitude of the output signal obtained in step S3-5 by the amplitude of the input signal in step S3-5 to obtain the amplitude-frequency characteristic of the model verification tool dynamic library function at the frequency point of step S3-2, and subtract the phase of the output signal obtained in step S3-5 from the phase of the input signal in step S3-5 to obtain the phase-frequency characteristic of the model verification tool dynamic library function at the frequency point of step S3-2;
[0105] S3-7: Increase w(i) by 0.1 Hz and return to step S3-2 until w(i) reaches 80 Hz. This will give the amplitude-frequency characteristics of the dynamic library function from 0.1 Hz to 80 Hz and the amplitude-frequency characteristics of the discrete filter constructed by MATLAB API from 0.1 Hz to 80 Hz.
[0106] Specifically, S3-2 includes:
[0107] S3-2-1: Set the number of cycles N and sampling time of the cosine input signal;
[0108] S3-2-2: Sampling frequency F corresponding to sampling time s , the cosine signal angular frequency w(i) and the number of cosine input signal cycles N, calculate the number of sampling points L of the input signal:
[0109]
[0110] S3-2-3: round up the number of sampling points L in step S3-2-2, and determine whether it is an even number after rounding. If it is not an even number, add 1 to make it an even number;
[0111] S3-2-4: Based on the number of sampling points L and sampling frequency w(i) obtained in S3-2-3, the time series of the input signal is calculated, and a cosine input signal based on the time series can be constructed.
[0112] Specifically, S3-5 includes:
[0113] S3-5-1: Search the position index number k of the input signal and the output signal at the frequency point in step S3-2:
[0114]
[0115] Among them: round means round down.
[0116] S3-5-2: Take out the amplitude and phase of the cosine input signal sequence and the output signal sequence at the kth point, and you can get the amplitude and phase of the input signal and the output signal at the frequency point of step S3-2.
[0117] Specifically, S4 includes:
[0118] S4-1: inject the cosine input signal in S3-2 into the discretization filter constructed in step S1 to obtain the output signal of the discretization filter, perform fast Fourier transform on the output signal, and calculate the amplitude and phase of the output signal of the discretization filter in the frequency domain;
[0119] S4-2: Find the amplitude and phase of the output signal in S4-1 at the frequency point of step S3-2;
[0120] S4-3: Divide the amplitude of the output signal obtained in step S4-2 by the amplitude of the cosine input signal in step S3-5 to obtain the amplitude-frequency characteristic of the discretized filter at the frequency point of step S3-2, and subtract the phase of the output signal obtained in step S4-2 from the phase of the input signal in step S3-5 to obtain the phase-frequency characteristic of the discretized filter at the frequency point of step S3-2.
[0121] Specifically, S4-1 includes:
[0122] S4-1-1: Use the API function fft provided by Matlab to perform Fourier transform on the signal to obtain the Y complex vector;
[0123] S4-1-2: Normalize the complex vector Y and calculate the amplitude of the complex vector Y;
[0124]
[0125] S4-1-3: Take the 1st to (L / 2+1)th elements in the amplitude vector to get the amplitude vector of the signal in the frequency domain;
[0126] S4-1-4: Take the 1st to (L / 2+1)th elements in the Y complex vector and calculate the complex angle of each element to obtain the phase vector of the signal in the frequency domain.
[0127] Example 1
[0128] Figure 1 It is a schematic diagram of the principle of a method for functional testing and verification of a model verification tool dynamic library function notch_filter (notch filter with a reset terminal) according to an embodiment of the present invention.
[0129] like Figure 1 As shown, the test verification of the function reset function in the method may include the following steps:
[0130] Step 1: construct the filter transfer function and the input signal based on the time series;
[0131] Among them, the transfer function of the filter and the input signal include:
[0132] Set the notch frequency (center frequency) f of the notch filter n =10hz, notch depth (signal attenuation multiple) depth = 0.01 (ie -40dB), set the notch filter denominator damping coefficient DENdamping = 2, according to the notch frequency and notch depth, the numerator damping coefficient NUMdamping = depth × DENdamping can be calculated, set the filter sampling time T s =0.025s, the time series based input signal to be processed by the filter is In_v.
[0133] Step 2: construct a reset signal sequence covering all scenarios;
[0134] Among them, building a reset signal sequence covering all scenarios includes:
[0135] According to the sampling time, a reset signal sequence reset based on the time series is constructed, as shown in the following table:
[0136] time Shot 1 Shot 2 Beat 3 Beat 4 Beat 5 reset 0 0 1 1 0
[0137] time Shot 1 Shot 2 Beat 3 Beat 4 Beat 5 reset 1 1 0 0 1
[0138] Step 3: discretize the transfer function of the constructed dynamic link according to the tool requirements to obtain the difference equation;
[0139] The discretization of transfer function includes:
[0140] (1) According to the requirements of the model verification tool, the notch filter with reset terminal needs to be pre-distorted at the natural frequency point.
[0141] (2) Use Matlab's API interface function c2dOptions to add pre-distortion correction to the constructed transfer function at the natural frequency point, and then use the API interface function c2d to perform Tustin discretization:
[0142] Step 4: Inject the time series-based input signal In_v and the reset signal sequence reset into the discretized difference equation to calculate the expected output of the dynamic link;
[0143] Step 5: Inject the input signal based on the time series and the reset signal sequence into the dynamic library function of the model verification tool to calculate the actual output of the dynamic link of the tool under test;
[0144] Step six, determine whether the expected output and the actual output of the tool under test meet the set tolerance. If they are within the set tolerance range, the reset function test result passes, otherwise it fails.
[0145] Example 2
[0146] Figure 2 It is a schematic diagram of the principle of a method for functional testing and verification of a model verification tool dynamic library function notch_filter (notch filter with a reset terminal) according to an embodiment of the present invention.
[0147] like Figure 2 As shown, the test verification of the function filtering function in the method may include the following steps:
[0148] Step 1: Set the filter parameters of the dynamic link library function of the model verification tool and set the notch frequency (center frequency) f of the notch filter. n =10hz, notch depth (signal attenuation multiple) depth = 0.01 (ie -40dB), set the notch filter denominator damping coefficient DENdamping = 2, according to the notch frequency and notch depth, the numerator damping coefficient NUMdamping = depth × DENdamping can be calculated, set the filter sampling time T s =0.025s, the input signal based on the time series to be processed by the filter is In_v, and the API interface function c2dOptions of Matlab is used to add pre-distortion correction to the constructed transfer function at the natural frequency point, and then the API interface function c2d is used to perform Tustin discretization:
[0149] Step 2: Use Matlab's standard frequency sweep API function to sweep the discretized filter constructed in step 1 to obtain the frequency characteristic data of the discretized filter in step 1;
[0150] Step 3, automatically sweep the frequency of the dynamic link library function of the model verification tool to obtain the frequency characteristic data of the library function;
[0151] Among them, the model verification tool dynamic link library function is automatically scanned, including:
[0152] (1) Setting the frequency range of the sweep signal. The sweep signal frequency w(i) starts at 0.01 Hz, increases in intervals of 0.01 Hz, and ends at 80 Hz.
[0153] (2) Setting the sampling time and constructing a cosine input signal based on the time series, the signal frequency is a certain frequency w(i) set in the step;
[0154] (2-1) Set the number of cycles N of the cosine input signal;
[0155] (2-2) Through the sampling frequency F s , the cosine signal angular frequency w(i) and the number of cosine input signal cycles N, calculate the number of sampling points L of the input signal:
[0156]
[0157] (2-3) Round up the number of sampling points L in step (2-2), and determine whether it is an even number after rounding. If it is not an even number, add 1 to make it an even number;
[0158] (2-4) According to the number of sampling points and sampling frequency, the time series of the input signal is calculated, and the cosine input signal based on the time series can be constructed.
[0159] (3) Performing a fast Fourier transform on the input signal to calculate the amplitude and phase of the input signal in the frequency domain;
[0160] (4) injecting the input signal into the dynamic link library function of the model verification tool to obtain the output of the dynamic library function of the model verification tool, performing a fast Fourier transform on the output signal, and calculating the amplitude and phase of the dynamic library function output signal in the frequency domain;
[0161] (5) Find the amplitude and phase of the input signal and the output signal at the frequency point w(i);
[0162] (5-1) Search for the position of the input signal and the output signal at the frequency point of step w(i)
[0163] Quote k:
[0164]
[0165] Among them: round means round down.
[0166] (5-2) By taking out the amplitude and phase of the input signal sequence and the output signal sequence at the kth point, we can obtain the amplitude and phase of the input signal and the output signal at the w(i) frequency point.
[0167] (6) Divide the amplitude of the output signal obtained in step (5) by the amplitude of the input signal in step (5) to obtain the amplitude-frequency characteristic of the model verification tool dynamic library function at the frequency point w(i). Divide the phase of the output signal obtained in step (5) by the phase of the input signal in step (5).
[0168] The phase of the input signal in the step is subtracted to obtain the phase-frequency characteristics of the dynamic library function of the model verification tool at the frequency point w(i);
[0169] (7) Increase w(i) by 0.1 Hz and repeat step (2) until w(i) reaches 80 Hz. This will give the amplitude-frequency characteristics of the dynamic library function from 0.1 Hz to 80 Hz and the amplitude-frequency characteristics of the discrete notch filter constructed by MATLAB API from 0.1 Hz to 80 Hz.
[0170] Step 4, automatically sweeping the discretized filter constructed in step 1 to obtain frequency characteristic data of the discretized filter in step 1;
[0171] The discretized filter constructed in step 1 is automatically swept, including:
[0172] (1) injecting the input signal in step (2) of step 3 into the discretization filter constructed in step 1, obtaining the output of the discretization filter constructed in step 1, performing a fast Fourier transform on the output signal, and calculating the amplitude and phase of the output signal of the discretization filter constructed in step 1 in the frequency domain;
[0173] (2) Find the amplitude and phase of the input signal and the output signal at the frequency point w(i);
[0174] (3) Divide the amplitude of the output signal obtained in step (1) by the amplitude of the input signal in step (5) of step 3 to obtain the amplitude-frequency characteristic of the discrete filter constructed in step 1 at the frequency point in step 3 (2), and subtract the phase of the output signal obtained in step (1) from the phase of the input signal in step 3 (5) to obtain the phase-frequency characteristic of the discrete filter constructed in step 1 at the frequency point w(i).
[0175] Step 5, determining whether the frequency characteristics of the standardized discretization filter obtained in step 2 are consistent with the filter parameter performance set in step 1;
[0176] Step 6, determining whether the model verification tool library function frequency characteristic data obtained in step 3 is consistent with the filter frequency characteristic data obtained in step 4;
[0177] Step seven, if the judgment in step five is consistent and step six is also consistent, then the dynamic link library function filtering function test result of the model verification tool passes, otherwise it fails.
[0178] Example 3
[0179] This embodiment provides a model verification tool MTST for a flight control system as an application example of the present invention. The reset function test of all dynamic link library functions in the model verification tool MTST specifically includes the following implementation steps:
[0180] Step 1: construct the filter transfer function and the input signal based on the time series;
[0181] Step 2: construct a reset signal sequence covering all scenarios;
[0182] Step 3: discretize the transfer function of the constructed dynamic link according to the tool requirements to obtain the difference equation;
[0183] Step 4: Inject the time series-based input signal In_v and the reset signal sequence reset into the discretized difference equation to calculate the expected output of the dynamic link;
[0184] Step 5: Inject the input signal based on the time series and the reset signal sequence into the dynamic library function of the model verification tool to calculate the actual output of the dynamic link of the tool under test;
[0185] Step six, determine whether the expected output and the actual output of the tool under test meet the set tolerance. If they are within the set tolerance range, the reset function test result passes, otherwise it fails.
[0186] For the filter function test of all dynamic link library functions in the model verification tool MTST, the specific implementation steps include the following:
[0187] Step 1: Set the filter parameters of the dynamic link library function of the model verification tool, and then use the API interface function c2d to discretize Tustin:
[0188] Step 2: Use Matlab's standard frequency sweep API function to sweep the discretized filter constructed in step 1 to obtain the frequency characteristic data of the discretized filter in step 1;
[0189] Step 3, automatically sweep the frequency of the dynamic link library function of the model verification tool to obtain the frequency characteristic data of the library function;
[0190] Step 5, determining whether the frequency characteristics of the standardized discretization filter obtained in step 2 are consistent with the filter parameter performance set in step 1;
[0191] Step 6, determining whether the model verification tool library function frequency characteristic data obtained in step 3 is consistent with the filter frequency characteristic data obtained in step 4;
[0192] Step seven, if the judgment in step five is consistent and step six is also consistent, then the dynamic link library function filtering function test result of the model verification tool passes, otherwise it fails.
[0193] It should be noted that the above process operations can be combined and applied to different degrees. For the sake of simplicity, the implementation methods of various combinations are not described in detail. Those skilled in the art can flexibly adjust the order of the steps of the above method (or the position of the components of the product) according to actual conditions, or perform operations such as combination.
[0194] It should be noted that the implementation of the functional components shown in the above embodiments can be hardware, software or a combination of the two. When implemented in hardware, it can be an electronic circuit, an application specific integrated circuit (ASIC), a plug-in, a function card, etc. When implemented in software, it can be a program or code segment used to perform the required task. The program or code segment can be stored in a machine or readable medium, or it can be transmitted on a transmission medium or a communication link through a data signal carried in a carrier.
[0195] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the field can easily think of various equivalent modifications or substitutions within the technical scope disclosed by the present invention, and these modifications or substitutions should all be covered within the protection scope of the present invention.
Claims
1. A model verification tool dynamic library function function test verification method, characterized in that: The method is used to test civil aircraft flight control software, wherein the test verification method of the reset function of the dynamic library function includes: S1, construct the filter transfer function and the input signal based on the time series; S2, construct a reset signal sequence covering all scenarios; S3, discretizing the transfer function of the constructed filter according to the requirements of the model verification tool to obtain a difference equation; S4, injecting the input signal based on the time series and the reset signal sequence into the discretized difference equation to calculate the expected output of the transfer function; S5, injecting the input signal based on the time series and the reset signal sequence into the dynamic library function of the model verification tool, and calculating and obtaining the actual output of the dynamic library function of the model verification tool under test; S6, judging whether the expected output and the actual output meet the set tolerance. If they are within the set tolerance range, the reset function test result passes, otherwise it fails.
2. The method according to claim 1, characterized in that S1 includes: Determine the parameters of the filter transfer function, including the time constant, the damping coefficient, and the natural frequency, set the filter sampling time, and construct the time series-based input signal to be processed by the filter according to the sampling time.
3. The method according to claim 1, characterized in that S2 include: S2-1: According to the sampling time set in step S1, a reset signal is constructed to trigger the filtering function, that is, the value of the reset signal in the first beat is 0, the reset function is not performed, and the filtering calculation starts at the initial moment; S2-2: Construct a scenario where the reset signal goes from 0 to 0, that is, to ensure that the dynamic link filter continues to perform filtering calculations; S2-3: Construct the scenario where the reset signal rises from 0 to 1, that is, ensure that the dynamic link filter is converted from the filtering calculation to the reset state at the current moment; S2-4: Construct a scenario where the reset signal goes from 1 to 1, that is, ensure that the dynamic link filter can be continuously reset without performing filtering calculations; S2-5: Construct the scenario of the falling edge of the reset signal from 1 to 0, that is, to ensure that the dynamic link filter is converted from the reset state to the filter calculation state; S2-6: Construct a scenario in which the reset signal is 1 at the first beat, that is, ensure that the dynamic link filter triggers reset at the first beat.
4. The method according to claim 1, characterized in that S3 include: S3-1: Determine whether to perform pre-distortion frequency correction at a specific frequency point according to the model verification tool requirements; S3-2: If pre-distortion correction is performed at a specific frequency point, use Matlab's own API interface to add pre-distortion correction to the constructed transfer function at the specific frequency point, and then use the API interface to perform Tustin discretization, otherwise Tustin discretization is performed directly.
5. A model verification tool dynamic library function function test verification method, characterized in that: The method is used to test the flight control software of a civil aircraft, wherein the test verification method of the dynamic library function filtering function includes: S1, set the filter parameters of the dynamic link library function of the model verification tool, and use the API interface of Matlab to construct a discretized filter according to the filter parameters; S2, using Matlab's standard frequency sweep API function to sweep the discretized filter constructed in step S1 to obtain first frequency characteristic data of the discretized filter; S3, automatically sweeping the filter of the dynamic link library function of the model verification tool to obtain frequency characteristic data of the filter of the library function; S4, automatically sweeping the frequency of the discretized filter constructed in step S1 to obtain second frequency characteristic data of the discretized filter in step S1; S5, determining whether the first frequency characteristic data of the discretized filter is consistent with the filter parameter performance set in step S1; S6, determining whether the frequency characteristic data of the filter of the model verification tool library function obtained in step S3 is consistent with the second frequency characteristic data of the discretized filter obtained in step S4; S7, if the judgment of step S5 is consistent and step S6 is also consistent, the dynamic characteristic test result of the filter of the dynamic link library function of the model verification tool passes, otherwise it fails.
6. The method according to claim 5, characterized in that S3 include: S3-1: Set the frequency range of the sweep signal. The sweep signal frequency w(i) starts at 0.1 Hz, increases in intervals of 0.1 Hz, and ends at 80 Hz. S3-2: Set the sampling time, and construct a cosine input signal based on the time series according to the sampling time. The angular frequency of the cosine input signal is w(i); S3-3: Perform fast Fourier transform on the cosine input signal to calculate the amplitude and phase of the cosine input signal in the frequency domain; S3-4: inject the cosine input signal into the dynamic link library function of the model verification tool to obtain the output signal of the dynamic library function of the model verification tool, perform fast Fourier transform on the output signal, and calculate the amplitude and phase of the dynamic library function output signal in the frequency domain; S3-5: Find the amplitude and phase of the cosine input signal and the output signal at the frequency point of step S3-2; S3-6: Divide the amplitude of the output signal obtained in step S3-5 by the amplitude of the input signal in step S3-5 to obtain the amplitude-frequency characteristic of the model verification tool dynamic library function at the frequency point of step S3-2, and subtract the phase of the output signal obtained in step S3-5 from the phase of the input signal in step S3-5 to obtain the phase-frequency characteristic of the model verification tool dynamic library function at the frequency point of step S3-2; S3-7: Increase w(i) by 0.1 Hz and return to step S3-2 until w(i) reaches 80 Hz. This will give the amplitude-frequency characteristics of the dynamic library function from 0.1 Hz to 80 Hz and the amplitude-frequency characteristics of the discrete filter constructed by MATLAB API from 0.1 Hz to 80 Hz.
7. The method according to claim 5, characterized in that S4 include: S4-1: inject the cosine input signal in S3-2 into the discretization filter constructed in step S1 to obtain the output signal of the discretization filter, perform fast Fourier transform on the output signal, and calculate the amplitude and phase of the output signal of the discretization filter in the frequency domain; S4-2: Find the amplitude and phase of the output signal in S4-1 at the frequency point of step S3-2; S4-3: Divide the amplitude of the output signal obtained in step S4-2 by the amplitude of the cosine input signal in step S3-5 to obtain the amplitude-frequency characteristic of the discretized filter at the frequency point of step S3-2, and subtract the phase of the output signal obtained in step S4-2 from the phase of the input signal in step S3-5 to obtain the phase-frequency characteristic of the discretized filter at the frequency point of step S3-2.
8. The method according to claim 6, characterized in that S3-2 includes: S3-2-1: Set the number of cycles N and sampling time of the cosine input signal; S3-2-2: Sampling frequency F corresponding to sampling time s , the cosine signal angular frequency w(i) and the number of cosine input signal cycles N, calculate the number of sampling points L of the input signal: S3-2-3: round up the number of sampling points L in step S3-2-2, and determine whether it is an even number after rounding. If it is not an even number, add 1 to make it an even number; S3-2-4: Based on the number of sampling points L and sampling frequency w(i) obtained in S3-2-3, the time series of the input signal is calculated, and a cosine input signal based on the time series can be constructed.
9. The method according to claim 6, characterized in that S3-5 includes: S3-5-1: Search the position index number k of the input signal and the output signal at the frequency point in step S3-2: Among them: round means round down; S3-5-2: Take out the amplitude and phase of the cosine input signal sequence and the output signal sequence at the kth point, and you can get the amplitude and phase of the input signal and the output signal at the frequency point of step S3-2.
10. The method according to claim 6, characterized in that The frequency characteristics of the signal calculated by the fast Fourier transform in step S4-1 include: S4-1-1: Use the API function fft provided by Matlab to perform Fourier transform on the signal to obtain the Y complex vector; S4-1-2: Normalize the complex vector Y and calculate the amplitude of the complex vector Y; S4-1-3: Take the 1st to (L / 2+1)th elements in the amplitude vector to get the amplitude vector of the signal in the frequency domain; S4-1-4: Take the 1st to (L / 2+1)th elements in the Y complex vector and calculate the complex angle of each element to obtain the phase vector of the signal in the frequency domain.
Citation Information
Patent Citations
Online detection method for torsion vibration signal of automotive power transmission system
CN101871846A
Method for adjusting frequency response parameter of machine tool and system using the same
CN111190363A
Design method of band elimination filter
CN115270676A
Parallel-axis helical gear box fault detection method based on support vector data description
CN118275114A
Method for minimizing center frequency shift and linearity errors in YIG filters
US20200373645A1