op_hla_attr_change_notify()
Note: Requires High-Level Architecture functionality
Abstract
Indicates to the HLA-PM that all published attributes of the specified object should be checked for possible value changes and an appropriate RTI attribute update generated if necessary.
Syntax
op_hla_attr_change_notify (objid)
| Argument | Type | Description |
|---|---|---|
objid |
Objid |
object ID of the object to check for attribute updates |
Return Type
Compcode
Completion code indicating success or failure in queuing the request. The procedure returns OPC_COMPCODE_SUCCESS if the request was successfully queued for later processing by the HLA-PM. It returns OPC_COMPCODE_FAILURE if the request could not be queued.
Example
op_ima_obj_attr_get (my_id, "Update Request", &value);
if (value != request_value)
{
int num_units;
double cost;
. . .
op_ima_obj_attr_get (row_id, "Number Units", &num_units);
op_ima_obj_attr_set (row_id, "Number Units", ++num_units);
op_ima_obj_attr_get (row_id, "Cost", &cost);
op_ima_obj_attr_set (row_id, "Cost", (cost * 0.5));
}
op_hla_attr_change_notify (node_id);
Details
The HLA-PM needs to be notified when attributes of an object mapped to a High-Level Architecture instance are being modified. One approach is to use one of the op_ima_obj_attr_set() KPs to update various attributes. Once the complete set of attribute changes has been applied, calling op_hla_attr_change_notify() will mark the object so the HLA-PM can check for any value changes to published attributes.
The HLA-PM check occurs only when the HLA-PM executes. If more changes are applied in the current simulation time, only the last changes will be visible to the HLA-PM. The HLA-PM records the current value of an attribute when that value is passed to the RTI for update. Later checks triggered by op_hla_attr_change_notify() will result in RTI updates only for attribute values that have changed.
Use op_hla_obj_attr_set() if you want to check for every change to an attribute, even if the change is to re-assign the previous value. If you use op_hla_obj_attr_set(), do not use op_hla_attr_change_notify().
Purpose
Provides a mechanism to allow the HLA-PM to generate appropriate attribute updates after the attributes were modified without using op_hla_obj_attr_set(). Updates will be made with op_ima_obj_attr_set() or directly by the Simulation Kernel.
Errors
- Recoverable Error: Objid (
<objid>): Unable to queue attribute change request. (due to memory allocation failure)
Reference
- Use the KP op_hla_obj_attr_set() to have the HLA-PM automatically take into account attribute changes
- Use the KP op_hla_obj_attr_enqueue() to have the HLA-PM generate an appropriate RTI attribute update.