op_ev_seek_time()

Abstract

Obtains the event handle referring to the event that is closest to the specified event handle in the specified manner.

Syntax

op_ev_seek_time (time, flag)
Argument Type Description
time double time boundary to start seeking for events
[If the “sim_time_quantum“ preference has a value other than 0.0, time will be truncated internally to a multiple of the specified quantum.]
flag int flag specifying type of seek
[This is an integer numeric code that represents one of the possible flag values (see Table 52 “Event Seek Mode Symbolic Constants“ on page 12; the available values for the flag are also listed in the Details section).]

Return Type

Evhandle

Event handle representing the event that matches the seek criteria. An invalid event handle will be returned if an error occurs.

Example

/* Find the first event for the receiver after */
/* 5.0 seconds from the current time and cancel it. */
time = op_sim_time () + 5.0;
event = op_ev_seek_time (time, OPC_EVSEEK_TIME_POST);
while (op_ev_valid (event))
	{
	if (op_ev_dst_id (event) == recv_id)
		{
		op_ev_cancel (event);
		break;
		}
	else
		event = op_ev_next (event);
	}

Details

This KP takes one of four symbolic constants for the flag argument:

  • OPC_EVSEEK_TIME_PRE—used to search for an event immediately before specified time.
  • OPC_EVSEEK_TIME_PREINC—used to search for an event at or immediately before specified time.
  • OPC_EVSEEK_TIME_POST—used to search for an event immediately after specified time.
  • OPC_EVSEEK_TIME_POSTINC—used to search for an event at or immediately after specified time.

Figure 48 illustrates the relationships specified by these symbolic constants.

Figure 48: op_ev_seek_time (τ, flag) Results with Different Flags

op_ev_seek_time (τ, flag) Results with Different Flags

Purpose

Provides a mechanism for “seeking” to a particular event relative to a specified time.

Note: This KP works only in a sequential simulation context. In a parallel simulation, where events in the current time cell might be executed in varying fashion based on what the threads are doing, it will act as if there are no events after the current one.

Errors

  • Recoverable Error: Seek time (<time>) is less than current simulation time.
  • Recoverable Error: Seek flag (<flag>) is unrecognized.

Reference

本站文档由 北京智网畅联科技有限公司 整理、翻译并提供 · 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