在处理来自时间管理的联邦的接收订单属性的反映时,我是使用提供的时间还是用户提供的标签?
Do I use provided time or user supplied tag when handling a reflect on a receive order attribute from a time managed federate?
在使用 RPR-FOM 的模拟中,如果我得到一个带有 LogicalTime
时间戳(模拟时间)的 reflectAttributeValues
和我的 FederateAmbassador
.对于航位推算算法,我是使用 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)
RPR FOM 的大多数用户只使用用户提供的标签中的时间。
通常不使用 HLA 时间管理服务,因为您永远不会收到 LogicalTime 或时间戳顺序 (TSO) 中的消息。
参见 RPR FOM 联合协议,“SISO-STD-001-2015:Real-time 平台的指导、基本原理和互操作性模式 (GRIM) 标准参考联合对象模型 (RPR FOM)”,了解更多详情:https://www.sisostds.org/DigitalLibrary.aspx?Command=Core_Download&EntryId=30822
对于已更新时间戳顺序的属性,我使用 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);
}
此处的代码是简化示例,可能无法编译,但它们捕获了我想出的解决方案。
在使用 RPR-FOM 的模拟中,如果我得到一个带有 LogicalTime
时间戳(模拟时间)的 reflectAttributeValues
和我的 FederateAmbassador
.对于航位推算算法,我是使用 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)
RPR FOM 的大多数用户只使用用户提供的标签中的时间。
通常不使用 HLA 时间管理服务,因为您永远不会收到 LogicalTime 或时间戳顺序 (TSO) 中的消息。
参见 RPR FOM 联合协议,“SISO-STD-001-2015:Real-time 平台的指导、基本原理和互操作性模式 (GRIM) 标准参考联合对象模型 (RPR FOM)”,了解更多详情:https://www.sisostds.org/DigitalLibrary.aspx?Command=Core_Download&EntryId=30822
对于已更新时间戳顺序的属性,我使用 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);
}
此处的代码是简化示例,可能无法编译,但它们捕获了我想出的解决方案。