CN110637522B - Control law gain model automatic generation method and system - Google Patents

Control law gain model automatic generation method and system Download PDF

Info

Publication number
CN110637522B
CN110637522B CN201618009510.5A CN201618009510A CN110637522B CN 110637522 B CN110637522 B CN 110637522B CN 201618009510 A CN201618009510 A CN 201618009510A CN 110637522 B CN110637522 B CN 110637522B
Authority
CN
China
Prior art keywords
gain
file
model
information
checking
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201618009510.5A
Other languages
Chinese (zh)
Inventor
王云明
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shanghai Aviation Information Technology Co ltd
Original Assignee
Shanghai Aviation Information Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shanghai Aviation Information Technology Co ltd filed Critical Shanghai Aviation Information Technology Co ltd
Priority to CN201618009510.5A priority Critical patent/CN110637522B/en
Application granted granted Critical
Publication of CN110637522B publication Critical patent/CN110637522B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Stored Programmes (AREA)

Abstract

The invention belongs to the technical field of flight control, and relates to a control law gain model generation method and a system; the method comprises the steps of control law gain file definition, gain file validity check, gain file preprocessing, automatic gain model generation, gain information display and modeling specification check; the system comprises a control law gain file definition module, a gain file validity check module, a gain file preprocessing module, a gain model automatic generation module, a gain information display module and a modeling specification check module. The method and the system for automatically generating the control law gain model can automatically check the control law gain file described by the formal language and generate the SCADE gain model according to the correct control law gain file. After the gain model is generated, the system also provides a graphical interface to assist the user in visually checking whether the gain information is consistent with the gain description file.

Description

Control law gain model automatic generation method and system
Technical Field
The invention belongs to the technical field of flight control, and relates to a control law gain model generation method and system.
Background
In the development process of the airborne software control law of the existing flight control system, a Windows-based SCADE model development tool becomes a more core link in the development process of the control law of the whole flight control system.
The existing development work of users is carried out under a UNIX platform, and the inheritability and readability of the development work of the control law are poor due to the environment particularity. Therefore, it is necessary to provide tools and means for aided design based on the SCADE model to efficiently develop the onboard software control law of the flight control system and ensure that the correct control law code conforming to the coding specification is generated.
0 shows the basic flow of the traditional control law gain modeling; the existing control law gain modeling method comprises the following steps:
and S1, manually establishing a gain model, and manually designing the gain model in an SCADE modeling tool by engineering personnel according to the control law gain requirement described by the natural language. The method comprises the contents of gain type, constant, gain implementation and the like;
s2, manually checking errors, wherein after an engineer manually establishes a gain model, the engineer needs to manually check the correctness of the model, and the method comprises the following steps: gain type, gain name, calculation period, calling period, switching value name, switching value combination, dimension and type of interpolation curve, data of gain calculation and the like;
and S3, checking the modeling specification, and after the logic of the gain model is confirmed to be accurate, checking the modeling specification of the model to ensure that the model meets the modeling specification, so that the gain model can generate correct codes.
And S4, automatically generating codes, and after the model check is completed, directly generating control law codes from the model by calling a code generator (KCG) built in SCADE.
The traditional gain modeling method has the following defects:
(1) the workload of manually establishing the gain model is large. And aiming at each control law gain type and the corresponding graph siton transformation type, manually establishing a gain model in the SCADE model. The combination of the control law gain type and the tustine transformation type is various, the steps of the gain model created each time are fixed, and the repeated manual workload is large.
(2) The gain model is not easy to maintain by manual establishment. Because parameters in the control law gain have a great influence on the performance of the flight control system, the control law gain parameters need to be frequently adjusted in the test and debugging process. Once the adjustment occurs, the corresponding gain requirement, gain model, must be changed synchronously. If changed by manual maintenance, the workload is great.
The inspection of manually building the gain model is too cumbersome. The gain model developed based on the gain requirement needs to be checked for various errors to ensure the correctness of the gain model. The method comprises the following steps: gain type, gain name, calculation period, calling period, switching value name, switching value combination, dimension and type of interpolation curve, data of gain calculation and the like. Although the inspection is subject to certain rules, the inspection completely depends on manual inspection, which increases labor cost and avoids omission of manual inspection.
In view of the above, there is an urgent need to design a new gain model generation method to overcome the above-mentioned shortcomings of the existing control method.
Disclosure of Invention
The invention aims to: the method for automatically generating the control law gain model can automatically check the control law gain file described by the formal language and generate the SCADE gain model according to the correct control law gain file.
In addition, the invention also provides an automatic generation system of the control law gain model, which can automatically check the control law gain file described by the formal language and generate the SCADE gain model according to the correct control law gain file.
In order to achieve the purpose, the invention adopts the following technical scheme:
the method and the system for automatically generating the control law gain model can automatically check the control law gain file described by the formal language and generate the SCADE gain model according to the correct control law gain file. After the gain model is generated, the system also provides a graphical interface to assist the user in visually checking whether the gain information is consistent with the gain description file. The system realizes high automation of the control law development process: the method can not only automatically check the error of the gain information, but also realize the automatic graph siten conversion of the interpolation curve, the automatic generation of the SCADE gain model, the automatic generation of the control rate code, the automatic calculation and the display of the interpolation curve, liberate developers from the redundant and non-technical functions and can be put into creative work.
Compared with the prior art, the invention has the following advantages:
(1) the gain model is built quickly. By converting the gain requirement into a formal gain description file according to a specific format and automatically generating the gain model based on the formal gain description file, the whole manual modeling process is completely automated by the system, and the time and the cost for developing the model are greatly reduced.
(2) The correctness of the gain model is improved. Through various validity checks provided by the system, the correctness of various information of the gain model is ensured, the workload of manual check is reduced, and the quality of the gain model is also ensured.
(3) Easy to debug and maintain. Parameters in the control law gain greatly affect the performance of the flight control system, so that the control law gain parameters need to be frequently adjusted and changed in the test and debugging process. By using the system, the influence of the gain parameters can be intuitively acquired only by changing the information in the gain description file or directly by the gain graphic display function every time, thereby facilitating debugging and maintenance.
(4) The high automation of the whole development process is realized, developers are liberated from encumbrance and non-technical work, and creative work is carried out. The automated process includes (a) automatic error checking of the gain information; (b) automatic Lanstine conversion of the interpolation curves; (c) automatically calculating the slope and intercept of the interpolation curve; (d) automatic generation of a SCADE gain model.
(5) Good look-ahead. The method has good openness, and can use a new future research and development process (model-based development and verification become a new direction of embedded software development); the method has good universality, not only completely supports the existing model, but also is completely suitable for future models; the method is suitable for development of not only multi-rate groups but also single-rate groups.
Drawings
Fig. 1 is a flowchart of a conventional gain modeling method.
FIG. 2 is an architecture diagram of an automatic generation system of control law gain model according to the present invention.
FIG. 3 is a flow chart of gain file preprocessing in the method of the present invention.
FIG. 4 is a flow chart of a gain model toolbar interface implementation of the method of the present invention.
FIG. 5 is a flow chart of automatic gain generation in the method of the present invention.
FIG. 6 is a flow chart of the design of the gain information display function in the method of the present invention.
FIG. 7 is a flow chart illustrating a graphical display function of the method of the present invention.
FIG. 8 is a flow chart of naming convention checking in the method of the present invention.
FIG. 9 is a flowchart of complexity checking in the method of the present invention.
FIG. 10 is a schematic view of a gain model toolbar interface.
Fig. 11 is a schematic view of a gain information file selection interface.
FIG. 12 is a schematic view of a gain information display toolbar.
Fig. 13 is a schematic view of a gain information display interface.
FIG. 14 is a modeling specification review toolbar diagram.
FIG. 15 is a schematic view of a modeling specification checking interface.
Detailed Description
The present invention will be described in detail below with reference to the accompanying drawings.
Example one
A method for automatically generating a control law gain model, as shown in fig. 2, includes:
step S1, defining a control law gain file;
through the design of a gain description file, the gain requirement described by a natural language is converted into a formalized text which can be read by a tool;
automatically checking the validity by using a gain file described by a formal language, and automatically generating an SCADE gain model by directly using the gain file as input;
step S2, checking the validity of the gain file;
providing a plurality of legality checking rules, checking the legality of the gain file:
generating a correct gain model for the gain files meeting the rules; for the gain files which do not meet the rules, giving alarm information, and listing error gain names and error gain ending line contents;
step S3, gain file preprocessing step;
for the formalized gain description file, preprocessing is needed before formally generating an SCADE gain model, partial logic rows and output quantities meeting requirements are combined, and the gain file is optimized so as to improve the realization efficiency of the gain model;
the processing flow of the gain file preprocessing step comprises the following steps:
step S31, opening a gain information file;
step S32, reading a line of data and recording a downlink number;
step S33, judging whether the gain is new, if so, turning to step S34, otherwise, turning to step S32;
step S34, starting to record the current gain data, judging whether the gain data is a line break symbol, if so, turning to step S35, otherwise, combining logic lines, and turning to step S32;
step S35, recording the read logic row, and turning to step S36;
step S36, recording a new logic line;
step S37, judging whether the gain is finished, if yes, turning to step S38; otherwise go to step S32;
step S38, merging the current gain information, starting new gain information analysis, and turning to step S32;
step S4, a gain model automatic generation step;
by using an interface expansion function provided by SCADE, using TCL script language, customizing toolbar buttons, menus and dialog boxes for importing gain files and automatically generating gain models in the SCADE environment; the automatic generation flow comprises the following steps:
step S41, an initialization step; the method comprises the following steps: assigning values to some variables to prepare for later work;
step S42, analyzing the input file; the method comprises the following steps: filtering the empty line; merging the physical rows and processing the physical rows into logic rows; checking the integrity of the input and the correctness of the format; preprocessing the interpolation curve data;
step S43, a gain node generation step; the method comprises the following steps: calling AnalisNodeInfo to perform detailed analysis on the information of the node: preparing information for generation of models of types, constants, nodes, and the like; and generating a type definition file: xscade, and adding to the model; generating a constant definition file: autoconsts. xscade, and added to the model; calling createimport operators to generate a model file corresponding to the import operator, and adding the model file into the model; generating an RAM variable marking node model file and adding the RAM variable marking node model file into the model; generating a switching value calculation node file and adding the switching value calculation node file into the model; generating a gain node file for each gain, and adding the gain node file into a model; calling createintegattednodes to generate an integrated node file, and adding the integrated node file into the model;
step S5, a gain information display step;
displaying the gain information; after the gain description file is imported into the automatic SCADE node, visually checking whether the gain information is consistent with the gain description file or not in a graphical interface mode;
displaying related information of the gain nodes through an intuitive graphical interface, and guiding a user to operate through characters, graphs, controls and warning information; a user selects a certain gain node in the SCADE, and clicks a key for correspondingly displaying gain information, so that the related gain information can be observed;
automatically reading comment information in the automatically generated gain nodes in the SCADE, formatting the data and displaying the data to a graphical interface; the method mainly comprises the following steps: two functions of reading comment information and calculating an interpolation curve;
the gain information display process of the gain information display step includes:
step S51, gain information analysis is carried out on the SCADE node comment data;
step S52, displaying the analyzed gain information to a graphical interface;
step S53, carrying out interpolation calculation; if the dimension is 0, reading a constant value; if the dimension is 1, respectively reading X, Y values, and respectively reading a coefficient, b coefficient, c coefficient and d coefficient; if the dimension is 2, respectively reading in two coefficients a and b; turning to step S52;
the one-dimensional interpolation curve graph observation function is started by a command line when a user selects a corresponding switching value combination on a gain information display interface to observe a curve, and simultaneously, information of a gain node is written into a temporary file and is brought into a gain information display module through a format of a command line parameter;
the gain information display step comprises a specified data file reading step, a data and window initialization step, a graphical interface display step, a display mode switching step and an X value input calculation interpolation step;
in the step of reading the specified data file, reading the file in the specified format and analyzing the switching value combination, the switching value, the value and the coefficient information;
in the data and window initialization step, the coordinate values automatically adapt to extreme values according to the data size, and the actual coordinate range and the screen coordinate range of the graph are drawn according to the extreme values;
in the graphical interface display step, 2-time magnification display, curve/broken line mode switching and graphical scrolling display are realized;
in the display mode switching step, switching between the display modes of the graph and the table is realized;
in the step of inputting the X value into the calculation interpolation, the Lanstine conversion is realized, the one-dimensional interpolation is calculated, and the result of the original value and the Lanstine conversion are provided for comparison;
the graphic display process in the gain information display step includes:
step A51, reading in a file with a specified format;
step A52, initializing data and window;
step A53, displaying an interface;
step A54, waiting for user input; if the information input by the user corresponds to the switching value selection or the display mode switching or the X value input calculation interpolation, feeding back to the step A53 according to the input information of the user for display; if the information input by the user is correspondingly quitted, the program is terminated;
step S6, a modeling specification checking step;
checking whether the model meets the specification; the SCADE tool is internally provided with a model checking function, provides an open interface, allows a modeling specification to be customized, automatically checks a naming rule and model complexity, analyzes and records non-conforming items;
the modeling specification checking step comprises a modeling specification checking step and a complexity checking step;
the step of checking the modeling specification comprises checking naming rules, providing 3 naming rules for selection, and listing modules, nodes, variables and constants which do not accord with the naming rules;
the naming rule checking process in the modeling specification checking step includes:
step S61, selecting a naming rule type;
step S62, filling in a module name list;
step S63, triggering the naming rule check;
step S64, judging whether the module name is null; if yes, go to step S65; otherwise go to step S66;
step S65, whether the check is continued is judged, if yes, the process goes to step S66; otherwise, returning to the step S62;
step S66, judging whether the naming accords with the selected rule; if yes, go to step S67, otherwise go to step S69;
step S67, list display, transition to step S68;
step S68, modifying the non-compliant name until the name is compliant with the requirement; turning to step S70;
step S69, displaying the list as empty; turning to step S70;
step S70, exporting the result;
step S71, ending;
(II) allowing the user to customize 8 complexity items: the number of structural body members, the array dimension, the number of times of calling nodes, the number of conditional combinations, expression bracket nesting, the number of single-dimensional array members, the number of maximum child nodes and the number of cases of switch;
the complexity checking process includes: setting the complexity of each item; a complexity check trigger; analyzing KCG _ metrics.txt generated by KCG; displaying the actual complexity; deriving a result; and (6) ending.
Example two
The invention discloses an automatic generation system of a control law gain model, which comprises: the device comprises a control law gain file definition module, a gain file validity check module, a gain file preprocessing module, a gain model automatic generation module, a gain information display module and a modeling specification check module.
(1) [ control Rate gain File definition Module ]
And through the design of the gain description file, the gain requirement described by the natural language is converted into a formalized text which can be read by a tool. The gain file described by the formal language not only can be used for carrying out automatic validity check, but also can be directly used as input to automatically generate an SCADE gain model.
Gain profile example a is as follows:
the formalization format of the gain description file is defined as follows:
a) delimiter of gain information:
the gain information takes "#" as a starting mark, and the content between two "#" rows is the description information of the gain.
b) Line break of gain information:
key% monopolizes a line, which indicates the end of the previous statement and starts a new statement, allowing multiple lines to appear in succession. Therefore, when the gain information is processed, the last line of sentences is ended when% is met, and a new line of sentences is started (here, one line refers to a logic line, and the gain information description file may write one line of logic line information with complete meaning in multiple lines, so that readability is improved). Since the gain type and the gain information are different parts of the gain total information, they belong to the same logic row, they cannot be separated by% and if% row occurs, the gain information content analysis will be mistaken.
c) Gain type:
the gain types include: AP, CAS, CASxxx (faded), APxxx (faded). Therefore, the AP, CAS, CASxxx (faded), apxxx (faded) are all keywords, which not only indicate the type of the gain, but also can be used as the basis for combining the input quantities when a plurality of gains are combined into a combined node. Such as: the gain type in example a is cas 120.
d) Gain description:
the name of the gain, the type of the tussin transformation, the calculation period and the usage period are described. The "gain specification" is typically an input row (logical row) that allows completion through multiple input rows, as long as the% row is not included in the middle.
The gain name, in the form of g _ xxx, must conform to the C language naming convention and must be less than 32 characters in length. Such as: the gain name in example a is g _ wqa.
Types of atlas transformations, including: c type I, c type II, i type, l type, w type, n/d type. Such as: the tussin transform type in example a is w type.
Calculating period: the basis for node combining (combining the gains of the same calculation period into one combined node) is usually a positive integer in ms. Such as: the calculation period in example a is 120 ms.
The service cycle is as follows: for the Lanstein transform calculation, it is usually a positive integer in ms. In the combination node, the usage period is one of the bases of output quantity combination. Such as: the usage period in example a is 15 ms.
e) Gain information switching value:
the switching value information is described by several non-repetitive variable names separated by spaces, and each variable name must be a legal C language variable name. Such as: u _ conf1 u _ lgh u _ swbug in example A.
The combination value of the logic behavior switching value after the switching value row is that a switching value sequence is obtained, and the format is as follows: "010", the number of values must be consistent with the number of switching values, each value corresponding to the value of the corresponding switching value. If a value is taken ". sup.", it is taken as a generic value, indicating that the value can take either 0 or 1.
The switching value combinations are followed by the description information of the interpolation table: the description information of the zero-dimensional, one-dimensional, two-dimensional or three-dimensional interpolation table, the start mark of the corresponding information row is "0", "1", "2" or "3", respectively.
To ensure the integrity and correctness of the gain information, a closure check must be performed on the switch combination case: that is, for a gain with N switching variables, there are 2N switching value combinations and their pair values corresponding to them, so that a corresponding number of calculation results must be provided for the switching value control selection (for the general case, consider according to two cases, i.e., x represents two cases of 0 and 1 for a certain switching value).
f) Linear interpolation table:
zero-dimensional interpolation: the zero-dimensional interpolation information description is composed of dimensions and floating point constants. Such as: "00.6" in example A.
One-dimensional interpolation: the one-dimensional linear interpolated data consists of two logical rows: the contents of the first logical row are the dimension (integer 1), the input variable name (legal variable name), the separation marker (character n), a series of floating point values (i.e., the value of the X-axis). The algorithm is as follows:
when the input value falls within the X-axis value range, it is calculated according to the standard algorithm of w ═ X0 ═ w1-w0)/(X1-X0) + w0, where X0, X1 represent two adjacent X-axis values and X falls between X0 and X1; if the input value falls outside the X-axis range of values, the corresponding boundary value is used: when the input value is smaller than the minimum X-axis value, taking the corresponding W value at the minimum value; when the input value is larger than the maximum X-axis value, taking the corresponding W value at the maximum value without linear interpolation.
Two-dimensional interpolation: the two-dimensional linear interpolated data consists of three logical rows: the contents of the first logical row are the dimension (integer 2), the input variable name X (legal variable name), the separation marker (character n), a series of floating point values (i.e., values on the X-axis), where the number is assumed to be m. The contents of the second logical row of the two-dimensional linear interpolation are the dimension (integer 2), the input variable name x (legal variable name), the separation marker (character n), a series of floating point values (i.e. values on the Y-axis), where the number is assumed to be n. The content of the third logical row of the two-dimensional linear interpolation is a series of floating point values (i.e., values on the W-axis), and the number of data on the W-axis must be equal to m × n.
Three-dimensional interpolation: the three-dimensional linear interpolated data consists of 3, X-axis interpolated input variables, n, 3D interpolated X-axis sequences, 3, interpolated input variables, n, 3D interpolated Y-axis sequences, 3, interpolated input variables, n, 3D interpolated Z-axis sequences, and 3D interpolated W-axis sequences, separated by%. The X, Y and Z axis sequences are arranged strictly according to the ascending order, and the variable values are separated by spaces. Assuming that the 3D interpolation has n X-axis variables, m Y-axis variables, and k Z-axis variables, the number of W-axis sequences of the 3D interpolation must be equal to n × m × k, and the values of the W-axis sequences are arranged in one row for every k × m variable values, which is k rows.
(2) [ GAIN FILE legality CHECKING MODULE ]
The legality of the gain file is checked through a tool to ensure the correctness of the gain file because the gain file is described in a formal language; the gain file validity checking module is used for checking the validity of the gain file; the gain file legality checking module provides a plurality of legality checking rules, and generates a correct gain model for the gain files meeting the rules; for the gain file which does not meet the rule, giving alarm information, listing the name of the gain which has an error and the content of the ending line of the gain which has an error;
specific rules include, but are not limited to:
1) illegal character between gain start symbols "#
2) Occurrence in the same logic row%
3) The variable name does not conform to C language naming specification and is longer than 32 characters
4) The gain name compiling conforms to C language naming specification and is longer than 32 characters
5) Gain type not meeting the requirements (AP, CAS, CASxxx (faded), APxxx (fadad))
6) The period of calculation of the gain being not an integer
7) The period of use of the gain being not an integer
8) The number of switching value combinations does not correspond to the defined number of switching values
9) When the number of interpolated values (i.e. the number of interpolated curve points) does not match the number of input values
10) The combined quantity of the switch is not closed
11) The value of zero-dimensional interpolation is not equal to 2
12) The second data of the zero-dimensional interpolation is not a floating-point number
13) The value of the X-axis input quantity of one-dimensional linear interpolation is not increased
14) The values of the X-axis and Y-axis input quantities of the two-dimensional linear interpolation are not increased progressively
15) The number of W-axis sequences of two-dimensional linear interpolation is not equal to n m
16) The values of the X-axis, Y-axis and Z-axis input quantities of the three-dimensional linear interpolation are not increased progressively
17) The number of W-axis sequences of three-dimensional linear interpolation is not equal to n m k
(3) [ gain file preprocessing module ]
For the formalized gain description file, before formally generating the SCADE gain model, preprocessing is required, partial logic rows and output quantities meeting requirements are combined, and the gain file is optimized so as to improve the realization efficiency of the gain model.
As shown in fig. 3, the preprocessing flow of the gain file preprocessing module includes:
step S31, opening a gain information file;
step S32, reading a line of data and recording a downlink number;
step S33, judging whether the gain is new, if so, turning to step S34, otherwise, turning to step S32;
step S34, starting to record the current gain data, judging whether the gain data is a line break symbol, if so, turning to step S35, otherwise, combining logic lines, and turning to step S32;
step S35, recording the read logic row, and turning to step S36;
step S36, recording a new logic line;
step S37, judging whether the gain is finished, if yes, turning to step S38; otherwise go to step S32;
step S38, merging the current gain information, starting new gain information analysis, and turning to step S32;
(4) [ automatic gain model Generation Module ]
Through the interface extension function provided by the SCADE, tool bar buttons, menus and dialog boxes for importing gain files and automatically generating gain models are customized in the SCADE environment by using a TCL script language.
a) The interface design of the gain model toolbar comprises the following steps:
1) defining a command: cmdGain AutoGenerator ()
2) Defining a toolbar: GainTools ()
3) Defining a menu: menu ()
4) Defining a dialog box: dialoggain AutoGeneration () and corresponding initialization subroutines
5) Defining an icon file: brGain AutoGeneration
6) Initialization commands, toolbars, menus
The flow chart of the implementation of the interface design is shown in fig. 4. The gain auto-generation interface is shown in FIG. 10; the corresponding user interface is shown in fig. 11.
In the interface, the name of the Gain information file is Input through a text box, and a graphical interface can be provided through a 'file open' (FileOpenDialog-filter 'Gain Input (·) ext) | txt | All Files (· ext) |') dialog for a user to specify an Input file in a file selecting mode. The calculation/invocation cycle is entered by the user by way of a text box, and the missing value takes "153060120". Clicking the "start" button automatically generates the gain model based on the input gain information questionnaire.
b) Fig. 5 shows an automatic generation process of the gain model, which specifically includes:
step S41, an initialization step; the method comprises the following steps: assigning values to some variables to prepare for later work;
step S42, analyzing the input file; the method comprises the following steps: filtering the empty line; merging the physical rows and processing the physical rows into logic rows; checking the integrity of the input and the correctness of the format; preprocessing the interpolation curve data;
step S43, a gain node generation step; the method comprises the following steps: calling AnalisNodeInfo to perform detailed analysis on the information of the node: preparing information for generation of models of types, constants, nodes, and the like; and generating a type definition file: xscade, and adding to the model; generating a constant definition file: autoconsts. xscade, and added to the model; calling createimport operators to generate a model file corresponding to the import operator, and adding the model file into the model; generating an RAM variable marking node model file and adding the RAM variable marking node model file into the model; generating a switching value calculation node file and adding the switching value calculation node file into the model; generating a gain node file for each gain, and adding the gain node file into a model; calling createintegattednodes to generate an integrated node file, and adding the integrated node file into the model;
(5) [ GAIN INFORMATION DISPLAY MODULE ]
The method is used for displaying the gain information, and after the gain description file is imported into the automatically generated SCADE node, whether the gain information is consistent with the gain description file can be visually checked in a graphical interface mode.
a) Gain information display interface design
The interface displays the relevant information of the gain node through a visual graphical interface, and guides the user to operate through information such as characters, graphs, controls and warnings. A user selects a certain gain node in the SCADE, and clicks the gain information display to observe the related gain information.
The gain information display interface is shown in fig. 12; the corresponding user interface is shown in fig. 13.
The interface is divided into four areas of red, yellow, green and blue, which are respectively defined as follows:
TABLE 1 interface region definition Table
If the dimension of the interpolation curve is one-dimensional, the user can enter graph observation by clicking a 'display curve' button in the graph 13, and gain information can be visually displayed in a graphical mode.
The interface is divided into four areas of yellow, green, blue and pink, which are respectively defined as follows:
TABLE 2 definition table of one-dimensional interpolation curve interface region
b) Design of gain information display function
1) Design of gain information display function
The gain information display function can automatically read the comment information in the gain node automatically generated in the SCADE, format the data and display the data to a graphical interface. The method mainly comprises the following steps: the 2 functions of reading in comment information and calculating the interpolation curve are shown in the flow chart of fig. 6.
The gain information display process of the gain information display module comprises the following steps:
step S51, gain information analysis is carried out on the SCADE node comment data;
step S52, displaying the analyzed gain information to a graphical interface;
step S53, carrying out interpolation calculation; if the dimension is 0, reading a constant value; if the dimension is 1, respectively reading X, Y values, and respectively reading a coefficient, b coefficient, c coefficient and d coefficient; if the dimension is 2, respectively reading in two coefficients a and b; the process proceeds to step S52.
2) Graphic display function design
The one-dimensional interpolation curve graph observation function is started by a command line when a user selects a corresponding switching value combination on a gain information display interface to observe a curve, and simultaneously, information of a gain node is written into a temporary file and is brought into the module through a format of a command line parameter.
The module contains 5 sub-functions:
● read in the specified data file design: supporting reading in a file with a specified format, and analyzing information such as a switching value combination, a switching value, a value, a coefficient and the like;
● data and Window initialization design: the coordinate value can automatically adapt to an extreme value according to the data size, and an actual coordinate range and a screen coordinate range of the graph are drawn according to the extreme value;
● graphic display interface design: 2 times of magnification display, curve/broken line mode switching and graph scrolling display are supported;
● shows a mode switch design: supporting the display mode switching of graphs and tables;
● X value input compute interpolation design: and supporting the Lanstine transformation, calculating one-dimensional interpolation, and providing comparison between an original value and a result of the Lanstine transformation.
Correspondingly, the gain information display module comprises a specified data file reading-in unit, a data and window initialization unit, a graphical interface display unit, a display mode switching unit and an X value input calculation interpolation unit;
the specified data file reading unit is used for supporting reading of a file in a specified format and analyzing switching value combination, switching value, value and coefficient information;
in the data and window initialization unit, coordinate values automatically adapt to extreme values according to the size of data, and an actual coordinate range and a screen coordinate range of a graph are drawn according to the extreme values;
the graphical interface display unit is used for realizing 2-time amplification display, curve/broken line mode switching and graphical scrolling display;
the display mode switching unit is used for realizing the switching of the display modes of graphs and tables;
the X value input calculation interpolation unit is used for realizing the Lanstine transformation, calculating one-dimensional interpolation and providing comparison of an original value and a Lanstine transformation result;
fig. 7 shows a flow chart of the graphic display function, and the graphic display process of the gain information display module includes:
step A51, reading in a file with a specified format;
step A52, initializing data and window;
step A53, displaying an interface;
step A54, waiting for user input; if the information input by the user corresponds to the switching value selection or the display mode switching or the X value input calculation interpolation, feeding back to the step A53 according to the input information of the user for display; and if the information input by the user is correspondingly exited, the program is terminated.
(6) [ modeling Specification inspection Module ]
The SCADE tool is used for checking whether the model meets the specification or not, a model checking function is built in the SCADE tool, an open interface is provided, the model building specification can be customized, the naming rule and the model complexity are automatically checked, and non-conforming items are analyzed and recorded.
a) Modeling specification inspection interface design
The modeling specification checking toolbar is shown in fig. 14, a user can intuitively display relevant information of modeling specification checking by clicking a "modeling rule checking" button and opening a graphical interface, and the user operation is known through information such as characters, controls and warnings, as shown in fig. 15.
b) Modeling specification checking functional design
1) Naming rule checking function: 3 Naming rules are provided for selection (NamingRauleDefinition, NamingRule Definition), and modules, nodes, variables, constants that do not comply with the Naming rules are listed.
The naming rule checking flow chart is shown in fig. 8; the naming rule checking process in the modeling specification checking step includes:
step S61, selecting a naming rule type;
step S62, filling in a module name list;
step S63, triggering the naming rule check;
step S64, judging whether the module name is null; if yes, go to step S65; otherwise go to step S66;
step S65, whether the check is continued is judged, if yes, the process goes to step S66; otherwise, returning to the step S62;
step S66, judging whether the naming accords with the selected rule; if yes, go to step S67, otherwise go to step S69;
step S67, list display, transition to step S68;
step S68, modifying the non-compliant name until the name is compliant with the requirement; turning to step S70;
step S69, displaying the list as empty; turning to step S70;
step S70, exporting the result;
step S71, ending;
2) complexity checking function: allowing the user to customize 8 complexity: the number of structural body members, array dimensions, the number of times of calling nodes, the number of conditional combinations, expression bracket nesting, the number of single-dimensional array members, the number of maximum child nodes and the number of cases of switch.
Complexity check flowchart as shown in fig. 9, the complexity check process includes: setting the complexity of each item; a complexity check trigger; analyzing KCG _ metrics.txt generated by KCG; displaying the actual complexity; deriving a result; and (6) ending.
In summary, the method and system for automatically generating the control law gain model provided by the invention can automatically check the control law gain file described by the formal language and generate the SCADE gain model according to the correct control law gain file. After the gain model is generated, the system also provides a graphical interface to assist the user in visually checking whether the gain information is consistent with the gain description file. The system realizes high automation of the control law development process: the method can not only automatically check the error of the gain information, but also realize the automatic graph siten conversion of the interpolation curve, the automatic generation of the SCADE gain model, the automatic generation of the control rate code, the automatic calculation and the display of the interpolation curve, liberate developers from the redundant and non-technical functions and can be put into creative work.
The description and applications of the invention herein are illustrative and are not intended to limit the scope of the invention to the embodiments described above. Variations and modifications of the embodiments disclosed herein are possible, and alternative and equivalent various components of the embodiments will be apparent to those skilled in the art. It will be clear to those skilled in the art that the present invention may be embodied in other forms, structures, arrangements, proportions, and with other components, materials, and parts, without departing from the spirit or essential characteristics thereof. Other variations and modifications of the embodiments disclosed herein may be made without departing from the scope and spirit of the invention.

Claims (10)

1. A method for automatically generating a control law gain model, the method comprising:
step S1, defining a control law gain file;
through the design of a gain file, the gain requirement described by a natural language is converted into a formalized text which can be read by a tool;
step S2, checking the validity of the gain file;
providing a plurality of legality checking rules, checking the legality of the gain file:
generating a correct gain model for the gain files meeting the rules; for the gain files which do not meet the rules, giving alarm information, and listing error gain names and error gain ending line contents;
step S3, gain file preprocessing;
for the formalized gain files, preprocessing is needed before formally generating an SCADE gain model, and partial logic rows and output quantities meeting requirements are combined to optimize the gain files;
step S4, a gain model automatic generation step;
by using an interface expansion function provided by SCADE, using TCL script language, customizing toolbar buttons, menus and dialog boxes for importing gain files and automatically generating gain models in the SCADE environment;
step S5, displaying gain information;
displaying the gain information;
after the gain file is imported into the SCADE node, visually checking whether the gain information is consistent with the gain file or not in a graphical interface mode;
step S6, checking modeling specifications;
checking whether the model meets the specification;
the SCADE tool is internally provided with a model checking function, provides an open interface, allows a modeling specification to be customized, automatically checks naming rules and model complexity, and analyzes and records non-conforming items.
2. The method for automatically generating the control-law gain model according to claim 1, wherein the processing flow of the step of preprocessing the S3 gain file includes:
step S31, opening a gain file;
step S32, reading a line of data and recording a downlink number;
step S33, judging whether the gain is new, if so, turning to step S34, otherwise, turning to step S32;
step S34, starting to record the current gain data, judging whether the gain data is a line break symbol, if so, turning to step S35, otherwise, combining logic lines, and turning to step S32;
step S35, recording the read logic row, and turning to step S36;
step S36, recording a new logic line;
step S37, judging whether the gain is finished, if yes, turning to step S38; otherwise go to step S32;
step S38, combine the current gain information, start new gain information analysis, and go to step S32.
3. The method according to claim 1, wherein in step S4, the automatic generation flow in the automatic gain model generation step includes:
step S41, an initialization step; the method comprises the following steps: assigning values to some variables to prepare for later work;
step S42, analyzing the input file; the method comprises the following steps: filtering the empty line; merging the physical rows and processing the physical rows into logic rows; checking the integrity of the input and the correctness of the format; preprocessing the interpolation curve data;
step S43, a gain node generation step; the method comprises the following steps: calling AnalisNodeInfo to perform detailed analysis on the information of the node: preparing information for generation of types, constants and node models; and generating a type definition file: xseade, and adding to the model; generating a constant definition file: autoconsts. xscade, and added to the model; calling createimport operators to generate a model file corresponding to the import operator, and adding the model file into the model; generating an RAM variable marking node model file and adding the RAM variable marking node model file into the model; generating a switching value calculation node file and adding the switching value calculation node file into the model; generating a gain node file for each gain, and adding the gain node file into a model; and calling createintegattednodes to generate an integrated node file, and adding the integrated node file into the model.
4. The method for automatically generating the control-law gain model according to claim 1, wherein in step S5, the information related to the gain node is displayed through an intuitive graphical interface, and the user operation is guided through text, graphics, controls and warning information; a user selects a certain gain node in the SCADE, and clicks a key for correspondingly displaying gain information, so that the related gain information can be observed;
automatically reading comment information in the automatically generated gain nodes in the SCADE, formatting the data and displaying the data to a graphical interface; the method mainly comprises the following steps: two functions of reading comment information and calculating an interpolation curve;
the gain information display process of the gain information display step includes:
step S51, gain information analysis is carried out on the SCADE node comment information;
step S52, displaying the analyzed gain information to a graphical interface;
step S53, carrying out interpolation calculation; if the dimension is 0, reading a constant value; if the dimension is 1, reading in Value values, and respectively reading in a coefficient and a coefficient; if the dimension is 2, reading X, Y values, and respectively reading a coefficient, b coefficient, c coefficient and d coefficient; turning to step S52;
the one-dimensional interpolation curve graph observation function is started by a command line when a user selects a corresponding switching value combination on a gain information display interface to observe a curve, and simultaneously, information of a gain node is written into a temporary file and is brought into a gain information display module through a format of a command line parameter;
the gain information display step comprises a specified data file reading step, a data and window initialization step, a graphical interface display step, a display mode switching step and an X value input calculation interpolation step;
in the step of reading the specified data file, reading the file in the specified format and analyzing the switching value combination, the switching value, the value and the coefficient information;
in the data and window initialization step, the coordinate values automatically adapt to extreme values according to the data size, and the actual coordinate range and the screen coordinate range of the graph are drawn according to the extreme values;
in the graphical interface display step, 2-time magnification display, curve/broken line mode switching and graphical scrolling display are realized;
in the display mode switching step, switching between the display modes of the graph and the table is realized;
in the step of inputting the X value into the calculation interpolation, the Lanstine conversion is realized, the one-dimensional interpolation is calculated, and the result of the original value and the Lanstine conversion are provided for comparison;
the graphic display process in the gain information display step includes:
step A51, reading in a file with a specified format;
step A52, initializing data and window;
step A53, displaying an interface;
step A54, waiting for user input; if the information input by the user corresponds to the switching value selection or the display mode switching or the X value input calculation interpolation, feeding back to the step A53 according to the input information of the user for display; and if the information input by the user is correspondingly exited, the program is terminated.
5. The method for automatically generating a control-law gain model according to claim 1, wherein in step S6, the modeling specification checking step includes a modeling specification checking step and a complexity checking step;
the step of checking the modeling specification comprises checking naming rules, providing 3 naming rules for selection, and listing modules, nodes, variables and constants which do not accord with the naming rules;
the naming rule checking process in the modeling specification checking step includes:
step S61, selecting a naming rule type;
step S62, filling in a module name list;
step S63, triggering the naming rule check;
step S64, judging whether the module name is null; if yes, go to step S65; otherwise go to step S66;
step S65, whether the check is continued is judged, if yes, the process goes to step S66; otherwise, returning to the step S62;
step S66, judging whether the naming accords with the selected rule; if yes, go to step S67, otherwise go to step S69;
step S67, list display, transition to step S68;
step S68, modifying the non-compliant name until the name is compliant with the requirement; turning to step S70;
step S69, displaying the list as empty; turning to step S70;
step S70, exporting the result;
step S71, ending;
allowing the user to customize 8 complexity: the number of structural body members, the array dimension, the number of times of calling nodes, the number of conditional combinations, expression bracket nesting, the number of single-dimensional array members, the number of maximum child nodes and the number of cases of switch;
the complexity checking process includes: setting the complexity of each item; a complexity check trigger; analyzing KCG _ metrics.txt generated by KCG; displaying the actual complexity; deriving a result; and (6) ending.
6. A control law gain model automatic generation system, the automatic generation system comprising: the device comprises a control law gain file definition module, a gain file validity check module, a gain file preprocessing module, a gain model automatic generation module, a gain information display module and a modeling specification check module;
the control law gain file definition module is used for converting the gain requirement described by the natural language into a formalized text which can be read by a tool through the design of a gain file; the gain file validity checking module is used for checking the validity of the gain file; the gain file legality checking module provides a plurality of legality checking rules, and generates a correct gain model for the gain files meeting the rules; for the gain file which does not meet the rule, giving alarm information, listing the name of the gain which has an error and the content of the ending line of the gain which has an error;
the gain file preprocessing module is used for preprocessing the formalized gain files before formally generating the SCADE gain model, combining part of logic lines and output quantities meeting the requirements, and optimizing the gain files so as to improve the realization efficiency of the gain model;
the gain model automatic generation module customizes toolbar buttons, menus and dialog boxes for importing gain files and automatically generating gain models in an SCADE environment by using a TCL script language through an interface extension function provided by the SCADE;
the gain information display module is used for displaying gain information; after the gain file is imported into the SCADE node, visually checking whether the gain information is consistent with the gain file or not in a graphical interface mode;
the modeling specification checking module is used for checking whether the model meets the specification; the SCADE tool is internally provided with a model checking function, provides an open interface, allows a modeling specification to be customized, automatically checks naming rules and model complexity, and analyzes and records non-conforming items.
7. The control-law gain model automatic generation system of claim 6, wherein:
the processing flow of the gain file preprocessing module comprises the following steps:
step S31, opening a gain file;
step S32, reading a line of data and recording a downlink number;
step S33, judging whether the gain is new, if so, turning to step S34, otherwise, turning to step S32;
step S34, starting to record the current gain data, judging whether the gain data is a line break symbol, if so, turning to step S35, otherwise, combining logic lines, and turning to step S32;
step S35, recording the read logic row, and turning to step S36;
step S36, recording a new logic line;
step S37, judging whether the gain is finished, if yes, turning to step S38; otherwise go to step S32;
step S38, combine the current gain information, start new gain information analysis, and go to step S32.
8. The control-law gain model automatic generation system of claim 6, wherein:
the automatic generation process of the gain model automatic generation module comprises the following steps:
step S41, an initialization step; the method comprises the following steps: assigning values to some variables to prepare for later work;
step S42, analyzing the input file; the method comprises the following steps: filtering the empty line; merging the physical rows and processing the physical rows into logic rows; checking the integrity of the input and the correctness of the format; preprocessing the interpolation curve data;
step S43, a gain node generation step; the method comprises the following steps: calling AnalisNodeInfo to perform detailed analysis on the information of the node: preparing information for generation of types, constants and node models; and generating a type definition file: xscade, and adding to the model; generating a constant definition file: autoconsts. xscade, and added to the model; calling createimport operators to generate a model file corresponding to the import operator, and adding the model file into the model; generating an RAM variable marking node model file and adding the RAM variable marking node model file into the model; generating a switching value calculation node file and adding the switching value calculation node file into the model; generating a gain node file for each gain, and adding the gain node file into a model; and calling createintegattednodes to generate an integrated node file, and adding the integrated node file into the model.
9. The control-law gain model automatic generation system of claim 6, wherein:
the gain information display module displays the related information of the gain nodes through an intuitive graphical interface and guides a user to operate through characters, graphs, controls and warning information; a user selects a certain gain node in the SCADE, and clicks a key for correspondingly displaying gain information, so that the related gain information can be observed;
the gain information display module is used for automatically reading comment information in the gain nodes automatically generated in the SCADE, formatting data and displaying the data to a graphical interface; the method mainly comprises the following steps: two functions of reading comment information and calculating an interpolation curve;
the gain information display process of the gain information display module comprises the following steps:
step S51, gain information analysis is carried out on the SCADE node comment information;
step S52, displaying the analyzed gain information to a graphical interface;
step S53, carrying out interpolation calculation; if the dimension is 0, reading a constant value; if the dimension is 1, reading in Value values, and respectively reading in a coefficient and a coefficient; if the dimension is 2, reading X, Y values, and respectively reading a coefficient, b coefficient, c coefficient and d coefficient; turning to step S52;
the one-dimensional interpolation curve graph observation function is started by a command line when a user selects a corresponding switching value combination on a gain information display interface to observe a curve, and simultaneously, information of a gain node is written into a temporary file and is brought into a gain information display module through a format of a command line parameter;
the gain information display module comprises a specified data file reading-in unit, a data and window initialization unit, a graphical interface display unit, a display mode switching unit and an X value input calculation interpolation unit;
the specified data file reading unit is used for supporting reading of a file in a specified format and analyzing switching value combination, switching value, value and coefficient information;
in the data and window initialization unit, coordinate values automatically adapt to extreme values according to the size of data, and an actual coordinate range and a screen coordinate range of a graph are drawn according to the extreme values;
the graphical interface display unit is used for realizing 2-time amplification display, curve/broken line mode switching and graphical scrolling display;
the display mode switching unit is used for realizing the switching of the display modes of graphs and tables;
the X value input calculation interpolation unit is used for realizing the Lanstine transformation, calculating one-dimensional interpolation and providing comparison of an original value and a Lanstine transformation result;
the graphic display process of the gain information display module comprises the following steps:
step A51, reading in a file with a specified format;
step A52, initializing data and window;
step A53, displaying an interface;
step A54, waiting for user input; if the information input by the user corresponds to the switching value selection or the display mode switching or the X value input calculation interpolation, feeding back to the step A53 according to the input information of the user for display; and if the information input by the user is correspondingly exited, the program is terminated.
10. The control-law gain model automatic generation system of claim 6, wherein:
the modeling specification checking module comprises a modeling specification checking unit and a complexity checking unit;
the modeling specification checking unit is used for checking the naming rules, providing 3 naming rules for selection, and listing modules, nodes, variables and constants which do not accord with the naming rules;
the naming rule checking process of the modeling specification checking unit comprises the following steps:
step S61, selecting a naming rule type;
step S62, filling in a module name list;
step S63, triggering the naming rule check;
step S64, judging whether the module name is null; if yes, go to step S65; otherwise go to step S66;
step S65, whether the check is continued is judged, if yes, the process goes to step S66; otherwise, returning to the step S62;
step S66, judging whether the naming accords with the selected rule; if yes, go to step S67, otherwise go to step S69;
step S67, list display, transition to step S68;
step S68, modifying the non-compliant name until the name is compliant with the requirement; turning to step S70;
step S69, displaying the list as empty; turning to step S70;
step S70, exporting the result;
step S71, ending;
the complexity check unit allows the user to customize 8 complexity items: the number of structural body members, the array dimension, the number of times of calling nodes, the number of conditional combinations, expression bracket nesting, the number of single-dimensional array members, the number of maximum child nodes and the number of cases of switch;
the complexity checking process of the complexity checking unit comprises the following steps: setting the complexity of each item; a complexity check trigger; analyzing KCG _ metrics.txt generated by KCG; displaying the actual complexity; deriving a result; and (6) ending.
CN201618009510.5A 2016-12-07 2016-12-07 Control law gain model automatic generation method and system Active CN110637522B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201618009510.5A CN110637522B (en) 2016-12-07 2016-12-07 Control law gain model automatic generation method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201618009510.5A CN110637522B (en) 2016-12-07 2016-12-07 Control law gain model automatic generation method and system

Publications (1)

Publication Number Publication Date
CN110637522B true CN110637522B (en) 2018-09-14

Family

ID=68944440

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201618009510.5A Active CN110637522B (en) 2016-12-07 2016-12-07 Control law gain model automatic generation method and system

Country Status (1)

Country Link
CN (1) CN110637522B (en)

Similar Documents

Publication Publication Date Title
US7954059B2 (en) Automatic conversion of text-based code having function overloading and dynamic types into a graphical program for compiled execution
US5161211A (en) Method and system of specification processing
US8046739B2 (en) System and method for enabling a graphical program to propagate attributes of inputs and outputs of blocks
CN109032577B (en) Data simulation method
US20070038947A1 (en) Method and device for generation of a parametric model associated with a 3D geometry
CN111177825A (en) Parameterized modeling method and device
CN112506759A (en) Automatic testing method and device for servo system control software and storage medium
CN115495069B (en) Model-driven coal industry software process implementation method, device and equipment
KR101772785B1 (en) Program chart display device, program chart display method, and computer readable recoding medium for recording program chart display program
JP6310527B1 (en) Object analysis apparatus, object analysis method, and program
US20110289396A1 (en) Spreadsheet-Based Graphical User Interface for Dynamic System Modeling and Simulation
CN117236111A (en) Fastener parametric modeling method and device, terminal equipment and storage medium
CN116932393A (en) Model checking method based on rule engine and low-code rule modeling
CN110637522B (en) Control law gain model automatic generation method and system
CN112597011B (en) Operator test case generation and optimization method based on multiple languages
Bocevska et al. An example of application design using solidworks application programming interface
Srivastava et al. Cause effect graph to decision table generation
CN112631918A (en) Software automation test verification method
CN113343659B (en) Analysis report generation method, device, equipment and storage medium
EP2163958A1 (en) Automated derivation of a logic controller behaviour model from a mechanical machine operation model
CN111353335A (en) Method for converting control layer logic diagram into simulation system configuration file
CN114662174A (en) Processing method and system for batch design of control logic diagrams of nuclear power plants
Adedjouma et al. Model-based computer-aided monitoring for ISO26262 compliant systems
CN114329776A (en) Unmanned aerial vehicle model matching method, device, equipment and storage medium
CN115774919A (en) Instrument control logic automatic simulation modeling method based on XML analysis

Legal Events

Date Code Title Description
GR03 Grant of secret patent right
GR03 Grant of secret patent right
DC01 Secret patent status has been lifted
DC01 Secret patent status has been lifted