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

📄 rwa_n.cpp

📁 simulation routing in wsn
💻 CPP
📖 第 1 页 / 共 4 页
字号:
	// an empty actual machine list for the next module
	par = new cPar();
	*par = mod->machinePar("default");
	machines.add( par );
	check_error(); check_memory();

	// module creation:
	islocal = simulation.netInterface()==NULL ||
	          simulation.netInterface()->isLocalMachineIn( machines );
	node13_mod = modtype->create( "node13", mod, islocal);
	check_error(); check_memory();

	// set machine list:
	node13_mod->setMachinePar( "default", ((cPar *)machines[0])->stringValue() );
	check_error(); check_memory();

	// 'parameters:' section
	par = &mod->ancestorPar( "num_node" );
	check_anc_param(par,"num_node","RWA");
	value.cancelRedirection();
	value = *par;
	par = &(node13_mod->par("num_node"));
	check_param(par, "num_node");
	*par = value;

	value.cancelRedirection();
	value = 0L;
	value.setPrompt( NULL );
	value.setInput( true );
	par = &(node13_mod->par("convert"));
	check_param(par, "convert");
	*par = value;

	par = &(node13_mod->par("nodeID"));
	check_param(par, "nodeID");
	*par = 13;

	n = node13_mod->params();
	for(k=0;k<n;k++)
	   if(node13_mod->par(k).isInput())
	      {node13_mod->par(k).read();check_error();}

	// 'gatesizes:' section
	n = mod->par( "num_node" );
	check_gate_count( n, "node13","nin","RWA");
	node13_mod->setGateSize("nin", n );

	n = mod->par( "num_node" );
	check_gate_count( n, "node13","nout","RWA");
	node13_mod->setGateSize("nout", n );

	node13_mod->setDisplayString(dispSUBMOD, "p=568,284;i=xconn;b=32,30" );

	// build function call:
	node13_mod->buildInside();
	machines.clear();

	// Connections:
	cLinkType *link_p;
	cPar *delay_p, *error_p, *datarate_p;
	int gateL, gateR;
	long mod_nr_L, mod_nr_R, gate_nr_L, gate_nr_R;

	do_this_block = true; // no "if" condition
	if (do_this_block) // "if" in NED
	{
	gate_nr_L = 0;
	gateL = node3_mod->findGate( "nout", gate_nr_L );
	check_gate( gateL, "node3", indexedname(b1,"nout",gate_nr_L) );

	gate_nr_R = 3;
	gateR = node0_mod->findGate( "nin", gate_nr_R );
	check_gate( gateR, "node0", indexedname(b1,"nin",gate_nr_R) );

	connect (node3_mod, gateL,
	         NULL,
	         node0_mod, gateR);

	check_error(); check_memory();
	} // end-if


	do_this_block = true; // no "if" condition
	if (do_this_block) // "if" in NED
	{
	gate_nr_L = 1;
	gateL = node0_mod->findGate( "nout", gate_nr_L );
	check_gate( gateL, "node0", indexedname(b1,"nout",gate_nr_L) );

	gate_nr_R = 0;
	gateR = node1_mod->findGate( "nin", gate_nr_R );
	check_gate( gateR, "node1", indexedname(b1,"nin",gate_nr_R) );

	connect (node0_mod, gateL,
	         NULL,
	         node1_mod, gateR);

	check_error(); check_memory();
	} // end-if


	do_this_block = true; // no "if" condition
	if (do_this_block) // "if" in NED
	{
	gate_nr_L = 0;
	gateL = node1_mod->findGate( "nout", gate_nr_L );
	check_gate( gateL, "node1", indexedname(b1,"nout",gate_nr_L) );

	gate_nr_R = 1;
	gateR = node0_mod->findGate( "nin", gate_nr_R );
	check_gate( gateR, "node0", indexedname(b1,"nin",gate_nr_R) );

	connect (node1_mod, gateL,
	         NULL,
	         node0_mod, gateR);

	check_error(); check_memory();
	} // end-if


	do_this_block = true; // no "if" condition
	if (do_this_block) // "if" in NED
	{
	gate_nr_L = 3;
	gateL = node0_mod->findGate( "nout", gate_nr_L );
	check_gate( gateL, "node0", indexedname(b1,"nout",gate_nr_L) );

	gate_nr_R = 0;
	gateR = node3_mod->findGate( "nin", gate_nr_R );
	check_gate( gateR, "node3", indexedname(b1,"nin",gate_nr_R) );

	connect (node0_mod, gateL,
	         NULL,
	         node3_mod, gateR);

	check_error(); check_memory();
	} // end-if


	do_this_block = true; // no "if" condition
	if (do_this_block) // "if" in NED
	{
	gate_nr_L = 1;
	gateL = node3_mod->findGate( "nout", gate_nr_L );
	check_gate( gateL, "node3", indexedname(b1,"nout",gate_nr_L) );

	gate_nr_R = 3;
	gateR = node1_mod->findGate( "nin", gate_nr_R );
	check_gate( gateR, "node1", indexedname(b1,"nin",gate_nr_R) );

	connect (node3_mod, gateL,
	         NULL,
	         node1_mod, gateR);

	check_error(); check_memory();
	} // end-if


	do_this_block = true; // no "if" condition
	if (do_this_block) // "if" in NED
	{
	gate_nr_L = 4;
	gateL = node3_mod->findGate( "nout", gate_nr_L );
	check_gate( gateL, "node3", indexedname(b1,"nout",gate_nr_L) );

	gate_nr_R = 3;
	gateR = node4_mod->findGate( "nin", gate_nr_R );
	check_gate( gateR, "node4", indexedname(b1,"nin",gate_nr_R) );

	connect (node3_mod, gateL,
	         NULL,
	         node4_mod, gateR);

	check_error(); check_memory();
	} // end-if


	do_this_block = true; // no "if" condition
	if (do_this_block) // "if" in NED
	{
	gate_nr_L = 3;
	gateL = node4_mod->findGate( "nout", gate_nr_L );
	check_gate( gateL, "node4", indexedname(b1,"nout",gate_nr_L) );

	gate_nr_R = 4;
	gateR = node3_mod->findGate( "nin", gate_nr_R );
	check_gate( gateR, "node3", indexedname(b1,"nin",gate_nr_R) );

	connect (node4_mod, gateL,
	         NULL,
	         node3_mod, gateR);

	check_error(); check_memory();
	} // end-if


	do_this_block = true; // no "if" condition
	if (do_this_block) // "if" in NED
	{
	gate_nr_L = 0;
	gateL = node2_mod->findGate( "nout", gate_nr_L );
	check_gate( gateL, "node2", indexedname(b1,"nout",gate_nr_L) );

	gate_nr_R = 2;
	gateR = node0_mod->findGate( "nin", gate_nr_R );
	check_gate( gateR, "node0", indexedname(b1,"nin",gate_nr_R) );

	connect (node2_mod, gateL,
	         NULL,
	         node0_mod, gateR);

	check_error(); check_memory();
	} // end-if


	do_this_block = true; // no "if" condition
	if (do_this_block) // "if" in NED
	{
	gate_nr_L = 2;
	gateL = node0_mod->findGate( "nout", gate_nr_L );
	check_gate( gateL, "node0", indexedname(b1,"nout",gate_nr_L) );

	gate_nr_R = 0;
	gateR = node2_mod->findGate( "nin", gate_nr_R );
	check_gate( gateR, "node2", indexedname(b1,"nin",gate_nr_R) );

	connect (node0_mod, gateL,
	         NULL,
	         node2_mod, gateR);

	check_error(); check_memory();
	} // end-if


	do_this_block = true; // no "if" condition
	if (do_this_block) // "if" in NED
	{
	gate_nr_L = 5;
	gateL = node2_mod->findGate( "nout", gate_nr_L );
	check_gate( gateL, "node2", indexedname(b1,"nout",gate_nr_L) );

	gate_nr_R = 2;
	gateR = node5_mod->findGate( "nin", gate_nr_R );
	check_gate( gateR, "node5", indexedname(b1,"nin",gate_nr_R) );

	connect (node2_mod, gateL,
	         NULL,
	         node5_mod, gateR);

	check_error(); check_memory();
	} // end-if


	do_this_block = true; // no "if" condition
	if (do_this_block) // "if" in NED
	{
	gate_nr_L = 9;
	gateL = node5_mod->findGate( "nout", gate_nr_L );
	check_gate( gateL, "node5", indexedname(b1,"nout",gate_nr_L) );

	gate_nr_R = 5;
	gateR = node9_mod->findGate( "nin", gate_nr_R );
	check_gate( gateR, "node9", indexedname(b1,"nin",gate_nr_R) );

	connect (node5_mod, gateL,
	         NULL,
	         node9_mod, gateR);

	check_error(); check_memory();
	} // end-if


	do_this_block = true; // no "if" condition
	if (do_this_block) // "if" in NED
	{
	gate_nr_L = 10;
	gateL = node9_mod->findGate( "nout", gate_nr_L );
	check_gate( gateL, "node9", indexedname(b1,"nout",gate_nr_L) );

	gate_nr_R = 9;
	gateR = node10_mod->findGate( "nin", gate_nr_R );
	check_gate( gateR, "node10", indexedname(b1,"nin",gate_nr_R) );

	connect (node9_mod, gateL,
	         NULL,
	         node10_mod, gateR);

	check_error(); check_memory();
	} // end-if


	do_this_block = true; // no "if" condition
	if (do_this_block) // "if" in NED
	{
	gate_nr_L = 11;
	gateL = node10_mod->findGate( "nout", gate_nr_L );
	check_gate( gateL, "node10", indexedname(b1,"nout",gate_nr_L) );

	gate_nr_R = 10;
	gateR = node11_mod->findGate( "nin", gate_nr_R );
	check_gate( gateR, "node11", indexedname(b1,"nin",gate_nr_R) );

	connect (node10_mod, gateL,
	         NULL,
	         node11_mod, gateR);

	check_error(); check_memory();
	} // end-if


	do_this_block = true; // no "if" condition
	if (do_this_block) // "if" in NED
	{
	gate_nr_L = 7;
	gateL = node11_mod->findGate( "nout", gate_nr_L );
	check_gate( gateL, "node11", indexedname(b1,"nout",gate_nr_L) );

	gate_nr_R = 11;
	gateR = node7_mod->findGate( "nin", gate_nr_R );
	check_gate( gateR, "node7", indexedname(b1,"nin",gate_nr_R) );

	connect (node11_mod, gateL,
	         NULL,
	         node7_mod, gateR);

	check_error(); check_memory();
	} // end-if


	do_this_block = true; // no "if" condition
	if (do_this_block) // "if" in NED
	{
	gate_nr_L = 11;
	gateL = node7_mod->findGate( "nout", gate_nr_L );
	check_gate( gateL, "node7", indexedname(b1,"nout",gate_nr_L) );

	gate_nr_R = 7;
	gateR = node11_mod->findGate( "nin", gate_nr_R );
	check_gate( gateR, "node11", indexedname(b1,"nin",gate_nr_R) );

	connect (node7_mod, gateL,
	         NULL,
	         node11_mod, gateR);

	check_error(); check_memory();
	} // end-if


	do_this_block = true; // no "if" condition
	if (do_this_block) // "if" in NED
	{
	gate_nr_L = 10;
	gateL = node11_mod->findGate( "nout", gate_nr_L );
	check_gate( gateL, "node11", indexedname(b1,"nout",gate_nr_L) );

	gate_nr_R = 11;
	gateR = node10_mod->findGate( "nin", gate_nr_R );
	check_gate( gateR, "node10", indexedname(b1,"nin",gate_nr_R) );

	connect (node11_mod, gateL,
	         NULL,
	         node10_mod, gateR);

	check_error(); check_memory();
	} // end-if


	do_this_block = true; // no "if" condition
	if (do_this_block) // "if" in NED
	{
	gate_nr_L = 9;
	gateL = node10_mod->findGate( "nout", gate_nr_L );
	check_gate( gateL, "node10", indexedname(b1,"nout",gate_nr_L) );

	gate_nr_R = 10;
	gateR = node9_mod->findGate( "nin", gate_nr_R );
	check_gate( gateR, "node9", indexedname(b1,"nin",gate_nr_R) );

	connect (node10_mod, gateL,
	         NULL,
	         node9_mod, gateR);

	check_error(); check_memory();
	} // end-if


	do_this_block = true; // no "if" condition
	if (do_this_block) // "if" in NED
	{
	gate_nr_L = 5;
	gateL = node9_mod->findGate( "nout", gate_nr_L );
	check_gate( gateL, "node9", indexedname(b1,"nout",gate_nr_L) );

	gate_nr_R = 9;
	gateR = node5_mod->findGate( "nin", gate_nr_R );
	check_gate( gateR, "node5", indexedname(b1,"nin",gate_nr_R) );

	connect (node9_mod, gateL,
	         NULL,
	         node5_mod, gateR);

	check_error(); check_memory();
	} // end-if


	do_this_block = true; // no "if" condition
	if (do_this_block) // "if" in NED
	{
	gate_nr_L = 2;
	gateL = node5_mod->findGate( "nout", gate_nr_L );
	check_gate( gateL, "node5", indexedname(b1,"nout",gate_nr_L) );

	gate_nr_R = 5;
	gateR = node2_mod->findGate( "nin", gate_nr_R );
	check_gate( gateR, "node2", indexedname(b1,"nin",gate_nr_R) );

	connect (node5_mod, gateL,
	         NULL,
	         node2_mod, gateR);

	check_error(); check_memory();
	} // end-if


	do_this_block = true; // no "if" condition
	if (do_this_block) // "if" in NED
	{
	gate_nr_L = 10;
	gateL = node1_mod->findGate( "nout", gate_nr_L );
	check_gate( gateL, "node1", indexedname(b1,"nout",gate_nr_L) );

	gate_nr_R = 1;
	gateR = node10_mod->findGate( "nin", gate_nr_R );
	check_gate( gateR, "node10", indexedname(b1,"nin",gate_nr_R) );

	connect (node1_mod, gateL,
	         NULL,
	         node10_mod, gateR);

	check_error(); check_memory();
	} // end-if


	do_this_block = true; // no "if" condition
	if (do_this_block) // "if" in NED
	{
	gate_nr_L = 1;
	gateL = node10_mod->findGate( "nout", gate_nr_L );
	check_gate( gateL, "node10", indexedname(b1,"nout",gate_nr_L) );

	gate_nr_R = 10;
	gateR = node1_mod->findGate( "nin", gate_nr_R );
	check_gate( gateR, "node1", indexedname(b1,"nin",gate_nr_R) );

	connect (node10_mod, gateL,
	         NULL,
	         node1_mod, gateR);

	check_error(); check_memory();
	} // end-if


	do_this_block = true; // no "if" condition
	if (do_this_block) // "if" in NED
	{

⌨️ 快捷键说明

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