Home 

>>

 Support 

>>

 Simulator Tips 

>>

 Example Auxiliary Files 

 
 
 

Customer Support

Support Home

Support FAQ

Changing the License Key

Simulator Tips

  Example Auxiliary Files

  Example SimAuto Files

Video Capture

Educator's Corner

Contact PowerWorld

 
 

 
 

Software Training

Training Home

Training Calendar

Training Registration

Online Training Video

 
 

 

Script: Adding Multiple Generators and Performing Contingency Analysis

Auxiliary File: NewGeneratorsCTG.aux

PowerWorld Case: B7OPF.pwb

PowerWorld Oneline: B7OPF.pwd

Output Files: NewGeneratorContingencyReport.txt

(Right-click on the above files and select Save Target As to save them to your computer.)

In this example we add two generators to the case and then solve the power flow, run contingency analysis and produce a contingency analysis report.

There are two scripts in this example

  • Edit changes the mode to edit so that we can add generators.
  • DoCalculations solves the power flow, runs contingency analysis and produces an automated contingency analysis report.

There are also two data sections.

  • AddGen contains the data for the two generators that we add at buses 3 and 5.
  • AddCTG contains a list of contingencies for contingency analysis.

NewGeneratorsCTG.aux:

//This script adds two small generators and then performs
//contingency analysis.
//It is written for a seven-bus case.

SCRIPT Edit
{
//Before we can add generators we must be in edit mode!
EnterMode(Edit);
}
DATA AddGen(GEN, [busnum, GenID, GENAGCAble, GenParFac, GenFixedCost, GenFuelCost,
GenMWMin, GenMWMax, GenEnforceMWLimits])
{
//Add two new generators. PowerWorld will ask you if you want to
//create them. Say Yes.
//
//Bus  Gen Gen Participation  Fixed  Fuel   Gen     Gen     Enforce
//Num  ID  AGC?   Factor      Cost   Cost   min MW  max MW  Limits? 
//------------------------------------------------------------------
3      2   YES    1           1      2      5       50      YES
5      2   YES    1           1      2      1       30      YES
}

DATA addCTG(Contingency, [CTGlabel, CTGskip])
//Enter data for the contigencies
{
//PowerWorld will ask if you want to create the contingencies.  
//Say Yes.
//Contingency Label  Skip?
//--------------------------------
"Contingencies"      NO
<SUBDATA CTGElement>
//Action Model Criteria Status
//Action             Model Criteria       Status
//----------------------------------------------------
"GEN 1 1 OPEN"             ""            ALWAYS 
"BRANCH 1 3 1 OPEN"        ""            ALWAYS 
"GEN 2 1 OPEN"             ""            ALWAYS
</SUBDATA>
}

SCRIPT DoCalculations
{
//Solve the power flow, run contingency analysis, 
//and create a report.
//Enter PowerFlow mode.
Entermode(PowerFlow);
//Solve the power flow.
SolvePowerFlow;
//Enter Contingency mode.
Entermode(Contingency);
//Solve the contingencies we entered earlier.
CTGSolve("Contingencies");
//Save an automatic contingency report in "NewGeneratorContingencyReport"
CTGProduceReport("NewGeneratorContingencyReport");
}