Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
//tochangesomedata,andthendoescontingencyanalysisagain.
DATA(FILTER,[ObjectType,FilterName,FilterLogic,FilterPre])
{
//Createtwofiltersoneforlinesandoneforgenerators
//Sincethesefiltersarenotalreadydefinedinthecase,
//PowerWorldmayaskifyouwanttodefinethem.PressYes.
//Thefirstfilter:
//Element Filtername Criteria Always?
//
BRANCH"BranchFilter""AND" "no"
<SUBDATACONDITION>
//TheconditionforBranchFilter
LineLimMVA>99
</SUBDATA>
//Now,thesecondfilter:
//Element Filtername Criteria Always?
//
GEN "GenFilter""AND" "no"
<SUBDATACONDITION>
//TheconditionforGenFilter:GeneratorMax.Output>450MW
GenMWMax>450
</SUBDATA>
}
DATAaddCTG(Contingency,[CTGlabel,CTGskip])
{
//Addasetofcontingencies,namedContingencies
//Sincethissetofcontingenciesdoesntexistinthecaseyet,
//PowerWorldwillaskyouifyouwanttodefinethem.SayYes.
//CTGname skip?
//
Contingencies NO
<SUBDATACTGElement>
//Hereisthelistofcontingencies.
//forModelCriteriaisrequiredinordertoenterastatus.
//Action ModelCriteria Status
//
"GEN11OPEN" "" ALWAYS
"BRANCH131OPEN" "" ALWAYS
"BRANCH251OPEN""" ALWAYS
"BRANCH671OPEN" "" ALWAYS
"GEN41OPEN" "" ALWAYS
"GEN21OPEN" "" ALWAYS
</SUBDATA>
}
SCRIPTContingencyBefore
{
//Dothe1stcontingencyanalysis,producethe'before'report
//First,solvethepowerflow.WemustenterPowerFlowmode.
EnterMode(PowerFlow);
//Solvethepowerflow.
SolvePowerFlow;
//Docontingencyanalysis.WemustentertheContingencymode.
EnterMode(Contingency);
//Solveallthecontingenciesenteredwiththedataearlier.
CTGSolveAll;
//Makeanautomaticcontingencyreport.Storethereportinthe
//fileCTG_Filters_BeforeReportinthecurrentdirectory.
CTGProduceReport("CTG_Filters_BeforeReport");
}
SCRIPTChangeData
{
//Changesomedata.
//Tochangedatawemustbeintheeditmode.
Entermode(Edit);
//SelectallbranchesmeetingthecriteriaintheBranchFilter
SelectAll(BRANCH,"BranchFilter");
//SetalloftheselectedbranchMVAlimitsto99MVA.
SetData(BRANCH,[LineLimMVA],[99],SELECTED);
//Unselectthebranches.
UnSelectAll(BRANCH,BranchFilter);
//Hereisadifferentwaytochangedata:
//UsetheSetDatacommandwiththesearguments:
//SetData(Object,[Field],[NewValue],"Filternametouse");
SetData(GEN,[GenMWMax],[399],"GenFilter");
ScriptContingencyAfter
{
//Dothe2ndcontingencyanalysisandproducethe'after'report
//Makesurethepowerflowstillconverges.
//Changetopowerflowmode.
Entermode(PowerFlow);
//Solvethepowerflow.
SolvePowerFlow;
//Nowentercontingencymodetodocontingencyanalysis.
EnterMode(Contingency);
//Solveallthecontingencies
CTGSolveAll;
//Producetheautomaticcontingencyreport,storeitinthe
//fileCTG_Filters_AfterReportinthecurrentdirectory.
CTGProduceReport("CTG_Filters_AfterReport");
}