op_hla_interaction_pk_send()
Note: Requires High-Level Architecture functionality
Abstract
Queues a packet representing an interaction for future delivery to other simulations.
Syntax
op_hla_interaction_pk_send (pk_ptr, delivery_time)
| Argument | Type | Description |
|---|---|---|
pk_ptr |
Packet * |
Packet representing the interaction to send |
delivery_time |
double |
time of delivery of the interaction to other simulations |
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
static void send_reply (void)
{
Packet * reply;
. . .
reply = op_pk_create_fmt ("Info_Reply");
. . .
op_pk_nfd_set (reply, "opnet id", my_id);
. . .
op_hla_interaction_pk_send (pd, OPC_HLA_DELIVER_NOW);
}
Details
HLA interactions are C++ objects. Using a packet format provides all process models with the ability to generate interactions without having to deal with the actual encoding of interaction components.
Using the constant OPC_HLA_DELIVER_NOW for the delivery time indicates to the HLA-PM that the interaction should be delivered to other simulations at the earliest possible time based on the current simulation time and the lookahead used by the simulation.
Purpose
Provides a mechanism to generate an HLA interaction to be delivered to other simulation when the simulation time reaches delivery_time. The packet pk_ptr will be converted to the interaction format by the HLA-PM.
Errors
- Recoverable Error: Unable to queue outgoing interaction packet.
- Recoverable Error: Interaction delivery time (
<time>) must be at least current time + lookahead (<time>).
Reference
- Use the KP op_hla_interaction_pk_struct_set() to assign a data block to a packet field
- Use one of the op_pk_nfd_set() KPs to assign a simple data type (integer, double, etc.) to a packet field