A model verification tool dynamic library function function test verification method
By constructing filter transfer functions and input signals and performing discretization processing, the safety and reliability issues of dynamic library functions in civil aircraft flight control systems are solved, thereby improving the safety and reliability of the system.
Patent Information
- Application Number
- CN202411897761.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-23
- Publication Date
- 2026-01-20
- Estimated Expiration
- 2044-12-23
AI Technical Summary
The software code of civil aircraft flight control systems is enormous, and manual writing is difficult to meet application requirements. The security and reliability of dynamic library functions in existing model verification tools cannot be guaranteed, which affects the reliability and security of the system.
The model verification tool dynamic library function functional testing verification method is adopted. By constructing the filter transfer function and input signal, discretizing them, and calculating the difference between the expected and actual output, the safety and reliability of the dynamic library function are ensured.
This improves the safety and reliability of civil aircraft flight control systems and ensures the high safety and reliability of dynamic library functions in model verification tools.
Smart Images

Figure CN119883894B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application relates to the technical field of civil aircraft flight control software testing, and particularly relates to a model verification tool dynamic library function function test verification method. BACKGROUND
[0002] With the increasing complexity of embedded systems and the continuous extension of the system scale, civil aircraft flight control system software code is very huge, and the manual code writing mode has been difficult to meet the application requirements. The model-based software development and verification (MBD&V) technology is an effective method to solve the problem. In the verification phase of verifying the consistency of the model and the system requirements, the model verification tool provides a high-safety and high-reliability library function, which can help testers greatly improve the verification efficiency, and thus improve the reliability and safety of the civil aircraft flight control system.
[0003] The core function of the model verification tool is to provide a high-safety and high-reliability library function, and in the field of civil aircraft flight control, dynamic links are used for control, therefore, the application proposes a model verification tool dynamic library function function test verification method for high-safety and critical fields, to ensure that the dynamic library function of the model verification tool has high safety and reliability. SUMMARY
[0004] The application aims to provide a model verification tool dynamic library function function test verification method, which can ensure that the dynamic library function of the model verification tool has high safety and reliability before the test personnel of the civil aircraft flight control system use the model verification tool to test the system, and thus improve the safety and reliability of the civil aircraft flight control system.
[0005] TECHNICAL SCHEME
[0006] A model verification tool dynamic library function function test verification method, the method is used for civil aircraft flight control software testing, wherein the test verification method of the reset function of the dynamic library function comprises the following steps:
[0007] S1, constructing a transfer function of a filter and a time series-based input signal;
[0008] S2, constructing 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 time series-based input signal and the reset signal sequence into the discretized difference equation, to calculate an expected output of the transfer function;
[0011] S5, inject the time series based input signal and the reset signal sequence into the dynamic library function of the model verification tool, and calculate the actual output of the dynamic library function of the measured model verification tool;
[0012] S6, judge whether the expected output and the actual output meet the set tolerance, if within the set tolerance range, the reset function test result is passed, otherwise, it is not passed.
[0013] Further, S1 comprises:
[0014] Determine the parameters of the filter transfer function, including time constant, damping coefficient and 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] Further, S2 comprises:
[0016] S2-1: according to the sampling time set in step S1, construct the reset signal triggering the filtering function, that is, the value of the reset signal at the first beat is 0, no reset function is performed, and the filtering calculation starts at the initial moment;
[0017] S2-2: construct the scenario of the reset signal rising from 0 to 1, that is, ensure that the dynamic link filter continues to perform filtering calculation;
[0018] S2-3: construct the scenario of the reset signal rising from 0 to 1, that is, ensure that the dynamic link filter at the current moment is converted from filtering calculation to reset state;
[0019] S2-4: construct the scenario of the reset signal rising from 1 to 1, that is, ensure that the dynamic link filter can continuously reset without filtering calculation;
[0020] S2-5: construct the scenario of the reset signal falling from 1 to 0, that is, ensure that the dynamic link filter is converted from the reset state to the filtering calculation state;
[0021] S2-6: construct the scenario of the reset signal being 1 at the first beat, that is, ensure that the dynamic link filter triggers reset at the first beat.
[0022] Further, S3 comprises:
[0023] S3-1: according to the requirement of the model verification tool, judge whether to perform pre-distortion frequency correction at a specific frequency point;
[0024] S3-2: if pre-distortion correction is performed at a specific frequency point, use the API interface provided by Matlab to add pre-distortion correction to the constructed transfer function at a specific frequency point, and then use the API interface for Tustin discretization, otherwise, directly perform Tustin discretization.
[0025] The application discloses a model verification tool dynamic library function function test verification method, and relates to the field of civil aircraft flight control software testing.
[0026] S1, setting filter parameters of a dynamic link library function of a model verification tool, and constructing a discretization filter by using an API interface of Matlab according to the filter parameters;
[0027] S2, performing frequency sweeping on the discretization filter constructed in the step S1 by using a standard frequency sweeping API function of Matlab, so as to obtain first frequency characteristic data of the discretization filter;
[0028] S3, performing automatic frequency sweeping on the filter of the dynamic link library function of the model verification tool, so as to obtain frequency characteristic data of the filter of the library function;
[0029] S4, performing automatic frequency sweeping on the discretization filter constructed in the step S1, so as to obtain second frequency characteristic data of the discretization filter in the step S1;
[0030] S5, judging whether the first frequency characteristic data of the discretization filter is consistent with the filter parameter performance set in the step S1;
[0031] S6, judging whether the frequency characteristic data of the filter of the library function of the model verification tool obtained in the step S3 is consistent with the second frequency characteristic data of the discretization filter obtained in the step S4;
[0032] S7, if the judgment in the step S5 is consistent and the judgment in the step S6 is also consistent, then the dynamic characteristic test result of the filter of the dynamic link library function of the model verification tool is passed, otherwise, the dynamic characteristic test result of the filter of the dynamic link library function of the model verification tool is not passed.
[0033] Further, the step S3 comprises:
[0034] S3-1, setting a frequency range of a frequency sweeping signal, the frequency w(i) of the frequency sweeping signal is 0.1 Hz at the beginning, is increased at an interval of 0.1 Hz, and is 80 Hz at the end;
[0035] S3-2, setting a sampling time, constructing a cosine input signal based on a time sequence according to the sampling time, and setting an angular frequency of the cosine input signal as w(i);
[0036] S3-3, performing fast Fourier transformation on the cosine input signal, and calculating the amplitude and the phase of the cosine input signal in the frequency domain;
[0037] S3-4, injecting the cosine input signal into the dynamic link library function of the model verification tool, obtaining an output signal of the dynamic link library function of the model verification tool, performing fast Fourier transformation on the output signal, and calculating the amplitude and the phase of the output signal of the dynamic link library function in the frequency domain;
[0038] S3-5: find the amplitude and phase of the output signal at the frequency point of S3-2 step;
[0039] S3-6: divide the amplitude of the output signal obtained in S3-5 step by the amplitude of the input signal in S3-5 step to obtain the amplitude-frequency characteristic of the model verification tool dynamic library function at the frequency point of S3-2 step, and subtract the phase of the output signal obtained in S3-5 step from the phase of the input signal in S3-5 step to obtain the phase-frequency characteristic of the model verification tool dynamic library function at the frequency point of S3-2 step;
[0040] S3-7: increase w(i) by 0.1 hz proportionally, return to S3-2 step, until w(i) reaches 80 hz, then the amplitude-frequency characteristic of the dynamic library function from 0.1 hz to 80 hz and the amplitude-frequency characteristic of the discrete filter constructed by MATLAB API from 0.1 hz to 80 hz can be obtained.
[0041] Further, S4 includes:
[0042] S4-1: inject the cosine input signal in S3-2 into the discrete filter constructed in S1 step to obtain the output signal of the discrete filter, and perform fast Fourier transform on the output signal to calculate the amplitude and phase of the discrete filter output signal in the frequency domain;
[0043] S4-2: find the amplitude and phase of the output signal in S4-1 at the frequency point of S3-2 step;
[0044] S4-3: divide the amplitude of the output signal obtained in S4-2 step by the amplitude of the cosine input signal in S3-5 step to obtain the amplitude-frequency characteristic of the discrete filter at the frequency point of S3-2 step, and subtract the phase of the output signal obtained in S4-2 step from the phase of the input signal in S3-5 step to obtain the phase-frequency characteristic of the discrete filter at the frequency point of S3-2 step.
[0045] Further, S3-2 includes:
[0046] S3-2-1: set the number of periods N and the sampling time of the cosine input signal;
[0047] S3-2-2: calculate the number of sampling points L of the input signal through the sampling frequency F s , the cosine signal angular frequency w(i) and the number of periods N of the cosine input signal:
[0048]
[0049] S3-2-3: round up the number of sampling points L in S3-2-2, and then determine whether it is even, if not, add 1 to make it even;
[0050] S3-2-4: according to the number of sampling points L and the sampling frequency w(i) obtained in S3-2-3, the time sequence of the input signal is calculated, and the cosine input signal based on the time sequence is constructed.
[0051] Further, 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 S3-2 step:
[0053]
[0054] Where: round is the down rounding.
[0055] S3-5-2: take out the amplitude and phase of the kth element of the cosine input signal sequence and the output signal sequence, and the amplitude and phase of the input signal and the output signal at the frequency point in S3-2 step are obtained.
[0056] Further, the fast Fourier transform calculation of the signal frequency characteristics in S4-1 step includes:
[0057] S4-1-1: use the API function fft provided by Matlab to perform Fourier transform on the signal to obtain Y complex vector;
[0058] S4-1-2: normalize the Y complex vector and calculate the amplitude of the complex vector Y;
[0059]
[0060] S4-1-3: take the first to the (L / 2+1)th element in the amplitude vector, and the amplitude vector of the signal in the frequency domain is obtained;
[0061] S4-1-4: take the first to the (L / 2+1)th element in the Y complex vector, and calculate the angle of each element of the complex number, and the phase vector of the signal in the frequency domain is obtained.
[0062] Beneficial effects:
[0063] The dynamic library function function test verification method of the model verification tool for high safety critical field can ensure that the dynamic library function in the model verification tool has high safety and reliability, and further improve the safety and reliability of the civil aircraft flight control system. BRIEF DESCRIPTION OF DRAWINGS
[0064] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings needed to be used in the description of the present application will be briefly described in the following. Obviously, the drawings described below only represent some of the embodiments of the present application, and for those skilled in the art, other drawings can also be obtained from these drawings without creative labor.
[0065] Figure 1 is a principle diagram of the dynamic library function reset function test verification method of the model verification tool for the high safety critical field according to the embodiments of the present application;
[0066] Figure 2 is a principle diagram of the dynamic library function dynamic feature test verification method of the model verification tool for the high safety critical field according to the embodiments of the present application;
[0067] Figure 3 is a flow diagram of the dynamic library function dynamic feature test verification method of the model verification tool for the high safety critical field according to the embodiments of the present application. DETAILED DESCRIPTION
[0068] In order to make the purpose, technical solutions and advantages of the embodiments of the present application more clear, the technical solutions of the embodiments of the present application will be clearly and completely described below in combination with the drawings of the embodiments of the present application. Obviously, the described embodiments are only some of the embodiments of the present application, not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor fall within the scope of protection of the present application.
[0069] The features of each aspect of the embodiments of the present application will be described in detail below. In the following detailed description, many specific details are proposed in order to have a comprehensive understanding of the present application. However, it is obvious for those skilled in the art that the present application can also be implemented without these specific details. The description of the embodiments below is only for better understanding of the present application by showing examples of the present application. The present application is not limited to any specific settings and methods provided below, but covers all improvements, replacements, etc. of product structures, methods without departing from the spirit of the present application. In each drawing and the following description, the known structures and technologies are not shown in order to avoid unnecessary obscuring of the present application.
[0070] It should be noted that the embodiments of the present application and the features in the embodiments can be combined with each other without conflict, and each embodiment can be mutually referred to and quoted. The present application will be described in detail below with reference to the drawings and in combination with the embodiments.
[0071] As Figures 1 to 3As shown, the application provides a model verification tool dynamic library function function test verification method for high safety critical fields, the test verification method is used for testing civil aircraft flight control software, wherein the test verification method of the reset function of the dynamic library function comprises:
[0072] S1, construct the transfer function of the filter and the time series based input signal;
[0073] S2, construct a reset signal sequence covering all scenarios;
[0074] S3, discretize the transfer function of the constructed filter according to the requirements of the model verification tool, to obtain a difference equation;
[0075] S4, inject the time series based input signal and the reset signal sequence into the discretized difference equation to calculate the expected output of the transfer function;
[0076] S5, inject the time series based input signal and the reset signal sequence into the dynamic library function of the model verification tool to calculate the actual output of the dynamic library function of the measured model verification tool;
[0077] S6, judge whether the expected output and the actual output meet the set tolerance, if within the set tolerance range, the reset function test result is passed, otherwise it is not passed.
[0078] Specifically, S1 comprises:
[0079] Determine the parameters of the filter transfer function, including time constant, damping coefficient and natural frequency, set the filter sampling time, and construct the time series based input signal to be processed of the filter according to the sampling time.
[0080] Specifically, S2 comprises:
[0081] S2-1: according to the sampling time set in step S1, construct the reset signal triggering the filter function, that is, the reset signal is 0 at the first beat, without reset function, and the filter calculation starts at the initial time;
[0082] S2-2: construct the scenario of the reset signal from 0 to 0, that is, ensure that the dynamic link filter continues to calculate the filter;
[0083] S2-3: construct the scenario of the rising edge of the reset signal from 0 to 1, that is, ensure that the dynamic link filter is converted from filter calculation to reset state at the current time;
[0084] S2-4: construct the scenario of the reset signal from 1 to 1, that is, ensure that the dynamic link filter can continuously reset without filter calculation;
[0085] S2-5: Construct the scenario of the falling edge of the reset signal from 1 to 0, that is, ensure that the dynamic link filter is converted from the reset state to the filter calculation state;
[0086] S2-6: Construct the scenario of the reset signal being 1 at the first beat time, that is, ensure that the dynamic link filter triggers the reset at the first beat time.
[0087] Specifically, S3 includes:
[0088] S3-1: According to the model verification tool requirement, determine whether to perform pre-distortion frequency correction at a specific frequency point;
[0089] S3-2: If pre-distortion correction is performed at a specific frequency point, use the API interface provided by Matlab to add pre-distortion correction to the constructed transfer function at the specific frequency point, and then use the API interface for Tustin discretization, otherwise directly perform Tustin discretization.
[0090] In a second aspect, the dynamic characteristic test and verification method of the model verification tool dynamic library function includes:
[0091] S1, set the filter parameters of the model verification tool dynamic link library function, and use the API interface of Matlab to construct a discretized filter according to the filter parameters;
[0092] S2, use the standard sweep API function of Matlab to sweep the discretized filter constructed in step S1 to obtain first frequency characteristic data of the discretized filter;
[0093] S3, automatically sweep the filter of the model verification tool dynamic link library function to obtain the frequency characteristic data of the filter of the library function;
[0094] S4, automatically sweep the discretized filter constructed in step S1 to obtain second frequency characteristic data of the discretized filter of step S1;
[0095] S5, determine whether the first frequency characteristic data of the discretized filter is consistent with the filter parameter performance set in step S1;
[0096] S6, determine 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 step S5 is consistent and the step S6 is also consistent, the dynamic characteristic test result of the filter of the dynamic link library function of the model verification tool is passed, otherwise it is not passed.
[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 and increases in increments of 0.1 Hz, ending at 80 Hz.
[0100] S3-2: Set the sampling time and construct a time-series-based cosine input signal based on the sampling time. The angular frequency of the cosine input signal is w(i).
[0101] S3-3: Perform a 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 a fast Fourier transform on the output signal to calculate the amplitude and phase of the output signal of the dynamic library function in the frequency domain.
[0103] S3-5: Find the amplitude and phase of the cosine input and output signals at the frequency points in 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 dynamic library function of the model verification tool at the frequency point of step S3-2. 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 dynamic library function of the model verification tool at the frequency point of step S3-2.
[0105] S3-7: Increment w(i) by 0.1 Hz and return to step S3-2 until w(i) reaches 80 Hz. This will give you the amplitude-frequency characteristics of the dynamic library function from 0.1 Hz to 80 Hz, as well as the amplitude-frequency characteristics of the discretized filter built by the MATLAB API from 0.1 Hz to 80 Hz.
[0106] Specifically, S3-2 includes:
[0107] S3-2-1: Set the number of periods N and sampling time of the cosine input signal;
[0108] S3-2-2: The sampling frequency F corresponding to the sampling time s Given the angular frequency w(i) of the cosine signal and the number of periods N of the cosine input signal, 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. After rounding, determine whether it is even. If it is not even, add 1 to make it even.
[0111] S3-2-4: According to the number of sampling points L and the sampling frequency w(i) obtained in S3-2-3, the time sequence of the input signal is calculated, and the cosine input signal based on the time sequence is 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 S3-2 step:
[0114]
[0115] Where: round is the down rounding.
[0116] S3-5-2: Take out the amplitude and phase of the first k of the cosine input signal sequence and the output signal sequence, that is, the amplitude and phase of the input signal and the output signal at the frequency point in S3-2 step.
[0117] Specifically, S4 includes:
[0118] S4-1: Inject the cosine input signal in S3-2 into the discrete filter constructed in S1 step to obtain the output signal of the discrete filter, and perform fast Fourier transform on the output signal to calculate the amplitude and phase of the discrete filter output signal in the frequency domain;
[0119] S4-2: Find the amplitude and phase of the output signal in S4-1 at the frequency point in S3-2 step;
[0120] S4-3: Divide the amplitude of the output signal obtained in S4-2 step by the amplitude of the cosine input signal in S3-5 step to obtain the amplitude-frequency characteristic of the discrete filter at the frequency point in S3-2 step, and subtract the phase of the output signal in S4-2 step from the phase of the input signal in S3-5 step to obtain the phase-frequency characteristic of the discrete filter at the frequency point in S3-2 step.
[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 Y complex vector;
[0123] S4-1-2: Normalize the Y complex vector and calculate the amplitude of the complex vector Y;
[0124]
[0125] S4-1-3: Take the first to the (L / 2+1)th element in the amplitude vector, that is, the amplitude vector of the signal in the frequency domain can be obtained.
[0126] S4-1-4: Take the first to the (L / 2+1)th element in the Y complex vector, and calculate the angle of each element of the complex number, that is, the phase vector of the signal in the frequency domain.
[0127] Embodiment 1
[0128] Figure 1 is the principle diagram of the function test verification method for the notch_filter (reset-end notch filter) function of the model verification tool of an embodiment of the application.
[0129] As shown in Figure 1 , the test verification of the reset function of the function in the method can include the following steps:
[0130] Step 1, constructing the transfer function of the filter and the input signal based on time series;
[0131] Among them, the transfer function of the filter and the input signal include:
[0132] Set the notch frequency (center frequency) f n of the notch filter = 10 Hz, the notch depth (signal attenuation multiple) depth = 0.01 (i.e. -40 dB), set the denominator damping coefficient DENdamping = 2 of the notch filter, according to the notch frequency and the notch depth, the numerator damping coefficient NUMdamping = depth × DENdamping can be calculated, set the filter sampling time T s = 0.025 s, and the input signal based on time series to be processed by the filter is In_v.
[0133] Step 2, constructing a reset signal sequence covering all scenarios;
[0134] Among them, constructing a reset signal sequence covering all scenarios includes:
[0135] According to the sampling time, the reset signal sequence reset based on time series is constructed, as shown in the following table:
[0136] Time Beat 1 Beat 2 Beat 3 Beat 4 Beat 5 Reset 0 0 1 1 0
[0137] Time Beat 1 Beat 2 Beat 3 Beat 4 Beat 5 Reset 1 1 0 0 1
[0138] Step 3, discretizing the transfer function of the constructed dynamic link according to the tool requirements to obtain a difference equation;
[0139] Among them, the transfer function discretization includes:
[0140] (1) According to the model verification tool requirement, the notch filter with reset end needs to be pre-distortion frequency corrected at the natural frequency point;
[0141] (2) 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 for Tustin discretization:
[0142] Step four, the time series based input signal In_v and the reset signal sequence reset are injected into the discretized difference equation, and the expected output of the dynamic link is calculated;
[0143] Step five, the time series based input signal and the reset signal sequence are injected into the dynamic library function of the model verification tool, and the actual output of the dynamic link of the measured tool is calculated;
[0144] Step six, judge whether the expected output and the actual output of the measured tool meet the set tolerance, if within the set tolerance range, the reset function test result is passed, otherwise it is not passed.
[0145] Embodiment 2
[0146] Figure 2 is the principle diagram of the function test verification method for the model verification tool dynamic library function notch_filter (notch filter with reset end) of an embodiment of the application.
[0147] As Figure 2 shown, the test verification of the filter function of the function in the method can include the following steps:
[0148] Step one, set the filter parameters of the model verification tool dynamic link library function, set the notch frequency (center frequency) f n = 10hz, the notch depth (signal attenuation multiple) depth = 0.01 (i.e. -40dB), set the denominator damping coefficient DENdamping = 2 of the notch filter, according to the notch frequency and the notch depth, the numerator damping coefficient NUMdamping = depth×DENdamping can be calculated, set the filter sampling time T s = 0.025s, construct the time series based input signal In_v to be processed by the filter, and use the API interface function c2dOptions of Matlab to add pre-distortion correction to the constructed transfer function at the natural frequency point, and then use the API interface function c2d for Tustin discretization:
[0149] Step two, using the standard sweep API function of Matlab to sweep the discrete filter constructed in step one, to obtain the frequency characteristic data of the discrete filter in step one;
[0150] Step three, automatically sweeping the dynamic link library function of the model verification tool, to obtain the frequency characteristic data of the library function;
[0151] Among them, automatically sweeping the dynamic link library function of the model verification tool, including:
[0152] (1) Set the frequency range of the sweep signal, the frequency w(i) of the sweep signal starts at 0.01hz, increases by 0.01hz intervals, and ends at 80hz;
[0153] (2) Set the sampling time, construct the cosine input signal based on the time series, and the signal frequency is a certain frequency w(i) set in the step;
[0154] (2-1) Set the period number N of the cosine input signal;
[0155] (2-2) Calculate the number of sampling points L of the input signal through the sampling frequency F s , the angular frequency w(i) of the cosine signal, and the period number N of the cosine input signal:
[0156]
[0157] (2-3) Take the integer part of the number of sampling points L in step (2-2) upwards, and then judge whether it is even after taking the integer part. If it is not even, add 1 to make it even;
[0158] (2-4) According to the number of sampling points and the sampling frequency, calculate the time series of the input signal, that is, construct the cosine input signal based on the time series.
[0159] (3) Perform fast Fourier transform on the input signal to calculate the amplitude and phase of the input signal in the frequency domain;
[0160] (4) Inject 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, and perform fast Fourier transform on the output signal to calculate the amplitude and phase of the output signal in the frequency domain;
[0161] (5) Find the amplitude and phase of the input signal and the output signal at the w(i) frequency point;
[0162] (5-1) Search the position index k of the input signal and the output signal at the w(i) step frequency point:
[0163] The quotation mark k:
[0164]
[0165] wherein round is the floor function.
[0166] (5-2) Take the amplitude and phase of the input signal sequence and the output signal sequence at the kth, that is, 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). Subtract the phase of the output signal obtained in step (5) from the phase of the input signal in step (5) to obtain the phase-frequency characteristic of the model verification tool dynamic library function at the frequency point w(i).
[0168]
[0169] (7) Increment w(i) by 0.1 hz, repeat step (2) until w(i) reaches 80 hz, that is, the amplitude-frequency characteristic of the dynamic library function at 0.1 hz to 80 hz, and the amplitude-frequency characteristic of the MATLAB API constructed discrete wave filter at 0.1 hz to 80 hz.
[0170] Step four, automatically sweep the frequency of the discrete filter constructed in step one to obtain the frequency characteristic data of the discrete filter in step one.
[0171] wherein automatically sweeping the frequency of the discrete filter constructed in step one comprises:
[0172] (1) Inject the input signal in step three (2) into the discrete filter constructed in step one to obtain the output of the discrete filter constructed in step one, and perform fast Fourier transform on the output signal to calculate the amplitude and phase of the output signal of the discrete filter constructed in step one in the frequency domain.
[0173] (2) Find the amplitude and phase of the input signal and the output signal at the w(i) frequency point.
[0174] (3) Divide the amplitude of the output signal obtained in step (1) by the amplitude of the input signal in step three (5) to obtain the amplitude-frequency characteristic of the discrete filter constructed in step one at the frequency point in step three (2). Subtract the phase of the output signal obtained in step (1) from the phase of the input signal in step three (5) to obtain the phase-frequency characteristic of the discrete filter constructed in step one at the frequency point w(i).
[0175] Step five, determine whether the frequency characteristic of the standardized discrete filter obtained in step two is consistent with the filter parameter performance set in step one.
[0176] Step six, judging whether the model verification tool library function frequency characteristic data obtained in step three is consistent with the filter frequency characteristic data obtained in step four;
[0177] Step seven, if the judgment in step five is consistent and the judgment in step six is also consistent, then the dynamic link library function filter function test result of the model verification tool is passed, otherwise it is not passed.
[0178] Embodiment 3
[0179] In this embodiment, all dynamic link library functions in the model verification tool MTST for the flight control system are provided as application examples of the application. For the reset function test of all dynamic link library functions in the model verification tool MTST, the specific implementation steps include:
[0180] Step one, constructing the transfer function of the filter and the time series based input signal;
[0181] Step two, constructing the reset signal sequence covering all scenarios;
[0182] Step three, discretizing the transfer function of the dynamic link according to the tool requirements to obtain the difference equation;
[0183] Step four, injecting 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 five, injecting the time series based input signal and the reset signal sequence into the dynamic library function of the model verification tool to calculate the actual output of the measured tool dynamic link;
[0185] Step six, judging whether the expected output and the actual output of the measured tool meet the set tolerance, if within the set tolerance range, then the reset function test result is passed, otherwise it is not passed.
[0186] For the filter function test of all dynamic link library functions in the model verification tool MTST, the specific implementation steps include:
[0187] Step one, setting the filter parameters of the model verification tool dynamic link library function, and then using the API interface function c2d for Tustin discretization:
[0188] Step two, using the standard sweep API function of Matlab to sweep the discretized filter constructed in step one to obtain the frequency characteristic data of the discretized filter in step one;
[0189] Step three, the model verification tool dynamic link library function is automatically swept, and the frequency characteristic data of the library function is obtained;
[0190] Step five, whether the frequency characteristic of the standardized and discretized filter obtained in step two is consistent with the filter parameter performance set in step one is judged;
[0191] Step six, whether the frequency characteristic data of the model verification tool library function obtained in step three is consistent with the filter frequency characteristic data obtained in step four is judged;
[0192] Step seven, if the judgment in step five is consistent and the judgment in step six is also consistent, the filter function test result of the dynamic link library function of the model verification tool is passed, otherwise, it is not passed.
[0193] It should be noted that the above process operations can be combined to different degrees. In order to be simple, the implementation of various combinations will not be described. 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 the actual situation, or combine and the like.
[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 functional card, etc. When implemented in software, it can be a program or a code segment used to perform the required tasks. The program or code segment can be stored in a machine or a readable medium, or it can be transmitted through a data signal carried in a carrier wave on a transmission medium or a communication link.
[0195] Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, but the protection scope of the present application is not limited thereto. Any skilled person in the art can easily think of various equivalent modifications or replacements within the technical range disclosed by the present application, and these modifications or replacements should be covered within the protection scope of the present application.
Claims
1. A method for testing and verifying the functionality of dynamic library functions in a model validation tool, characterized in that, The method is used to test civil aircraft flight control software, wherein the testing and verification method for the dynamic library function filtering function includes: S1. Set the filter parameters of the dynamic link library function of the model validation tool, and use the Matlab API interface to construct the discretized filter based on the filter parameters. S2, use the standard frequency sweep API function of Matlab to sweep the frequency of the discretized filter constructed in step S1 to obtain the first frequency characteristic data of the discretized filter; S3, automatically sweep the frequency of the filters in the dynamic link library function of the model verification tool to obtain the frequency characteristic data of the filters in the library function; S4. Perform automatic frequency sweeping on the discretized filter constructed in step S1 to obtain the second frequency characteristic data of the discretized filter in step S1. S5, determine whether the first frequency characteristic data of the discretized filter is consistent with the filter parameter performance set in step S1; S6. Determine whether the frequency characteristic data of the filter obtained from the model verification tool library function in step S3 is consistent with the second frequency characteristic data of the discretized filter obtained in step S4. S7. If the judgments in steps S5 and S6 are consistent, then the dynamic characteristic test result of the filter in the dynamic link library function of the model verification tool passes; otherwise, it fails. S3 includes: S3-1: Set the frequency range of the sweep signal. The sweep signal frequency f(i) starts at 0.1 Hz and increases in increments of 0.1 Hz, ending at 80 Hz. S3-2: Set the sampling time and construct a time-series-based cosine input signal based on the sampling time. The angular frequency of the cosine input signal is w(i). S3-3: Perform a 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 a fast Fourier transform on the output signal to calculate the amplitude and phase of the output signal of the dynamic library function in the frequency domain. S3-5: Find the amplitude and phase of the cosine input and output signals at the frequency points in 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 dynamic library function of the model verification tool at the frequency point of step S3-2. 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 dynamic library function of the model verification tool at the frequency point of step S3-2. S3-7: Increment f(i) by 0.1 Hz and return to step S3-2 until f(i) reaches 80 Hz. This will give you the amplitude-frequency characteristics of the dynamic library function from 0.1 Hz to 80 Hz, as well as the amplitude-frequency characteristics of the discretized filter built by the MATLAB API interface from 0.1 Hz to 80 Hz.
2. The method according to claim 1, characterized in that, S4 include: S4-1: Inject the cosine input signal from S3-2 into the discretized filter constructed in step S1 to obtain the output signal of the discretized filter. Perform a fast Fourier transform on the output signal to calculate the amplitude and phase of the output signal of the discretized filter in the frequency domain. S4-2: Find the amplitude and phase of the output signal in S4-1 at the frequency point in 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. 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.
3. The method according to claim 2, characterized in that, S3-2 includes: S3-2-1: Set the number of periods N and sampling time of the cosine input signal; S3-2-2: The sampling frequency F corresponding to the sampling time s Given the angular frequency w(i) of the cosine input signal and the number of periods N of the cosine input signal, 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. After rounding, determine whether it is even. If it is not even, add 1 to make it even. S3-2-4: Based on the number of sampling points L and the angular frequency w(i) of the cosine input signal obtained in S3-2-3, the time series of the input signal can be calculated, and the cosine input signal based on the time series can be constructed.
4. The method according to claim 3, characterized in that, S3-5 includes: S3-5-1: Search for the index number k of the position of the input and output signals at the frequency point in step S3-2: ; Where: round means round down; S3-5-2: Extract the amplitude and phase of the cosine input signal sequence and the output signal sequence at the kth position to obtain the amplitude and phase of the input signal and the output signal at the frequency point of step S3-2.
5. The method according to claim 4, characterized in that, The Fast Fourier Transform (FFT) step S4-1 calculates the frequency characteristics of the signal, including: S4-1-1: Use the standard frequency sweep API function provided by Matlab to perform a Fourier transform on the signal to obtain the complex vector of Y; S4-1-2: Normalize the complex vector Y and calculate the amplitude of the complex vector Y; ; S4-1-3: Take the first to (L / 2+1)th elements in the amplitude vector to obtain the amplitude vector of the signal in the frequency domain; S4-1-4: Take the first to (L / 2+1)th elements of the complex vector Y, and calculate the complex angle for 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
Parallel-axis helical gear box fault detection method based on support vector data description
CN118275114A