📄 writejac.cpp
字号:
sprintf(str,"Vr%-d",ACptr->Num); fCustomPrint(OutFile,"%4d %8s %-11.5g\n",++i,str,ACptr->Gen->Vr);
sprintf(str,"Vi%-d",ACptr->Num); fCustomPrint(OutFile,"%4d %8s %-11.5g\n",++i,str,ACptr->Gen->Vi);
sprintf(str,"Ir%-d",ACptr->Num); fCustomPrint(OutFile,"%4d %8s %-11.5g\n",++i,str,ACptr->Gen->Ir);
sprintf(str,"Ii%-d",ACptr->Num); fCustomPrint(OutFile,"%4d %8s %-11.5g\n",++i,str,ACptr->Gen->Ii);
sprintf(str,"Vq%-d",ACptr->Num); fCustomPrint(OutFile,"%4d %8s %-11.5g\n",++i,str,ACptr->Gen->Vq);
sprintf(str,"Vd%-d",ACptr->Num); fCustomPrint(OutFile,"%4d %8s %-11.5g\n",++i,str,ACptr->Gen->Vd);
sprintf(str,"Iq%-d",ACptr->Num); fCustomPrint(OutFile,"%4d %8s %-11.5g\n",++i,str,ACptr->Gen->Iq);
sprintf(str,"Id%-d",ACptr->Num); fCustomPrint(OutFile,"%4d %8s %-11.5g\n",++i,str,ACptr->Gen->Id);
if (strpbrk(ACptr->cont,"I")) {
sprintf(str,"Qg%-d",ACptr->Num); fCustomPrint(OutFile,"%4d %8s %-11.5g\n",++i,str,ACptr->Qg);
} else {
sprintf(str,"Ia%-d",ACptr->Num); fCustomPrint(OutFile,"%4d %8s %-11.5g\n",++i,str,ACptr->Gen->Ia);
}
}
}
for(k=0,DCptrR=dataPtr->DCbus;DCptrR!=NULL;DCptrR=DCptrR->Next){
DCptrI=DCptrR->To;
if(!strcmp(DCptrR->Type,"R")){
for (k++,l=1;l<=11;l++){
sprintf(str,"Fdc%-d_%-d",k,l); i++;
fCustomPrint(OutFilep,"%4d %8s %-11.5g\n",i,str,dF[i]);
}
for(l=i-11,j=1;j<=2;j++){
if(j==1) { DCptr=DCptrR; strcpy(type,"r"); }
else { DCptr=DCptrI; strcpy(type,"i"); }
if(strcmp(DCptr->Cont1,"VD")&&strcmp(DCptr->Cont2,"VD")) {
sprintf(str,"Vd%1s%-d",type,k);
fCustomPrint(OutFile,"%4d %8s %-11.5g\n",++l,str,DCptr->Vd);
}
if(strcmp(DCptr->Cont1,"AT")&&strcmp(DCptr->Cont2,"AT")) {
sprintf(str,"t%1s%-d",type,k);
fCustomPrint(OutFile,"%4d %8s %-11.5g\n",++l,str,DCptr->Tap);
}
if(strcmp(DCptr->Cont1,"AL")&&strcmp(DCptr->Cont2,"AL")) {
sprintf(str,"al%1s%-d",type,k);
fCustomPrint(OutFile,"%4d %8s %-11.5g\n",++l,str,DCptr->Alfa);
}
if(strcmp(DCptr->Cont1,"GA")&&strcmp(DCptr->Cont2,"GA")) {
sprintf(str,"ga%1s%-d",type,k);
fCustomPrint(OutFile,"%4d %8s %-11.5g\n",++l,str,DCptr->Gamma);
}
sprintf(str,"s%1s%-d",type,k);
fCustomPrint(OutFile,"%4d %8s %-11.5g\n",++l,str,DCptr->MVA);
if(strcmp(DCptr->Cont1,"PA")&&strcmp(DCptr->Cont2,"PA")) {
sprintf(str,"P%1s%-d",type,k);
fCustomPrint(OutFile,"%4d %8s %-11.5g\n",++l,str,DCptr->P);
}
if(strcmp(DCptr->Cont1,"QA")&&strcmp(DCptr->Cont2,"QA")) {
sprintf(str,"Q%1s%-d",type,k);
fCustomPrint(OutFile,"%4d %8s %-11.5g\n",++l,str,DCptr->Q);
}
}
if(strcmp(DCptrR->Cont1,"ID")&&strcmp(DCptrR->Cont2,"ID")&&
strcmp(DCptrI->Cont1,"ID")&&strcmp(DCptrI->Cont2,"ID")) {
sprintf(str,"Id%-d",k);
fCustomPrint(OutFile,"%4d %8s %-11.5g\n",++l,str,DCptrR->Id);
}
}
}
/* FACTS */
for(k=0,SVCptr=dataPtr->SVCbus;SVCptr!=NULL;SVCptr=SVCptr->Next){
k++; l=0;
sprintf(str,"Qsvc%-d",k);i++;
fCustomPrint(OutFile,"%4d %8s %-11.5g\n",i,str,SVCptr->Qsvc);
sprintf(str,"Fsvc%-d_%-d",k,++l); fCustomPrint(OutFilep,"%4d %8s %-11.5g\n",i,str,dF[i]);
sprintf(str,"Bv%-d",k);i++; fCustomPrint(OutFile,"%4d %8s %-11.5g\n",i,str,SVCptr->Bv);
sprintf(str,"Fsvc%-d_%-d",k,++l); fCustomPrint(OutFilep,"%4d %8s %-11.5g\n",i,str,dF[i]);
if(!strcmp(SVCptr->Cont,"AL")){
sprintf(str,"alpha%-d",k);i++;
fCustomPrint(OutFile,"%4d %8s %-11.5g\n",i,str,SVCptr->alpha_svc);
} else {
sprintf(str,"Vrefc%-d",k);i++;
fCustomPrint(OutFile,"%4d %8s %-11.5g\n",i,str,SVCptr->Vvar);
}
sprintf(str,"Fsvc%-d_%-d",k,++l); fCustomPrint(OutFilep,"%4d %8s %-11.5g\n",i,str,dF[i]);
}
for(k=0,TCSCptr=dataPtr->TCSCbus;TCSCptr!=NULL;TCSCptr=TCSCptr->Next){
k++; l=0;
sprintf(str,"Ptcsc%-d",k);i++;
fCustomPrint(OutFile,"%4d %8s %-11.5g\n",i,str,TCSCptr->Ptcsc);
sprintf(str,"Ftcsc%-d_%-d",k,++l); fCustomPrint(OutFilep,"%4d %8s %-11.5g\n",i,str,dF[i]);
sprintf(str,"Qtcsck%-d",k);i++;
fCustomPrint(OutFile,"%4d %8s %-11.5g\n",i,str,TCSCptr->Qtcsck);
sprintf(str,"Ftcsc%-d_%-d",k,++l); fCustomPrint(OutFilep,"%4d %8s %-11.5g\n",i,str,dF[i]);
sprintf(str,"Qtcscm%-d",k);i++;
fCustomPrint(OutFile,"%4d %8s %-11.5g\n",i,str,TCSCptr->Qtcscm);
sprintf(str,"Ftcsc%-d_%-d",k,++l); fCustomPrint(OutFilep,"%4d %8s %-11.5g\n",i,str,dF[i]);
sprintf(str,"Be%-d",k);i++;
fCustomPrint(OutFile,"%4d %8s %-11.5g\n",i,str,TCSCptr->Be);
sprintf(str,"Ftcsc%-d_%-d",k,++l); fCustomPrint(OutFilep,"%4d %8s %-11.5g\n",i,str,dF[i]);
sprintf(str,"alpha%-d",k);i++;
fCustomPrint(OutFile,"%4d %8s %-11.5g\n",i,str,TCSCptr->alpha_tcsc);
sprintf(str,"Ftcsc%-d_%-d",k,++l); fCustomPrint(OutFilep,"%4d %8s %-11.5g\n",i,str,dF[i]);
sprintf(str,"Itcsc%-d",k);i++;
fCustomPrint(OutFile,"%4d %8s %-11.5g\n",i,str,TCSCptr->Itcsc);
sprintf(str,"Ftcsc%-d_%-d",k,++l); fCustomPrint(OutFilep,"%4d %8s %-11.5g\n",i,str,dF[i]);
sprintf(str,"delta%-d",k);i++;
fCustomPrint(OutFile,"%4d %8s %-11.5g\n",i,str,TCSCptr->delta_t);
sprintf(str,"Ftcsc%-d_%-d",k,++l); fCustomPrint(OutFilep,"%4d %8s %-11.5g\n",i,str,dF[i]);
}
for(k=0,STATCOMptr=dataPtr->STATCOMbus;STATCOMptr!=NULL;STATCOMptr=STATCOMptr->Next){
k++; l=0;
if(!strcmp(STATCOMptr->Cont,"PW") || !strcmp(STATCOMptr->Cont,"AL")){
sprintf(str,"Istat%-d",k);i++;
fCustomPrint(OutFile,"%4d %8s %-11.5g\n",i,str,STATCOMptr->I);
} else {
sprintf(str,"Vrefc%-d",k);i++;
fCustomPrint(OutFile,"%4d %8s %-11.5g\n",i,str,STATCOMptr->Vvar);
}
sprintf(str,"Vcont%-d_%-d",k,++l); fCustomPrint(OutFilep,"%4d %8s %-11.5g\n",i,str,dF[i]);
sprintf(str,"theta%-d",k);i++;
fCustomPrint(OutFile,"%4d %8s %-11.5g\n",i,str,STATCOMptr->theta);
sprintf(str,"Cont%-d_%-d",k,++l); fCustomPrint(OutFilep,"%4d %8s %-11.5g\n",i,str,dF[i]);
sprintf(str,"Vdc%-d",k);i++;
fCustomPrint(OutFile,"%4d %8s %-11.5g\n",i,str,STATCOMptr->Vdc);
sprintf(str,"Loss%-d_%-d",k,++l); fCustomPrint(OutFilep,"%4d %8s %-11.5g\n",i,str,dF[i]);
sprintf(str,"k%-d",k);i++;
fCustomPrint(OutFile,"%4d %8s %-11.5g\n",i,str,STATCOMptr->k);
sprintf(str,"ReS%-d_%-d",k,++l); fCustomPrint(OutFilep,"%4d %8s %-11.5g\n",i,str,dF[i]);
sprintf(str,"alpha%-d",k);i++;
fCustomPrint(OutFile,"%4d %8s %-11.5g\n",i,str,STATCOMptr->alpha);
sprintf(str,"ImS%-d_%-d",k,++l); fCustomPrint(OutFilep,"%4d %8s %-11.5g\n",i,str,dF[i]);
sprintf(str,"Pstat%-d",k);i++;
fCustomPrint(OutFile,"%4d %8s %-11.5g\n",i,str,STATCOMptr->P);
sprintf(str,"Pstat%-d_%-d",k,++l); fCustomPrint(OutFilep,"%4d %8s %-11.5g\n",i,str,dF[i]);
sprintf(str,"Qstat%-d",k);i++;
fCustomPrint(OutFile,"%4d %8s %-11.5g\n",i,str,STATCOMptr->Q);
sprintf(str,"Qstat%-d_%-d",k,++l); fCustomPrint(OutFilep,"%4d %8s %-11.5g\n",i,str,dF[i]);
}
/* END FACTS */
if (flagH) {
fCustomPrint(OutFile,"%4d %8s %-11.5g\n",Jac->n1,"l",lambda);
fCustomPrint(OutFilep,"%4d %8s %-11.5g\n",Jac->n1,"dH",dF[Jac->n1]);
}
else if (flag) {
N=NacVar+11*Ndc/2+3*Nsvc+NtcscVar+7*Nstatcom; /* FACTS */
for (i=N,ACptr=dataPtr->ACbus; ACptr!=NULL; ACptr=ACptr->Next){
i++; sprintf(str,"w%-d",i-N); fCustomPrint(OutFile,"%4d %8s %-11.5g\n",i,str,x0[i-N]);
sprintf(str,"gP%-d",ACptr->Num); fCustomPrint(OutFilep,"%4d %8s %-11.5g\n",i,str,dF[i]);
i++; sprintf(str,"w%-d",i-N); fCustomPrint(OutFile,"%4d %8s %-11.5g\n",i,str,x0[i-N]);
sprintf(str,"gQ%-d",ACptr->Num); fCustomPrint(OutFilep,"%4d %8s %-11.5g\n",i,str,dF[i]);
if(Acont && strpbrk(ACptr->Type,"A")){
i++; sprintf(str,"w%-d",i-N); fCustomPrint(OutFile,"%4d %8s %-11.5g\n",i,str,x0[i-N]);
sprintf(str,"gPA%-d",ACptr->Area->N); fCustomPrint(OutFilep,"%4d %8s %-11.5g\n",i,str,dF[i]);
}
if (PQcont) for(ELptr=ACptr->Reg;ELptr!=NULL;ELptr=ELptr->Next) {
Eptr=ELptr->Eptr;
if(strpbrk(Eptr->Type,"PQNM")) {
if (Eptr->From==ACptr) {
I=Eptr->From->Num;
J=Eptr->To->Num;
} else {
J=Eptr->From->Num;
I=Eptr->To->Num;
}
if(!strcmp(Eptr->Type,"PM")){
i++; sprintf(str,"w%-d",i-N); fCustomPrint(OutFile,"%4d %8s %-11.5g\n",i,str,x0[i-N]);
sprintf(str,"gP%-d_%-d",I,J); fCustomPrint(OutFilep,"%4d %8s %-11.5g\n",i,str,dF[i]);
} else {
i++; sprintf(str,"w%-d",i-N); fCustomPrint(OutFile,"%4d %8s %-11.5g\n",i,str,x0[i-N]);
sprintf(str,"gQ%-d_%-d",I,J); fCustomPrint(OutFilep,"%4d %8s %-11.5g\n",i,str,dF[i]);
}
}
}
if (ACptr->Gen!=NULL) {
i++; sprintf(str,"w%-d",i-N); fCustomPrint(OutFile,"%4d %8s %-11.5g\n",i,str,x0[i-N]);
sprintf(str,"gPg%-d",ACptr->Num); fCustomPrint(OutFilep,"%4d %8s %-11.5g\n",i,str,dF[i]);
i++; sprintf(str,"w%-d",i-N); fCustomPrint(OutFile,"%4d %8s %-11.5g\n",i,str,x0[i-N]);
sprintf(str,"gQg%-d",ACptr->Num); fCustomPrint(OutFilep,"%4d %8s %-11.5g\n",i,str,dF[i]);
i++; sprintf(str,"w%-d",i-N); fCustomPrint(OutFile,"%4d %8s %-11.5g\n",i,str,x0[i-N]);
sprintf(str,"gEq%-d",ACptr->Num); fCustomPrint(OutFilep,"%4d %8s %-11.5g\n",i,str,dF[i]);
i++; sprintf(str,"w%-d",i-N); fCustomPrint(OutFile,"%4d %8s %-11.5g\n",i,str,x0[i-N]);
sprintf(str,"gEd%-d",ACptr->Num); fCustomPrint(OutFilep,"%4d %8s %-11.5g\n",i,str,dF[i]);
i++; sprintf(str,"w%-d",i-N); fCustomPrint(OutFile,"%4d %8s %-11.5g\n",i,str,x0[i-N]);
sprintf(str,"gVd%-d",ACptr->Num); fCustomPrint(OutFilep,"%4d %8s %-11.5g\n",i,str,dF[i]);
i++; sprintf(str,"w%-d",i-N); fCustomPrint(OutFile,"%4d %8s %-11.5g\n",i,str,x0[i-N]);
sprintf(str,"gVq%-d",ACptr->Num); fCustomPrint(OutFilep,"%4d %8s %-11.5g\n",i,str,dF[i]);
i++; sprintf(str,"w%-d",i-N); fCustomPrint(OutFile,"%4d %8s %-11.5g\n",i,str,x0[i-N]);
sprintf(str,"gId%-d",ACptr->Num); fCustomPrint(OutFilep,"%4d %8s %-11.5g\n",i,str,dF[i]);
i++; sprintf(str,"w%-d",i-N); fCustomPrint(OutFile,"%4d %8s %-11.5g\n",i,str,x0[i-N]);
sprintf(str,"gIq%-d",ACptr->Num); fCustomPrint(OutFilep,"%4d %8s %-11.5g\n",i,str,dF[i]);
i++; sprintf(str,"w%-d",i-N); fCustomPrint(OutFile,"%4d %8s %-11.5g\n",i,str,x0[i-N]);
sprintf(str,"gVr%-d",ACptr->Num); fCustomPrint(OutFilep,"%4d %8s %-11.5g\n",i,str,dF[i]);
i++; sprintf(str,"w%-d",i-N); fCustomPrint(OutFile,"%4d %8s %-11.5g\n",i,str,x0[i-N]);
sprintf(str,"gVi%-d",ACptr->Num); fCustomPrint(OutFilep,"%4d %8s %-11.5g\n",i,str,dF[i]);
i++; sprintf(str,"w%-d",i-N); fCustomPrint(OutFile,"%4d %8s %-11.5g\n",i,str,x0[i-N]);
sprintf(str,"gIa%-d",ACptr->Num); fCustomPrint(OutFilep,"%4d %8s %-11.5g\n",i,str,dF[i]);
}
}
for(k=0,DCptrR=dataPtr->DCbus;DCptrR!=NULL;DCptrR=DCptrR->Next){
if(!strcmp(DCptrR->Type,"R")){
for (k++,l=1;l<=11;l++){
i++; sprintf(str,"w%-d",i-N); fCustomPrint(OutFile,"%4d %8s %-11.5g\n",i,str,x0[i-N]);
sprintf(str,"gdc%-d_%-d",k,l); fCustomPrint(OutFilep,"%4d %8s %-11.5g\n",i,str,dF[i]);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -