Knowledge Base

PTDF and Contingency Analysis of a New Transaction

Auxiliary File: Transaction.aux

PowerWorld Case: B7OPF.pwb

PowerWorld Oneline: B7OPF.pwd

Output Files: PTDF.aux, BeforeTransactionCTGReport.txt, AfterTransactionCTGReport.txt

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

This script implements a large transaction from the left area to the top area of a seven-bus system and illustrates the effects of the transaction through calculation of power transfer distribution factors (PTDF). It also performs contingency analysis before and after the transaction. It saves PTDF data before and after the transaction to a file.

There are three Script sections:

SolveCase solves the power flow, sets the base case for difference flows, calculates PTDFs for a transaction between Area 2 and Area 1, and saves PTDF data to an external file.

CTGBefore performs contingency analysis before the transaction and produces an automatic contingency report.

SolveAfterTransaction solves the power flow, calculates the PTDFs, and performs contingency analysis after the transaction. It saves the PTDF data to an external file and produces an automatic contingency report. Finally, it displays a difference flow comparing the power flow solutions before and after the transaction.

There are also two Data sections:

AddCTG contains a list of contingencies for the contingency analysis.

Transactions contains data for the transaction between areas 1 and 2.

Transaction.aux:

//Script to show the effects of a large transaction//from area left (2) to area top (1)SCRIPT SolveCase

{

//Solve the power flow and run the OPF

//First enter PowerFlow mode.

EnterMode(PowerFlow);

//Solve the power flow:

SolvePowerFlow;

//Set the system state as the base case for difference flows.

DiffFlowSetAsBase;

//Switch to Run mode to calculate PTDFs.

Entermode(Run);

//Calculate PTDFs for a transaction between Area 1 and Area 2

//use the AC calculation method.

CalculatePTDF([Area 2], [Area 1], AC);

//Save some data to a file named PTDF.AUX; it will have the

//to and from bus numbers and the value of the PTDF for every

//branch in the system. The empty brackets [] at the end are for

//a sub data list, which we are not using in this example.

SaveData(“PTDF”, AUX, BRANCH, [BusNum, BusNum:1, AbsValPTDF],[]);

}DATA AddCTG(Contingency, [CTGlabel, CTGskip])

{

//Enter data for the contigencies

//Since these contingencies don’t exist in the

//case, PowerWorld will ask if you want to

//create them. Say Yes.//CTG Label SKIP?

//————————–

Contingencies NO

//The list of contingencies. We always have to enter “” for

//Model Criteria if we want to say a status.//Action Model Criteria Status

//—————————————————–

“GEN 1 1 OPEN” “” ALWAYS

“BRANCH 1 3 1 OPEN” “” ALWAYS

“BRANCH 3 4 1 OPEN” “” ALWAYS

“BRANCH 6 7 1 OPEN” “” ALWAYS

“GEN 4 1 OPEN” “” ALWAYS

“BRANCH 6 7 2 OPEN” “” ALWAYS

}SCRIPT CTGBefore

{

//Do contingency analysis before the transaction.

//First enter Contingency mode.

EnterMode(Contingency);

//Solve the contingencies listed in the data section.

//We labeled them “Contingencies”.

CTGSolve(“Contingencies”);

//Produce an automatic contingency analysis report.

//Save the report to the file “BeforeTransactionCTGReport”

CTGProduceReport(“BeforeTransactionCTGReport”);

}

Data Transactions(StudyMWTransactions, [AreaNum, AreaNum:1, MWTRSched])

{

//Add a MW transaction between areas 2 and 1

//PowerWorld will ask you if you want to create

//the transaction because it doesn’t exist. Say Yes.

//Seller Buyer MW Transaction

//———————————-

2 1 200.00

}

SCRIPT SolveAfterTransaction

{

//Repeat the above calculations after the transaction.

//First do the power flow – enter power flow mode.

EnterMode(PowerFlow);

//Solve the power flow.

SolvePowerFlow;

//Display the difference flow comparing the solution

//after the transaction to the original solution.

DiffFlowMode(DIFFERENCE);

//Calculate PTDFS for a transaction between areas 2 and 1.

CalculatePTDF([Area 2], [Area 1], AC);

//Save the PTDF data to the file PTDF.aux. The data will be

//appended to the file created earlier.

SaveData(“PTDF”, AUX, BRANCH, [BusNum, BusNum:1, AbsValPTDF],[]);

//Switch to contingency mode to do contingency analysis

EnterMode(Contingency);

//Solve the contingencies included in the data section above,

//we labeled this set of congtingencies “Contingencies”

CTGSolve(“Contingencies”);

//Save the automatic contingency report to the file

//AfterTransactionCTGReport.

CTGProduceReport(“AfterTransactionCTGReport”);

}

Tags: ,,,

June 29, 2012