【正文】
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 establish munication directly with the realtime kernel to start and terminate the operation of an executable program. SIMULINK models and realtime applications have maintained a checking mechanism to check realtime kernel to use this mechanism to determine the SIMULINK model structure in the automatic code generation and realtime whether the structure of the application consistent. This ensures that the line changes when the model parameters, SIMULINK model parameters can be correctly mapped to the realtime application, the corresponding parameters. RTWT on the I / 0 board39。s algorithms and simulation through the writing and debugging, MATLAB piler and the C / C + + Math Library MATLAB application will be automatically converted to portable 231。輸出階段 mdlOutputs 模塊計(jì)算系統(tǒng)輸出。 S函數(shù)的工作原理和 Simulink 的仿真原理基本類似,每一個(gè) Simulink模塊都具有輸入 u、輸出 y、狀態(tài) x三個(gè)向量和其他一些對應(yīng)仿真各階段的方法。 利用 Simulink 模塊搭建控制器模型靈活方便,它外表以方塊圖形式呈現(xiàn),且采用分層結(jié)構(gòu)。當(dāng)客戶端和服務(wù)端是遠(yuǎn)程的時(shí)候,通過 TCP/IP 方式傳遞數(shù)據(jù),當(dāng)客戶端與服務(wù)端是當(dāng)?shù)氐臅r(shí)候,采用共享內(nèi)存的方式傳送數(shù)據(jù),在本系統(tǒng)中采用的就是后一種方式 。通道的另 一端在外部程序中執(zhí)行,這一端把新的參數(shù)值寫到目標(biāo)參數(shù)結(jié)構(gòu)中。在初始下載完成后, Simulink 保持在等待狀態(tài),只有在框圖中的參數(shù)發(fā)生改變或者接收到來自目標(biāo)機(jī)的參數(shù)才開始動作。對于 RTWT 不支持的板卡,可利用 Sfunction 模塊自行開發(fā)板卡的驅(qū)動程序。當(dāng) Simulink 模型的運(yùn)行期間, RTWT 從一個(gè)或多個(gè)輸入通道獲得采樣數(shù)據(jù)作為模型的輸入,然后快速的處理數(shù)據(jù),再通過 I/O boards 的輸出通道輸送到外部。 RTWT 對 I/0 board 的支持,在混合仿真試驗(yàn)系統(tǒng)中,數(shù)據(jù)的物理采集和物理控制輸出是靠 I/O 板卡完成的,那么實(shí)時(shí)應(yīng)用程序必須在軟件上具備數(shù)據(jù)采集和控制輸出的能力,也就說程序必須要和 I/O 板卡建立連接。 Simulink與實(shí)時(shí)程序之間的通訊是通過 Simulink的外部模式下的模塊來實(shí)現(xiàn)的。對于 RTWT, Simulink 和所12 生成的代碼都運(yùn)行在同一個(gè) PC 機(jī)上,其運(yùn)行界面可使用戶 PC 機(jī)的處理器運(yùn)行在 Windows NT 或者 Windows 95/98/2020/XP 操作系統(tǒng)的同時(shí)采用RTW 生成的代碼。模板文件 (makefile )允許用