op_sim_anim()

Abstract

Determines if the simulation is currently in animation mode.

Syntax

op_sim_anim ()
Argument Type Description
no arguments

Return Type

Boolean

Boolean value indicating if the simulation is configured to generate animation requests. This value is OPC_TRUE if animation is enabled, OPC_FALSE otherwise.

Example

/* If animation is not currently enabled, avoid doing unnecessary work. */
if (op_sim_anim ())
	{
	/* Open a full-size animation viewer. */
	vid = op_anim_viewer_open_std ("Network Display", OPC_ANIM_LOCATION_FULL);

	/* Load and draw a network model into viewer. */
	op_anim_ime_nmod_draw (vid, OPC_ANIM_MODTYPE_NETWORK, "anet", "top",
		OPC_ANIM_MOD_OPTION_NONE, OPC_ANIM_DEFPROPS);

	/* Determine the name of the "animation" node. */
	mod_objid  = op_id_self ();
	node_objid = op_topo_parent (mod_objid);
	op_ima_obj_attr_get (node_objid, "name", node_name);

	/* Change the icon of the "animation" node so that it is not seen. */
	op_anim_ime_nobj_update (vid, OPC_ANIM_OBJTYPE_NODE, node_name,
		OPC_ANIM_OBJ_ATTR_ICON, "blank", OPC_EOL);
	}

Details

A simulation is in animation mode when it is executed with the anim_hist or anim_view environment attributes set to enable the generation of animation requests. The use of these attributes to enable simulations is illustrated in the following example command lines:

%example.sim -anim_hist my_anim
%example.sim -anim_view

If the generation of animation events is halted due to an error (e.g., the inability to communicate with the animation server), op_sim_anim() will return OPC_FALSE to indicate that animation is no longer active.

Purpose

This KP provides the capability to develop process models that have inherent animation capability while maintaining efficiency of the simulation. The intended use of the KP is to prevent Anim package calls and other animation-related computations from being carried out if animation is not currently active. Typically animation-related computations and calls will be grouped together in an if statement whose condition is (op_sim_anim() == OPC_TRUE).

By using this capability the user can develop models that provide built-in animation, but run near maximum efficiency when animation is not desired. No recompilation is necessary to switch between the two modes.

Errors

  • No errors are trapped.

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