//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"); }