CN116339700A - Automatic user demand generation method for spacecraft control system based on C codes - Google Patents

Automatic user demand generation method for spacecraft control system based on C codes Download PDF

Info

Publication number
CN116339700A
CN116339700A CN202310287689.XA CN202310287689A CN116339700A CN 116339700 A CN116339700 A CN 116339700A CN 202310287689 A CN202310287689 A CN 202310287689A CN 116339700 A CN116339700 A CN 116339700A
Authority
CN
China
Prior art keywords
information
code
algorithm
user
primitive
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.)
Pending
Application number
CN202310287689.XA
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.)
Beijing Institute of Control Engineering
Original Assignee
Beijing Institute of Control Engineering
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 Beijing Institute of Control Engineering filed Critical Beijing Institute of Control Engineering
Priority to CN202310287689.XA priority Critical patent/CN116339700A/en
Publication of CN116339700A publication Critical patent/CN116339700A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/31Programming languages or programming paradigms
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F30/00Computer-aided design [CAD]
    • G06F30/20Design optimisation, verification or simulation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/34Graphical or visual programming
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/02Total factory control, e.g. smart factories, flexible manufacturing systems [FMS] or integrated manufacturing systems [IMS]

Abstract

A spacecraft control system user demand automatic generation method based on C codes adopts a C compiling technology to carry out algorithm encapsulation; then, a state flow diagram and a program flow diagram are built, and user demand simulation C codes are edited to design a controller; then, the user demand simulation C codes edited by the user are packaged into a C++ class which accords with the interface demand of the mathematical simulation verification platform; and finally, automatically generating a Word document required by the user according to the C code by a template format, replacing the C language variable required to be replaced designated by the user by a mathematical symbol, and replacing the mathematical function existing in the rule table by mathematical calculation expressed by the mathematical symbol. The invention realizes the encapsulation of mature trusted C codes, is used as a standard component written by software user demands, and solves the problems that the user demands of spacecraft control systems depend on manual writing, errors are checked without effective tools, the user demands are inconsistent with simulation verification codes easily, and the like.

Description

Automatic user demand generation method for spacecraft control system based on C codes
Technical Field
The invention relates to a user demand automatic generation method of a spacecraft control system based on a C code, and belongs to the technical field of space.
Background
The space station comprises a plurality of cabins, which relate to dozens of configurations and a plurality of control modes. The conventional user demand writing method is adopted to realize the following steps: scheme algorithm design, scheme simulation, user demand writing, mathematical simulation program writing and mathematical simulation program verification can be completed to output user demands. Two significant disadvantages of this procedure: 1) The user needs to write, check and check a large number of mathematical formulas completely by hand, errors are easy to occur, write personnel are required to carefully check, a large number of symbols are arranged to write a data dictionary, and a plurality of related items involved in the soft needs are checked in each change in the later maintenance process, so that errors are easy to occur. 2) The mathematical simulation program goes through one encoding process from the user requirement to the mathematical simulation program, so that inconsistency easily occurs, and the mathematical simulation is performed to verify that a large number of measurement examples are not the soft requirement of final output.
Disclosure of Invention
The invention solves the technical problems that: the method for automatically generating the user requirements of the spacecraft control system based on the C codes solves the problems that the user requirements of the spacecraft control system are written manually, errors are checked by no effective tools, the user requirements are inconsistent with simulation verification codes easily and the like.
The technical scheme of the invention is as follows: a spacecraft control system user demand automatic generation method based on C codes comprises the following steps:
c compiling is adopted to package a sensor interface, an executing mechanism interface, a normalization algorithm and a custom algorithm, and a corresponding algorithm package is generated;
constructing a state flow diagram and a program flow diagram according to the algorithm package, simulating a C code according to user requirements input by a user to design a controller, and recording the positions of the C codes of all parts input by the user;
packaging the edited user demand simulation C code into a C++ class which meets the interface demand of the mathematical simulation verification platform, and compiling, simulating, verifying and correcting errors;
after the controller simulation verification is completed, the user demand simulation C code is generated into a software demand document according to a preset format.
Further, the packaging of the sensor interface, the actuator interface, the normalization algorithm and the custom algorithm includes:
reading an input file and extracting information;
generating a neutral description file of the algorithm according to the extracted information;
and generating an icon of the algorithm according to the extracted information, and displaying the icon serving as an algorithm tree.
Further, reading the input file, extracting information, specifically including:
code scanning: performing lexical grammar analysis on the code text in the memory by using a grammar analysis tool Antlr to generate an abstract grammar tree, and analyzing the code text by traversing the abstract grammar tree to obtain code information;
annotation scan: scanning the annotation in the specific format to obtain scanning information; the scanning information comprises class information, file information, naming space information, variable information, function information, inheritance relationship and function calling relationship;
integrating information: and binding the information of the code scanning and the annotation scanning by using the line number information.
Further, the preset format includes: the user-specified user-required simulation C-linguistic variables that need replacement are replaced with mathematical symbols, and mathematical functions that exist in the rule table are replaced with mathematical calculations that represent mathematical symbols.
Further, a state flow diagram and a program flow diagram are built, a controller design is carried out, and user demand simulation C codes are edited, and the method specifically comprises the following steps:
step1: classifying the primitives for constructing the user demands, and defining the operation behaviors of each primitive, including state primitives and program flow diagram primitives; the state flow graph primitives comprise nestable state primitives, non-nestable state primitives and conditional primitives; the program flow graph primitives comprise a start primitive, an end primitive, an internal algorithm primitive, a if, switch, for, while, break, continue primitive, a local variable primitive and a code primitive;
step2: drawing sub-primitives and putting the sub-primitives into a parent primitive strategy to realize primitive nesting under the same view; realizing primitive nesting of layered views by adopting a strategy of associating primitives with views;
step3: checking correctness of the primitive information;
step4: in the modeling process, the synchronous generation algorithm navigation tree displays the hierarchical information of all the primitives by collecting the operation of the user and the primitive information. Positioning the graphic element through an algorithm navigation tree;
step5: and accessing and displaying the data at the server side, and providing a tool for downloading and dragging.
Further, the user demand simulation C code is packaged into a C++ class, and the method specifically comprises the following steps:
step1: analyzing the controller design output data and the controller codes, and establishing a mapping relation between the controller design output data and the controller codes;
step2: the generation of the controller code file is realized by combining the C++ writing file stream technology;
step3: constructing a controller VC project based on a qmake building tool;
step4: compiling of the controller VC engineering is achieved based on the MSBuild tool, and a dynamic library of the controller model is generated.
A spacecraft control system user demand automatic generation system based on C-codes, comprising:
the algorithm packaging module is used for packaging a sensor interface, an executing mechanism interface, a normalized algorithm and a custom algorithm by adopting C compiling to generate a corresponding algorithm package;
the C code editing module builds a state flow diagram and a program flow diagram according to the algorithm package, simulates the C codes according to the user requirements input by the user to design the controller, and records the positions of the C codes of all parts input by the user;
the class packaging module packages the edited user demand simulation C code into a C++ class which meets the interface demand of the mathematical simulation verification platform, and compiles, simulates, verifies and corrects errors;
and the demand generation module is used for generating a software demand document according to a preset format by using a user demand simulation C code after the controller simulation verification is completed.
Further, the packaging of the sensor interface, the actuator interface, the normalization algorithm and the custom algorithm includes:
reading an input file and extracting information;
generating a neutral description file of the algorithm according to the extracted information;
generating an icon of the algorithm according to the extracted information, and displaying the icon serving as an algorithm tree;
reading an input file, extracting information, and specifically comprising:
code scanning: performing lexical grammar analysis on the code text in the memory by using a grammar analysis tool Antlr to generate an abstract grammar tree, and analyzing the code text by traversing the abstract grammar tree to obtain code information;
annotation scan: scanning the annotation in the specific format to obtain scanning information; the scanning information comprises class information, file information, naming space information, variable information, function information, inheritance relationship and function calling relationship;
integrating information: binding the information of the code scanning and the annotation scanning by using the line number information;
the user demand simulation C code comprises mode setting, mode conversion conditions, various mode call flows, a writing tool of a demand algorithm, a numbering tool of the demand algorithm and a management tool of a global variable; the demand algorithm comprises a normalization algorithm, a custom algorithm and a public function;
the preset format includes: replacing the user-specified user-required simulation C language variable to be replaced with a mathematical symbol, and replacing the mathematical function existing in the rule table with mathematical calculation expressed by the mathematical symbol;
setting up a state flow diagram and a program flow diagram, designing a controller, editing an application software user demand simulation C code, and specifically comprising:
step1: classifying the primitives required by the construction controller, and defining the operation behavior of each primitive, including a state primitive and a program flow diagram primitive; the state flow graph primitives comprise nestable state primitives, non-nestable state primitives and conditional primitives; the program flow graph primitives comprise a start primitive, an end primitive, an internal algorithm primitive, a if, switch, for, while, break, continue primitive, a local variable primitive and a code primitive;
step2: drawing sub-primitives and putting the sub-primitives into a parent primitive strategy to realize primitive nesting under the same view; realizing primitive nesting of layered views by adopting a strategy of associating primitives with views;
step3: checking correctness of the primitive information;
step4: in the modeling process, the synchronous generation algorithm navigation tree displays the hierarchical information of all the primitives by collecting the operation of the user and the primitive information. Positioning the graphic element through an algorithm navigation tree;
step5: accessing and displaying server-side data, and providing a tool for downloading and dragging;
the method for encapsulating the application software user demand simulation C code into the C++ class specifically comprises the following steps:
step1: analyzing the controller design output data and the controller codes, and establishing a mapping relation between the controller design output data and the controller codes;
step2: the generation of the controller code file is realized by combining the C++ writing file stream technology;
step3: constructing a controller VC project based on a qmake building tool;
step4: compiling of the controller VC engineering is achieved based on the MSBuild tool, and a dynamic library of the controller model is generated.
A computer readable storage medium storing a computer program which when executed by a processor implements the steps of the method for automatically generating user requirements for a spacecraft control system based on C-codes.
The automatic generation device for the user requirements of the spacecraft control system based on the C codes comprises a memory, a processor and a computer program which is stored in the memory and can run on the processor, wherein the computer program is executed by the processor to realize the steps of the automatic generation method for the user requirements of the spacecraft control system based on the C codes.
Compared with the prior art, the invention has the advantages that:
(1) The invention can package mature trusted C codes and is used as a standard component which is required to be written by a software user;
(2) The invention provides a graphical modeling technology for newly added demands, and constructs a simulation verification model;
(3) The method and the device automatically generate the user requirements after the test is correct, so that the writing efficiency of the user requirements is improved;
(4) The consistency of the user demand and the simulation verification code generated by the invention is good, and the readability of the user demand is good;
drawings
FIG. 1 is a C code scanner operating framework;
fig. 2 is a neutral profile example of an algorithm package.
Detailed Description
In order to better understand the technical solutions described above, the following detailed description of the technical solutions of the present application is provided through the accompanying drawings and specific embodiments, and it should be understood that the specific features of the embodiments and embodiments of the present application are detailed descriptions of the technical solutions of the present application, and not limit the technical solutions of the present application, and the technical features of the embodiments and embodiments of the present application may be combined with each other without conflict.
The following describes in further detail a method for automatically generating user requirements of a spacecraft control system based on a C code according to an embodiment of the application with reference to the accompanying drawings, and a specific implementation manner may include (as shown in fig. 1-2):
(1) The method comprises the steps of adopting a C compiling technology to package an algorithm, firstly packaging a sensor interface, an executing mechanism interface, a standardization algorithm, a custom algorithm and the like, extracting key information (comprising a structural body type, a global variable, a function statement, a function body and the like), and submitting the packaged algorithm package to a data management module;
(2) Establishing a server-side data management module, and submitting the packaged algorithm package to the data management module;
(3) The method comprises the steps of constructing a state flow diagram and a program flow diagram by adopting a controller graphical modeling technology based on componentization, designing a controller, and editing user-required C codes, wherein the user-required C codes comprise special tools such as mode setting, mode conversion conditions, mode call flows, writing tools of algorithms (normalized algorithms, custom algorithms and public functions), numbering tools of the algorithms, management tools of global variables and the like. The user can write the C code required by the user conveniently, and the positions of the C codes of all parts in the soft required template are recorded in the process of user input;
(4) The controller code generation is to automatically package the soft C code to be simulated edited by a user into a C++ class meeting the interface requirement of the mathematical simulation verification platform, so that the consistency of the soft document to be simulated and the controller simulation verification code is realized;
(5) According to the design result of the controller, automatically generating a software requirement Word document by the C code according to a template format, replacing a C language variable which is designated by a user and needs to be replaced with a mathematical symbol in the conversion process, and replacing a mathematical function existing in a rule table with a mathematical calculation expressed by the mathematical symbol
In the scheme provided by the embodiment of the application, the method specifically comprises the following steps:
algorithm encapsulation method
The algorithm packaging method mainly comprises three blocks, namely, a C/C++ code scanner reads an input file and extracts information; the XML generator generates a neutral description file of the algorithm according to the extracted information; the icon generator generates an icon of the algorithm based on the extracted information, and displays the icon as an algorithm tree.
Step1: C/C++ code scanner
a. And (5) code scanning. As shown in fig. 1, using a syntax analysis tool Antlr to perform lexical syntax analysis on a code text in a memory to generate an abstract syntax tree (AST tree), and traversing the abstract syntax tree to analyze the code text to obtain code information (mainly a logical relation of an expression);
b. annotating the scan. Scanning the annotation in the specific format by using third-party open source software Doxygen to obtain scanning information (such as class information, file information, name space information, variable information, function information, inheritance relationship, function call relationship and the like);
c. and integrating the information. And binding the information of the code scanning and the annotation scanning by using the line number information.
Step2: XML generator
Based on the extraction results of the C/C++ code scanner, an algorithmic neutral description file (XML) is generated, as shown in FIG. 2.
Step3: an icon generator.
The icon file of the algorithm is provided by the data management module, and after the algorithm is submitted to the server, the data management module automatically generates a corresponding icon file according to the content of the algorithm.
(II) controller graphical modeling technology based on componentization
The method comprises the steps of constructing a state flow diagram and a program flow diagram by adopting a controller graphical modeling technology based on componentization, designing a controller, and editing user-required C codes, wherein the user-required C codes comprise special tools such as mode setting, mode conversion conditions, mode call flows, writing tools of algorithms (normalized algorithms, custom algorithms and public functions), numbering tools of the algorithms, management tools of global variables and the like.
Step1: classifying the primitives required by the construction controller, and defining the operation behavior of each primitive. Mainly comprises a state graphic element and a program flow graphic element. Wherein the state flow graph primitives are divided into nestable state primitives, non-nestable state primitives, and conditional primitives. The program flow diagram primitives are mainly divided into a start/end primitive, an internal algorithm primitive, a if, switch, for, while, break, continue primitive, a local variable primitive and a code primitive.
Step2: the primitive nesting under the same view is realized by adopting a strategy of dragging the child primitive and putting the parent primitive. For primitive nesting of hierarchical views, a policy implementation is employed in which primitives are associated with the views.
Step3: and checking the correctness of the primitive information, namely mainly checking whether the primitive information of the primitive information is correct or not, and checking whether the primitive association information comprises nested primitives, nested primitives and information of connecting lines.
Step4: in the modeling process, the synchronous generation algorithm navigation tree displays the hierarchical information of all the primitives by collecting the operation of the user and the primitive information. And can navigate the tree to locate the primitives by means of an algorithm.
Step5: accessing and displaying the content of the data management module at the server side, and providing a tool for downloading and dragging;
method for generating simulation code of controller
And automatically packaging the soft C codes which are edited by the user and need to be simulated into a C++ class which meets the interface requirement of the mathematical simulation verification platform.
Step1: analyzing the controller design output data (XML file) and the controller code, and establishing a mapping relation between the controller design output data (XML file) and the controller code;
step2: the automatic generation of the controller code file is realized by combining the C++ writing file stream technology;
step3: constructing a controller VC project based on a qmake building tool;
step4: and realizing automatic compiling of the controller VC engineering based on the MSBuild tool, and generating a dynamic library of the controller model.
Step5: and the controller simulates code running and testing.
(IV) reverse modification of software user demand engineering by controller simulation code
And comparing the simulation code with the engineering when the code is generated according to the mapping relation between the controller design output data (XML file) and the controller code, and modifying the engineering reversely.
And (3) iterating the steps of (III) and (IV) until a correct controller is obtained.
(V) automatic Generation of Soft demand report
After the controller is designed, automatically generating a software requirement Word document by the C code according to a template format according to the design result of the controller, replacing a C language variable which is designated by a user and needs to be replaced by a mathematical symbol in the conversion process, and replacing a mathematical function existing in a rule table by mathematical calculation expressed by the mathematical symbol. Based on the Word document template, the functions of generating a cover, a catalog, setting a style, inserting characters and symbols, inserting a mathematical formula, inserting pictures, inserting hyperlinks and the like are realized.
The present application provides a computer readable storage medium storing computer instructions that, when run on a computer, cause the computer to perform the method described in fig. 1.
It will be appreciated by those skilled in the art that embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, magnetic disk storage, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
It will be apparent to those skilled in the art that various modifications and variations can be made in the present application without departing from the spirit or scope of the application. Thus, if such modifications and variations of the present application fall within the scope of the claims and the equivalents thereof, the present application is intended to cover such modifications and variations.
What is not described in detail in the present specification is a well known technology to those skilled in the art.

Claims (10)

1. A spacecraft control system user demand automatic generation method based on C codes is characterized by comprising the following steps:
c compiling is adopted to package a sensor interface, an executing mechanism interface, a normalization algorithm and a custom algorithm, and a corresponding algorithm package is generated;
constructing a state flow diagram and a program flow diagram according to the algorithm package, simulating a C code according to user requirements input by a user to design a controller, and recording the positions of the C codes of all parts input by the user;
packaging the edited user demand simulation C code into a C++ class which meets the interface demand of the mathematical simulation verification platform, and compiling, simulating, verifying and correcting errors;
after the controller simulation verification is completed, the user demand simulation C code is generated into a software demand document according to a preset format.
2. The automatic generation method of user requirements of a spacecraft control system based on a C code according to claim 1, wherein the method comprises the following steps: the packaging of the sensor interface, the executing mechanism interface, the normalization algorithm and the custom algorithm comprises the following steps:
reading an input file and extracting information;
generating a neutral description file of the algorithm according to the extracted information;
and generating an icon of the algorithm according to the extracted information, and displaying the icon serving as an algorithm tree.
3. The automatic generation method of user requirements of a spacecraft control system based on a C code according to claim 2, wherein the steps of reading an input file and extracting information comprise:
code scanning: performing lexical grammar analysis on the code text in the memory by using a grammar analysis tool Antlr to generate an abstract grammar tree, and analyzing the code text by traversing the abstract grammar tree to obtain code information;
annotation scan: scanning the annotation in the specific format to obtain scanning information; the scanning information comprises class information, file information, naming space information, variable information, function information, inheritance relationship and function calling relationship;
integrating information: and binding the information of the code scanning and the annotation scanning by using the line number information.
4. The method for automatically generating user requirements of a spacecraft control system based on a C-code according to claim 1, wherein the preset format comprises: the user-specified user-required simulation C-linguistic variables that need replacement are replaced with mathematical symbols, and mathematical functions that exist in the rule table are replaced with mathematical calculations that represent mathematical symbols.
5. The automatic generation method of the user requirements of the spacecraft control system based on the C codes, which is characterized by comprising the steps of constructing a state flow diagram and a program flow diagram, designing a controller, editing the user requirements and simulating the C codes, and specifically comprising the following steps:
step1: classifying the primitives for constructing the user demands, and defining the operation behaviors of each primitive, including state primitives and program flow diagram primitives; the state flow graph primitives comprise nestable state primitives, non-nestable state primitives and conditional primitives; the program flow graph primitives comprise a start primitive, an end primitive, an internal algorithm primitive, a if, switch, for, while, break, continue primitive, a local variable primitive and a code primitive;
step2: drawing sub-primitives and putting the sub-primitives into a parent primitive strategy to realize primitive nesting under the same view; realizing primitive nesting of layered views by adopting a strategy of associating primitives with views;
step3: checking correctness of the primitive information;
step4: in the modeling process, the synchronous generation algorithm navigation tree displays the hierarchical information of all the primitives by collecting the operation of the user and the primitive information. Positioning the graphic element through an algorithm navigation tree;
step5: and accessing and displaying the data at the server side, and providing a tool for downloading and dragging.
6. The method for automatically generating the user requirements of the spacecraft control system based on the C codes according to claim 1, wherein the method for automatically generating the user requirements of the spacecraft control system based on the C codes is characterized by comprising the steps of:
step1: analyzing the controller design output data and the controller codes, and establishing a mapping relation between the controller design output data and the controller codes;
step2: the generation of the controller code file is realized by combining the C++ writing file stream technology;
step3: constructing a controller VC project based on a qmake building tool;
step4: compiling of the controller VC engineering is achieved based on the MSBuild tool, and a dynamic library of the controller model is generated.
7. A spacecraft control system user demand automatic generation system based on C-code, comprising:
the algorithm packaging module is used for packaging a sensor interface, an executing mechanism interface, a normalized algorithm and a custom algorithm by adopting C compiling to generate a corresponding algorithm package;
the C code editing module builds a state flow diagram and a program flow diagram according to the algorithm package, simulates the C codes according to the user requirements input by the user to design the controller, and records the positions of the C codes of all parts input by the user;
the class packaging module packages the edited user demand simulation C code into a C++ class which meets the interface demand of the mathematical simulation verification platform, and compiles, simulates, verifies and corrects errors;
and the demand generation module is used for generating a software demand document according to a preset format by using a user demand simulation C code after the controller simulation verification is completed.
8. The C-code based spacecraft control system user demand automatic generation system of claim 7, wherein: the packaging of the sensor interface, the executing mechanism interface, the normalization algorithm and the custom algorithm comprises the following steps:
reading an input file and extracting information;
generating a neutral description file of the algorithm according to the extracted information;
generating an icon of the algorithm according to the extracted information, and displaying the icon serving as an algorithm tree;
reading an input file, extracting information, and specifically comprising:
code scanning: performing lexical grammar analysis on the code text in the memory by using a grammar analysis tool Antlr to generate an abstract grammar tree, and analyzing the code text by traversing the abstract grammar tree to obtain code information;
annotation scan: scanning the annotation in the specific format to obtain scanning information; the scanning information comprises class information, file information, naming space information, variable information, function information, inheritance relationship and function calling relationship;
integrating information: binding the information of the code scanning and the annotation scanning by using the line number information;
the user demand simulation C code comprises mode setting, mode conversion conditions, various mode call flows, a writing tool of a demand algorithm, a numbering tool of the demand algorithm and a management tool of a global variable; the demand algorithm comprises a normalization algorithm, a custom algorithm and a public function;
the preset format includes: replacing the user-specified user-required simulation C language variable to be replaced with a mathematical symbol, and replacing the mathematical function existing in the rule table with mathematical calculation expressed by the mathematical symbol;
setting up a state flow diagram and a program flow diagram, designing a controller, editing an application software user demand simulation C code, and specifically comprising:
step1: classifying the primitives required by the construction controller, and defining the operation behavior of each primitive, including a state primitive and a program flow diagram primitive; the state flow graph primitives comprise nestable state primitives, non-nestable state primitives and conditional primitives; the program flow graph primitives comprise a start primitive, an end primitive, an internal algorithm primitive, a if, switch, for, while, break, continue primitive, a local variable primitive and a code primitive;
step2: drawing sub-primitives and putting the sub-primitives into a parent primitive strategy to realize primitive nesting under the same view; realizing primitive nesting of layered views by adopting a strategy of associating primitives with views;
step3: checking correctness of the primitive information;
step4: in the modeling process, the synchronous generation algorithm navigation tree displays the hierarchical information of all the primitives by collecting the operation of the user and the primitive information. Positioning the graphic element through an algorithm navigation tree;
step5: accessing and displaying server-side data, and providing a tool for downloading and dragging;
the method for encapsulating the application software user demand simulation C code into the C++ class specifically comprises the following steps:
step1: analyzing the controller design output data and the controller codes, and establishing a mapping relation between the controller design output data and the controller codes;
step2: the generation of the controller code file is realized by combining the C++ writing file stream technology;
step3: constructing a controller VC project based on a qmake building tool;
step4: compiling of the controller VC engineering is achieved based on the MSBuild tool, and a dynamic library of the controller model is generated.
9. A computer readable storage medium storing a computer program, wherein the computer program when executed by a processor performs the steps of the method according to any one of claims 1 to 6.
10. A C-code based spacecraft control system user demand auto-generation device comprising a memory, a processor, and a computer program stored in said memory and executable on said processor, characterized by: the processor, when executing the computer program, performs the steps of the method according to any one of claims 1 to 6.
CN202310287689.XA 2023-03-22 2023-03-22 Automatic user demand generation method for spacecraft control system based on C codes Pending CN116339700A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310287689.XA CN116339700A (en) 2023-03-22 2023-03-22 Automatic user demand generation method for spacecraft control system based on C codes

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310287689.XA CN116339700A (en) 2023-03-22 2023-03-22 Automatic user demand generation method for spacecraft control system based on C codes

Publications (1)

Publication Number Publication Date
CN116339700A true CN116339700A (en) 2023-06-27

Family

ID=86883444

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310287689.XA Pending CN116339700A (en) 2023-03-22 2023-03-22 Automatic user demand generation method for spacecraft control system based on C codes

Country Status (1)

Country Link
CN (1) CN116339700A (en)

Similar Documents

Publication Publication Date Title
US9754059B2 (en) Graphical design verification environment generator
US8856726B2 (en) Verification of computer-executable code generated from a slice of a model
US8869103B2 (en) Using intermediate representations to verify computer-executable code generated from a model
US10831456B1 (en) External code integrations within a computing environment
CN103140838B (en) Method of converting source code
WO2012032890A1 (en) Source code conversion method and source code conversion program
US9952837B1 (en) Reusable component in a modeling environment
CN107844424A (en) Model-based testing system and method
CN106406890A (en) A method of constructing robot modules by using multiple languages
CN105335412A (en) Method and device for data conversion and data migration
CN109032577B (en) Data simulation method
CN110502808B (en) SysML-oriented system security analysis method and device
KR101770292B1 (en) Computer-executable model reverse engineering method and apparatus performing the same
US20140214396A1 (en) Specification properties creation for a visual model of a system
CN106709985A (en) Generation method and device for virtual three-dimensional sacrifice scene
KR20150066377A (en) Simulation framework system based on DEVS and simulation method using the same
CN111143228B (en) Test code generation method and device based on decision table method
CN115053209A (en) Method and system for generating engineering drawings in engineering system
CN116339700A (en) Automatic user demand generation method for spacecraft control system based on C codes
JP7418608B2 (en) How to analyze programmable logic controller programs
CN106933563B (en) Page flow editor
CN117874393B (en) Method and system for constructing SCA model engineering through XML file
CN109460236A (en) Program version building and inspection method and system
EP2718821A2 (en) Verification of computer-executable code generated from a model
KR102138980B1 (en) Method and apparatus of generating digital contents

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination