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

📄 wp_sattest_mrt_rx_point.pr.c

📁 这是利用OPNET仿真工具进行仿真的源代码
💻 C
字号:
/* Process model C form file: wp_SatTest_mrt_rx_point.pr.c */
/* Portions of this file copyright 1992-2003 by OPNET Technologies, Inc. */



/* This variable carries the header into the object file */
const char wp_SatTest_mrt_rx_point_pr_c [] = "MIL_3_Tfile_Hdr_ 100A 30A modeler 7 4417B66D 4417B66D 1 angeldevil WanPeng 0 0 none none 0 0 none 0 0 0 0 0 0 0 0 90b 2                                                                                                                                                                                                                                                                                                                                                                                                        ";
#include <string.h>



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


#if !defined (VOSD_NO_FIN)
#undef	BIN
#undef	BOUT
#define	BIN		FIN_LOCAL_FIELD(_op_last_line_passed) = __LINE__ - _op_block_origin;
#define	BOUT	BIN
#define	BINIT	FIN_LOCAL_FIELD(_op_last_line_passed) = 0; _op_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
	} wp_SatTest_mrt_rx_point_state;

#define pr_state_ptr            		((wp_SatTest_mrt_rx_point_state*) (OP_SIM_CONTEXT_PTR->mod_state_ptr))

/* These macro definitions 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_DEC
#undef FIN_PREAMBLE_CODE
#if defined (OPD_PARALLEL)
#  define FIN_PREAMBLE_DEC	wp_SatTest_mrt_rx_point_state *op_sv_ptr; OpT_Sim_Context * tcontext_ptr;
#  define FIN_PREAMBLE_CODE	\
		if (VosS_Mt_Perform_Lock) \
			VOS_THREAD_SPECIFIC_DATA_GET (VosI_Globals.simi_mt_context_data_key, tcontext_ptr, SimT_Context *); \
		else \
			tcontext_ptr = VosI_Globals.simi_sequential_context_ptr; \
		op_sv_ptr = ((wp_SatTest_mrt_rx_point_state *)(tcontext_ptr->mod_state_ptr));
#else
#  define FIN_PREAMBLE_DEC	wp_SatTest_mrt_rx_point_state *op_sv_ptr;
#  define FIN_PREAMBLE_CODE	op_sv_ptr = pr_state_ptr;
#endif


/* No Function Block */


#if !defined (VOSD_NO_FIN)
enum { _op_block_origin = __LINE__ };
#endif

/* 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 wp_SatTest_mrt_rx_point (OP_SIM_CONTEXT_ARG_OPT);
	VosT_Obtype wp_SatTest_mrt_rx_point_init (int * init_block_ptr);
	VosT_Address wp_SatTest_mrt_rx_point_alloc (VOS_THREAD_INDEX_ARG_COMMA VosT_Obtype, int);
	void wp_SatTest_mrt_rx_point_diag (OP_SIM_CONTEXT_ARG_OPT);
	void wp_SatTest_mrt_rx_point_terminate (OP_SIM_CONTEXT_ARG_OPT);
	void wp_SatTest_mrt_rx_point_svar (void *, const char *, void **);


	VosT_Fun_Status Vos_Define_Object (VosT_Obtype * _op_obst_ptr, const char * _op_name, unsigned int _op_size, unsigned int _op_init_obs, unsigned int _op_inc_obs);
	VosT_Address Vos_Alloc_Object_MT (VOS_THREAD_INDEX_ARG_COMMA VosT_Obtype _op_ob_hndl);
	VosT_Fun_Status Vos_Poolmem_Dealloc_MT (VOS_THREAD_INDEX_ARG_COMMA VosT_Address _op_ob_ptr);
#if defined (__cplusplus)
} /* end of 'extern "C"' */
#endif




/* Process model interrupt handling procedure */


void
wp_SatTest_mrt_rx_point (OP_SIM_CONTEXT_ARG_OPT)
	{

#if !defined (VOSD_NO_FIN)
	int _op_block_origin = 0;
#endif
	FIN_MT (wp_SatTest_mrt_rx_point ());
	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_NO_VARS ("wp_SatTest_mrt_rx_point")

		FSM_BLOCK_SWITCH
			{
			/*---------------------------------------------------------*/
			/** state (point) enter executives **/
			FSM_STATE_ENTER_UNFORCED (0, "point", state0_enter_exec, "wp_SatTest_mrt_rx_point [point enter execs]")
				FSM_PROFILE_SECTION_IN ("wp_SatTest_mrt_rx_point [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 (state0_enter_exec)

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


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


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



			}


		FSM_EXIT (0,"wp_SatTest_mrt_rx_point")
		}
	}




void
wp_SatTest_mrt_rx_point_diag (OP_SIM_CONTEXT_ARG_OPT)
	{
	/* No Diagnostic Block */
	}




void
wp_SatTest_mrt_rx_point_terminate (OP_SIM_CONTEXT_ARG_OPT)
	{

#if !defined (VOSD_NO_FIN)
	int _op_block_origin = __LINE__;
#endif

	FIN_MT (wp_SatTest_mrt_rx_point_terminate ())

	Vos_Poolmem_Dealloc_MT (OP_SIM_CONTEXT_THREAD_INDEX_COMMA pr_state_ptr);

	FOUT
	}


#undef FIN_PREAMBLE_DEC
#undef FIN_PREAMBLE_CODE

#define FIN_PREAMBLE_DEC
#define FIN_PREAMBLE_CODE

VosT_Obtype
wp_SatTest_mrt_rx_point_init (int * init_block_ptr)
	{

#if !defined (VOSD_NO_FIN)
	int _op_block_origin = 0;
#endif
	VosT_Obtype obtype = OPC_NIL;
	FIN_MT (wp_SatTest_mrt_rx_point_init (init_block_ptr))

	Vos_Define_Object (&obtype, "proc state vars (wp_SatTest_mrt_rx_point)",
		sizeof (wp_SatTest_mrt_rx_point_state), 0, 20);
	*init_block_ptr = 0;

	FRET (obtype)
	}

VosT_Address
wp_SatTest_mrt_rx_point_alloc (VOS_THREAD_INDEX_ARG_COMMA VosT_Obtype obtype, int init_block)
	{

#if !defined (VOSD_NO_FIN)
	int _op_block_origin = 0;
#endif
	wp_SatTest_mrt_rx_point_state * ptr;
	FIN_MT (wp_SatTest_mrt_rx_point_alloc (obtype))

	ptr = (wp_SatTest_mrt_rx_point_state *)Vos_Alloc_Object_MT (VOS_THREAD_INDEX_COMMA obtype);
	if (ptr != OPC_NIL)
		ptr->_op_current_block = init_block;
	FRET ((VosT_Address)ptr)
	}



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

	FIN_MT (wp_SatTest_mrt_rx_point_svar (gen_ptr, var_name, var_p_ptr))

	*var_p_ptr = (void *)OPC_NIL;

	FOUT
	}

⌨️ 快捷键说明

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