CN111309292B - MATLAB/Simulink-based full-model executable program construction method - Google Patents

MATLAB/Simulink-based full-model executable program construction method Download PDF

Info

Publication number
CN111309292B
CN111309292B CN202010079105.6A CN202010079105A CN111309292B CN 111309292 B CN111309292 B CN 111309292B CN 202010079105 A CN202010079105 A CN 202010079105A CN 111309292 B CN111309292 B CN 111309292B
Authority
CN
China
Prior art keywords
file
tlc
matlab
model
simulink
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
CN202010079105.6A
Other languages
Chinese (zh)
Other versions
CN111309292A (en
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.)
Xian Microelectronics Technology Institute
Original Assignee
Xian Microelectronics Technology Institute
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 Xian Microelectronics Technology Institute filed Critical Xian Microelectronics Technology Institute
Priority to CN202010079105.6A priority Critical patent/CN111309292B/en
Publication of CN111309292A publication Critical patent/CN111309292A/en
Application granted granted Critical
Publication of CN111309292B publication Critical patent/CN111309292B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/20Software design
    • G06F8/24Object-oriented
    • 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
    • G06F8/315Object-oriented languages
    • 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
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/35Creation or generation of source code model driven
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/37Compiler construction; Parser generation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/44Encoding
    • G06F8/447Target code generation

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • Stored Programmes (AREA)

Abstract

The invention discloses a method for constructing a full-model executable program based on MATLAB/Simulink, which realizes full-graphical model drive development by designing and creating a bottom layer drive assembly, automatically generating, compiling and linking a design code and adding the design code into an MATLAB/Simulink environment, wherein the whole development process does not need manual coding, and after the full model construction is finished, the embedded code generation, file copying, compiling and linking are automatically finished through a one-key generation function to generate an executable file capable of directly running on an embedded control computer. The software product development efficiency and code reusability are improved, and the low-level problem is reduced.

Description

MATLAB/Simulink-based full-model executable program construction method
Technical Field
The invention belongs to the technical field of aviation systems, and relates to drive component development, processor framework design, executable program generation and the like under MATLAB/Simulink. In particular to a method for constructing a full model executable program based on MATLAB/Simulink.
Background
At present, model driven development under MATLAB/Simulink is generally that a user builds a control model under Simulink through an existing algorithm component and a custom component, simulation is carried out under Simulink, after the simulation is passed, manual coding is adopted or a code generation function of Simulink is utilized to convert the control model into a C program, meanwhile, a peripheral access code is manually compiled to obtain model input data and output a model control command, and the C program can be generated into an executable program after being compiled and linked through a cross compiler and is operated on an embedded target machine. In the development mode, no matter which mode is adopted for generating the control model code, the bottom layer driving interface is required to be called manually, the generated code is required to be copied to the compiling environment for compiling, the executable program is generated, the development efficiency is low, code copying is required manually, and the possibility of problems is increased. Meanwhile, when the Simulink is used for converting the model into the embedded code, the Simulink with ert template codes is generally adopted, and special requirements in embedded application cannot be met, for example, the running period of the model needs to be dynamically modified according to certain specific conditions. For the compilation and linking of the generated C code to the executable program, a Microsoft Visual C + + compiler or an LCC compiler which can be identified under MATLAB is generally adopted, and cannot be supported and configured by other compilers.
Disclosure of Invention
The invention provides a full-model executable program construction method based on MATLAB/Simulink, which realizes full-graphical model drive development, and simultaneously can generate executable programs conforming to processors with different architectures by supporting any compiling environment through configuration. The software product development efficiency and code reusability are improved, and the low-level problem is reduced.
In order to achieve the purpose, the invention provides a method for constructing a full-model executable program based on MATLAB/Simulink, which comprises the following steps:
step 1, writing a secondary S-Function file to describe the component A to obtain an A.c file;
step 2, configuring an S-Function component carried by the MATLAB, and configuring input, output and parameters of an interface of the S-Function component to obtain an A.slx component;
step 3, compiling a tlc file with the same name as the component A to obtain an A.tlc file;
step 4, compiling the A.c file obtained in the step 1 into an A.mex64 file through a mex command under MATLAB;
step 5, the A.c file obtained in the step 1 is associated with the A.slx file obtained in the step 2;
step 6, creating a custom component library lib.slx by using a library building function carried under MATLAB/Simulink;
step 7, adding the A.slx component obtained in the step 2 into a custom component library lib.slx, and adding the lib.slx into an MATLAB/Simulink component library by writing an sblocks.m file;
step 8, adding lib.slx in the step 6, sblock.m file in the step 7, A.mex64 file in the step 4 and A.tlc file in the step 3 into an MATLAB search path;
step 9, modifying the single-rate model code to generate a template file, namely, bareboard _ srain.tlc, adding functions of obtaining a model operation cycle, initializing a timer, binding interruption and scheduling the model to form an xx _ srain.tlc file;
step 10, modifying the variable rate model code to generate a template file, namely, bareboard _ mrman.tlc, and adding functions of obtaining a model operation cycle, initializing a timer, binding an interrupt and scheduling the model to form an xx _ mrman.tlc file;
step 11, customizing a code to generate a template file xx _ file _ process.tlc, and adding file names of xx _ normal.tlc and xx _ mr.tlc files into an xx _ file _ process.tlc file;
step 12, designing a processor frame description file xx.tlc, describing a processor to be used, and adding the file name of the xx _ file _ process.tlc file to the xx.tlc file;
bat, add compiler, compile order, compile option configuration that need use, create and preserve the directory src that the model generates the source code automatically and preserve the Debug directory of compiling, linking the result file;
step 14, customizing a compiled hook file xx _ make _ rtw _ hook.m, and adding the file names of the xx _ srmin.tlc obtained in the step 9 and the xx _ mrmin.tlc obtained in the step 10 into an xx _ make _ rtw _ hook.m file;
step 15, creating a system _ frame directory, and putting the code generation template file xx _ file _ process.tlc created in the step 11, the single-rate model code generation template file xx _ srain.tlc created in the step 9, the variable-rate model code generation template file xx _ mrain.tlc created in the step 10, the processor frame description file xx.tlc designed in the step 12, the compiling designed in the step 13, the configuration command file xx _ make.bat and the compiling hook file xx _ make _ rtw _ hook.m designed in the step 14 into the system _ frame directory;
step 16, adding a system _ frame directory into the MATLAB/Simulink search path;
step 17, building a user model in Matlab/Simulink, and selecting all bottom layer driving components to be used from a component library lib.slx added in the step 7 in Matlab/Simulink;
and step 18, generating codes through the Generator Code of the model in Matlab/Simulink, and automatically completing compilation, linkage and generation of an executable program.
Further, the process of step 1 is: using an sfuntmpl _ basic.c file template carried by MATLAB, renaming the sfuntmpl _ basic.c file to be A.c, and modifying the macro definition # define S _ FUNCTION _ NAME at the beginning of the file to be A;
in the mdlinitializesisizers function in A.c, using ssSetNumSFcnParams to declare the number of parameters required to be configured by the component, wherein the values of the parameters can be configured on a component interface by a user, and the component A has two parameters which are respectively a bitmap chan _ mask for identifying whether a channel is selected and timeout time timeout; the number of input and output ports of the component is stated by using the functions ssSetNumInputports and ssSetNumOutputports of the MATLAB in A.c, and the data dimension of each port is stated by using the function ssSetOutputPort of the MATLAB in A.c under the condition that the port exists.
Further, the specific process of step 3 is: creating a tlc file corresponding to the A.slx component, wherein the name of the tlc file is the same as the name of the component, the name A of the component is written after the instruction of% instances in the A.tlc file, the name is followed by the implementation language, and the% instances A and C are in the tlc file of the A component; the instances instruction is followed by the BlockTypeSetup, start, outputs, and Terminate functions.
Further, the specific process of step 9 is: modifying a single-rate model code carried by MATLAB/Simulink to generate a template file, namely, bareboard _ srain.tlc, acquiring a model running period set by a user from a bareboard _ srain.tlc file, initializing a timer according to the running period, establishing a timer interrupt processing program and binding the timer interrupt processing program with the timer interrupt, periodically scheduling an rt _ one _ step function carried by the bareboard _ srain.tlc file to realize a model scheduling function, and finally storing the bareboard _ srain.tlc file as an ft _ bareboard _ srain.tlc file.
Further, the specific process of step 14 is: designing a compiling hook file xx _ make _ rtw _ hook.m, calling and executing the compiling hook file xx _ make _ rtw _ hook.m by MATLAB/Simulink after model codes are generated, generating a folder corresponding to a model in an exit method in an xx _ make _ rtw _ hook function of the hook file xx _ make _ rtw _ hook.m, copying a file automatically generated by MATLAB/Simulink to an src directory created in step 13, and executing xx _ make.bat files designed in step 12 to complete generation of executable files.
Further, the specific process of step 18 is: clicking the Configuration Parameters option under the Configuration menu in Matlab/Simulink, popping up the model executable file to automatically Generate the control interface Configuration Parameters, selecting xx.tlc designed and realized in step 12 in the System target file under the model executable file automatically generating the control interface Configuration Parameters, checking a generic Code only check box, clicking application, and clicking a generic Code button, namely automatically completing the Code generation, copying, compiling, linking and out turning of the model and the driver component.
Compared with the prior art, the invention has at least the following beneficial technical effects:
the invention realizes a full model executable program construction method based on MATLAB/Simulink, which realizes full graphical model drive development by designing and creating a bottom layer drive component, automatically generating, compiling and linking a design code and adding the design code into an MATLAB/Simulink environment, does not need manual coding in the whole development process, automatically completes embedded code generation, file copying, compiling and linking through a key generation function after the full model construction is completed, and generates an executable file capable of directly running on an embedded control computer. Developers only need to concern about the building of the model, and other processes are automatically completed, so that human factors are reduced, the software product development efficiency and code reusability are improved, and the low-level problem is reduced.
Drawings
FIG. 1 is a flow chart of the present invention;
FIG. 2 is a Mask parameter of the ADC _ in block;
FIG. 3 is a component parameter setting interface;
FIG. 4 is an interface for automatic generation of a model executable.
Detailed Description
In order to make the objects and technical solutions of the present invention clearer and more understandable. The present invention will be described in further detail with reference to the following drawings and examples, wherein the specific examples are provided for illustrative purposes only and are not intended to limit the present invention.
Referring to fig. 1, the invention realizes full-graphical model drive development support through bottom layer drive assembly encapsulation and processor system framework support, the invention has no limit to processor architecture, and can be applied to a target platform of any processor architecture, the following describes an embodiment of the invention by taking a certain embedded computer as an example, the embedded computer adopts a domestic FT multi-core processor FT6678, an ADC _ in assembly is integrated externally, and the specific implementation steps of the model drive development by adopting the method of the invention are as follows:
step 1, compiling a two-level S-Function file ADC _ in.c
The sfuntmpl _ basic.c file is renamed to ADC _ in.c by using an sfuntmpl _ basic.c file template carried by MATLAB, and the modified macro definition # define S _ FUNCTION _ NAME at the beginning of the file is the NAME of S-FUNCTION, in this case ADC _ in which is the FUNCTION NAME of the S-FUNCTION.
In the mdlinitializesizesis function in the ADC _ in.c file, the number of parameters to be configured by the component is declared by using the ssSetNumSFcnParams function carried by MATLAB, the values of the parameters can be configured on the component interface by the user, and the ADC _ in component has two parameters, namely a bitmap chan _ mask for identifying whether the channel is selected and timeout time out. The number of input and output ports of the component (indicated by 0 if there are no ports) is declared using the ssSetNumInputports and ssSetNumOutputports functions of the MATLAB tape itself, and the data dimension of each port is declared using the ssSetOutputPort width function of the MATLAB tape in the case of a port, and the corresponding codes are as follows.
Figure BDA0002379646440000061
Step 2, configuring ADC _ in assembly
And editing a mask parameter of the ADC _ in component, and packaging a control provided by Simulink in a module to realize the self-defined function of the component. Right-clicking the component, selecting a Create Mask under the Mask from the appearing option entries, creating controls displayed on an interface by the component under the Parameters and Dialog entries in a Mask Editor page, wherein each control corresponds to one Mask parameter, fig. 2 is a configuration page of the Mask Parameters of an ADC _ in component, and except for the corresponding component Parameters Mask _ num and timeout, a checkbox is set for each AD channel so that a user can select the corresponding channel. And (4) configuring to be saved after completion, and obtaining the ADC _ in.
Step 3, compiling TLc files with the same names of the components
Creating a tic file corresponding to the ADC _ in component, wherein the name of the tic file is the same as the component name, writing the component name after the% instances instruction in the ADC _ in.tic file, and the language realized after the component name, wherein the% instances ADC _ in 'C' is in the tic file for creating the ADC _ in component. The initialization instruction comprises a blockTypeSetup, a Start, outputs and a Terminate function, data needed to be prepared and executed when an ADC _ in component is created, initialized and simulated are respectively described, a header file of a corresponding code of the ADC _ in component and a corresponding driving interface prototype are declared in the blockTypeSetup, and the Outputs acquire information of ADC _ in component parameters and port data to call a driving interface. The code of the Start function is generated in a model _ initial function in the model where the component is located, and the code of the Outputs function is generated in a model _ step function.
According to the statement in the above S-Function file, the ADC _ in component has two parameters, which are the selected state Mask _ num and timeout time timeout of the channel, respectively, where the Mask _ num can be obtained by the library Function libblock parameter value (Mask _ num, index), and the timeout time can be obtained by block. Fig. 2 shows an output function in ADC _ in.tlc, which calls an interface c66x _ ADC _ in to obtain an acquisition value of a selected channel and Outputs the result to a port.
Figure BDA0002379646440000071
And 4, after the S-FUNCTION file is written, inputting mexADC _ in.c into a Matlab command line window, and compiling to obtain an ADC _ in component description file ADC _ in.mex64 after carriage return. This is the result file that the ADC _ in.c file is compiled out under MTALAB.
Step 5, associating the ADC _ in.c file with the ADC _ in component
And (3) opening the ADC _ in.slx component created in the step (2) under MATLAB/Simulink, double-clicking the ADC _ in.slx component by a mouse, filling the name and the parameter of the component in a component parameter setting interface (such as a dialog box shown in FIG. 3), wherein the name and the parameter filled in the parameter configuration interface need to be consistent with the definition in the ADC _ in.c file. For the ADC _ in component, named ADC _ in, there are two parameters, mask _ num and timeout, respectively.
And 6, newly building a model c66x _ lib.slx under MATLAB/Simulink.
Step 7, adding the ADC _ in component into c66x _ lib.slx, storing, and writing an sblocks.m file, wherein the file content is as follows:
Figure BDA0002379646440000081
and 8, adding c66x _ lib.slx and sblock.m created in the step 6, ADC _ in.mex64 created in the step 4 and an ADC _ in.tlc file created in the step 3 into the MATLAB search path.
Step 9, modifying a single-rate model code carried by MATLAB/Simulink to generate a template file, namely, barebaard _ srain.tlc, acquiring a model running period set by a user from the barebaard _ srain.tlc file, initializing a timer according to the running period, establishing a timer interrupt processing program, binding the timer interrupt processing program with the timer interrupt, periodically scheduling a self-carried rt _ one _ step function in the barebaard _ srain.tlc file to realize a model scheduling function, and finally storing the barebaard _ srain.tlc file as an ft _ barebaard _ srain.tlc file.
Step 10, modifying a variable rate model code of the MATLAB/Simulink self-carrying by adopting the same method as the step 9 to generate a template file bareboard _ mmain.tlc, acquiring a model operation period set by a user from a bareboard _ mmain.tlc file, initializing a timer according to the operation period, establishing a timer interrupt processing program and binding the timer interrupt processing program with the timer interrupt, periodically scheduling a self-carrying rt _ one _ step function in the bareboard _ mmain.tlc file to realize a model scheduling function, and finally storing the bareboard _ mmain.tlc file as a ft _ bareboard _ mmain.tlc file.
Step 11, customizing a code of a FT6678 multi-core processor to generate a template file FT6678_ file _ process.tlc, and generating a template file from a code which needs to be used at a single rate and a variable rate, namely adding file names of the FT6678_ file _ process.tlc and FT _ barebaard _ mr. Tlc files customized in step 9 and step 10 into the FT6678_ file _ process.tlc file, wherein the codes are as follows:
%if LibIsSingleRateModel()||LibIsSingleTasking()
%include"ft_bareboard_srmain.tlc"
%<FcnSingleTaskingMain()>
%else
%include"ft_bareboard_mrmain.tlc"。
and step 12, designing a processor framework description file FT6678.Tlc, describing a processor to be used, and adding the file name of the code generation template file FT6678_ file _ process. Tlc in the step 11 to the FT6678.Tlc file.
And step 13, designing a compiling and configuring command file ft _ make.bat, adding a compiler, a compiling command, a compiling option, a link command and an out file to bin file command which need to be used, creating a directory src for storing a model to automatically generate a source code and a Debug directory for storing a compiling and link result file.
Step 14, designing a compiled hook file FT6678_ make _ rtw _ hook.m file, which is called and executed by MATLAB/Simulink after the model code is generated, copying the file automatically generated by MATLAB/Simulink to the src directory created in step 13, and executing the FT _ make.bat file designed in step 12 to complete the generation of the executable file, wherein the exit method is as follows:
Figure BDA0002379646440000091
step 15, creating a system _ frame directory, generating a template file FT6678_ file _ process.tlc from the code created in step 11, generating a template file FT _ bareboard _ srmin.tlc from the single rate model code customized in step 9, generating a template file FT _ bareboard _ smrmin.tlc from the variable rate model code customized in step 10, and putting the processor frame description file ft6678.tlc, the compilation designed in step 13, the configuration command file FT _ make.bat, and the compilation hook file FT6678_ make _ rtw _ hook.m designed in step 14 into the system _ frame directory.
Step 16, add system _ frame directory under MATLAB search path.
And step 17, building a user model in Matlab/Simulink, and selecting an ADC _ in component required to be used from the c66x _ lib.
Step 18, clicking the Configuration Parameters option under the Simulation menu in Matlab/Simulation, and automatically generating the control interface Configuration Parameters by the popup model executable file, as shown in FIG. 4. FT6678.Tlc designed and realized in the step 12 is selected in the System target file under Configuration Parameters interface, a general Code only check box is checked, then, the application is clicked, then, a general Code button is clicked, code generation, copying, compiling, linking and out turning to bin files of the model and the driving component can be automatically completed, and the generated executable file is saved in a c \ vxp \ debug directory.
The above contents are only for illustrating the technical idea of the present invention, and the protection scope of the present invention should not be limited thereby, and any modification made on the basis of the technical idea proposed by the present invention falls within the protection scope of the claims of the present invention.

Claims (6)

1. A full model executable program building method based on MATLAB/Simulink is characterized by comprising the following steps:
step 1, writing a secondary S-Function file to describe an A component to obtain an A.c file;
step 2, configuring an S-Function component carried by the MATLAB, and configuring input, output and parameters of an interface of the S-Function component to obtain an A.slx component;
step 3, compiling a tlc file with the same name as the component A to obtain an A.tlc file;
step 4, compiling the A.c file obtained in the step 1 into an A.mex64 file through a mex command under MATLAB;
step 5, the A.c file obtained in the step 1 is associated with the A.slx file obtained in the step 2;
step 6, creating a custom component library lib.slx by using a library building function under MATLAB/Simulink;
step 7, adding the A.slx component obtained in the step 2 into a custom component library lib.slx, and adding the lib.slx into an MATLAB/Simulink component library by writing an sblocks.m file;
step 8, adding lib.slx in the step 6, sblock.m file in the step 7, A.mex64 file in the step 4 and A.tlc file in the step 3 into an MATLAB search path;
step 9, modifying the single-rate model code to generate a template file, namely, bareboard _ srain.tlc, adding functions of obtaining a model operation cycle, initializing a timer, binding interruption and scheduling the model to form an xx _ srain.tlc file;
step 10, modifying a variable rate model code to generate a template file bareboard _ mrain.tlc, and adding functions of acquisition of a model running period, initialization of a timer, interrupt binding and model scheduling to form an xx _ mrain.tlc file;
step 11, customizing a code to generate a template file xx _ file _ process.tlc, and adding file names of xx _ normal.tlc and xx _ mr.tlc files into an xx _ file _ process.tlc file;
step 12, designing a processor frame description file xx.tlc, describing a processor to be used, and adding the file name of the xx _ file _ process.tlc file to the xx.tlc file;
step 13, designing a compiling and configuring command file xx _ make.bat, adding a compiler, a compiling command and a compiling option configuration which need to be used, creating a directory src for automatically generating source codes by a storage model, and storing a Debug directory of compiling and linking result files;
step 14, customizing a compiling hook file xx _ make _ rtw _ hook.m, and adding the file name of the xx _ srmin.tlc obtained in the step 9 and the file name of the xx _ mrmin.tlc obtained in the step 10 into an xx _ make _ rtw _ hook.m file;
step 15, creating a system _ frame directory, and putting the code generation template file xx _ file _ process.tlc created in the step 11, the single-rate model code generation template file xx _ sramin.tlc created in the step 9, the variable-rate model code generation template file xx _ mramin.tlc created in the step 10, the processor frame description file xx.tlc designed in the step 12, the compiling designed in the step 13, the configuration command file xx _ make.bat, and the compiling hook file xx _ make _ rtw _ hook.m designed in the step 14 into the system _ frame directory;
step 16, adding a system _ frame directory into the MATLAB/Simulink search path;
step 17, building a user model in Matlab/Simulink, and selecting all bottom layer driving components to be used from a component library lib.slx added in the step 7 in Matlab/Simulink;
and 18, generating codes through the Generator Code of the model in Matlab/Simulink and automatically completing compiling, linking and generation of an executable program.
2. The MATLAB/Simulink-based full model executable program building method according to claim 1, wherein the process of step 1 is: using an sfuntmpl _ basic.c file template carried by MATLAB, renaming the sfuntmpl _ basic.c file to be A.c, and modifying the macro definition # define S _ FUNCTION _ NAME at the beginning of the file to be A;
in the mdlinitializesisizers function in a.c, ssSetNumSFcnParams is used to declare the number of parameters to be configured by the component, the values of the parameters can be configured on a component interface by a user, and the component a has two parameters which are respectively a bitmap chan _ mask for identifying whether a channel is selected and timeout time timeout; the number of input and output ports of the component is declared using the ssSetNumInputports and ssSetNumOutputports functions of the MATLAB in A.c, and the data dimension of each port is declared using the ssSetOutputPort function of the MATLAB in A.c if the port exists.
3. The MATLAB/Simulink-based full model executable program building method according to claim 1, wherein the specific process of step 3 is: creating a tlc file corresponding to the A.slx component, wherein the name of the tlc file is the same as the name of the component, the name A of the component is written after the instruction of% instances in the A.tlc file, the name is followed by the implementation language, and the% instances A and C are in the tlc file of the A component; the instances instruction is followed by the BlockTypeSetup, start, outputs, and Terminate functions.
4. The MATLAB/Simulink-based full model executable program building method according to claim 1, wherein the specific process of step 9 is: modifying a single-rate model code carried by MATLAB/Simulink to generate a template file, namely, bareboard _ srain.tlc, acquiring a model running period set by a user from a bareboard _ srain.tlc file, initializing a timer according to the running period, establishing a timer interrupt processing program and binding the timer interrupt processing program with the timer interrupt, periodically scheduling an rt _ one _ step function carried by the bareboard _ srain.tlc file to realize a model scheduling function, and finally storing the bareboard _ srain.tlc file as an ft _ bareboard _ srain.tlc file.
5. The MATLAB/Simulink-based full model executable program building method according to claim 1, wherein the specific process of step 14 is: designing a compiling hook file xx _ make _ rtw _ hook.m, calling and executing the compiling hook file xx _ make _ rtw _ hook.m by MATLAB/Simulink after model codes are generated, generating a folder corresponding to a model in an exit method in an xx _ make _ rtw _ hook function of the hook file xx _ make _ rtw _ hook.m, copying a file automatically generated by MATLAB/Simulink to an src directory created in step 13, and executing xx _ make.bat files designed in step 12 to complete generation of executable files.
6. The MATLAB/Simulink-based full model executable program building method according to claim 1, wherein the specific process of step 18 is: clicking a Configuration Parameters option under a Configuration menu in Matlab/Simulink, popping up a model executable file to automatically Generate control interface Configuration Parameters, selecting xx.tlc realized by step 12 in a System target file under the model executable file automatically generating control interface Configuration Parameters, checking a general Code only check box, clicking application, and clicking a general Code button, namely automatically completing Code generation, copying, compiling, linking and out conversion of a model and a driving component.
CN202010079105.6A 2020-02-03 2020-02-03 MATLAB/Simulink-based full-model executable program construction method Active CN111309292B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010079105.6A CN111309292B (en) 2020-02-03 2020-02-03 MATLAB/Simulink-based full-model executable program construction method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010079105.6A CN111309292B (en) 2020-02-03 2020-02-03 MATLAB/Simulink-based full-model executable program construction method

Publications (2)

Publication Number Publication Date
CN111309292A CN111309292A (en) 2020-06-19
CN111309292B true CN111309292B (en) 2023-02-21

Family

ID=71145760

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010079105.6A Active CN111309292B (en) 2020-02-03 2020-02-03 MATLAB/Simulink-based full-model executable program construction method

Country Status (1)

Country Link
CN (1) CN111309292B (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111880796B (en) * 2020-07-30 2023-03-14 西安微电子技术研究所 Multi-core model architecture implementation method and system
CN112579215B (en) * 2020-12-23 2023-12-15 潍柴动力股份有限公司 Scheduling function generation method and device
CN113742232B (en) * 2021-09-04 2024-02-27 重庆红江机械有限责任公司 Model-based TC1797 diesel engine control algorithm development tool
CN114942757B (en) * 2022-05-16 2023-07-21 北京世冠金洋科技发展有限公司 File generation method and system and electronic equipment
CN115185539B (en) * 2022-09-06 2022-12-09 西安羚控电子科技有限公司 Method, device and storage medium for generating executable dynamic link library file
CN118426782B (en) * 2024-07-05 2024-09-13 西安羚控电子科技有限公司 Method and device for compiling model file based on CMake tool

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7353502B2 (en) * 2002-07-03 2008-04-01 The Mathworks, Inc. System and method for creation of software components
US10410380B2 (en) * 2016-06-29 2019-09-10 Cornell University Image rendering utilizing procedural yarn model generated in multi-stage processing pipeline
CN108415699A (en) * 2018-02-12 2018-08-17 北京智行鸿远汽车有限公司 The method that the bottom layer driving of microcontroller carries out code building is customized using Simulink

Also Published As

Publication number Publication date
CN111309292A (en) 2020-06-19

Similar Documents

Publication Publication Date Title
CN111309292B (en) MATLAB/Simulink-based full-model executable program construction method
Jézéquel et al. Mashup of metalanguages and its implementation in the kermeta language workbench
CN110149800B (en) Apparatus for processing abstract syntax tree associated with source code of source program
Jézéquel et al. Model driven language engineering with kermeta
US6185728B1 (en) Development system with methods for type-safe delegation of object events to event handlers of other objects
Baker et al. Runtime aspect weaving through metaprogramming
Hähnle The abstract behavioral specification language: A tutorial introduction
Sawada et al. Emfrp: a functional reactive programming language for small-scale embedded systems
EP2249249B1 (en) Systems and methods for modifying code generation templates
US8429627B2 (en) Asynchronous preemptive edit time semantic analysis of a graphical program
EP1074911A2 (en) Aspect-oriented programming
CN111176658B (en) Automatic conversion method from AADL (architecture analysis and design language) to Simulink model based on meta-object mechanism
Dwarampudi et al. Comparative study of the pros and cons of programming languages java, scala, c++, haskell, vb. net, aspectj, perl, ruby, php & scheme-a team 11 comp6411-s10 term report
Zarrin et al. An integrated framework to specify domain-specific modeling languages
Cosentino et al. A model-driven approach to generate external dsls from object-oriented apis
WO2023128793A1 (en) System and method for dynamically visualizing software elements
Ramos et al. An Implementation of Python for Racket.
George et al. Programming language inter-conversion
Palanque et al. Interactive cooperative objects: an object-oriented formalism based on petri nets for user interface design
Ellner et al. An integrated tool chain for software process modeling and execution
Blunk et al. Efficient Development of Domain-Specific Simulation Modelling Languages and Tools
Gotti et al. A Model Driven approach for multi-platform execution of interactive UIS designed with IFML
Watt A technique for generic iteration and its optimization
Schröpfer et al. Integrating UML and ALF: An Approach to Overcome the Code Generation Dilemma in Model-Driven Software Engineering
CN111880796B (en) Multi-core model architecture implementation method and system

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
GR01 Patent grant
GR01 Patent grant