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

📄 limits.c

📁 电力系统分析计算 学习调试程序 UNIX / LINUX / CYGWIN 系统使用
💻 C
📖 第 1 页 / 共 3 页
字号:
        else if (Elim && Recover && strpbrk(ACptr->cont,"E") &&   ACptr->Cont->Kbg<1  &&                 ((ACptr->Gen->Eq==ACptr->Gen->EqMax && ACptr->Cont->V>=ACptr->Cont->VCont) ||                  (ACptr->Gen->Eq==ACptr->Gen->EqMin && ACptr->Cont->V<=ACptr->Cont->VCont)) ){          flag=TRUE;  Nvolt++;          strcpy(ACptr->cont,"V");          if (flagH) x0[ACptr->Gen->Nvar+1]=ACptr->Gen->Eq;          fCustomPrint(stderr,"***Warning: Generator %d %s has recovered\n",ACptr->Num,ACptr->Name);          fCustomPrint(stderr,"            remote V control as Eq is again within limits.\n");          ACptr->Cont->Kbg++;          if (ACptr->Cont->Kbg==1) {            ACptr->Cont->Cont=NULL;            ACptr->Cont->V=ACptr->Cont->VCont;            if (flagH) x0[ACvar[ACptr->Cont->N]+1]=ACptr->Qg/ACptr->Kbg;            fCustomPrint(stderr,"***Warning: Remote voltage controlled bus %d %s\n",ACptr->Cont->Num,ACptr->Cont->Name);            fCustomPrint(stderr,"            has recovered generator support.\n");          }        }        else if (strpbrk(ACptr->cont,"Q") &&                 ((Ilim && ACptr->Gen->Ia>=ACptr->Gen->IaMax) ||                  (Elim && (ACptr->Gen->Eq>=ACptr->Gen->EqMax || ACptr->Gen->Eq<=ACptr->Gen->EqMin)))) {          fCustomPrint(stderr,"***Error: Generator %d %s it's already at a Q limit.\n",ACptr->Num,ACptr->Name);          fCustomPrint(stderr,"          Try changing Ia and/or Eq limits.\n");          WriteSolution(0,TrueParamStr(2),"Ia/Eq Limit Problems:");          stopExecute(1);        }        else if (strpbrk(ACptr->cont,"I") &&                 ((Qlim && (ACptr->Qg>=ACptr->Max || ACptr->Qg<=ACptr->Min)) ||                  (Elim && (ACptr->Gen->Eq>=ACptr->Gen->EqMax || ACptr->Gen->Eq<=ACptr->Gen->EqMin)))) {          fCustomPrint(stderr,"***Error: Generator %d %s it's already at an Ia limit.\n",ACptr->Num,ACptr->Name);          fCustomPrint(stderr,"          Try changing Q and/or Eq limits.\n");          WriteSolution(0,TrueParamStr(2),"Q/Eq Limit Problems:");          stopExecute(1);        }        else if (strpbrk(ACptr->cont,"E") &&                 ((Ilim && ACptr->Gen->Ia>=ACptr->Gen->IaMax) ||                  (Qlim && (ACptr->Qg>=ACptr->Max || ACptr->Qg<=ACptr->Min)))) {          fCustomPrint(stderr,"***Error: Generator %d %s it's already at an Eq limit.\n",ACptr->Num,ACptr->Name);          fCustomPrint(stderr,"          Try changing Q and/or Ia limits.\n");          WriteSolution(0,TrueParamStr(2),"Q/Ia Limit Problems:");          stopExecute(1);        }      }    }    else if (strpbrk(ACptr->Type,"Q,S") || (!QRcont && strpbrk(ACptr->Type,"G")) ) {      if (Qlim && strpbrk(ACptr->cont,"V") && (ACptr->Qg>=ACptr->Max || ACptr->Qg<=ACptr->Min)) {        flag=TRUE; Nvolt--;        if(ACptr->Qg>=ACptr->Max) {          ACptr->Qg=ACptr->Max;          strcpy(str,Qmax);        }        else {          ACptr->Qg=ACptr->Min;          strcpy(str,Qmin);        }        strcpy(ACptr->cont,"Q");        ACptr->VCont=ACptr->V;        if (strpbrk(ACptr->Type,"G")) ACptr->Cont=ACptr->ContBus->AC;        else                          ACptr->Cont=ACptr;        if (flagH) x0[ACvar[ACptr->N]+1]=ACptr->V;        fCustomPrint(stderr,"***Warning: Generator %d %s has lost voltage control\n",ACptr->Num,ACptr->Name);        fCustomPrint(stderr,"            due to %4s problems.\n",str);      }      else if (Qlim && Recover && strpbrk(ACptr->cont,"Q") &&               ((ACptr->Qg>=ACptr->Max && ACptr->V>=ACptr->VCont) ||                (ACptr->Qg<=ACptr->Min && ACptr->V<=ACptr->VCont)) ){        flag=TRUE; Nvolt++;        ACptr->V=ACptr->VCont;        strcpy(ACptr->cont,"V");        ACptr->Cont=NULL;        if (flagH) x0[ACvar[ACptr->N]+1]=ACptr->Qg;        fCustomPrint(stderr,"***Warning: Generator %d %s has recovered\n",ACptr->Num,ACptr->Name);        fCustomPrint(stderr,"            voltage control as Qg/Sg is again within limits.\n");      }      else if (ACptr->Gen!=NULL) {        if (Ilim && strpbrk(ACptr->cont,"V") && ACptr->Gen->Ia>=ACptr->Gen->IaMax) {          flag=TRUE;  Nvolt--;          ACptr->Gen->Ia=ACptr->Gen->IaMax;          strcpy(ACptr->cont,"I");          ACptr->VCont=ACptr->V;          if (strpbrk(ACptr->Type,"G")) ACptr->Cont=ACptr->ContBus->AC;          else                          ACptr->Cont=ACptr;          if (flagH) {            x0[ACvar[ACptr->N]+1]=ACptr->V;            x0[ACptr->Gen->Nvar+11]=ACptr->Qg;          }          fCustomPrint(stderr,"***Warning: Generator %d %s has lost V control\n",ACptr->Num,ACptr->Name);          fCustomPrint(stderr,"            due to Ia_max limit problems.\n");        }        else if (Ilim && Recover && strpbrk(ACptr->cont,"I") &&                 ACptr->Gen->Ia==ACptr->Gen->IaMax && ACptr->V>=ACptr->VCont) {          flag=TRUE;  Nvolt++;          strcpy(ACptr->cont,"V");          ACptr->V=ACptr->VCont;          ACptr->Cont=NULL;          if (flagH) {            x0[ACvar[ACptr->N]+1]=ACptr->Qg;            x0[ACptr->Gen->Nvar+11]=ACptr->Gen->Ia;          }          fCustomPrint(stderr,"***Warning: Generator %d %s has recovered\n",ACptr->Num,ACptr->Name);          fCustomPrint(stderr,"            V control as Ia is again within limits.\n");        }        else if (Elim && strpbrk(ACptr->cont,"V") &&                 (ACptr->Gen->Eq>=ACptr->Gen->EqMax || ACptr->Gen->Eq<=ACptr->Gen->EqMin)) {          flag=TRUE; Nvolt--;          if (ACptr->Gen->Eq>=ACptr->Gen->EqMax) {            ACptr->Gen->Eq=ACptr->Gen->EqMax;            strcpy(str,"max");          } else {            ACptr->Gen->Eq=ACptr->Gen->EqMin;            strcpy(str,"min");          }          strcpy(ACptr->cont,"E");          ACptr->VCont=ACptr->V;          if (strpbrk(ACptr->Type,"G")) ACptr->Cont=ACptr->ContBus->AC;          else                          ACptr->Cont=ACptr;          if (flagH) {            x0[ACvar[ACptr->N]+1]=ACptr->V;            x0[ACptr->Gen->Nvar+1]=ACptr->Qg;          }          fCustomPrint(stderr,"***Warning: Generator %d %s has lost V control\n",ACptr->Num,ACptr->Name);          fCustomPrint(stderr,"            due to Eq_%3s limit problems.\n",str);        }        else if (Elim && Recover && strpbrk(ACptr->cont,"E") &&                 ((ACptr->Gen->Eq==ACptr->Gen->EqMax && ACptr->V>=ACptr->VCont) ||                  (ACptr->Gen->Eq==ACptr->Gen->EqMin && ACptr->V<=ACptr->VCont)) ){          flag=TRUE;  Nvolt++;          strcpy(ACptr->cont,"V");          ACptr->V=ACptr->VCont;          ACptr->Cont=NULL;          if (flagH) {            x0[ACvar[ACptr->N]+1]=ACptr->Qg;            x0[ACptr->Gen->Nvar+1]=ACptr->Gen->Eq;          }          fCustomPrint(stderr,"***Warning: Generator %d %s has recovered\n",ACptr->Num,ACptr->Name);          fCustomPrint(stderr,"            V control as Eq is again within limits.\n");        }        else if (strpbrk(ACptr->cont,"Q") &&                 ((Ilim && ACptr->Gen->Ia>=ACptr->Gen->IaMax) ||                  (Elim && (ACptr->Gen->Eq>=ACptr->Gen->EqMax || ACptr->Gen->Eq<=ACptr->Gen->EqMin)))) {          fCustomPrint(stderr,"***Error: Generator %d %s it's already at a Q limit.\n",ACptr->Num,ACptr->Name);          fCustomPrint(stderr,"          Try changing Ia and/or Eq limits.\n");          WriteSolution(0,TrueParamStr(2),"Ia/Eq Limit Problems:");          stopExecute(1);        }        else if (strpbrk(ACptr->cont,"I") &&                 ((Qlim && (ACptr->Qg>=ACptr->Max || ACptr->Qg<=ACptr->Min)) ||                  (Elim && (ACptr->Gen->Eq>=ACptr->Gen->EqMax || ACptr->Gen->Eq<=ACptr->Gen->EqMin)))) {          fCustomPrint(stderr,"***Error: Generator %d %s it's already at an Ia limit.\n",ACptr->Num,ACptr->Name);          fCustomPrint(stderr,"          Try changing Q and/or Eq limits.\n");          WriteSolution(0,TrueParamStr(2),"Q/Eq Limit Problems:");          stopExecute(1);        }        else if (strpbrk(ACptr->cont,"E") &&                 ((Ilim && ACptr->Gen->Ia>=ACptr->Gen->IaMax) ||                  (Qlim && (ACptr->Qg>=ACptr->Max || ACptr->Qg<=ACptr->Min)))) {          fCustomPrint(stderr,"***Error: Generator %d %s it's already at an Eq limit.\n",ACptr->Num,ACptr->Name);          fCustomPrint(stderr,"          Try changing Q and/or Ia limits.\n");          WriteSolution(0,TrueParamStr(2),"Q/Ia Limit Problems:");          stopExecute(1);        }      }    }    else if (strpbrk(ACptr->Type,"Z")) {      if (Zlim && strpbrk(ACptr->cont,"V") && (ACptr->Qg>=ACptr->Qmax || ACptr->Qg<=ACptr->Qmin)) {        flag=TRUE; NZvolt--;        if(ACptr->Qg>=ACptr->Qmax) {          ACptr->Qg=ACptr->Qmax;          strcpy(str,Qmax);        }        else {          ACptr->Qg=ACptr->Qmin;          strcpy(str,Qmin);        }        ACptr->Bz=ACptr->Qg/(ACptr->V*ACptr->V);        strcpy(ACptr->cont,"Q");        ACptr->VCont=ACptr->V;        ACptr->Cont=ACptr;        if (flagH) x0[ACvar[ACptr->N]+1]=ACptr->V;        fCustomPrint(stderr,"***Warning: Reactance-controlled bus %d %s has lost\n",ACptr->Num,ACptr->Name);        fCustomPrint(stderr,"            voltage control due to %4s problems.\n",str);      }      else if (Zlim && strpbrk(ACptr->cont,"Q") &&               ((ACptr->Qg>=ACptr->Qmax && ACptr->V>=ACptr->VCont) ||                (ACptr->Qg<=ACptr->Qmin && ACptr->V<=ACptr->VCont)) ){        flag=TRUE; NZvolt++;        ACptr->V=ACptr->VCont;        strcpy(ACptr->cont,"V");        ACptr->Cont=NULL;        if (flagH) x0[ACvar[ACptr->N]+1]=ACptr->Qg;        fCustomPrint(stderr,"***Warning: Reactance-controlled bus %d %s has recovered\n",ACptr->Num,ACptr->Name);        fCustomPrint(stderr,"            voltage control as Q is again within limits.\n");      }    }  }    if ((Qlim || Elim || Ilim || Zlim) && RemoteVlost && QRcont)    for(ACptr=dataPtr->ACbus;ACptr!=NULL;ACptr=ACptr->Next) {      if (strpbrk(ACptr->Type,"C") && ACptr->Kg<0) ACptr->Kbg=0;    }  return(flag);}/* -------------------- CheckDClimits ----------------------- */#ifdef ANSIPROTOBOOLEAN CheckDClimits(void)#elseBOOLEAN CheckDClimits()#endif{  DCbusData *DCptrR,*DCptrI;  BOOLEAN flag=FALSE;  for (DCptrR=dataPtr->DCbus;DCptrR!=NULL;DCptrR=DCptrR->Next) if(!strcmp(DCptrR->Type,"R")) {    DCptrI=DCptrR->To;    if ((strcmp(DCptrR->Cont1,"AT") && strcmp(DCptrR->Cont2,"AT") &&         (DCptrR->Tap>=DCptrR->TapMax || DCptrR->Tap<=DCptrR->TapMin)) ||        (strcmp(DCptrI->Cont1,"AT") && strcmp(DCptrI->Cont2,"AT") &&         (DCptrI->Tap>=DCptrI->TapMax || DCptrI->Tap<=DCptrI->TapMin))){      flag=TRUE;      fCustomPrint(stderr,"***Warning: The program will release tap limits in the HVDC links.\n");      break;    }  }  return(flag);}

⌨️ 快捷键说明

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