Moving and Combining Generators and Comparing Power Flows
(Right-click on the above files and select Save Target As to save them to your computer.)
In this example we will use a script to combine and move generators in a seven-bus case. We will solve the power flow, move and combine some generators, re-solve the power flow, and then look at a difference flow to see how our changes in generation have affected the power flow.
The auxiliary file contains five script sections:
The Before script solves the power flow and sets the solution as the base case.
The CombineGenerators script creates a second generator at bus 4 using the CreateData command, and then combines the two generators at bus 4 into one generator.
The MoveGenerator script moves the generator from bus 4 to bus 7.
The EnforceLimits script makes sure that the output limits are enforced for all generators in the system.
The After script solves the power flow, and then sets the DiffFlowMode to difference so that the difference case is displayed. Looking at the oneline after running all of these scripts we can see how combing the two generators at bus 4 and then moving the combined generator to bus 7 affects the power flow.
//This script adds a new generator, combines it with an
//existing generator, moves another generator, and then
//shows the change in the power flow.SCRIPT Before
//First we will run the power flow to set a base case.
//We must be in PowerFlow mode.
//Solve the power flow.
//Set the current system state as the base case.
//Later we will use difference flows to compare the changed //system with the base case.
//First we will create a new generator at bus 4.
//Then we will combine the new generator with
//the existing one.
//To do this we must be in Edit mode.
//Create the new generator using the CreateData command.
//If we were creating several generators we would make
//a separate data section. CreateData is good for one though.
//These are the arguments in CreateData:
//CreateData(Obejct, [List of fields], [list of values])
//The CreateData command is too long for one line.
//This is not a problem – just continue on the next line.
CreateData(GEN, [BusNum, GenID, GENMWMax, GENAGCAble, GenEnforceMWLimits],[4, 2, 35, “YES”, “YES”]);
//Combine the old generator at bus 4 with the new one.
//Combine([object to move] [object to combine with]);
//In the brackets: [Object Bus number Object ID] Combine([GEN 4 1], [GEN 4 2]);
//Move the (newly combined) generator from bus 4 to bus 7
//Enter the Edit mode
//Move([object to move] [where to move it]);
//In the brackets: [Object Bus number Object ID] //and [Bus number Object ID] Move([GEN 4 2], [7 2]);
//Make sure the MW limits are enforced for all generators
//Enter the Edit mode.
//Select all the generators
//Set the EnforceMWLimits? To Yes for all the selected
SetData(GEN, [GenEnforceMWLimits], [“YES”], SELECTED);
//Unselect the generators
//Solve the power flow, look at the difference case.
//Enter the PowerFlow mode.
//Solve the Power Flow.
//Look at the difference flow case to see how moving the
//generators has changed the power flow in comparison to
//the base case.
June 29, 2012