【正文】
s Sfunction supports this feature, so the algorithm extensions must use C / C + + language, S function. Sfunction, working principle and the basic SIMULINK simulation of a similar principle, every SIMULINK blocks have input u, output y, state 23 vector x and the other corresponding to the three stages of simulation methods. SIMULINK model through the cycle of calling a particular method of each module to plete the calculation of output value, such as, update discrete state values, calculating a state of differential and other tasks. In the Sfunction with the SIMULINK simulation is provided corresponding to different stages of the callback function. phase includes Sizes, module initializes the system since they were input dimension output dimension, the number of state variables, the definition of simulation sampling time and the role of initial state variables. Output stage modular puting system output. Loop simulation phase Update modular puting system is currently updating the value of state variables. CS function not only has the C language to describe the function of the code embedded in SIMULINK blocks for the simulation in SIMULINK, and can easily be C language Sfunction module function code into pure C code. 。 (4) Calculation of the size of the vector (mainly for SFunctions module box). In this process, RTW read the model file , and then pile it as a model of internal description. This description is stored in ASCII files and languageindependent, name . We can use that file as input for the next process, it will be automatically deleted after the code generation. 2. call TLC program to generate C code, at this stage, TLC stored in in the internal model description into a specific object code. TLC is an interpreted programming language, programming language design that the only purpose is to model description into the code. TLC in the pilation process of the implementation of multiple object files (TLC script file), and TLC library procedures. Object file is divided into two types: one is the target file system, one is the module object file. The target file to specify how to used as an input, generate code from modle. RealTime Workshop target binding environment for a variety of target file system, Figure shows all the available system target file. In this system, our target environment is windows, the selected target rapid prototyping RTWT, then the building process before, we specify as TLC used in the pilation process script file. customized Mfile, in this step, will have a custom template 19 file (Mfile), the file name is .. Generated makefi1e used to guide the make utility to pile and link model, which generates source code. RTW is a systemgenerated template (system template Mfile) generated , this template file name is (syetem is the target name is selected), such as in the previous step, we selected as Our system target file, also called selected our system as a template file. Template file (Mfile) allows users to customize the piler, piler options and other information during the process to establish, if the piler used in different, then the makefile file will be different, such as when the target is Windows, the system target file is rtwin . tlc, but with the visual C \ C + + piler, the system template file is , and choose wat, the system of the template file is . only a copy, you can modify this file to customize the build process of the process. RTWT (RealTime Windows Target) is to provide and distribute a MATLAB RTW system framework based on the additional products are shipping 將 turn its machines into as a PC system with the aim of rapid prototyping one kind of methods for Kong realtime testing and development. In this environment, a PC, both as a host, but also as the target machine there. For RTWT, SIMULINK and the generated code running on the same PC, the interface allows users to run PCprocessor running on Windows NT or Windows 95/98/2020/XP operating system, while the code generated by RTW . RTWT supports many types of I / O device boards (including the two types of ISA and PCI). Users only need to install related software, a piler and I / O device card, a PC machine can be used for realtime system and through I / O devices and external devices to connect. Core through the I / O driver module as the interface and I / O hardware, munication, and to check I / O board installation is correct. SIMULINK and Realtime munication between processes is 20 through the SIMULINK external mode, the module to achieve. This module is to estab