TrueTime安装详细说明
- 格式:pdf
- 大小:118.41 KB
- 文档页数:2
TrueTime安装说明:详细注明各个细节
rueTime是瑞典隆德大学(Lund University)自动控制系的Martin Ohlin,Dan Henriksson和
Anton Cervin开发的一个基于MATLAB\Simulink的网络化控制仿真工具箱,该工具箱填
补了MATLAB\Simulink在新兴的网络化控制领域的仿真方面存在的空白。截至目前(2007
年8月),TrueTime的最近版本是1.5,下面的说明旨在介绍TrueTime 1.5的安装步骤,并对安
装之前以及安装过程中的诸多调试过程中可能存在的问题给出解决的办法。 T
首先,需要申明。TrueTime是使用C++语言编写的,因而它的运行依赖于C++编译器。
所以目标电脑上除了必须的MATLAB外还应安装C++编译器。这里,TrueTime的作者推荐
用户使用Microsoft公司的Visual Studio C++的编译器。一般来说,计算机相关专业都需要
Visual Studio这个涵盖Basic、C++、C#和J#等编程语言的可视化集成开发环境。需要特别注
意:TrueTime 1.5要求使用Visual Studio C++ 7.0,而广为使用的Visual Studio C++ 6.0是不可
以的(因为它无法编译部分TrueTime的源文件)。那么我们就应该事先安装Visual Studio .NET
2002(对应7.0版本)或Visual Studio .NET 2003(对应7.1版本)。
另外,TrueTime 1.5要求的MATLAB最低版本为6.5.1(即R13 SP1) 。常用的6.1或5.3
版本TrueTime 1.5不再支持。
1、如何得到TrueTime 1.5
登陆隆德大学自动控制系站点http://www.control.lth.se/truetime。下载需要先注册,然后
他们会发邮件到你所注册的邮箱,邮件中包含下载TrueTime 1.5的链接。下载是免费的。
2、安装TrueTime 1.5
(1)把第一步获得的truetime-1.5.zip解压缩后到truetime-1.5文件夹,并拷到matlab的安
装目录toolbox下;
(2)运行MATLAB,在MATLAB的File菜单下点击“Set Path...”然后弹出“Set Path”窗
口,点击“Add Folder...”点开(1)中创建的truetime-1.5文件夹中的Kernel子文件夹,点“确
定”。这时,窗口中会多出一个路径,如“D:\MATLAB701\toolbox\truetime-1.5\kernel”。(该路
径随MATLAB版本和MATLAB的安装路径的不同而变化。)最后,点击左下角的“Save”,再
“Close”;
(3)在Windows XP中依次进入“控制面版/系统/高级/环境变量”中添加系统变量及用户
变量“TTKERNEL”;以及路径,例如D:\MATLAB701\toolbox\truetime-1.5\kernel;
(4)在MATLAB\toolbox\local\startsav.m中添加如下命令:
addpath([getenv('TTKERNEL')])
init_truetime; 例如,
%STARTUPSAV Startup file
% Change the name of this file to STARTUP.M. The file
% is executed when MATLAB starts up, if it exists
% anywhere on the path. In this example, the
% MAT-file generated during quitting using FINISHSAV
% is loaded into MATLAB during startup.
% Copyright 1984-2000 The MathWorks, Inc.
% $Revision: 1.4 $ $Date: 2000/06/01 16:19:26 $
addpath([getenv('TTKERNEL')])
init_truetime;
load matlab.mat
并把该文件更名为:startup.m;
(5)在MATLAB中打开MATLAB\toolbox\local\matlabrc.m,并用M-File Editor中File
菜单下的“Save Workspace As...” 命令把该文件命名为matlab.mat并保存至
MATLAB\toolbox\local;
(6)把MATLAB\toolbox\truetime\kernel\init_truetime.m复制到MATLAB\toolbox\local。
3、安装VC++编译器
特别注意TrueTime 1.5只能使用Visual studio .NET 2002或Visual studio .NET 2003。
4、编译器设定
重新运行MATLAB并在Command Window运行“mex -setup”设定编译器。
5、初始化
要试用例子时,先要初始化,同样在Command Window运行“make_truetime”。这时
MATLAB会用设置的C++编译器编译TrueTime中相关源文件。这需要一定时间。如果前面
的步骤都准确完成,最后在Command Window会提示编译成功完成。这也表明安装大功告成。
你可以把TrueTime 1.5自带的10个例子复制到MATLAB\work然后就可以尝试了。
6、释放空间
如果在成功使用“make_truetime”完成编译后,并且今后你选择使用M文件而不是C++编
写仿真初始化、控制等代码,你可以此时将先前安装的Visual Studio卸载掉。因为无论是Visual
Studio .NET 2002或Visual Studio .NET 2003都需要相当大的磁盘空间,这样也可以再重新安
装Visual Studio C++ 6.0,用于其它编程应用,毕竟还是Visual Studio C++ 6.0实惠。不过要注
意,安装Visual Studio .NET 2002或Visual Studio .NET 2003对于安装TrueTime过程中初次编译其源文件是必须的。但是,完成编译后,就可以将其卸载,以释放空间。
注:上述说明对应的计算机软件配置
Windows XP SP2 Professional
MATLAB 7.0.1
Visual Studio .NET Enterprise Architect 2003
TrueTime 1.5
声明 本文章系作者原创。谢绝任何形式未经许可的全部或部分的引用。经作者书面同意的
转载必须指明出处。 Note All rights reserved. No part of this work covered by copyrights hereon may be reproduced or copied in any form or by any means―graphic, electronic, or mechanical, including photocopying , recording, taping, or information storage or retrieval systems―without written permission of the publisher.
Copyright © 2007 Shaoxin Zheng School of Electronic Information & Automation, Tianjin University of Science & Technology, P. R. China Please direct questions and bug reports to: zhsxcn@gmail.com