2

In a simulation using RPR-FOM, if I get a reflectAttributeValues with a LogicalTime time stamp (simulation time) and the OrderType receive order in my FederateAmbassador. For dead reckoning algorithms do I use the time stamp supplied by the RTI or the time stamp encoded in the userSuppliedTag? Using the userSuppliedTag would be decoded value if absolute and system clock if relative.

To clarify, I get attributes reflected specified receive order from a time managed federate in this call in FederateAmbassador from the RTI:

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

2 回答 2

1

对于已更新时间戳顺序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
      ...
   }
}

对于在没有时间戳的情况下更新接收订单的属性,我使用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);
}

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

于 2017-01-24T09:34:19.563 回答
0

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

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

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

于 2016-01-26T21:21:20.280 回答