在处理来自时间管理联邦成员的接收顺序属性的反射时,我使用提供的时间还是用户提供的标记



在使用RPR-FOM的模拟中,如果我在FederateAmbassador中获得具有LogicalTime时间戳(模拟时间)和OrderType接收顺序的reflectAttributeValues。对于航位推算算法,我使用RTI提供的时间戳还是userSuppliedTag中编码的时间戳?如果是绝对的,则使用userSuppliedTag将是解码值,如果是相对的,则系统时钟将是解码的值。

为了澄清,我在FederateAmbassador中从RTI:获得了来自时间管理联邦成员的反映指定接收顺序的属性

void reflectAttributeValues(ObjectInstanceHandle theObject,
                               AttributeHandleValueMap theAttributes,
                               byte[] userSuppliedTag,
                               OrderType sentOrdering,
                               TransportationTypeHandle theTransport,
                               LogicalTime theTime,
                               OrderType receivedOrdering,
                               MessageRetractionHandle retractionHandle,
                               SupplementalReflectInfo reflectInfo)

对于更新了"时间戳顺序"的属性,我使用time参数来知道属性最后一次更新的时间以及到死的模拟时间。

public void reflectAttributeValues(
            ObjectInstanceHandle objectHandle,
            AttributeHandleValueMap attributes,
            byte[] userSuppliedTag,
            OrderType sentOrdering,
            TransportationTypeHandle theTransport,
            LogicalTime time,
            OrderType receivedOrdering,
            MessageRetractionHandle retractionHandle,
            SupplementalReflectInfo reflectInfo) {
   attributes.forEach((attributeHandle, value) -> {
      lastUpdated.put(attributeHandle, time));
      timeManaged.add(attributeHandle);
      // decode value into your object
      ...
   }
}

对于更新了Receive Order而没有时间戳的属性,我使用userSuppliedTag来知道属性的最后一个更新时间(接收属性时标签中的绝对值和系统时钟中的相对值),然后使用系统时钟进行死计算。

public void reflectAttributeValues(
            ObjectInstanceHandle objectHandle,
            AttributeHandleValueMap attributes,
            byte[] userSuppliedTag,
            OrderType sentOrdering,
            TransportationTypeHandle theTransport,
            SupplementalReflectInfo reflectInfo) {
    LogicalTime time;
    if (isRelativeTag(userSuppliedTag)) {
       time = factory.createSystemLogicalTime(System.currentTimeMillis());
    } else {
       time = decodeTag(userSuppliedTag);
    }
    attributes.forEach((attributeHandle, value)-> {
       lastUpdated.put(attributeHandle, time);
       timeManaged.remove(attributeHandle); // attributes might switch
       // decode value into your objects
       ...
    }
}

然后去死估计:

private Vector3D getDeadReckonedWorldLocation(LogicalTime time) {
   LogicalTime lastUpdatedSpatial = lastUpdated.get(spatialAttributeHandle);
   if (!timeManaged.contains(spatialAttributeHandle)) {
      time = factory.createSystemLogicalTime(System.currentTimeMillis());
   }
   LogicalTimeInterval timeToDeadReckon = time.distance(lastUpdatedSpatial);
   return deadReckon(timeToDeadReckon);
}

这里的代码是简化的示例,可能不会编译,但它们捕获了我设法想出的解决方案。

RPR FOM的大多数用户只使用用户提供的标记中的时间。

HLA时间管理服务通常不会被使用——您永远不会收到LogicalTime或时间戳顺序(TSO)中的消息。

有关更多详细信息,请参阅RPR FOM的联邦协议,"SISO-STD-001-2015:实时平台参考联邦对象模型(RPR-FOM)的指导、原理和互操作模式标准"https://www.sisostds.org/DigitalLibrary.aspx?Command=Core_Download&入口ID=30822

最新更新