op_hla_obj_attr_set()

Note: Requires High-Level Architecture functionality

Abstract

Assigns the value of an attribute in the specified object and informs the HLA-PM of the change.

Syntax

op_hla_obj_attr_set (objid, attr_name, value)
Argument Type Description
objid Objid object ID of the object-of-interest
attr_name const char * name of the attribute-of-interest
value void* new value for the specified attribute
[This argument can accept an integer, a double, or a character string value.]

Return Type

Compcode

Completion code indicating success or failure in setting the attribute value or queuing the request. The procedure returns OPC_COMPCODE_SUCCESS if the attribute was updated and the request was queued for later processing by the HLA-PM. It returns OPC_COMPCODE_FAILURE otherwise.

Example

op_ima_obj_attr_get (my_id, "Update Request", &value);
if (value != request_value)
	{
	op_hla_obj_attr_set (node_id, "Update Time", op_sim_time ());

Details

This KP first invokes op_ima_obj_attr_set() to perform the assignment (see that KP for details). If the assignment is successful, the HLA-PM is informed of the change so that, if the attribute is mapped to a published HLA attribute, an appropriate RTI attribute update event is generated once all the events at the current simulation time have been processed. All changes for a given object are sent using a single RTI attribute update.

Using this KP is more efficient that using op_ima_obj_attr_set() followed by op_hla_attr_change_notify() to let the HLA-PM determine which attributes have been modified.

Purpose

Provides a mechanism to dynamically assign object attributes during the course of a simulation, and have the HLA-PM immediately register the change for eventual generation of appropriate RTI attribute updates.

Errors

  • Recoverable Error: Objid (<objid>): Unable to queue request of outgoing update for attribute (<attr_name>). (due to memory allocation failure)

Reference

  • Use one of the op_ima_obj_attr_set() KPs to set the attribute of an object without informing the HLA-PM of the change
  • Use the KP op_hla_attr_change_notify() to let the HLA-PM check all published attributes of an object for possible changes

本站文档由 北京智网畅联科技有限公司 整理、翻译并提供 · Documentation compiled and provided by Beijing ZNetLink Technology Co., Ltd.

交流群 · QQ Group:OPNET/智网妙算网络仿真交流群(群号 486383494)

原文档 © 2017 Riverbed Technology · 本站为公益翻译,由 AI 辅助完成,请仔细甄别

Original documentation © 2017 Riverbed Technology. Community translation, AI-assisted. Contact: jiazequn@znetlink.com