我用pRTI和两个联邦成员在Java中进行了HLA仿真。我想提前进行模拟。据我所知,为此目的采用了以下方法:
_ambassador.timeAdvanceRequest(time);,ambassador是RTI大使。
我的问题是将什么传递到time参数中?我想这应该是我希望我的模拟提前的时间,但是如何得到这个呢?
发布于 2014-05-02 21:01:53
好吧,我想出来了。
有必要使用LogicalTime接口实现之一,例如使用TimeFactory:
LogicalTime time = _ambassador.getTimeFactory().makeFinal();调用timeAdvanceRequest()将向RTI发送请求。如果时间提前,将对联邦成员调用timeAdvanceGrant()。
进一步的信息,这里。
发布于 2017-01-24 00:23:08
以下是我认为它应该在HLA 1516-2010中工作的方式。从HLA1516-2010开始,RTI需要提供两个时间表示:HLAinteger64Time和HLAfloat64Time ( HLA接口规范的12.4和12.11.2节)。要访问这些文件,可以使用LogicalTimeFactoryFactory。例如,下面的代码将获得一个HLAfloat64TimeFactory
HLAfloat64TimeFactory timeFactory =
(HLAfloat64TimeFactory)LogicalTimeFactoryFactory.getLogicalTimeFactory("HLAfloat64Time")然后,可以使用这个timeFactory实例创建HLAfloat64Time和HLAfloat64Interval实例:
HLAfloat64Time t = timeFactory.makeTime(3.0);
HLAfloat64Interval interval = timeFactory.makeInterval(1.0);或者,使用接口
LogicalTime t = timeFactory.makeTime(3.0);
LogicalTimeInterval interval = timeFactory.makeInterval(1.0);类似的代码用于Integer时间工厂。
https://stackoverflow.com/questions/23436713
复制相似问题