版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、Mechanical Simulation912 North Main, Suite 210, Ann Arbor MI, 48104, USATechnical MemoPhone: 734 668-2930 Fax: 734 668-2877 : infoRunning Multiple VS Vehicles in SimulinkThis document describes how multiple vehicles from a VehicleSim (VS) product (BikeSim,CarSim, and TruckSim) can be simulated in a
2、single Simulink m. The example simulation inthis memo is based on some datasets included in TruckSim 7.0; similar examples also exist in CarSim and BikeSim.Example Simulink Mwith Two VehiclesAll of the VS products come with an example Simulink mthat includes two vehicles thatinteract. (See the examp
3、les in the Datasets, category Simulink). For example, TruckSim7.0 includes a Simulink mshowing two vehicles interacting, with the second vehicle usingadaptive cruise control based on the distance between the vehicles. Figure 1 shows a view of the animation.Figure 1. Animation of two-vehicle simulati
4、on example in TruckSim.Any simulation that involves multiple vehicles must have at least one Run Control dataset per vehicle that provides a description of that vehicle. For example, in TruckSim the two vehicles shown in the animation in Figure 1 are associated with two Run Control datasets datasets
5、:··Simulink Multi Vehicles: Cruising First TruckSimulink Multi Vehicles: Cruising Second TruckApril 2, 20081 / 9Before making a new run in Simulink involving multiple vehicles, there is an extra step necessaryafter installing the software from the CD that is not required for ms with just o
6、ne vehicle.Navigate to each run that is referenced in the Simulink m(the two datasets noted above),unlock the screen, and click the Send to Simulink button. After this is done for both datasets, theSimulink misy to run with the two vehicles.Background: Running One Vehicle Min SimulinkRunning a Simul
7、ink mwith just one vehicle is done with a high level of automation betweenSimulink and a VS browser such as TruckSim. Working with multiple ms requires that someof the information set automatically for one mmust instead be set manually.1234Figure 2. Simulink mwith one VS vehicle m.Before going into
8、thes of the two-vehicle example, the technical discussion will begin witha description of how the browser sets up runs in Simulink involving a single vehicle. For2 / 9NoteThe run can be initiated from Simulink, or from either TruckSim run screen using the Run from Here button.example, consider the S
9、imulink ABS mincluded in TruckSim that is shown in Figure 2.(Similar ABS ms are also included in BikeSim and CarSim.)VS products such as TruckSim include a group of DLL solver program files, each optimized for a specific multibody vehicle configuration involving nonlinear suspension types, the numbe
10、r of axles, the number of trailers, and other factors. The multibody configuration is identified by a vehicle code, associated with the vehicle dataset. For example, in Figure 2 the vehicle dataset linkshows that the vehicle code for the selected vehicle is s_s. (This code represents a 2-axle1vehicl
11、e with solid-axle suspensions front and rear.) The s_s code was sent automatically to theSimulink mby the TruckSim browser, and is shown under the TruckSim S-Function block, and also in the Function Block Parameters window.23The Function Block Parameters window shows a second parameter: the name of
12、a simulationcontrol file (simfile). The default name for this file is simfile.4The operation of a VS solver program is described in the VehicleSim Solver Programs ReferenceManual. When running under Windows OS, the program that runs the simulations a simfilethat identifies a dynamically linked libra
13、ry (DLL) file that is then loaded to access the VS solver suitable for the specified run.Listing 1 shows the contents of simfile for the example run from Figure 2. (The listing includes line numbers to support the following discussion.) Line 7 identifies the DLL file for the vehicle as C:Program Fil
14、esTruckSim_ProgProgramsSolversDefault s_s.dll.Listing 1. Example simfile for a single vehicle simulation.When the Simulink m automatically:(an MDL file) is opened by Simulink, several things happen1.Simulink queries the VS S-Function block (e.g., the TruckSim S-Function) to determine the number of i
15、nput and output variables and other properties of the block.2.In response to the query from Simulink, the VS S-functions the simfileidentified as a function block parameterand finds the global pathname for a DLL4file identified by the keyword DLLFILE (see line 7 in Listing 1).The S-Function loads th
16、e DLL file identified in step 2, and invokes a function from3.the DLL called vs_configuration that is part of the VS applicationprogram interface (VS API). This function takes the name of the simfile as an input,and then scans the simfile to obtain the name of a mparameter input file(parsfile), iden
17、tified by the keyword INPUT (see line 2 in Listing 1).3 / 91. SIMFILE2. INPUT C:TruckSim_DataRunsRun193_all.par3. ECHO C:TruckSim_DataRunsRun193_echo.par4. FINAL C:TruckSim_DataRunsRun193_end.par5. LOGFILE C:TruckSim_DataRunsRun193_log.txt6. ERDFILE C:TruckSim_DataRunsRun193.erd7. DLLFILE C:Program
18、FilesTruckSim_ProgProgramsSolversDefaults_s.dll8. END4.The VS API function continues tothe parsfile identified in step 3, obtaining allparametric information from the VS database (e.g., TruckSim) associated with thecurrent run. This includes the number of variables imported into the block and the nu
19、mber of variables exported from the block.5.The VS API function vs_configuration provides the number of importand export variables to Simulink, which then checks for compatibility with the inputand output controls that are set in the Simulink m then Simulink generates an error message.). (If they ar
20、e not compatible,6.Simulink sends a terminated to the S-Function block. The S-function theninvokes a corresponding VS API function vs_terminate and unloads the VS DLL.Whenever a run is initiated, either from Simulink or the VS browser, the S-Function loads theDLL file again, repeating steps 3 and 4
21、above. Thus, the simfile is alwaysat least twice for arun: once to determine the number of import and export variables when Simulink defines itsinternal representation of the m, and a second time when the run starts.It is common to change vehicle properties or run conditions from the VS browser afte
22、r a Simulinkmiivated. If this is done, the Send to Simulink button should be clicked so the browserwill update the parsfile and simfile used by Simulink.Considerations with Multiple Vehicle MsThe VS browser is designed to automatically load the appropriate VS solver from the family of DLL files if r
23、un with no other software, or to communicate with other software (e.g, Simulink) with a full pathname for the specific DLL file that should be loaded. All of the information from the VS database is provided to the DLL via an input parsfile that is specified in a simfile, which is automatically gener
24、ated whenever initiating a run or sending information to other software.The VS solvers are designed be loaded and run from many environments, so the main considerations for running multiple vehicles is to set up an independent solver for each vehicle, with an associated independent parsfile, referen
25、ced by an independent simfile.Multiple VS DLL FilesA VS solver DLL is intended to represent a single vehicle, and cannot represent two independent vehicles at the same time. (At any given time, the Windows OS will load a specific DLL file only once. If a program specifies that the DLL should be load
26、ed again, the OS simply returns a pointer to the existing location in memory.)When there is a need to simulate two vehicles at the same time, based on the same VS configuration (e.g., s_s), then a simple method for defining a new independent simulation mis to make a copy of the DLL with a different
27、name (e.g., s_s2.dll) and load the copy. Even though the contents of the second DLL are identical to the original, the Windows OS will handle them as being completely independent.Multiple Simfiles and ParsfilesIn normal operation with a single vehicle, the VS solver writes a new simfile in the curre
28、nt working directory (the root folder of the VS database) that references a parsfile generated from the currently active Run Control dataset.4 / 9If two separate vehicles are to be simulated simultaneously, then each needs a separate simfileand parsfile. A simple way to set up multiple vehicle ms th
29、at can run at the same time is tocreate a separate Run Control dataset to represent each vehicle, as described for the TruckSim example below.The Adaptive Cruise Control Example in TruckSim: the Second VehicleFigure 3 shows one of two Run Control datasets that connected to a Simulink mused tosimulat
30、e two vehicles that interact through an adaptive cruise control. Clicking on the Send toSimulink buttonbrings up a Simulink mthat has two TruckSim S-Function blocks.2Double-click on a block to see the associated parameters, as was done in Figure 3 for the secondblock. The two parameters for the bloc
31、k are the vehicle code(s_s2)and the simfile name56(simfile2). Listing 2 shows the contents of simfile2. Note that the DLL file that is7named in line 7 is compatible with the vehicle code s_s2 shown in Figure 3 for Simulink (5and), but not for the linked vehicle dataset in the Run Control screen. The
32、 automatic61copying of the code from the Run Control screen will not work here: the code must be set manually for each vehicle S-Function block.2134567Figure 3. Example Simulink mwith two trucks that interact.5 / 9Listing 2. Simfile2 for TruckSim adaptive cruise control (second vehicle).Clicking on
33、the blue link under the run control buttons transfers to the Simulink m the second vehicle, shown in Figure 4.screen for12345678Figure 4. Ms: Simulink screen for second vehicle in TruckSim example.As with any Ms: Simulink dataset, the name of the MDL file is specified, along with1links to datasets t
34、hat specify variables for importand exportrelative to the Simulink78m.In this case, some advanced features are also used.The name of the simfile is also specified on this screen to be simfile2. (Thed for6defining the name of a simfile is the keyword simfile, followed by the name.) Therefore, whenthe
35、 Send to Simulink button (in Figure 3) is clicked, the file created is simfile2 rather2than the default simfile. This name is set to match the name that was put in the TruckSimBlock Parameters fieldin Figure 3.76 / 91. SIMFILE2. INPUT c:TruckSim_DataRunsRun204_all.par3. ECHO c:TruckSim_DataRunsRun20
36、4_echo.par4. FINAL c:TruckSim_DataRunsRun204_end.par5. LOGFILE c:TruckSim_DataRunsRun204_log.txt6. ERDFILE c:TruckSim_DataRunsRun204.erd7. DLLFILE c:TruckSim_DataExtensionsMulti_Vehicles_s2.dll8. ENDThere are no restrictions for the name of the simfile, except that it cannot contain any charactersth
37、at would be illegal for a Windows file name. To avoids, it is recommended that asimfile that is linked to a datset such as this should have a unique name, so it will not be inadvertently overwritten. There is nothing magical about the name simfile2; in the example that come with TruckSim there are o
38、nly two datasets that specify non-default simfile names, and those names are simfile1 (for the first vehicle in this example) and simfile2.The checkbox for specifying alternative solver files is checked, causing a pull-down control4to be displayed for setting the number of vehicle types that will be
39、 associated with alternativesolver files. In this case, the control is set to 1, causing data fields to be shown for one vehicle5codeand one pathname. The settings in these fields indicate that when a vehicle is23selected on the Run Control screen with code s_s, then the associated DLL file is to be
40、2. This relative pathname is converted to anExtensionsMulti_Vehicless_s2.dll3absolute pathname when writing simfile2 (see line 7 in Listing 2). The file name is set to becompatible with the vehicle code set for the Function Block Parameters fieldin Figure 36If we want to change the name of the eithe
41、r the simfile or the DLL file, then a matching changemust bein the Ms: Simulink screen (Figure 4) and also for the Function BlockParameters window (Figure 3).The Adaptive Cruise Control Example in TruckSim: the First VehicleA separate Ms: Simulink dataset is used for the first vehicle in the Simulin
42、k m, and isshown in Figure 5.As with the Ms: Simulink dataset from Figure 4, the Simulink MDL file is identified.1The defauLL file for the vehicle (s_s.dll) can be used, and therefore the checkbox to use adifferent solver file is not checked, and the advanced controls shown in Figure 4 are not2visib
43、le. The only remaining pieces of information are the name of the simfile associated with thisvehicle (simfile1), and a set of output variables that will be provided by this mto3Simulink.47 / 9Note In the example datasets provided with the TruckSim 7.0 CD and CarSim7.01 CD, the simfile specification
44、3 shown in the above figure is instead located in the misc. yellow field on the Run Control screen, as was done for the simfile name for the second vehicle.Note In the example datasets provided with the TruckSim 7.0 CD and CarSim7.01 CD, the simfile specification 6 shown in the above figure is inste
45、ad located in the misc. yellow field on the Run Control screen. Both locations are equally valid. However, the location described in this memo is recommended because it places most of the information needed to define a separate vehicle m on the same dataset: the screen shown in Figure 4.1234Figure 5
46、. Ms: Simulink screen for first vehicle in TruckSim example.Summary of Method for Simulating Multiple VehiclesTeral method for building a Simulink mthat involves two or more vehicles can now besummarized.1.Each vehicle min the Simulink m(an MDL file) must be represented by a copyof the vehicle S-Function block provided with the VS package. (E.g., the TruckSim S- Function for TruckSim). For example, in Figure 3, there are two copies of this block.2.Each vehicle must be def
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2023年疾病预防控制及防疫服务项目可行性建设方案
- 2024政府采购环保设备采购招标代理服务合同3篇
- 初一新生安全教育宣讲
- 二建建筑工程实务-二建《建筑工程管理与实务》预测试卷2267
- 2024年公务员考试乌拉特前旗《行政职业能力测验》预测试卷含解析
- 科教融汇培养创新人才的策略及实施路径
- 2025年幼儿园春季安全工作计划范文
- 2025年安全生产办公室工作计划
- 2025年班主任工作计划范文小学低年级
- 2025年市场营销工作计划范文
- 2024年电商平台入驻服务合同
- 2024年度政府采购代理服务合同-医疗卫生设备采购项目3篇
- GJB9001C版标准培训课件
- 船舶防火与灭火(课件)
- 七、监理工作重点、难点分析及对策
- 面膜中蓝铜肽经皮渗透性和改善皮肤衰老作用研究
- 湖北省荆州市八县市2023-2024学年高一上学期1月期末考试 化学 含解析
- 专题05 说明文阅读(必考题型梳理)50题-2023-2024学年八年级语文下学期期中专题复习(上海专用)(解析版)
- 《水文化概论》全套教学课件
- 2023年四川省公务员录用考试《行测》真题卷及答案解析
- 社区共享菜园建设方案及实施计划
评论
0/150
提交评论