安装和运行SSFNet
首先应该安装1.4的jdk版本,因为源代码中的enum与1.5的jdk关键字重复
在linux下安装的时候很简单,只需要在其根目录下输入make all即可。因为你下载下来的是.java文件,要运行当然要先进行编译成.class文件了
,因为所有的SSFNet simulation要跑起来都必须从/src/SSF/Net/Net.class开始入口,因为该文件中才有main函数。
你可以看根目录下的Makefile是在干些什么事情,比如像我,就把worm的test注释掉了,因为对我没有用处。
明白了其原理,那么在windows下面也是同样的道理,你可以先把下载下来的src都编译成为.class来为每次模拟运行。当然也可以
在集成开发环境,如eclispe中来运行,只需把其jar文件作为build path添加进来,然后把src下的源文件作为工程普通文件倒入即可。
SSFNet运行的时候都必须从/src/SSF/Net/Net这个文件为入口,通常的运行命令是:
java SSF.Net.Net 1000 my.dml $SSF_HOME/examples/net.dml
其中1000表示仿真时间,my.dml是自己配置的网络,最后一个参数official DML SSFNet schema file that is used for automatic validation of your input DML file
所以说SSFNet是 self-configuring的,即 that is, each SSFNet class instance can autonomously configure itself by querying a configuration database, which may be locally resident or available over the Web
整个SSFNet仿真运行的流程如下:
At the start of the sumulation run, SSF.Net.Net object will use the services of the DML library to load the content
of the files my.dml and net.dml into a runtime Configuration database object. After that, SSF.Net.Net will systematically
instantiate and configure all simulation objects (Hosts, Routers, protocols, and network links). Once all simulation objects
have been instatiated, the initialization phase begins (Entity subclasses call their init() method), and finally SSF.Net.Net
invokes its method startAll(), and the simulation begins with simulation time value equal to 0 sec. There is a lot of
verbose output, including the automatically generated IP address blocks etc.
需要说一个比较搞人的事情是,如果在window下面的eclipse开发环境中按照上面说的方法运行的时候提示?Raceway license validation failure 0x4455这样
的错误,这个时候并不是真正的许可证验证失败!而是eclipse开发环境的build path中含有不常规的字符的原因,比如中文字符甚至[]都不行,
而我们知道下载下来的文件如果在windows下直接解压缩我们知道是有[]这个方括号的!!(类似的关于eclispe的build path中有非常规内容
而导致无法编译等问题的情况以前也见过,就是在build path中含有hibernate的非jar文件而导致无法编译),所以改换一下目录就可以了!
我又遇见?Raceway license validation failure 的无法运行的错误了,不过这次是0X5253了,搞死我了,多亏网上这位牛人的指导:
I think that your license problem can be solve if you organize your classpath with the raceway.jar followed by the other
“*”.jar files but first I recommend you to erase the ssfnet directory and uncompressed again and to do the make all again
from cero. If this doesn’t work a person posted this solution long time ago.
These are some examples of failure codes.
0x4253 if the class files for raceway SSF are not in a jar file
0x5253 if the filename of the jar file containing raceway SSF is not
"raceway.jar" (strictly speaking it's the first jar file on the
CLASSPATH that contains the raceway SSF class files -- so you may
want to put the raceway.jar on the CLASSPATH before ssf.jar and
dml.jar)
0x4335 if there is no license
0x4235 if there is no license key
0x8455 if the license doesn't match the license key
0x4455 any other errors not caught previously
那么根据上面的error code,5253的错误原因是他妈的build path中的jar文件顺序不合规定,即racewary.jar应该在第一个。
那么打开eclipse中的build path,选择Order and Export标签页,然后选中raceway.jar让其up到其它的jar文件之前即可运行了。
不过总之,这种错误依然还是build path的错误。