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

📄 vclfup.cpp

📁 psasp程序的upi范例
💻 CPP
字号:
extern "C" _declspec(dllexport) int _stdcall LF_UP0(
		int &Markend,const int &NTime, const int *Npar,
		const double * varin,const int &nvarin,
		double * varout,const int &nvarout,
		double * varprn,const int &nvarprn,
		const double * vector,const int &nvector,
		const int *vp,const int *nvp,const int &nnvp)
/******* Arguments description **************************************** 
   Markend: mark of computing end given by UP                          -
          ( 0: end of compution; 1: continuing)                       -
   Ntime : times, the UP called by LF, provided by LF                 -
   NPar  : Group no. of parameter                                     -
   F1    : Array of input variavles provided by LF, dimension nf1     -
   F2    : Array of output variavles, provided by UP, dimension nf2   -
   F3    : Array of print variavles, provided by UP, dimension nf3    -
   V1    : Array of input vectors,provided by LF, dimension nv1       -
   IVP   : start position pointer of each vector in V1, dimension nnvp-
   NVP   : dimension  of each vector in V1, dimension nnvp            -
**********************************************************************/
{//write upi main program here
	int Ncal,NSin,NSout,NSprn;
	int i,N;
	const double *VT,*PG,*QG,*NewNo;
	const int Numin=9,Numout=3,Numprn=8;
	static int NumCall=0;
	VT=vector;
	PG=vector+vp[1];
	QG=vector+vp[2];
	NewNo=vector+vp[3];
	for (Ncal=0;Ncal<NTime;Ncal++){
		NSin=Numin*Ncal;
		NSout=Numout*Ncal;
		NSprn=Numprn*Ncal;
		//Output variable
		for(i=0;i<3;i++){
			varout[NSout+i]=varin[NSin+6+i];
		}
		//Print varable
		N=varin[NSin]; // Bus1 No.
		N=NewNo[N-1]-1;			//Pointer start from 0
		varprn[NSprn]=varin[NSin+1]; // Bus1 PG
		varprn[NSprn+1]=QG[N]; // Bus1 QG
		varprn[NSprn+2]=VT[N]; // Bus1 VT
		N=varin[NSin+3]; // Bus3 No.
		N=NewNo[N-1]-1;
		varprn[NSprn+3]=PG[N]; // Bus3 PG
		varprn[NSprn+4]=varin[NSin+5]; // Bus3 QG
		varprn[NSprn+5]=VT[N]; // Bus3 VT
		for(i=0;i<2;i++){
			varprn[NSprn+i+6]=varin[NSin+7+i];
		}
	}
	//Deal with Covergence Mark
	NumCall++;
	if (NumCall>9){ // 10 times
		Markend=0;
	}else{
		Markend=1;
	}
	return 0;
}

⌨️ 快捷键说明

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