⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wireless_mrt_rx_point_ref.pr.c

📁 收集的一些OPNET无线仿真的模型及程序
💻 C
字号:
/* Process model C form file: wireless_mrt_rx_point_ref.pr.c */
/* Portions of this file copyright 1992-2002 by OPNET Technologies, Inc. */



/* This variable carries the header into the object file */
static const char wireless_mrt_rx_point_ref_pr_c [] = "MIL_3_Tfile_Hdr_ 90A 30A op_runsim 7 3F8A4BE7 3F8A4BE7 1 TRACY tracy 0 0 none none 0 0 none 0 0 0 0 0 0                                                                                                                                                                                                                                                                                                                                                                                                                        ";
#include <string.h>



/* OPNET system definitions */
#include <opnet.h>

#if defined (__cplusplus)
extern "C" {
#endif
FSM_EXT_DECS
#if defined (__cplusplus)
} /* end of 'extern "C"' */
#endif

#if !defined (VOSD_NO_FIN)
#undef	BIN
#undef	BOUT
#define	BIN		FIN_LOCAL_FIELD(last_line_passed) = __LINE__ - _block_origin;
#define	BOUT	BIN
#define	BINIT	FIN_LOCAL_FIELD(last_line_passed) = 0; _block_origin = __LINE__;
#else
#define	BINIT
#endif /* #if !defined (VOSD_NO_FIN) */



/* State variable definitions */
typedef struct
	{
	/* Internal state tracking for FSM */
	FSM_SYS_STATE
	} wireless_mrt_rx_point_ref_state;

#define pr_state_ptr            		((wireless_mrt_rx_point_ref_state*) SimI_Mod_State_Ptr)

/* This macro definition will define a local variable called	*/
/* "op_sv_ptr" in each function containing a FIN statement.	*/
/* This variable points to the state variable data structure,	*/
/* and can be used from a C debugger to display their values.	*/
#undef FIN_PREAMBLE
#define FIN_PREAMBLE	wireless_mrt_rx_point_ref_state *op_sv_ptr = pr_state_ptr;


/* No Function Block */

enum { _block_origin = __LINE__ };

/* Undefine optional tracing in FIN/FOUT/FRET */
/* The FSM has its own tracing code and the other */
/* functions should not have any tracing.		  */
#undef FIN_TRACING
#define FIN_TRACING

#undef FOUTRET_TRACING
#define FOUTRET_TRACING

#if defined (__cplusplus)
extern "C" {
#endif
	void wireless_mrt_rx_point_ref (void);
	Compcode wireless_mrt_rx_point_ref_init (void **);
	void wireless_mrt_rx_point_ref_diag (void);
	void wireless_mrt_rx_point_ref_terminate (void);
	void wireless_mrt_rx_point_ref_svar (void *, const char *, char **);
#if defined (__cplusplus)
} /* end of 'extern "C"' */
#endif




/* Process model interrupt handling procedure */


void
wireless_mrt_rx_point_ref (void)
	{
	int _block_origin = 0;
	FIN (wireless_mrt_rx_point_ref ());
	if (1)
		{
		Objid subnet_id,		/* subnetwork object identifier */
			tx_node_id,			/* transmitter node object identifier */
			rx_node_id,			/* receiver node object identifier */
			rx_ant_id;			/* receiver antenna object identifier */
		double altitude,		/* the altitude of the transmitter node */
			latitude,			/* the latitude of the transmitter node */
			longitude,			/* the longitude of the transmitter node */
			x_pos,				/* the subnetwork x position of the transmitter node */
			y_pos,				/* the subnetwork y position of the transmitter node */
			z_pos;				/* the subnetwork z position of the transmitter node */
		Compcode comp_code;		/* the completion code for Ima procedures */


		FSM_ENTER (wireless_mrt_rx_point_ref)

		FSM_BLOCK_SWITCH
			{
			/*---------------------------------------------------------*/
			/** state (point) enter executives **/
			FSM_STATE_ENTER_UNFORCED (0, state0_enter_exec, "point", "wireless_mrt_rx_point_ref [point enter execs]")
				FSM_PROFILE_SECTION_IN ("wireless_mrt_rx_point_ref [point enter execs]", state0_enter_exec)
				{
				/* This line assigns the ID of the parent node object (the object    */
				/* which contains this processor module) to the variable rx_node_id. */
				/* op_id_self() determines the object ID of the processor module.    */
				/* op_topo_parent() uses the processor object ID to determine the    */
				/* processor's parent object ID. */
				
				rx_node_id = op_topo_parent (op_id_self ());
				
				/* This line determines the ID of the subnet object containing the */
				/* node object and stores the value in subnet_id. */
				
				subnet_id = op_topo_parent (rx_node_id);
				
				/* This line assigns the object ID of the transmitter node to the     */
				/* variable tx_node_id.  It uses the name of the transmitter node     */
				/* (the transmitter node will be named "tx" in the network model) as  */
				/* an argument to op_id_from_name(), which determines the object's ID */
				/* from the provided parameters:  parent object ID, object type, and  */
				/* object name. */
				
				tx_node_id = op_id_from_name (subnet_id, OPC_OBJTYPE_NDFIX, "tx");
				
				/* This line uses op_ima_obj_pos_get() to retrieve the transmitter      */
				/* node object's global position values.  It converts the relative       */
				/* subnet position values of the transmitter node to geocentric values.  */
				/* The values of x_pos, y_pos, and z_pos will not be used here, but      */
				/* the procedure requires their presence as arguments.  Most of the      */
				/* Ima kernel procedures return a completion code which indicates        */
				/* whether the operation completed successfully.  The code is stored     */
				/* here in the OPNET integer variable comp_code.                         */
				
				comp_code = op_ima_obj_pos_get (tx_node_id, &latitude, &longitude, &altitude, &x_pos, &y_pos, &z_pos);
				
				/* Comparing the completion code value to the OPNET symbolic             */
				/* constants OPC_COMPCODE_SUCCESS and OPC_COMPCODE_FAILURE reveals the   */
				/* success or failure status of the previous operation.  This line       */
				/* tests the completion code, and upon detecting failure, calls          */
				/* op_sim_end() to immediately end the simulation and print an error     */
				/* message to the standard output device, and the opnet message area. */
				
				if (comp_code == OPC_COMPCODE_FAILURE)
					op_sim_end ("get attributes failed", "", "", "");
				
				/* This line assigns the object ID of the antenna module within the   */
				/* receiver node to the variable rx_ant_id.  It uses the name of the */
				/* antenna module (the antenna module will be named ant_rx in the     */
				/* receiver node model) as an argument to op_id_from_name().          */
				
				rx_ant_id = op_id_from_name (rx_node_id, OPC_OBJTYPE_ANT, "ant_rx");
				
				/* The remaining lines use op_ima_obj_attr_set() to modify the antenna */
				/* module's target altitude, target latitude, and target longitude     */
				/* attributes with values retrieved from the transmitter node.         */
				/* If the comp_code indicates failure then the simulation is ended     */
				/* immediately. */
				
				comp_code = op_ima_obj_attr_set (rx_ant_id, "target altitude", altitude);
				if (comp_code == OPC_COMPCODE_FAILURE)
					op_sim_end ("set target altitude failed", "", "", "");
				
				comp_code = op_ima_obj_attr_set (rx_ant_id, "target latitude", latitude);
				if (comp_code == OPC_COMPCODE_FAILURE)
					op_sim_end ("set target latitude failed", "", "", "");
				
				comp_code = op_ima_obj_attr_set (rx_ant_id, "target longitude", longitude);
				if (comp_code == OPC_COMPCODE_FAILURE)
					op_sim_end ("set target longitude failed", "", "", "");
				
				}

				FSM_PROFILE_SECTION_OUT ("wireless_mrt_rx_point_ref [point enter execs]", state0_enter_exec)

			/** blocking after enter executives of unforced state. **/
			FSM_EXIT (1,wireless_mrt_rx_point_ref)


			/** state (point) exit executives **/
			FSM_STATE_EXIT_UNFORCED (0, "point", "wireless_mrt_rx_point_ref [point exit execs]")
				FSM_PROFILE_SECTION_IN ("wireless_mrt_rx_point_ref [point exit execs]", state0_exit_exec)
				{
				}
				FSM_PROFILE_SECTION_OUT ("wireless_mrt_rx_point_ref [point exit execs]", state0_exit_exec)


			/** state (point) transition processing **/
			FSM_TRANSIT_FORCE (0, state0_enter_exec, ;, "default", "", "point", "point")
				/*---------------------------------------------------------*/



			}


		FSM_EXIT (0,wireless_mrt_rx_point_ref)
		}
	}

#if defined (__cplusplus)
	extern "C" { 
#endif
	extern VosT_Fun_Status Vos_Catmem_Register (const char * , int , VosT_Void_Null_Proc, VosT_Address *);
	extern VosT_Address Vos_Catmem_Alloc (VosT_Address, size_t);
	extern VosT_Fun_Status Vos_Catmem_Dealloc (VosT_Address);
#if defined (__cplusplus)
	}
#endif


Compcode
wireless_mrt_rx_point_ref_init (void ** gen_state_pptr)
	{
	int _block_origin = 0;
	static VosT_Address	obtype = OPC_NIL;

	FIN (wireless_mrt_rx_point_ref_init (gen_state_pptr))

	if (obtype == OPC_NIL)
		{
		/* Initialize memory management */
		if (Vos_Catmem_Register ("proc state vars (wireless_mrt_rx_point_ref)",
			sizeof (wireless_mrt_rx_point_ref_state), Vos_Vnop, &obtype) == VOSC_FAILURE)
			{
			FRET (OPC_COMPCODE_FAILURE)
			}
		}

	*gen_state_pptr = Vos_Catmem_Alloc (obtype, 1);
	if (*gen_state_pptr == OPC_NIL)
		{
		FRET (OPC_COMPCODE_FAILURE)
		}
	else
		{
		/* Initialize FSM handling */
		((wireless_mrt_rx_point_ref_state *)(*gen_state_pptr))->current_block = 0;

		FRET (OPC_COMPCODE_SUCCESS)
		}
	}



void
wireless_mrt_rx_point_ref_diag (void)
	{
	/* No Diagnostic Block */
	}




void
wireless_mrt_rx_point_ref_terminate (void)
	{
	int _block_origin = __LINE__;

	FIN (wireless_mrt_rx_point_ref_terminate (void))

	Vos_Catmem_Dealloc (pr_state_ptr);

	FOUT
	}




void
wireless_mrt_rx_point_ref_svar (void * gen_ptr, const char * var_name, char ** var_p_ptr)
	{

	FIN (wireless_mrt_rx_point_ref_svar (gen_ptr, var_name, var_p_ptr))

	*var_p_ptr = (char *)OPC_NIL;

	FOUT
	}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -