97
Dev Tutorial www.interpss.org InterPSS Development Tutorial In progress... Version: <V0.42> Date: <7/23/2014> 1

InterPSS Application and Development tutorial_V0.42

Embed Size (px)

DESCRIPTION

InterPSS Application and Development tutorial for v0.42.For more details, visit: www.InterPSS.org

Citation preview

  • DevTutorialwww.interpss.org

    InterPSS

    DevelopmentTutorial

    Inprogress...

    Version:Date:

    1

    http://www.google.com/url?q=http%3A%2F%2Fwww.interpss.org&sa=D&sntz=1&usg=AFQjCNFuWD5qyebV38VkZNbOpsw1esWEMA

  • DevTutorialwww.interpss.org

    DocumentVersionHistory

    VersionNo. ReleaseDate Description Preparedby

    V0.1 12/17/2013 startworkingonthefirstversion,theoutlineoftutorial

    T.Huang

    V0.2 1/25/2014 completedch2:introtothethreebasicpowersystemmodels,bus,branchandnetwork

    T.Huang

    V0.3 03/02/2014 addtheAppendixB,introtoODM T.Huang

    V0.4 03/16/2014 addch4shortcircuit,updatech5dstab T.Huang

    V0.41 04/12/2014 addch5dstabmonitoringandoutput T.Huang

    V0.42 07/23/2014 addAppendixAsparsematrixandsolver T.Huang

    2

    http://www.google.com/url?q=http%3A%2F%2Fwww.interpss.org&sa=D&sntz=1&usg=AFQjCNFuWD5qyebV38VkZNbOpsw1esWEMA

  • DevTutorialwww.interpss.org

    TableofContents

    IntroductionChapter1.SettinguptheInterPSSDevelopmentEnvironment

    1.1ImportInterPSSlibraryprojects1.1.1Libraryrepositoryasazipfile1.1.2CloneLibraryprojectrepositoryviaEgit

    (1)GitHubEclipseplugin(2)ClonetherepositorytolocalPCandimporttheprojectsintoworkspace

    1.2RunsampleloadflowtestcaseChapter2.AnintroductiontothepowersystembasicmodelsinInterPSS

    2.1.OverviewofpowersystemmodelinginInterPSS2.2.Inheritanceandclasshierarchystructure2.3Threebasictypesofpowersystemmodels

    2.3.1Networkobject2.3.2Bus2.3.3Branch

    2.4.Gettingandsettingthedataofanobject2.4.1Network2.4.2Bus2.3.3Branch

    2.4ExampleChapter3.Powersystemloadflowanalysis

    Introductiontopowersystemloadflow3.1Datarequiredforloadflowanalysis

    3.1.1System/networkdata3.1.2Busdata3.1.3Branchdata

    3.2.Supportedpowersystemmodels3.3.Solutionmethodsandinternalsparsematrixdatastructure

    3.3.1NewtonRaphson3.3.2FastDecoupled3.3.3DCloadflow

    3.4AdjustmentDuringloadflow3.5Configurationofloadflowalgorithm3.6Example

    3.6.1Runloadflowandoutputresult3.6.2CustomizeNRloadflow

    Chapter4.ShortcircuitanalysisIntroductiontoshortcircuitanalysis4.1Powersystemsequencedata4.2Busbasedsimpleshortcircuit4.3Branchbasedsimpleshortcircuit4.4ShortcircuitanalysisinInterPSS

    3

    http://www.google.com/url?q=http%3A%2F%2Fwww.interpss.org&sa=D&sntz=1&usg=AFQjCNFuWD5qyebV38VkZNbOpsw1esWEMA

  • DevTutorialwww.interpss.org

    4.4.1CreateACSCnetwork4.4.2Defineafault4.4.3Calculateshortcircuit4.4.4Obtainresults

    4.5Example4.5.1Buildasystemforshortcircuitanalysis4.5.2Shortcircuitanalysiswithloadflowandsequencedata

    Chapter5.Transientstabilitysimulation5.1Introductiontotransientstabilitysimulation5.2Dynamicmodels

    5.2.1Machinemodel(1)MachinemodelinaDStabBus(2)Machinemodelsofdifferentlevelsofmodelingdetails(3)Modelingtheeffectsofsaturation

    5.2.2Excitor5.2.3Turbineandgovernor5.2.5Loadmodel5.2.7BusFrequencyMeasurement

    5.3NumericalSolution5.4Simulationprocedure

    5.4.1Simulationdatapreparation5.4.2Simulationsetting5.4.3Eventsetting

    (1)Faultsetting(a)Busfault(b)BranchFault

    5.4.4Monitoringandoutput5.4.5Loadflowandsysteminitialization5.4.6Simulation

    5.6Datacheckandautocorrection5.7Developmentofnewdynamicdevice5.8Example

    Chapter6.PowersystemoptimizationthroughintegratingInterPSSwithGAMS6.1GAMSV246.2.CallGAMSfromJava6.3EconomicdispatchSample

    Chapter7.SensitivityAnalysisandDCLFbasedcontingencyanalysisChapter8.NewcontrollermodeldevelopmentwithControllerModelingLanguageChapter9.GraphbasedpowersystemapplicationsAppendixASparseMatrixAppendixBOpenDataModelfordataimport/output

    1.Prerequisite1.1BasicunderstandingofXML:schema,databindingandJAXB1.2Basicknowledgeofdataforpowersystemsimulation

    2.ODMinanutshell2.1ODMasadataformatfreeintermediaryfordataexchange2.2XMLSchemaforpowersystemsimulationdatamodeling

    2.2.1BasicSchema

    4

    http://www.google.com/url?q=http%3A%2F%2Fwww.interpss.org&sa=D&sntz=1&usg=AFQjCNFuWD5qyebV38VkZNbOpsw1esWEMA

  • DevTutorialwww.interpss.org

    NamingConventionNameSpaceVersionNumberPUSystemExtensionSchemaRootElementBaseRecordIDRecord

    2.2.2BaseCase2.2.3BusRecord

    2.2.3.1BusRecordforACLoadflowBusGenerationDataBusGenDataXmlTypeBusLoadData2.2.3.2BusRecordforACshortcircuit2.2.3.3BusRecordfortransientstability

    2.2.4BranchRecordBaseBranchDataLoadflowLineDataLoadflowTransformerDataTransformerDataTransformerTapAdjustmentTransformerTapAdjustmentforBusVoltageTransformerTapAdjustmentforMVarFlowLoadflowPhaseShiftTransformerDataPhaseAngleAdjustment

    BranchRatingLimit3Windingtransformer

    ModificationContingency

    StudyScenario2.3DatabindingwithJAXB2.4DataimporttoODM/XML

    2.4.1Modeldataparserandmapper2.4.1.1InputLineStringParser

    ParseinputlineString2.4.2Implementaspecificdataparserandmapper

    2.4.2.1Implementinputlinestringparser2.4.2.2Implementinputlinestringmapper

    2.4.3DataAdapter2.5ODM>InterPSS

    5

    http://www.google.com/url?q=http%3A%2F%2Fwww.interpss.org&sa=D&sntz=1&usg=AFQjCNFuWD5qyebV38VkZNbOpsw1esWEMA

  • DevTutorialwww.interpss.org

    IntroductionThisdevelopmenttutorialisintendedtohelpusersofInterPSStolearnInterPSSandhowtouseitbetterandfaster.BackgroundknowledgeofbasicJavaprogrammingandsomeknowledgeofpowersystemmodelingandsimulationisrequired.ForthosewhosearenotthatfamiliarwithJavaprogrammingandEclipseIDE,Itissuggestedthatyouspendoneortwoweeksonthosestufffirstandthencomebacktothistutorial.TherearemanyonlinelearningmaterialforyouwhenyougoogleJavatutorialorEclipsetutorial.Forexample:Javalearning:http://www.learnjavaonline.org/Eclipse:http://eclipsetutorial.sourceforge.net/totalbeginner.htmlIfyouhavesomebackgroundinJavaandinterestedtolearnInterPSS,thenitisrightforyou.ThistutorialwillfirstguideyouthroughsettingupthedevelopmentenvironmentinChapter1.InChapter2,introductiontothebasicpowersystemmodelsinInterPSSispresented.InthefollowingChapter3to5,themodelingandsimulationalgorithminInterPSSfortypicalapplicationsarediscussed,includingpowerflow,shortcircuitandtransientstability.InChapter6,integrationofInterPSSwiththeGAMS(ahighlevelmodelingsystemformathematicalprogrammingandoptimization)willbepresented,alongwithasimpleSCEDexample.Foreachchapter,simpleapplicationexamplesiscreatedtohelpuserstohavebetterunderstandingofthematerialinthechapter.Youareencouragedtocreateyourownstudycasebyfollowingthoseexamples.

    TutorialexampleandcodeThistutorialisaccompaniedbysimpleexamplesforeachchapter.ThecodeforallexamplesisavailableonGitHub:https://github.com/InterPSSProject/ipsscommon/tree/master/ipss.tutorial.

    6

    http://www.google.com/url?q=http%3A%2F%2Fwww.interpss.org&sa=D&sntz=1&usg=AFQjCNFuWD5qyebV38VkZNbOpsw1esWEMAhttp://www.google.com/url?q=http%3A%2F%2Fwww.learnjavaonline.org%2F&sa=D&sntz=1&usg=AFQjCNEYb4nmp3VOXBkV_8X8b9y4s-7m7Ahttp://www.google.com/url?q=http%3A%2F%2Feclipsetutorial.sourceforge.net%2Ftotalbeginner.html&sa=D&sntz=1&usg=AFQjCNFkeSGq8C90esIcJgpsnMyTPYWyXghttps://www.google.com/url?q=https%3A%2F%2Fgithub.com%2FInterPSS-Project%2Fipss-common%2Ftree%2Fmaster%2Fipss.tutorial&sa=D&sntz=1&usg=AFQjCNFzaKflquDQ06ud16R4bW_B3QZziw

  • DevTutorialwww.interpss.org

    Chapter1.SettinguptheInterPSSDevelopmentEnvironment

    InterPSSprojecthasbeentryingtocreateanewopenplatform,tosupportthenextgenerationpowersystemsimulationandanalysis.ThefoundationofthisplatformisInterPSScoreengine,whichincludesbutnotlimitedtopowersystemnetworkobjectmodelandpowersystemanalysisfunctions,e.g.,powerflow,shortcircuitandtransientstability.InterPSSnowsupportstwoversions,i.e.,cloudeditionanddevelopmentedition.Botheditionsrunonthesamecoresimulationengine.InterPSScloudeditionrunsontheGooglecloudplatformandprovidespowersystemanalysisasaservice,24/7,anywhereintheworldwiththeInternetaccess.Formoreinformation,pleasevisitwww.interpss.org.Thecloudeditionprovidesbasicanalysisfunctionsanditissimpletouse.However,flexibilityandcapabilityofInterPSScoreengineisstillnotfullyexploited.ForthosewhowanttohaveabettercontrolofInterPSS,orcustomizeitfortheirapplications,InterPSSdevelopmenteditionisrecommended.ThedevelopmenteditionisbasedontheEclipseIDEandInterPSScorelibraries.ThosefamiliarwiththeJavaprogrammingknowsthatbasicandcorejavafunctionsareprovidedinJavasystemlibraries.EachjavaprojectsshouldhaveareferencetotheseJRESystemlibrary.Similarly,forpowersystemsimulationandanalysiswithInterPSS,InterPSScorelibrariesandtheirdependentthirdpartylibrariesarerequired.PrerequisiteofInterPSSdevelopmentenvironmentisasfollows:JavaEnvironmentSetupMakesureyouhaveJavaSDKinstalledonyourcomputer.YoucancheckyourJavainstallationbylaunchingaCMDwindowfromStart/run/cmd.Typethefollowingcommand javaversiontomakesurethatyourhaveJavaversionis1.7.xxorabove.

    EclipseIDESetupInterPSSiswritteninJava.InterPSSdevelopmentteamusesEclipseasthemainJavaIDE.Currently,InterPSSusesEclipseKepler(4.3.1),whichcanbedownloadedfromwww.eclipse.org.Youcanusethe"EclipseIDEforJavaDevelopers"version.

    1.1ImportInterPSSlibraryprojectsInterPSScorelibrariesandalldependentlibraries(*.Jar)arestoredinthefollowingGitHubrepositoryhttps://github.com/InterPSSProject/ipsscommonThelibraryprojectscanbedownloadedfullyasaZIPfile(about60MB),orclonetothedesktopthroughGitcloneasindicatedbythetwooperationbuttonsontherightbottom.

    7

    http://www.google.com/url?q=http%3A%2F%2Fwww.interpss.org&sa=D&sntz=1&usg=AFQjCNFuWD5qyebV38VkZNbOpsw1esWEMAhttp://www.google.com/url?q=http%3A%2F%2Fwww.interpss.org%2F&sa=D&sntz=1&usg=AFQjCNE_bEK2HFW7kz8OZi3qAPLPis8Z8ghttp://www.google.com/url?q=http%3A%2F%2Fwww.interpss.org%2F&sa=D&sntz=1&usg=AFQjCNE_bEK2HFW7kz8OZi3qAPLPis8Z8ghttp://www.google.com/url?q=http%3A%2F%2Fwww.eclipse.org%2F&sa=D&sntz=1&usg=AFQjCNHjmBe6J3yE4kaaaDn62J1HeUn08Ahttp://www.google.com/url?q=http%3A%2F%2Fwww.eclipse.org%2F&sa=D&sntz=1&usg=AFQjCNHjmBe6J3yE4kaaaDn62J1HeUn08Ahttps://www.google.com/url?q=https%3A%2F%2Fgithub.com%2FInterPSS-Project%2Fipss-common&sa=D&sntz=1&usg=AFQjCNHGYYiZM3WS85jwRiGfz-vcz7CH3whttps://www.google.com/url?q=https%3A%2F%2Fgithub.com%2FInterPSS-Project%2Fipss-common&sa=D&sntz=1&usg=AFQjCNHGYYiZM3WS85jwRiGfz-vcz7CH3whttps://www.google.com/url?q=https%3A%2F%2Fgithub.com%2FInterPSS-Project%2Fipss-common&sa=D&sntz=1&usg=AFQjCNHGYYiZM3WS85jwRiGfz-vcz7CH3w

  • DevTutorialwww.interpss.org

    Sometestcasesarealsoavailablewithintheipss.sampleprojectstoredintheipsspluginrepositoryhttps://github.com/InterPSSProject/ipsspluginInthefollowingtwosubsections,twoapproachesofimportingtheInterPSScorelibprojectsandipss.sampleprojectintoyourworkingworkspaceofEclipsewillbeintroduced,andtheyare1)downloadingthewholerepositoryZipfileand2)clonetherepositoriesonGithubviaEclipseEGitplugin.

    1.1.1Libraryrepositoryasazipfile1)ClickontheDownloadZipbuttontodownloadazipfilecontainingallthethreelibprojects2)Extract(unzip)theprojectsfromthedownloadedzipfile3)Import>General>Existingprojectsintoworkspace

    4)Followingthesameprocessasbeforetodownloadtheipss.sampleprojectfrom

    8

    http://www.google.com/url?q=http%3A%2F%2Fwww.interpss.org&sa=D&sntz=1&usg=AFQjCNFuWD5qyebV38VkZNbOpsw1esWEMAhttps://www.google.com/url?q=https%3A%2F%2Fgithub.com%2FInterPSS-Project%2Fipss-plugin&sa=D&sntz=1&usg=AFQjCNFj5VS4-suMOIRD8KM8wofk72ASuw

  • DevTutorialwww.interpss.org

    https://github.com/InterPSSProject/ipsspluginandrunthesamplecases.

    1.1.2CloneLibraryprojectrepositoryviaEgit

    (1)GitHubEclipsepluginTheEGitpluginisavailablefromhttp://eclipse.org/egit/download/orEclipse>Help>Installnewsoftware1)Selectoradd:WorkwithKeplerhttp://download.eclipse.org/releases/kepler2)ChooseEclipseGitTeamrelatedinstallationsasshowninfigurebelow

    3)InstallandrestartFortheuseofEGit,thefollowinguserguideisrecommendedhttp://wiki.eclipse.org/EGit/User_Guide

    (2)ClonetherepositorytolocalPCandimporttheprojectsintoworkspace1)GettheprojectHTTPScloneURLbycopyingtheURLtoclipboard

    9

    http://www.google.com/url?q=http%3A%2F%2Fwww.interpss.org&sa=D&sntz=1&usg=AFQjCNFuWD5qyebV38VkZNbOpsw1esWEMAhttps://www.google.com/url?q=https%3A%2F%2Fgithub.com%2FInterPSS-Project%2Fipss-plugin&sa=D&sntz=1&usg=AFQjCNFj5VS4-suMOIRD8KM8wofk72ASuwhttp://www.google.com/url?q=http%3A%2F%2Feclipse.org%2Fegit%2Fdownload%2F&sa=D&sntz=1&usg=AFQjCNEWDvKMEiSxGg9uFQ4FQpSbAHveiwhttp://www.google.com/url?q=http%3A%2F%2Fdownload.eclipse.org%2Freleases%2Fkepler&sa=D&sntz=1&usg=AFQjCNFrNlitBmRmYILbs8yxyiPYXDMVJwhttp://www.google.com/url?q=http%3A%2F%2Fdownload.eclipse.org%2Freleases%2Fkepler&sa=D&sntz=1&usg=AFQjCNFrNlitBmRmYILbs8yxyiPYXDMVJwhttp://www.google.com/url?q=http%3A%2F%2Fwiki.eclipse.org%2FEGit%2FUser_Guide&sa=D&sntz=1&usg=AFQjCNHAtQ5zROxku2rby-oXzbp7SLNw1A

  • DevTutorialwww.interpss.org

    InterPSSlibprojects:https://github.com/InterPSSProject/ipsscommon.gitInterPSSpluginincludingtheipss.sampleproject: https://github.com/InterPSSProject/ipssplugin.git2)OpentheGitrepositoriesperspectivethroughEclipse>Window>Openperspective>Others>GitRepositoryExploring3)SelectCloneaGitrepositoryfromtheGitrepositoryperspective

    Clonetheipsscommonandtheipsspluginrepositoriestoyourlocalstorage.Stepsforcloningtheipsspluginrepositorywillbeshownbelow,andtheprocessisthesameforipsscommonrepository.

    10

    http://www.google.com/url?q=http%3A%2F%2Fwww.interpss.org&sa=D&sntz=1&usg=AFQjCNFuWD5qyebV38VkZNbOpsw1esWEMAhttps://www.google.com/url?q=https%3A%2F%2Fgithub.com%2FInterPSS-Project%2Fipss-common.git&sa=D&sntz=1&usg=AFQjCNGqBa0wuta2cyECtjWAupEWXC2zjAhttps://www.google.com/url?q=https%3A%2F%2Fgithub.com%2FInterPSS-Project%2Fipss-plugin.git&sa=D&sntz=1&usg=AFQjCNEp-SXv0CT5HNkx4v804tqBuhVbpQ

  • DevTutorialwww.interpss.org

    Note:Alwayschoosethecommon_libwhichmeanstheprojectbuildpatharelinkingtothecommon

    libraryJars.

    11

    http://www.google.com/url?q=http%3A%2F%2Fwww.interpss.org&sa=D&sntz=1&usg=AFQjCNFuWD5qyebV38VkZNbOpsw1esWEMA

  • DevTutorialwww.interpss.org

    ChooseLocalandthenselectIpssplugininthenextstep

    12

    http://www.google.com/url?q=http%3A%2F%2Fwww.interpss.org&sa=D&sntz=1&usg=AFQjCNFuWD5qyebV38VkZNbOpsw1esWEMA

  • DevTutorialwww.interpss.org

    13

    http://www.google.com/url?q=http%3A%2F%2Fwww.interpss.org&sa=D&sntz=1&usg=AFQjCNFuWD5qyebV38VkZNbOpsw1esWEMA

  • DevTutorialwww.interpss.org

    Checkthebuildpathofipss.sampletomakesurealltherequiredlibsareloadedandthereisnoerrorinthe[Problems]viewwindow.

    14

    http://www.google.com/url?q=http%3A%2F%2Fwww.interpss.org&sa=D&sntz=1&usg=AFQjCNFuWD5qyebV38VkZNbOpsw1esWEMA

  • DevTutorialwww.interpss.org

    1.2RunsampleloadflowtestcaseRightclicktheSampleLoadflow.javaandRunAs"JavaApplication"

    Twobusloadflowresultisasfollows:

    15

    http://www.google.com/url?q=http%3A%2F%2Fwww.interpss.org&sa=D&sntz=1&usg=AFQjCNFuWD5qyebV38VkZNbOpsw1esWEMA

  • DevTutorialwww.interpss.org

    Chapter2.AnintroductiontothepowersystembasicmodelsinInterPSS

    AsJavalanguageistheprogramminglanguageadoptedbyInterPSS,theobjectorientedprogramming(OOP)techniqueiswidelyusedinthedesignanddevelopmentofInterPSS.Asisknowntoall,oneofthemostbasicconceptinOOPistheobject.TounderstandInterPSS,andsubsequentlyextendInterPSSforyourownpurpose,itisimportanttobefamiliarwiththethreebasictypesofpowersystemmodelswithinthecoreofInterPSS,andtheyarenetwork,busandbranch.FormoreinformationofOOPandInterPSS,pleasereadthisIEEETransactionpaper"ObjectorientedProgramming,C++andPowerSystemSimulation",IEEETransactionsonPowerSystems,Vol.11,No.1,pp.206215,1996

    2.1. Overview of power system modeling in InterPSS AnetworkistostorealltheinformationrequiredforpowersystemsimulationinInterPSS.Atthecenterofthenetworkobjectistwolinkedlists,whichareusedtostorethebusobjectsandbranchobjects,respectively,asshowninFig.2.1.InterPSSfollowsthebusorientedconventiontorepresentthenetwork.Accordingly,Busisdefinedtostoreallinformation(definedasattributesofthebusclass)relatedtoabus,forexample,busIdandbusvoltage,aswellasallcomponentsconnectedtoabus,e.g.,ageneratororacapacitor.Theotherbasicmodelisbranch.Itisusedtorepresentoverheadline,transformer(conventionaltwowindingtransformer,phaseshifttransformer).Specialtypebranches,currentlyincludingthreewindingtransformerandHVDCtransmissionlines,andseriesFACTsdevicesinthefuture,arestoredinanotherlistnamedspecialBranchList.WithinInterPSS,athreewindingtransformerisautomaticallyconvertedtothreetwowindingtransformers.InFig.2.1,Thebusandbranchmutualreferencehelptodefinethetopologyofthenetworkasagraph:thefromBusIdandtoBusIdofabrancharethetwoattributestorelatetwobusestoatwoterminalbranch,whilethebranchListofabusstorethebranchobjectsconnectedtothebusatthefromendandtoendofthebranch,respectively.

    Fig.2.1InterPSSnetworkmodel

    16

    http://www.google.com/url?q=http%3A%2F%2Fwww.interpss.org&sa=D&sntz=1&usg=AFQjCNFuWD5qyebV38VkZNbOpsw1esWEMAhttp://commondatastorage.googleapis.com/mikezhou/paper/OOP_CPP_and_PSS.pdfhttp://commondatastorage.googleapis.com/mikezhou/paper/OOP_CPP_and_PSS.pdfhttp://commondatastorage.googleapis.com/mikezhou/paper/OOP_CPP_and_PSS.pdf

  • DevTutorialwww.interpss.org

    LetsfirstlookatthetwobussystemexampledefinedinthesampleLoadflow.javawithintheipss.sampleprojectunderipss.plugin,asthisexamplegiveyousomeideaofthesethreetypesofobjectsandtheytogetherformsapowersystemnetworkobjectforloadflowanalysis.

    publicstaticvoidsimpleLoadflow(IPSSMsgHubmsg){//CreateanAclfNetworkobjectAclfNetworknet=CoreObjectFactory.createAclfNetwork()

    doublebaseKva=100000.0//setsystembasekvaforloadflowcalculationnet.setBaseKva(baseKva)

    //createaAclfBusobject

    AclfBusbus1=CoreObjectFactory.createAclfBus("Bus1",net) //setbusnameanddescriptionattributes bus1.setAttributes("Bus1","") //setbusbasevoltage bus1.setBaseVoltage(4000.0) //setbustobeaswingbus bus1.setGenCode(AclfGenCode.SWING) //adaptthebusobjecttoaswingbusobject AclfSwingBusswingBus=bus1.toSwingBus() //setswingbusattributes swingBus.setVoltMag(1.0,UnitType.PU) swingBus.setVoltAng(0.0,UnitType.Deg) AclfBusbus2=CoreObjectFactory.createAclfBus("Bus2",net) bus2.setAttributes("Bus2","") bus2.setBaseVoltage(4000.0) //setthebustoanongeneratorbus bus2.setGenCode(AclfGenCode.NON_GEN) //setthebustoaconstantpowerloadbus bus2.setLoadCode(AclfLoadCode.CONST_P) //adaptthebusobjecttoaLoadbusobject AclfLoadBusloadBus=bus2.toLoadBus() //setloadofthebus:Load=P+jQ=1.0+j*0.8pu loadBus.setLoad(newComplex(1.0,0.8),UnitType.PU) //createanAclfBranchobject AclfBranchbranch=CoreObjectFactory.createAclfBranch()

    17

    http://www.google.com/url?q=http%3A%2F%2Fwww.interpss.org&sa=D&sntz=1&usg=AFQjCNFuWD5qyebV38VkZNbOpsw1esWEMAhttps://www.google.com/url?q=https%3A%2F%2Fgithub.com%2FInterPSS-Project%2Fipss-plugin%2Fblob%2Fmaster%2Fipss.sample%2Fsrc%2Forg%2Finterpss%2Fsample%2Faclf%2FSampleLoadflow.java&sa=D&sntz=1&usg=AFQjCNGRFWbAOXnhapUEHmpYSqw8Dpoy_Q

  • DevTutorialwww.interpss.org

    net.addBranch(branch,"Bus1","Bus2") //setbranchname,descriptionandcircuitnumber branch.setAttributes("Branch1","","1") //setbranchtoaLinebranch branch.setBranchCode(AclfBranchCode.LINE) //adaptethebranchobjecttoalinebranchobject

    AclfLinelineBranch=branch.toLine()

    //setbranchparameters lineBranch.setZ(newComplex(0.05,0.1),UnitType.PU,4000.0)

    //createthedefaultloadflowalgorithm LoadflowAlgorithmalgo=CoreObjectFactory.createLoadflowAlgorithm(net)

    //usetheloadflowalgorithmtoperformloadflowcalculation algo.loadflow() //outputloadflowcalculationresults System.out.println(AclfOutFunc.loadFlowSummary(net))

    } Thereareseveralkeypointsfortheexampleabove.

    Networkobjectcanberegardedasacontainer,whichstoresallbusesandbranchesofapowersysteminInterPSS.Thus,itshouldbecreatedattheverybeginning.

    Busarecreatedlatterandthenbranch.Suchsequenceisimportantasabranchneedstorefertothebusobjectsconnectedattheterminalsinordertoproperlysetupthebusbranchconnectionrelations,hencethebusobjectsmustbecreatedbeforeabranchtriestoreferorconnecttoit.

    BothBusandBranchobjectsareaccessedandreferredtobytheirIDs,forexample,

    AclfBusbus1=CoreObjectFactory.createAclfBus("Bus1",net)net.addBranch(branch,"Bus1","Bus2").

    WhereBus1andBus2aretheIDsofbus1andbus2,foridentificationpurpose.

    Objectattributesand/orinformationissettotheobjectthroughthesettermethods(network/bus/branch.setX(value))

    NOTE:Thisexamplemaygivesomeofyouawrongimpressionthatitneedstowritethousandsoflinesofcodetocreateanetworkforlargepowersystems.ActuallyThereisanotheropenprojectcalledOpenModelforExchangingPowerSystemSimulationDatathatInterPSShasbeendevotingto.InterPSShasdevelopedODMbasedadaptersandmappertoimportavailablenetworkdatadefinedincommonlyuseddataformat,suchIEEECDF,PSS/E,PowerWorld,PSDBPAformattocreateanetworkobjectinInterPSS,Formoreinformation,pleaserefertoAppendixBIntroductiontoODM.

    18

    http://www.google.com/url?q=http%3A%2F%2Fwww.interpss.org&sa=D&sntz=1&usg=AFQjCNFuWD5qyebV38VkZNbOpsw1esWEMA

  • DevTutorialwww.interpss.org

    2.2. Inheritance and class hierarchy structure

    Whyinheritance?InheritanceisanimportantconceptforobjectsinOOP.Asubclass,orchildclass,canbederivedfromthebase,orparent,classthroughinheritance,suchthatthechildclasswillinheritalltheattributesandmethoddefinedthebaseclass.Withinheritance,wedonthavetorewriteallthecommonorsimilarpartsofcodeagainandagain.Thatiscommonlyknownascodereuseincomputerscience.

    HowistheclassinheritancedesignedinInterPSSBasedonthenatureofpowersystemanalysis,weknowthatthemostbasicinformationforrepresentingapowersystemisthenetworktopology,aswellasbasicbusandbranchidentificationattributes.Theinformationisrequiredforallpowersystemanalysis.Therefore,itisreasonabletoabstractthesebasic,commoninformationandbehaviorintobasenetwork,busandbranchclasses.Secondly,letslookatthecharacteristicsofthethreebasicpowersystemanalysisfunctions,i.e.,loadflow,shortcircuitcalculationorfaultanalysis,transientstabilitysimulation.Loadflowisthemostbasicfunction,andbothshortcircuitanalysisandtransientstabilitysimulationrelyonloadflowdataandresults.Thus,loadflowrelatedobjectsshouldbeonthesecondlevelofthehierarchystructure,fromwhichtheshortcircuitandtransientstabilityrelatedobjectsarederived.Shortcircuit(SC)analysisusuallyrequiresloadflowresultstodeterminetheoperatingpoint.Further,positivesequencenetworkdataforshortcircuitanalysisisgenerallythesameasthatusedinloadflowstudy.Shortcircuitrelatedobjectscanandshouldreuseloadflowdataandmethodsbyinheritingtheloadflowobjects.Moreover,thenegativeandzerosequencedata,ifavailable,willbeincludedinthebusandbranchobjectsforshortcircuitanalysis.Dynamicstability(DStab)simulationreliesontheloadflowdataforconstructingthenetworkadmittanceaswellastheequationYV=Iandloadflowresultsfordeterminingtheprefaultsystemcondition.Duringthefaultperiod,alsoitneedstoformthesequencenetworkandcalculatethepositivesequenceequivalentfaultimpedanceatthefaultpointforunsymmetricalfaults.Consideringthatsuchfunctionisavailableinshortcircuitanalysis.Thusbothloadflowandshortcircuitanalysisshouldbereusedfordynamicstability.Forthebusobjectsforstabilityanalysis(DStabBus),detailedgenerator(machine)model,withthecontrollers(exciter,governor,stabilizer)forthegeneratorbeingapartofthegeneratormodel,willbeincludedasacomponentinthebusobject.Branchclassforstabilityanalysis(DstabBranch)extendsfromthebranchclassforshortcircuitandaddsattributesandmethodsforrelayandprotectionsetting.ThenetworkclassstructureinInterPSSisshownasfollows:

    19

    http://www.google.com/url?q=http%3A%2F%2Fwww.interpss.org&sa=D&sntz=1&usg=AFQjCNFuWD5qyebV38VkZNbOpsw1esWEMA

  • DevTutorialwww.interpss.org

    Noteforthenaminginthefigureabove:

    AclfACloadflowAcscACshortcircuitDstabDynamicstabilityorTransientstabilityDistDistribution

    Thebusandbranchclasshaveasimilarhierarchystructure,asfollows:

    Bus

  • DevTutorialwww.interpss.org

    2.3.1 Network object NetworkisthecontainerforalltheinformationrequiredforpowersystemanalysisinInterPSS.Aseachtypeofpowersystemanalysisrequiresdifferentinformationfromnetwork,busandbranch,itisreasonabletodefineadifferentnetworkobjectforeachtype.Inaddition,itshouldbenotedthatthenetworktopologyinformationisthemostbasicforallanalyses,thusabasicnetworkobjectisemployedinInterPSS.Further,thereissomeinformationexchangeamongtheseanalysis.Inthepast,suchdataexchangeisdonebyfileinputandoutput.Nowthesameprocessisperfectlysolvedthroughobjectinheritance,asdiscussedinSection2.2.Consideringthattherearemainlythreetypicaltypesofapplications,namely,loadflow,shortcircuitandtransientstability,AclfNetwork,AcscNetworkandDStabNetworkaredefinedaccordingly.

    BasicNetworkTheNetworkclassandthecorrespondingimplementationNetworkImplclassistoformthenetworktopologywithbusList,theconnectionrelationshipamongbusesthroughbranches.

    LoadflowNetworkThemajordifferencebetweenNetworkandAclfNetworkisthatallthebusesandbranchesobjectscontainedinAclfNetworkobjectmustbeoftypeAclfBus/AclfBranchclassoritssubclass,whichmeanstheycontainalltheinformationrequiredforloadflowanalysis.Also,theadmittancematrix,orYmatrix,andJacobianmatrix,asthebasicunderlyingdatastructureforloadflowanalysis,areformedintheAclfNetwork.

    ShortCircuitNetworkBaseAcscNetworkandAcscNetworkclassisforshortcircuitanalysis.BaseAcscNetworkisextendedfromtheBaseAclfNework,themajordifferenceisthatsequencenetworkadmittancematrixcanbeformedandaccessedinAcscNetwork,besidesalltheAclfNetworkoperations.BusesandbranchesintheAcscNetworkareofAcscBusandAcscBranchtype.Thesequencenetworkdata,includingsequenceimpedanceofgenerators,equivalentimpedanceoradmittanceofloadandsequenceimpedanceofbranches,shouldbeprovided.

    TransientstabilityNetworkDStabilityNetworkclassisfortransientstabilityanalysis.allthebusesandbranchesobjectscontainedinthisobjectmustbeoftypeDStabBus/DStabBranch.Themainfunctionsofthisclassincludenetworkinitializationandsolvingnetworkdynamicequationduringsimulation.

    2.3.2 Bus Recalltheclassstructure,Bus

  • DevTutorialwww.interpss.org

    Forshortcircuitanalysis,sequencenetworkdataforgeneratorandloadconnectedtothebusisrequired.Fortransientstability,detaileddynamicmodeldataofthegenerators,ifany,isrequired,dynamicloadmodeldatawillalsobenecessaryifdynamicsoftheloadsaretobeincludedinthesimulation.

    Fig.2.3BusmodelinInterPSS

    2.3.3 Branch Overheadlineandundergroundcable,transformersaretreatedasanabstractBranchinanetwork,whichconnectstwoormorebuses.SoBranchisthebasicclassforalltheseconnectiontypecomponentsinthepowersystems.ThebasicattributesforabrancharethefromBus,toBus(tertBusifitisathreewindingtransformer).OverheadlinesandundergroundcablesaremodeledbytheLineclassinInterPSS.Transformersinpowersystemsincludetwowindingtransformerandthreewindingtransformer,andtheyaremodeledseparately.InternallyonethreewindingtransformerismodeledbythreetwowindingtransformerthroughYDeltatransformation.

    Fig2.4LinemodelinInterPSS

    22

    http://www.google.com/url?q=http%3A%2F%2Fwww.interpss.org&sa=D&sntz=1&usg=AFQjCNFuWD5qyebV38VkZNbOpsw1esWEMA

  • DevTutorialwww.interpss.org

    Fig2.5TwowindingtransformermodelinInterPSS

    Fig2.6ThreewindingtransformermodelinInterPSS

    Line

    AclfBranch

  • DevTutorialwww.interpss.org

    2.4. Getting and setting the data of an object

    2.4.1 Network basicinfo:baseKva

    net.setBaseKva(baseKva) setnetworkbaseKVA,unitinkVA

    net.getBaseKva() getnetworkbaseKVA,unitinkVA

    Busrelated

    getNoBus() getthetotalnumberofbuses

    getNoActiveBus() getthetotalnumberofactivebuses

    getBus(StringbusId) getaspecificbusbyitsid

    addBus(AclfBusbus) addanewbustothenetwork

    getBusList() Returnalistofbusobjects

    Branchrelated

    getNoBranch() getthetotalnumberofbranches

    getNoActiveBranch() getthetotalnumberofactivebranches,i.e.,thoseoutofservicebranchesarenotincluded.

    getBranch(StringbranchId) getaspecificbranchbyitsid

    addBranch(AclfBranchbranch) addanewbranchtothenetwork

    getBranchList() Returnalistofbranchobjectswhichhavetwoterminals

    NOTE:accessingabus/branchobjectfromanetworkobjectisusedquiteoften,andthemethodviathebus/branchIdisrecommendedtouse.

    2.4.2 Bus Getandsetbusvoltages

    getVoltage()getVoltage(UnitType)setVoltage(Complexvolt)setVoltage(Complexvolt,UnitTypetype)

    getandsetvoltageasacomplex,voltageunitTypecanalsobeused

    24

    http://www.google.com/url?q=http%3A%2F%2Fwww.interpss.org&sa=D&sntz=1&usg=AFQjCNFuWD5qyebV38VkZNbOpsw1esWEMA

  • DevTutorialwww.interpss.org

    getVoltageMag()getVoltageMag(UnitType)setVoltageMag(doublevolt)setVoltageMag(doublevolt,UnitTypetype)

    getandsetvoltagemagnitudeasadouble,voltageunitTypecanalsobeused

    getVoltageAng()getVoltageAng(UnitType)setVoltageAng(doublevolt)setVoltageAng(doublevolt,UnitTypetype)

    getandsetvoltageangleasadouble,voltageunitType(e.g.,V,kV,pu)canalsobeused

    Getandsetbusgenerationdata

    getGenCode()setGenCode(AclfGenCodegenCode)

    fourstypesofGenCode:Swing,PV,PQandNoneGen

    isGen()isSwing()isGenPV()isGenPQ()

    checkthebustype,basedonthegenerationcode.

    getGenList()getGenerator(StringgenId)

    Multiplegeneratorconnectintothesamebusissupported.ThefirstmethodgetsallthegeneratorconnectedtothebusandreturnasalistThesecondonegetaspecificgeneratorbyitsid

    get/setGen()get/setGenP()get/setGenQ()

    1)ForSwingbus,genPusedtostoreVoltMag,genQusedtostoreVoltAng2)ForPVbus,genPusedtostoregenP,genQusedtostoreVoltMag3)ForPQbus,genPusedtostoregenP,genQusedtostoregenQ

    getGenResult() gettheeffectivepowergenerationatthebus.

    Getandsetbusloaddata

    getLoadCode()setLoadCode(AclfLoadCodeLoadCode)

    tourstypesofLoadCode:Swing,PV,PQandNoneLoad

    isLoad()

    checkifthereisanyloadatthebus

    getLoadList()getLoad(StringloadId)

    getalltheloadconnectedtothebusandreturnasalistgetaspecificloadbyitsid

    get/setLoad()get/setLoadP()

    getthetotalinserviceloadofthebusincomplexform,orrealandreactivepoweroftheload.

    25

    http://www.google.com/url?q=http%3A%2F%2Fwww.interpss.org&sa=D&sntz=1&usg=AFQjCNFuWD5qyebV38VkZNbOpsw1esWEMA

  • DevTutorialwww.interpss.org

    get/setLoadQ()

    getLoadResult() gettheactualloadatthebusconsideringtheloadtypeandbusvoltageatthemoment.

    Getconnectedbranchesofabus

    getBranchList()getFromBranchList()getToBranchList()

    returnalltheconnectedbranchesasalist,orthebrancheswhichareconnectedtothisbusatthefromendorthetoend(putitanotherway,thebrancheswhosetromend/toendterminalisthisprocessingbus).NOTE:Threewindingtransformerisalsoconsideredinthisoperation.

    nNonGroundBranchConnected(booleaninclActiveOnly)

    ThenumberofthetotalconnectedbrancheswhichareNOTgroundbranch,orconnectedtotheground,forexample,shuntcapacitorbranch.

    nBranchConnected thenumberofthetotalconnectedbranches

    noConnectedBranch(AclfBranchCodetype) Thenumberofthetotalconnectedbranchesofacertaintype.

    SortNumber

    Certaintypeofsortingalgorithm(includingTinney1,2and3,andTinney2isthedefault)isusuallyappliedtoarrangetheinternalsequenceofthebusesforloadflowandshortcircuitanalysis,andthenasortNumberisassignedtoeachbusafterapplyingthesortingalgorithm,bothactiveandinactive(outofservice).ThissortNumberhelpsgetaccesstotheinternalstorageofAdmittancematrix,Jacobianmatrixandthenetworkequationsolutionresults.Syntax:

    bus.setSortNumber(intnum)bus.getSortNumber()

    Admittance

    get/setShuntY() getandsetthebusshuntadmittanceY=G+j*B

    get/setYii() getandsetthebusselfadmittance

    2.3.3 Branch Frombusandtobus

    set/getFromBus set/getthefromortobusobjectoritsbusId.

    26

    http://www.google.com/url?q=http%3A%2F%2Fwww.interpss.org&sa=D&sntz=1&usg=AFQjCNFuWD5qyebV38VkZNbOpsw1esWEMA

  • DevTutorialwww.interpss.org

    set/getToBus

    set/getFromBusIdset/getToBusId

    set/getthefromortobusId.

    Branchimpedanceandadmittance

    set/getZ() branchimpedanceZ=r+j*x

    getY() admittanceY=1/Z

    get/setFromShuntY()get/setToShuntY()

    shuntadmittanceatthefromsideandtosideofthebranch

    get/setHShuntY() halfofthetotalbranchshuntadmittance

    Tapratioandphaseshiftanglefortransformer

    get/setFromTurnRatio()get/setToTurnRatio()get/setTertTurnRatio()[forthreewindingtransformeronly]

    InterPSSsupporttodefinethetapratioatbothsides

    get/setFromPSXfrAngle()get/setToPSXfrAngle()

    phaseshiftangleatthefromsideandtoside

    2.4 Example TheexampleintroNetworkObjectSample.javaunderthech2_introfolderofthetutorialpackageservestohelpusersanddeveloperstolearnhowthemodelsintroducedbeforeareusedinnetworkcreationandbusdataextraction.Withinthesample,youwillgothroughcreatingasimple2busnetworkandtooutputthebusdatafollowingspecifictxtformat,withtheInterPSSCoreAPI.Thenetworkcreationpartinthisexampleisthesameasthatprovidedinthischapterbefore,soitisnotreplicatedhere.ThefollowingbusOrientedOutPut()methodistooutputthebusvoltage,generationandloadandthepowerflowtoconnectedbuses. privatestaticStringbusOrientedOutPut(AclfNetworknet,AclfBusbus){

    StringBufferstr=newStringBuffer("")

    str.append("\n")str.append("BusIDBusVoltageGenerationLoadToBranchP+jQXfrRatioPSXfrAng\n")str.append("baseKVMag/puAng/deg(mW)(mVar)(mW)(mVar)BusID(mW)(mVar)(kA)(From)(To)(from)(to)\n")

    27

    http://www.google.com/url?q=http%3A%2F%2Fwww.interpss.org&sa=D&sntz=1&usg=AFQjCNFuWD5qyebV38VkZNbOpsw1esWEMA

  • DevTutorialwww.interpss.org

    str.append("\n")

    doublebaseKVA=net.getBaseKva()

    AclfGenBusAdaptergenBus=bus.toGenBus()

    //getthegenerationandloadComplexbusGen=genBus.getGenResults(UnitType.mVA)ComplexbusLoad=genBus.getLoadResults(UnitType.mVA)

    Stringid=bus.getId()

    //outputthebusdatawithspecificformat

    str.append(Number2String.toStr(12,id)+"")str.append(String.format("%s",FormatKVStr.f(bus.getBaseVoltage()*0.001)))str.append(Number2String.toStr("0.0000",bus.getVoltageMag(UnitType.PU))+"")str.append(Number2String.toStr("##0.00",bus.getVoltageAng(UnitType.Deg))+"")str.append(Number2String.toStr("####0.00",busGen.getReal())+"")str.append(Number2String.toStr("####0.00",busGen.getImaginary())+"")str.append(Number2String.toStr("####0.00",busLoad.getReal())+"")str.append(Number2String.toStr("####0.00",busLoad.getImaginary())+"")

    //outputthedataofbranchesconnectedtothebus//

    intcnt=0//iterateoverallthebranchesconnectedtothebus,bothinserviceand

    offlinefor(Branchbr:bus.getBranchList()){

    if(br.isActive()&&brinstanceofAclfBranch){AclfBranchbra=(AclfBranch)br

    Complexpq=newComplex(0.0,0.0)doubleamp=0.0,fromRatio=1.0,toRatio=1.0,fromAng=

    0.0,toAng=0.0AclfBustoBus=nullif(bra.isActive()){

    //todeterminewhetherthebusisatthefromortoendofthe

    branch.if(bus.getId().equals(bra.getFromAclfBus().getId())){

    toBus=bra.getToAclfBus()

    //powertransferfromfromendtotoendofthebranch

    pq=bra.powerFrom2To(UnitType.mVA)

    28

    http://www.google.com/url?q=http%3A%2F%2Fwww.interpss.org&sa=D&sntz=1&usg=AFQjCNFuWD5qyebV38VkZNbOpsw1esWEMA

  • DevTutorialwww.interpss.org

    //brnachcurrentmeasuredatAmpere.amp=UnitHelper.iConversion(bra.current(UnitType.PU),

    bra.getFromAclfBus().getBaseVoltage(),baseKVA,UnitType.PU,UnitType.Amp)

    //ifthebranchisatransformer,thenoutputthetapratioand//phaseshiftingangle,ifany

    if(bra.isXfr()||bra.isPSXfr()){fromRatio=bra.getFromTurnRatio()toRatio=bra.getToTurnRatio()if(bra.isPSXfr()){

    AclfPSXformerpsXfr=bra.toPSXfr()fromAng=psXfr.getFromAngle(UnitType.Deg)toAng=psXfr.getToAngle(UnitType.Deg)

    }}

    }else{toBus=bra.getFromAclfBus()pq=bra.powerTo2From(UnitType.mVA)amp=UnitHelper.iConversion(bra.current(UnitType.PU),

    bra.getToAclfBus().getBaseVoltage(),baseKVA,UnitType.PU,UnitType.Amp)if(bra.isXfr()||bra.isPSXfr()){

    toRatio=bra.getFromTurnRatio()fromRatio=bra.getToTurnRatio()

    if(bra.isPSXfr()){

    AclfPSXformerpsXfr=bra.toPSXfr()toAng=psXfr.getFromAngle(UnitType.Deg)fromAng=psXfr.getToAngle(UnitType.Deg)

    }}

    }}

    //ifmorethanonebranchconnectedtothebus,outputthebranch//informationinanewline

    if(cnt++>0)str.append(Number2String.toStr(67,"")+"")id=toBus.getId()str.append(""+Number2String.toStr(12,id)+"")str.append(Number2String.toStr("####0.00",pq.getReal())+"")str.append(Number2String.toStr("####0.00",pq.getImaginary())+"

    ")str.append(Number2String.toStr("##0.0##",0.001*amp)+"")if(bra.isXfr()||bra.isPSXfr()){

    if(fromRatio!=1.0)str.append(Number2String.toStr("0.0###",fromRatio)+"")elsestr.append("")

    if(toRatio!=1.0)

    str.append(Number2String.toStr("0.0###",toRatio))

    29

    http://www.google.com/url?q=http%3A%2F%2Fwww.interpss.org&sa=D&sntz=1&usg=AFQjCNFuWD5qyebV38VkZNbOpsw1esWEMA

  • DevTutorialwww.interpss.org

    elsestr.append("")

    if(bra.isPSXfr()){if(fromAng!=0.0)

    str.append(""+Number2String.toStr("##0.0",fromAng))

    elsestr.append("")

    if(toAng!=0.0)

    str.append(""+Number2String.toStr("##0.0",toAng))

    elsestr.append("")

    }str.append("\n")

    }else{str.append("\n")

    }}

    }

    returnstr.toString()}

    AsyouhavelearntthebasicandcoremodelsofInterPSS,youcanrollupsleevesandstarttoplaywithInterPSS!

    30

    http://www.google.com/url?q=http%3A%2F%2Fwww.interpss.org&sa=D&sntz=1&usg=AFQjCNFuWD5qyebV38VkZNbOpsw1esWEMA

  • DevTutorialwww.interpss.org

    Chapter3.Powersystemloadflowanalysis

    Introduction to power system load flow Thegoalofapowerflowstudyistoobtaincompletevoltageangleandmagnitudeinformationforeachbusinapowersystemforspecifiedloadandgeneratorrealpowerandvoltageconditions.Forthegeneratorbuses,theexactvoltageanglesarenotprovidedandaretobedetermined.Generallyspeaking,thevoltagemagnitudeandtheactivepowergenerationoutputareassumedtobeknownandkeptconstantduringthesolution.Consideringthenonlinearrelationshipbetweenvoltageandpower,loadflowproblemisanonlinearproblembynature,numericalmethodsareemployedtoobtainasolutionthatiswithinanacceptabletolerance.Oncethebusvoltagemagnitudesandanglesareknown,realandreactivepowerflowoneachbranchaswellasgeneratorreactivepoweroutputcanbedetermined.

    BustypeBasedonthecharacteristicsofthebusesinthepowersystem,theyareusuallycategorizedintothreetypes,namely,Swingorslackbus,PQbusandPVbus.Theywillbeexplainedwitha5bussystemshowninFig.3.1.Swing/slackbus:Withinoneinterconnectedpowersystem,areferencebusangleisrequiredtodeterminetheangleoftherestofbuses,analogoustoareferencezerovoltagepointinanelectriccircuit.Also,asthetotalgeneration=totalload+totallossinthesystem.Thelosscannotbeexactlydeterminedbeforetheloadflow,thusgenerationoutputofatleastonebusneedtobedeterminedbytheloadflowtocoverthesystemloss.Thisbusiscalledslackbus.Forthesakeofconvenience,bothswingandslackbusarecombinedandmodeledbyonebuswith(large)generatorconnectedtoit.Thebusvoltagemagnitudeandvoltagemustbepredefined(usuallytheangleissettobezerodegree).Inthe5bussystem,therearetwobusesthathasgenerator,thuseitheronecanbechosentobetheswingbus.SupposetheBus5isselectedastheswingbus.

    Fig.3.1Onelinediagramofa5buspowersystem

    PQbus:PQmeansthebusnetpowerinjectionintothenetworkisconstant,orasastaticfunctionofthevoltage.Thisisusuallyusedtomodelthesubstationservinglocalloadsoraconnectionpointinthesystemwithoutanygenerationorload.Thus,Bus1,Bus2andBus3arePQtypebus.

    31

    http://www.google.com/url?q=http%3A%2F%2Fwww.interpss.org&sa=D&sntz=1&usg=AFQjCNFuWD5qyebV38VkZNbOpsw1esWEMA

  • DevTutorialwww.interpss.org

    PVbus:therealpowerPandvoltagemagnitudeVareknownforthiskindofbus.Thisisusuallyusedtomodelthebuswithgeneratorconnectedtoit.SometimeabuswhosevoltageiscontrolledbyalocalorremotereactivesourcecanalsomodeledasaPVbus.Bus4isaPVtypebus.

    3.1 Data required for load flow analysis Networkdata Busdata,includingloaddataandgenerationdata. Branchdata,usuallyincludingbothlinesandtransformers Otheroptional:HVDC,switchedshunt

    3.1.1 System/network data BaseMVAAlltheperunitinthesystemforloadflowstudyisbasedonthesystembaseMVA,

    whichisusuallysettobe100MVA Areadata,optional:Foralargepowersystemwithmultipleareas,areapowerinterchangedata

    shouldbeprovided. Zonedata,optional

    3.1.2 Bus data Basicdata:busId,basevoltage,bustype Loaddata(ifthebusservesload(s)):LoadcanbemodeledasconstantP,constantcurrent,

    constantadmittanceoracombinationofthethree,whichiscalledZIPtypeload. Generationdata(ifthebushasgenerator(s))

    PVbus:realpower(P)anddesired/scheduledvoltagemagnitude(V)mustbeprovided,whilethereactivepowergenerationlimitisusuallyrequired.

    PQbus:generationoutput(GenP+GenQ)mustbedefinedanditisassumedtobeconstant.

    Fig.3.2AclfBusmodelinInterPSS

    32

    http://www.google.com/url?q=http%3A%2F%2Fwww.interpss.org&sa=D&sntz=1&usg=AFQjCNFuWD5qyebV38VkZNbOpsw1esWEMA

  • DevTutorialwww.interpss.org

    Fixedshuntdata:Itcanbeafixedrectororshuntcapacitor.TheVarcanbespecifiedinPU(onsystemMVArating)orMVAR=V^2*Bsh,Bshisthebusfixedshunt.

    Switchedshunt:theinitialshunt,andtheavailablevarbanksdataisneeded.

    3.1.3 Branch data Basicbranchdata:fromBus,toBus,impedanceZ,branchtype Transmissionline/cable:modeledasequivalentPImodel.Shuntadmittanceisrequiredbesidesthe

    basicbranchdata Transformer

    Twowindingtransformer:tapratioisrequired,forphaseshiftingtransformer,thephaseshiftingangleisneeded.

    Threewindingtransformer:tapratiooneachwindingisrequired,windingequivalentimpedanceZ12,Z23,Z13shouldalsobeprovided.

    Forfurtherreading,pleaserefertotheIEEECommondataformatdocument,andfindouthowthesedataaredocumentedandprovided.PleasenotethatInterPSSitselfdoesnothaveorlimittoaspecificdataformatfordefiningthedatarequiredforloadflowanalysis.Instead,itsupportsthosewidelyusedintheindustry,e.g.,IEEECDF,PSS/E,PowerWorld,UCTEandBPA,throughtheadaptersdevelopedundertheOpenDataModel(ODM)project.

    33

    http://www.google.com/url?q=http%3A%2F%2Fwww.interpss.org&sa=D&sntz=1&usg=AFQjCNFuWD5qyebV38VkZNbOpsw1esWEMAhttp://www.google.com/url?q=http%3A%2F%2Fwww.ons.com.br%2Fpublicacao%2FASC%2FReal-Time%2520Stability%2520Assessment%2FQuickStab_Theoretical_Foundation%2FIEEE_Common_Format_Spec.pdf&sa=D&sntz=1&usg=AFQjCNF2V7uXgXAQudVkmlWbeClRhLsRlg

  • DevTutorialwww.interpss.org

    3.2. Supported power system models

    Model Details

    Generation onegeneratorormultiplegeneratorsareallowedtoconnectedtoabus.Whentherearemorethanonegenerators,theywillbemergedtoanequivalentgenerator,whosegenPisthetotalrealpoweroutputofallgenerators.

    Load oneload,ormultipleloadsareallowedtoconnectedtoabus.constantpower,constantcurrent,constantimpedanceandZIPtypeofloadsaresupported

    Branch line,twowindingtransformerandphaseshifttransformer,3windingtransformer.

    SwitchedShunt supportedswitchedshuntupto8Varbanks,withthreecontrolmodes:Fixed,DiscreteandContinuous

    Transformercorrectiontable

    compatibletothePSS/Emodel

    HVDC canbemodeledincoreengine,butnotsupportedintheloadflowalgorithmyet

    FACTs canbemodeledincoreengine,butnotsupportedintheloadflowalgorithmyet

    3.3. Solution methods and internal sparse matrix data structure ACloadflowisthecorealgorithmforpowersystemanalysis,withnoexceptiontoInterPSS.ThefollowingthreeACloadflowsolutionmethodsaresupportedinInterPSS:NewtonRaphson,FastDecoupledandGauss.Moreover,thefunctionofonesteploadflowsolutionisalsoprovidedinInterPSS,suchthatuserscanrunonestepsolutionandthenchecktheresultorapplyadjustmentorchangestothesystem,thenrunthenextstepsolution.Atthecenterofpowernetworksolutionisthesolutionofsparsematrixequation[A]x[x]=[B]

    3.3.1 Newton-Raphson NewtonRaphson(NR)isthedefaultsolutionmethodinInterPSS.TheNRimplementationusespolarcoordinates.JacobianmatrixcanbeformedbycallingaclfNetwork.formJMaxtrix().ThematrixisrepresentedbytheSparseEqnMatrix2X2classinInterPSS.FormoreinformationofthesparsematrixusedinInterPSS,pleaserefertotheAppendixA.ThestructureoftheJacobianmatrixisshownasfollows:

    34

    http://www.google.com/url?q=http%3A%2F%2Fwww.interpss.org&sa=D&sntz=1&usg=AFQjCNFuWD5qyebV38VkZNbOpsw1esWEMA

  • DevTutorialwww.interpss.org

    Powerintothenetworkisdefinedasthepositivedirectionwhencalculatingthepowermismatch(dP,dQ)

    Foreachbus,itselementsintheJacobianmatrixisalwaysrepresentedbya2X2blockmatrix

    [dP_dangdP_dV][dQ_dangdQ_dV]

    This2X2blockmatrixisrepresentedasMatrix_xyclassinInterPSS,whichhasthefollowingstructure

    [xxxy][yxyy]

    Thus,foracertainbus,ifthecorrespondingMatrix_xyisobtained,thendP_dAng=Matrix_xy.xx,dP_dV=Matrix_xy.xy

    BusarrangementisoptimizedbeforeformingtheJacobianmatrix Thepositionofthevector[dPi,dQi]ontherighthandsideoftheequationmustbeconsistentwith

    the2X2submatrixwiththeJacobianmatrix.Inaddition,botharearrangedaccordingtothebusinternalsortNumber.

    Forthepurposeofcustomization,itisdesirabletoaugmenttheoriginaljacobianmatrixinordertoincludeextraequationsforanewmodelorcontrolstrategy.Forsuchrequirement,extradimensionscanbeaddedattheendoftheJmatrixwhencallingtheformJMatrix(n,msg)method,asshowninthefollowingequation.Whenn=1,tworowsandtwocolumns(tobeconsistentwiththeinternal2X2blockstoragescheme)willbeaddedontherightandbottomoftheoriginalJacobianmatrix.Theextracolumnsandrowscouldbeusedtoimplementnewmodel,forexample,SVC.

    ToimplementacustomNRmethod,firststepistocreateacustomNRsolverclass,extendingtheDefaultNrSolverclassandoverridingthethreemethods.TheDefaultNrSolverhasmethodstobuildthe[J]partandassociateditemsintherighthandsideofeqn(1)( ),whichshouldbeinherited.Pi, Qi

    35

    http://www.google.com/url?q=http%3A%2F%2Fwww.interpss.org&sa=D&sntz=1&usg=AFQjCNFuWD5qyebV38VkZNbOpsw1esWEMA

  • DevTutorialwww.interpss.org

    TheDefaultNrSolverclassdefinestheframeworkforcustomization.Therearethreemethodstooverride.

    classCustomNrSolverextendsDefaultNrSolver{publicCustomNrSolver(AclfNetworknet){//ReusetheconstructoroftheDefaultNrSolverclasssuper(net)}/***formJMatrixmethodiscalledatthebeginningofeachNRiteration*/@OverridepublicSparseEqnMatrix2x2formJMatrix(IPSSMsgHubmsg){//createnetworkJmatrixwithnextradimensionintn=1

    SparseEqnMatrix2x2lfEqn=getAclfNet().formJMatrix(n,msg)

    //atthispointtheoriginalpowernetworkJmatrixisalreadystored//inthelfEqn.Youcanaddextraelementshere

    returnlfEqn}/***setPowerMismatchmethodiscalledatthebeginningofeachNRiterationtocalculatethepowermismatchtoupdatethevectorontherighthandsideoftheequation*/@OverridepublicvoidsetPowerMismatch(SparseEqnMatrix2x2lfEqn){

    //calculatebuspowermismatch.Themismatchstoredon//therighthandsideofthesparseeqn

    super.setPowerMismatch(lfEqn)

    //atthispoint,buspowermismatchalreadystoredinB[1,n].You//addextradatatotherighthandsideoftheeqn}

    /***updateBusVoltagemethodiscalledatattheendofeachNRiteration,*afterthesparseeqnhasbeensolved.Theresultsofthesparseeqn*solutionisstoredinthesparseeqn.*/@OverridepublicvoidupdateBusVoltage(SparseEqnMatrix2x2lfEqn){

    //updatethebusvoltageusingthesolutionresultsstoreinthe//sparseeqn

    super.updateBusVoltage(lfEqn)

    //thesolutionresultoftheextravariabledefinedisstoredat//B[n+1...]}}

    Asforthepartofnewlyaddedcolumnsandrows,whichiscorrespondingthederivationofexistingbusandthenewlyaddedvariables,ifany,elementsareoftypeMatrix_xyandareassociatedwithbusobject.You

    36

    http://www.google.com/url?q=http%3A%2F%2Fwww.interpss.org&sa=D&sntz=1&usg=AFQjCNFuWD5qyebV38VkZNbOpsw1esWEMA

  • DevTutorialwww.interpss.org

    needtousebus.sortNumbertodecidetheelementpositioninthematrix,sincethebusnumberhasbeenoptimizedtominimizethenonzerofillinsintheLUdecomposition.Thefollowingaresomesamplecode:

    Matrix_xym=newMatrix_xy()m.xx=//definetheelementvaluesm.xy=

    Stringid=...//getbusidassociatedwiththeelementBusbus=aclfNet().getBus(id)inti=bus.getSortNumber()//getbussortNumbern=aclfNet.getNoBus()//JmatrixdimensionlfEqn.setAij(m,i,n+1)//n+1pointtothelastcolumn.

    ThenthecustomNRsolverclasscanbeusedtooverridethedefaultNRsolverintheLoadflowAlgorithmobject.

    AclfNetworkaclfNet=...//assumewehaveanAclfNetworkobject//createaLoadflowalgoobjectLoadflowAlgorithmalgo=CoreObjectFactory.createLoadflowAlgorithm(msg)//setalgoNRsolvertotheCustomNrSolveralgo.setNrSolver(newCustomNrSolver(aclfNet))//applythealgototheaclfNetobjecttorunLoadflowanalysis.aclfNet.accept(algo)

    3.3.2 Fast Decoupled ThemathematicalexpressionoftheFastDecoupledmodelisasfollows:

    P/V B1] = [ Q/V B11]V = [

    whereB1andB11matrixcanbeformbyaclfNetwork.formB1Matrix()andaclfNetwork.formB11Matrix(),respectively.Thissolutionalgorithmcanbeusedbysettingthemethodofloadflowalgorithm:

    LoadflowAlgorithmalgo=CoreObjectFactory.createLoadflowAlgorithm(net)algo.setLfMethod(AclfMethod.PQ)

    3.3.3 DC load flow ( )P B =

    Note:TheapplicationofBmatrixinDCLFtosensitivityanalysisandcontingencyanalysisisprovidedinlaterchapter.

    37

    http://www.google.com/url?q=http%3A%2F%2Fwww.interpss.org&sa=D&sntz=1&usg=AFQjCNFuWD5qyebV38VkZNbOpsw1esWEMAhttp://www.google.com/url?q=http%3A%2F%2Fwww.vogella.com%2Ftutorials%2FSpringDependencyInjection%2Farticle.html&sa=D&sntz=1&usg=AFQjCNFNVbELrGJ1v3adgLayZWx5Ihu82g

  • DevTutorialwww.interpss.org

    3.4 Adjustment During load flow [Todo]localadjustment:LfAdjustAlgorithmsystemadjustment:NetAdjustAlgorithm

    3.5 Configuration of load flow algorithm

    setMaxIterations() maximumiterationnumber

    setTolerance() toleranceinpu.

    setInitBusVoltage() Thisconcernswhetherflatstart(busvoltagemagnitude1.0,angle0degree)isenabled.IftheinitBusVoltagesettobetrue,thenflatstartwillbeused.

    setLfMethod() NR,PQ(Fastdecoupled)arerecommended.

    setNonDivergent(boolean) settruetousethenondivergentsolutionmethodbysolvingtheloadflowwithoptimalaccelerationfactorFasfollows: (k ) (k) F xx +1 = x + *

    3.6 Example

    3.6.1 Run load flow and output result packageorg.interpss.tutorial.loadflowimportorg.interpss.CorePluginObjFactoryimportorg.interpss.IpssCorePluginimportorg.interpss.display.AclfOutFuncimportorg.interpss.fadapter.IpssFileAdapterimportcom.interpss.CoreObjectFactoryimportcom.interpss.common.exp.InterpssExceptionimportcom.interpss.core.aclf.AclfNetworkimportcom.interpss.core.algo.LoadflowAlgorithmpublicclassIEEE9BusLoadFlow{

    publicstaticvoidmain(String[]args)throwsInterpssException{

    //InitializeloggerandSpringconfigIpssCorePlugin.init()//importIEEECDFformatdatatocreateanetworkobject

    38

    http://www.google.com/url?q=http%3A%2F%2Fwww.interpss.org&sa=D&sntz=1&usg=AFQjCNFuWD5qyebV38VkZNbOpsw1esWEMA

  • DevTutorialwww.interpss.org

    AclfNetworknet=CorePluginObjFactory.getFileAdapter(IpssFileAdapter.FileFormat.IEEECDF).load("testData/ieee/009ieee.dat").getAclfNet()

    //createaloadflowalgorithmobject

    LoadflowAlgorithmalgo=CoreObjectFactory.createLoadflowAlgorithm(net) //runloadflowusingdefaultsetting,whichusestheNRmethod algo.loadflow()

    //outputloadflowresultSystem.out.println(AclfOutFunc.loadFlowSummary(net))

    }}

    3.6.2 Customize NR load flow packageorg.interpss.tutorial.loadflowimportorg.apache.commons.math3.complex.Compleximportorg.interpss.IpssCorePluginimportorg.interpss.display.AclfOutFuncimportorg.interpss.numeric.datatype.Matrix_xyimportorg.interpss.numeric.sparse.ISparseEqnMatrix2x2importcom.interpss.CoreObjectFactoryimportcom.interpss.core.aclf.AclfNetworkimportcom.interpss.core.algo.LoadflowAlgorithmimportcom.interpss.core.algo.impl.DefaultNrSolverimportcom.interpss.simu.util.sample.SampleCasespublicclassCustomLoadFlowExample{

    /***DefineacustomNRsolver**/staticclassCustomNrSolverextendsDefaultNrSolver{publicCustomNrSolver(AclfNetworknet){super(net)}/***formJMatrixmethodiscalledatthebeginningofeachNRiteration*/@OverridepublicISparseEqnMatrix2x2formJMatrix(){//createnetworkJmatrixwithoneextradimension

    39

    http://www.google.com/url?q=http%3A%2F%2Fwww.interpss.org&sa=D&sntz=1&usg=AFQjCNFuWD5qyebV38VkZNbOpsw1esWEMA

  • DevTutorialwww.interpss.org

    //suchthatuptotwoaddtionalequationscanbeconsidered //andincludedintheaugmentedJacobianequations.ISparseEqnMatrix2x2lfEqn=aclfNet.formJMatrix(1) //createa2x2matrixelementMatrix_xym=newMatrix_xy()m.xx=2.0m.xy=0.0m.yx=0.0m.yy=2.0 //setthematrixelementtoJmatrixintn=aclfNet.getNoBus() //indexis0based,whichmeanstheindexoriginallyis//0,1...n1,nowthelastelementindexisnlfEqn.setA(m,n,n) returnlfEqn}//thisisdummyvariableforsettingtheextramismatchfieldprivatedoublemis=1.0 /***setPowerMismatchmethodiscalledatthebeginningofeachNR*iteration*/@OverridepublicvoidsetPowerMismatch(ISparseEqnMatrix2x2lfEqn){//calculatebuspowermismatch.Themismatchstoredon//therighthandsideofthesparseeqnsuper.setPowerMismatch(lfEqn) //definea2x1vectorComplexb=newComplex(1.0,1.0) //setthevectortotherighthandsideofthesparseeqnintn=aclfNet.getNoBus()//Again,indexis0based,whichmeanstheindexoriginallyis0,1...n1,andnowthelastelementindexisn lfEqn.setB(b,n)} /***updateBusVoltagemethodiscalledatattheendofeachNRiteration,afterthesparseeqnhasbeensolved.Theresultsofthesparseeqnsolutionisstoredinthesparseeqn.

    40

    http://www.google.com/url?q=http%3A%2F%2Fwww.interpss.org&sa=D&sntz=1&usg=AFQjCNFuWD5qyebV38VkZNbOpsw1esWEMA

  • DevTutorialwww.interpss.org

    */@OverridepublicvoidupdateBusVoltage(ISparseEqnMatrix2x2lfEqn){//updatethebusvoltageusingthesolutionresults//storeinthesparseeqnsuper.updateBusVoltage(lfEqn) //thesolutionresultoftheextravariabledefinedis//storedatB(n)intn=aclfNet.getNoBus()System.out.println("mis:"+this.mis+">"+lfEqn.getX(n)) //reducethedummyvariablesothattheloadflowcanconvergethis.mis*=0.1}}

    publicstaticvoidmain(Stringargs[]){ //InitializeloggerandSpringconfiguration

    IpssCorePlugin.init() //createasample5bussystemforLoadflowAclfNetworknet=CoreObjectFactory.createAclfNetwork()SampleCases.load_LF_5BusSystem(net)//System.out.println(net.net2String())//createaLoadflowalgoobjectLoadflowAlgorithmalgo=CoreObjectFactory.createLoadflowAlgorithm()//setalgoNRsolvertotheCustomNrSolveralgo.setNrSolver(newCustomNrSolver(net))//runLoadflow,thecustomNRLoadflowalgorithmisregarded//asavisitornet.accept(algo) //outputloadflowcalculationresultsSystem.out.println(AclfOutFunc.loadFlowSummary(net))} }

    41

    http://www.google.com/url?q=http%3A%2F%2Fwww.interpss.org&sa=D&sntz=1&usg=AFQjCNFuWD5qyebV38VkZNbOpsw1esWEMA

  • DevTutorialwww.interpss.org

    Chapter4.ShortcircuitanalysisIntroduction to short circuit analysis

    SuperpositionmethodThebasicassumptionofshortcircuitisthat,duringtheveryshortperiodofinterest(rightafterthefault),thefaultcurrentcontributingsources,mainlygeneratorsandinductionmotors,canberegardedasconstantvoltagesourcesbehindtheircorrespondingimpedances(usuallyeithertransientorsubtransientimpedancewillbeused).Thevoltagesourceareknown,eitherbasedontheloadflowsolutionorregardedasflat(vmag=1.0pu).Further,theloadsareallconvertedtotheconstantimpedances.Withtheseassumptionandsimplification,thenetworkisabasicallyalinearcircuit.Fromtheelectriccircuitcourse,welearntthatthesuperpositiontheoremisvalidforlinearcircuitanditisapowerfultooltoanalysisthiskindofcircuit. Basedonthesuperpositionmethod,thetotaleffectofnetworkunderthefaultcouldbeseparatedintotwoparts:1)theeffectofnormaloperationand2)theeffectofthefaultcurrent,whichisillustratedinFig.4.1.

    (Vactual)(Vnormal)(Vfault)

    Fig.4.1Superpositionmethodforshortcircuitanalysis

    Withthismethod,busvoltageiscalculatedbyVactual=Vnormal+VfaultwhereVnormalistheprefault,normaloperationvoltage,Vfaultisthebusvoltagewiththeonlysourceinthesystemisthefaultcurrentinjectionathefaultpoint.Regardingthecalculationofthefaultcurrent,itcanbedirectlycalculatedthroughnetworksolutionforbalancedfaults.Forunsymmectricalfaultitisbasedonthesymmetricalcomponentandthepositivesequenceequivalentmethod,whichwillbediscussedinthefollowing.

    SymmetricalcomponentmethodInthepaper[1],FortescuefoundthatasystemofthreeunbalancedphasorscanbetransformedintotwosetsofbalancedphasorsandanaddItionalsetofphasors,whichareidentical.Thesethreesetsofphasorsareknownaspositive,negativeandzerosequencecomponents.Undertheconditionofthreephasesymmetricimpedance,thethreecomponentsofthenetworkaredecoupled,whichmeanstheycanbeanalyzedseparately.Mostoftheactualpowersystemssatisfysuchcondition,thus,thethreecomponentmethodsiswidelyused.Basedonthefaultpointboundarycondition,thethreesequencenetworksarebuiltandconnected.Furthermore,thevoltagesourcesonlyexistinpositivesequencenetwork,whilethereisno

    42

    http://www.google.com/url?q=http%3A%2F%2Fwww.interpss.org&sa=D&sntz=1&usg=AFQjCNFuWD5qyebV38VkZNbOpsw1esWEMA

  • DevTutorialwww.interpss.org

    voltagesourceinnegativeandzerosequencenetwork,thusbotharepassivecircuitnetworks,andcanbetreatedasequivalentimpedanceviewedatthefaultpointofthepositivesequencenetwork.Thisisthesocalledpositivesequenceequivalentmethod.Formoreinformationofthesequenceimpedanceofeachmodelandbuildingofsequencenetwork,pleaserefertothefollowingreferencesforshortcircuitanalysis:

    English:P.M.Anderson,Analysisoffaultpowersystems Chinese:(2/3)

    4.1 Power system sequence data

    Model Positivesequence Negativesequence Zerosequence

    Generator positivesequenceimpedanceGeneratorsubtransientortransientimpedancecanbeusedhere

    Sameasthepositivesequenceunlessotherwisespecified

    Sameasthepositivesequenceunlessotherwisespecified.However,usuallyitislessthanpositivesequence.

    Load Alltheloadsareconvertedtoconstantimpedancebasedonthebusvoltage.

    Sameasthepositivesequenceunlessotherwisespecified

    zerobydefault(duetotheDeltaWyeconnectionofdistributiontransformer),unlessotherwisespecified

    Nontransformer sameastheloadflowdata

    Sameasthepositivesequenceunlessotherwisespecified

    zeroimpedanceis2.53.5timesofthepositiveimpedance*zerosequencemutualimpedancebetweentwoparallellinesisnotsupportedyet

    Transformer sameasdefinedintheloadflowdata

    ImpedanceisSameasthepositivesequenceunlessspecifiedPhaseshiftanglebecomeopposite

    Attentionmustbepaidtothetransformerwindingconnection.Theconnectionandgroundinginfomustbeprovided.ifzerosequencepathavailable,zeroimpedanceissameasthepositiveimpedance

    43

    http://www.google.com/url?q=http%3A%2F%2Fwww.interpss.org&sa=D&sntz=1&usg=AFQjCNFuWD5qyebV38VkZNbOpsw1esWEMA

  • DevTutorialwww.interpss.org

    Switchshunt sameasdefinedintheloadflowdata

    Sameasthepositivesequenceunlessotherwisespecified

    zerobydefault,unlessotherwisespecified

    HVDC regardedasopenorconverttoequivalentloadatterminals

    zerobydefault,unlessotherwisespecified

    Note:Currently,InterPSSsupportsthesequencedatainputwithPSS/EV30format,whichisusedinthesecondexampleinSection4.5.AsamplesequencedataofIEEE9Busisprovidedintheorg.interpss.tutorial/testdata/psse/IEEE9Bus(download)

    4.2 Bus based simple short circuit Simplebusfault,symmetricandunsymmetric,isshownbelow:

    3PhaseLGFaultLLGFaultLLFault++++|+|+|+|+||+||+||+||+||||||||||||||||Zll/2Zll/2Zll/2Zll/2|ZlgZlgZlgZlg||||||||+|++++|+|Zlg|||===Positivesequenceequivalent

    3Pfault zeq=zlg

    LGfault zeq=zdd0+zdd2,i1=i2=i0

    zdd0=zdd0(net)+3*Zlg zdd2=zdd2(net)

    LLfault zeq=Zll/2+zdd2, i2=i1,i0=0

    zdd2=zdd2(net)+Zll/2 LLGfault

    zeq=zll/2+zdd0||zdd2 zdd2=zdd2(net)+Zll/2 zdd0=zdd0(net)+Zll/2+3*ZlgNote:Zlg:PhasetogroundimpedanceZll:TotalphasetophaseimpedanceforLinetoLinefault.zdd0:Thezerosequenceequivalentimpedanceviewedatthefaultpointzdd2:ThenegativesequenceequivalentimpedanceviewedatthefaultpointNegativeandzerosequencecurrenti2andi0arecalculatedbasedonpositivesequencevoltagev1onthe

    44

    http://www.google.com/url?q=http%3A%2F%2Fwww.interpss.org&sa=D&sntz=1&usg=AFQjCNFuWD5qyebV38VkZNbOpsw1esWEMAhttps://www.google.com/url?q=https%3A%2F%2Fgithub.com%2FInterPSS-Project%2Fipss-common%2Fblob%2Fmaster%2Fipss.tutorial%2FtestData%2Fpsse%2FIEEE9Bus%2Fieee9.seq&sa=D&sntz=1&usg=AFQjCNFz5pmx6N9kEFq9pXTYj6-mE-eZUw

  • DevTutorialwww.interpss.org

    faultpoint.

    4.3 Branch based simple short circuit [Todo]

    4.4 Short circuit analysis in InterPSS

    4.4.1 Create ACSC network ThereistwowaystocreateanACSCnetworkobject,oneisthroughtheinpututilprovidedbyInterPSS,theotherisbyimportingtheindustrystandarddata(currentlyonlyacceptPSS/Ev30sequencedata)

    Method1:AcscInputUtilFuncandAPI

    //createanacscBusAcscInputUtilFunc.addScNonContributeBusTo(net,IdPrefix+"1","Bus1",13800,1,1)//createanacscBranchAcscBranchbra=CoreObjectFactory.createAcscBranch()bra.setBranchCode(AclfBranchCode.LINE)bra.setZ(newComplex(0.0,0.25))bra.setZ0(newComplex(0.0,0.7))net.addBranch(bra,IdPrefix+"1",IdPrefix+"2")

    Foracompleteexample,pleaserefertotheload_SC_5BusSystem(AcscNetworknet)methodinAcsc5BusExample.JavaNote:Asallthedataissetbycoding,Thismethod,ifdirectlyused,issuitablefordefiningasmallsystem.However,youmayusetheAPIsanddevelopyourcustomizeddataimporter,toloaddatafromcsv,exceloranyotherformatdatafiletocreateanAcscnetwork.

    Method2:PSSEAdapterAnexampleofusingthePSSEAdaptertoimportandcreateanACSCnetworkobjectisprovidedbelow:PSSEAdapteradapter=newPSSEAdapter(PsseVersion.PSSE_30)

    assertTrue(adapter.parseInputFile(NetType.AcscNet,newString[]{"testData/psse/IEEE9Bus/ieee9.raw","testData/psse/IEEE9Bus/ieee9.seq"

    }))AcscModelParseracscParser=(AcscModelParser)adapter.getModel()

    AcscNetworknet=new

    ODMAcscParserMapper().map2Model(acscParser).getAcscNet()

    45

    http://www.google.com/url?q=http%3A%2F%2Fwww.interpss.org&sa=D&sntz=1&usg=AFQjCNFuWD5qyebV38VkZNbOpsw1esWEMAhttps://www.google.com/url?q=https%3A%2F%2Fgithub.com%2FInterPSS-Project%2Fipss-common%2Fblob%2Fmaster%2Fipss.tutorial%2Fsrc%2Forg%2Finterpss%2Ftutorial%2Fch4_shortCircuit%2FAcsc5BusExample.java&sa=D&sntz=1&usg=AFQjCNE1ovUCvyu3bcqld4maLW6iR2U2GA

  • DevTutorialwww.interpss.org

    4.4.2 Define a fault Informationneedstodefineafault:

    faultpoint,busorbranch faulttype faultimpedance,includingzlgandzll

    Hereisanexampleofdefininga3phasebusfault: AcscBusFaultfault=CoreObjectFactory.createAcscBusFault("Bus4",acscAlgo)

    fault.setFaultCode(SimpleFaultCode.GROUND_3P)//faulttypefault.setZLGFault(newComplex(0.0,0.0))//faultimpedancezlgfault.setZLLFault(newComplex(0.0,0.0))//faultimpedancezll

    4.4.3 Calculate short circuit Thesettingoftheprefaultbusvoltageprofileisrequired.Itcanbebasedonthesolvedpowerflow(ScBusVoltageType.LOADFLOW_VOLT)orFlatvoltage(ScBusVoltageType.UNIT_VOLT)Example:

    //prefaultprofile:solvedpowerflowacscAlgo.setScBusVoltage(ScBusVoltageType.LOADFLOW_VOLT) acscAlgo.calculateBusFault(fault)

    4.4.4 Obtain results Faultcurrent:eitherabcor012coordinate

    fault.getFaultResult().getSCCurrent_012()

    Busvoltage:eitherabcor012coordinate

    fault.getFaultResult().getBusVoltage_012(Bus)

    4.5 Example Thecorrespondingcodeoftheexamplesisprovidedinthech4_shortcircuitpackageofthetutorialproject

    4.5.1 Build a system for short circuit analysis SeetheexampleofAcsc5BusExample.java

    4.5.2 Short circuit analysis with load flow and sequence data SeetheexampleofIEEE9Bus_Acsc_test.java

    Reference:

    46

    http://www.google.com/url?q=http%3A%2F%2Fwww.interpss.org&sa=D&sntz=1&usg=AFQjCNFuWD5qyebV38VkZNbOpsw1esWEMAhttps://www.google.com/url?q=https%3A%2F%2Fgithub.com%2FInterPSS-Project%2Fipss-common%2Fblob%2Fmaster%2Fipss.tutorial%2Fsrc%2Forg%2Finterpss%2Ftutorial%2Fch4_shortCircuit%2FAcsc5BusExample.java&sa=D&sntz=1&usg=AFQjCNE1ovUCvyu3bcqld4maLW6iR2U2GAhttps://www.google.com/url?q=https%3A%2F%2Fgithub.com%2FInterPSS-Project%2Fipss-common%2Fblob%2Fmaster%2Fipss.tutorial%2Fsrc%2Forg%2Finterpss%2Ftutorial%2Fch4_shortCircuit%2FIEEE9Bus_Acsc_test.java&sa=D&sntz=1&usg=AFQjCNEgPArhXxymoAZck2rY_UVftEOhww

  • DevTutorialwww.interpss.org

    [1]Fortescue,CharlesL."Methodofsymmetricalcoordinatesappliedtothesolutionofpolyphasenetworks."AmericanInstituteofElectricalEngineers,Transactionsofthe37.2(1918):10271140.

    47

    http://www.google.com/url?q=http%3A%2F%2Fwww.interpss.org&sa=D&sntz=1&usg=AFQjCNFuWD5qyebV38VkZNbOpsw1esWEMA

  • DevTutorialwww.interpss.org

    Chapter5.Transientstabilitysimulation5.1 Introduction to transient stability simulation

    ElectromechanicaltransientstabilityTransientstabilityistheabilityofthepowersystemtomaintainsynchronismwhensubjectedtoaseveretransientdisturbancesuchasafaultonthetransmissionline,lossoflargegenerationorlossoflargeload.Thesynchronismismainlymeasuredbythelargestgeneratorangledifferenceamongallthegenerators,thusitisheavilyrelatedtothedynamicresponseofthegeneratorstothefault,whichisgovernedbyboththeirmechanicalinputandelectricaloutput.Thusthestabilityofconcernisalsoknownaselectromechanicaltransientstability.

    StabilitystudieswithpositivesequencenetworkPowersystemsareusuallyoperatedunderbalancedconditions,andsuchthreephasesystemscanberepresentedbyanequivalentsinglephasenetwork,withallvoltageandcurrentsrepresentedinphasorform.Whenunsymmetricalfaultsareconsidered,thethreephasesystemcanbemodeledasthreesymmetricalsystems,i.e.,positive,negativeandzerosequencesystems,usingthesymmetricalcomponentmethod.Consideringthatthemotionofthegeneratorsismainlyaffectedbythepositivesequence,andthatthenegativeandzerosequencevoltageandcurrentsarenotofinterestinstabilitystudies,stabilitystudiescanconcentrateonpositivesequencenetwork,withtheoveralleffectsofthenegativeandzerosequencenetworkonthepositivesequencerepresentedbyeffectiveequivalentimpedanceviewedatthefaultpoint,whichisshownasfollows:

    Fig.5.1Positivesequenceequivalentmethod[1]

    Diagrambelowshowsthekeymodelsofinterest(generation,loadandthenetwork)andtheinteractionsofthem

    48

    http://www.google.com/url?q=http%3A%2F%2Fwww.interpss.org&sa=D&sntz=1&usg=AFQjCNFuWD5qyebV38VkZNbOpsw1esWEMA

  • DevTutorialwww.interpss.org

    Fig.5.2Structureofthecompletepowersystemmodelfortransientstabilitysimulation[1]

    Withthenetworkmodeledbynodaladmittance,thenetworkloadingcomponents(load,generator,SVC,HVDC,etc)areconvertedintoNortonequivalentsofinjectedcurrentsinparallelwithadmittance.Forconstantimpedanceload,thecurrentinjectioniszero.Theequivalentadmittancesareaddedintothenetworktoformamodifiedadmittancematrix.Thethenetworkequationbecomes:

    [I]=[Y][V]Solutionprocessissummarizedasfollows:

    (1)Foreachloadingcomponent,calculatethecurrentinjectionsbysolvingitsdifferentialandalgebraicequations.

    (2)DeterminenetworkvoltagesfromtheinjectioncurrentsAsthebusvoltagesaffecttheloadingcomponents,aniterativeprocessisrequiredfortheabovetwosteps.

    5.2 Dynamic models

    5.2.1 Machine model(1)MachinemodelinaDStabBusRecallthebusmodeldepictedinFig.2.3,thegeneratorforloadflowstudyismodeledbyaAclfGen,whichisanentryintheGenListofabus.Fordynamicstudy,DStabGenmodelisused,anditisextendedfromtheAclfGenwiththefollowinghierarchystructure:AclfGenAcscGenDStabGenMachineisnotdirectlyconnectingtoabus,instead,itiscontainedwithinaDStabGenobject.Therelationshipsamongthebus,dstabGen,machine,andothermachinecontrollers(turbinegovernor,exciter

    49

    http://www.google.com/url?q=http%3A%2F%2Fwww.interpss.org&sa=D&sntz=1&usg=AFQjCNFuWD5qyebV38VkZNbOpsw1esWEMA

  • DevTutorialwww.interpss.org

    andpss)canbeillustratedbythefollowingFig.5.3.Thus,adstabGenmustbecreatedandaddedtothegenListbeforethecreationandmodelingofamachine.Thisrequirementisalsoappliedtoamachinecontrollerastoamachine.

    Fig.5.3Relationshipsofcontroller,machine,dstabGenandbus

    (2)MachinemodelsofdifferentlevelsofmodelingdetailsInterPSSmachinemodelimplementationisbasedonIEEEStd11102002:IEEEGuideforSynchronousGeneratorModelingPracticesandApplicationsinPowerSystemStabilityAnalysis.Currentlythefollowingmodelsareimplemented.

    Tab.5.1Machinemodels

    InterPSSMachineModel

    IEEEStd11102002Model

    Modelingconsiderationaxiswindings

    Note

    EConstant N/A N/A classicalmodelorconstantvoltagebehindreactancemodel

    2order

    InfinitBus N/A N/A Tomodeltheinfinitebus,similartoclassicalmodellwithverylargemachineMVA,e.g.,999999MVA

    2order

    50

    http://www.google.com/url?q=http%3A%2F%2Fwww.interpss.org&sa=D&sntz=1&usg=AFQjCNFuWD5qyebV38VkZNbOpsw1esWEMA

  • DevTutorialwww.interpss.org

    Eq1Model IEEE1.0 Onlyfieldwindingf Salientpolemodel 3order

    Eq1Ed1Model IEEE1.1 daxis:fieldwindingf qaxis:Qdamper

    winding

    Twoaxismodel 4order

    E11RoundRotor IEEE2.2 daxis:fieldwindingf,damperwindingD

    qaxis:damperwindingQandG

    detailedmodelforroundrotormachines,

    6order

    E11SalientPole IEEE2.1 daxis:fieldwindingf,damperwindingD

    qaxis:damperwindingQ

    detailedmodelforsalientpolemachines,

    5order

    Tab.5.2Machinemodelingparametersandunit

    Parameter Unit

    MachineratingRating MVA

    MachineratedvoltageRatedVolt V

    ShaftMechanicalDampingFactorD %MW/Hz

    ArmatureLeakageReactanceXl pu

    ArmatureResistanceRa pu

    SynchronousDirectAxisReactanceXd pu

    SynchronousQuadratureAxisReactanceXq pu

    TransientDirectAxisReactanceXd1 pu

    TransientQuadratureAxisReactanceXq1 pu

    OpenCircuitTransientDirectAxisTimeConstantTd01

    s

    OpenCircuitTransientQuadratureAxisTimeConstantTq01

    s

    SubtransientDirectAxisReactanceXd11 pu

    SubtransientQuadratureAxisReactanceXq11 pu

    OpenCircuitSubtransientDirectAxisTimeConstantTd011

    s

    51

    http://www.google.com/url?q=http%3A%2F%2Fwww.interpss.org&sa=D&sntz=1&usg=AFQjCNFuWD5qyebV38VkZNbOpsw1esWEMA

  • DevTutorialwww.interpss.org

    OpenCircuitSubtransientQuadratureAxisTimeConstantTq011

    s

    SaturationFactorat100%TerminalVoltageSE100 %

    SaturationFactorat120%TerminalVoltageSE120 %

    Poles optional,forinformationonly

    PleaseNote:

    PerUnitsystemAllmachineparameters,youenteredintoInterPSSare,assumedbasedonthemachineratingandmachineratedvoltage.Internally,thesemachinesaretransferredtothesystemKvabaseandthebusbasevoltage,towhichthemachineisconnectedto,whennecessary.

    MachineoutputAllmachineoutput,suchasPm,Pearebasedonmachinerating. Roundrotormodel:

    Salientrotormodel:

    Itisalmostthesameasabove,exceptthereisonlyonedamperwindinginqaxis,thereforethisisnomodelingofEd,withxq=xqandTq0=0.

    (3)Modelingtheeffectsofsaturation

    Defaultmethod:Quadraticfunction:

    S = EB(EA)2

    EistheinputandAandBaredeterminedbyfittingthetwopointsinputasgeneratorparameters,i.e.(1.0,S1.0)and(1.2,S1.2)

    Otheravailablemethods: Exponentialfunction

    52

    http://www.google.com/url?q=http%3A%2F%2Fwww.interpss.org&sa=D&sntz=1&usg=AFQjCNFuWD5qyebV38VkZNbOpsw1esWEMA

  • DevTutorialwww.interpss.org

    Threesectionmethod

    SaturationdatainputSlinerVoltageattheEndPointofLinerAreaonGeneratorOCCCurve.0.80.9puisrecommended

    5.2.2 Excitor [Todo]Addmoredescription

    5.2.3 Turbine and governor [Todo]Addmoredescription

    5.2.4 PSS[Todo]Addmoredescription

    53

    http://www.google.com/url?q=http%3A%2F%2Fwww.interpss.org&sa=D&sntz=1&usg=AFQjCNFuWD5qyebV38VkZNbOpsw1esWEMA

  • DevTutorialwww.interpss.org

    5.2.5 Load model Nowtheloadscanberepresentedasconstantcurrent,constantimpedanceandconstantpowertypesofloadfortransientstabilitysimulation.Constantpowerloadisconvertedtoconstantimpedanceloadbasedontheloadflowresult,bydefault,withintheDStabNetworkinitializationprocess.[Todo]Addmoredescription

    5.2.7 Bus Frequency MeasurementBusfrequencyismeasuredbythechangerateofbusvoltageangle.Thetransferfunctionforthemeasurementisshowninthefollowingdiagram:

    Fig.5.4Busfrequencymeasurementblockdiagram

    Thefollowingvaluesareset:

    Tf=0.01secTw=0.01sec

    Youcanmodifytheproperties/coreLibContext.xmltochangetheirvalues:

    0.010.01

    InterPSSbusfrequencyimplementationJavasourcecodecanbefoundHere.

    5.3 Numerical Solution Asshownbythediagraminsection5.1,thedynamiccomponentsinpowersystem,forexample,thegeneratorsandcontrollers,aremodeledbyordinarydifferentialequations,whilethetransmissionnetworkandthestaticloadsarerepresentedbyalgebraicequations.Thus,ingeneral,thepowersystemfortransientstabilitysimulationcanbemodeledasDifferentialAlgebraicequations(DAEs):

    (5.1) F(X , )X

    = V (5.2)(X , ) YVI V =

    54

    http://www.google.com/url?q=http%3A%2F%2Fwww.interpss.org&sa=D&sntz=1&usg=AFQjCNFuWD5qyebV38VkZNbOpsw1esWEMAhttp://interpss.googlecode.com/svn/trunk/ipss.plugin/src/org/interpss/dstab/measure/BusFreqMeasurementImpl.java

  • DevTutorialwww.interpss.org

    ThereisgenerallytwosolutionmethodsfortheDAEsabove,oneisiterativemethodandthereotheristosolvebothsimultaneouslyusingimplicitsolution,e.g.Trapezoidalmethod.InterPSSchoosetheformermethod.Foreachstep,differentialequationsforthedynamicmodels(Eqn.5.1)aresolvedfirstusingtheForwardEulermethod,thenthedynamicmodelsinterfacewiththenetworkascurrentsourcesinparallelwithequivalentadmittance.Astheinterfaceerrorexistsfortheiterativemethod,iterationbetweennetworkequationanddynamicmodelsolutionisoftenrequiredtoeliminatesucherrors.Duringtheperiodwhenthesystemexperiencesconsiderablechangesinthestatevariables,theiterationisconductedfor6times,whilemaximumiterationissettobe4fortherestofthesimulation.

    5.4 Simulation procedure

    Fig.5.5FlowdiagramofInterPSStransientstabilitysimulationprocedure

    5.4.1 Simulation data preparation Fortransientstabilitysimulation,loadflowdataandthedynamicmodeldataistheminimumrequireddatatoconducttransientstabilitysimulationforsymmetricalfault.Thesequencenetworkdatamustalsobeincludedwhenanyunsymmetricalfaultisconsidered.NowInterPSSsupportsloadflowdatadefinedinavarietyofformats,forexample,IEEECDF,PSS/E(V29V33),PowerWorld(v16),GEPSLF.However,forthedynamicmodelandsequencenetworkdata,theODMadapternowsupportsthePSS/EandPSDBPAformatdataaswellasdatainODM/XMLformat.Dynamicmodelsdefinedinotherformatsmightbesupportedinthenearfuture.

    5.4.2 Simulation setting

    Simulationtime DynamicSimuAlgorithm.setTotalSimuTimeSec()

    totalsimulationtimeinseconds

    Simulationtimestep DynamicSimuAlgorithm.setSimuStepSec()

    shouldbelessthanhalfofthesmallesttimeconstantinthesystem

    Simulationmethod DynamicSimuAlgorithm.setSimuMethod(DynamicSimuMethod.MODIFIED_EULER)

    nowONLYthemodifiedeulerissupported.

    Referencemachine DynamicSimuAlgorithm..setRefMachine(dsNet.getMachine(MachineId))

    MachineIdisformedas:BusId_GeneratorId

    55

    http://www.google.com/url?q=http%3A%2F%2Fwww.interpss.org&sa=D&sntz=1&usg=AFQjCNFuWD5qyebV38VkZNbOpsw1esWEMA

  • DevTutorialwww.interpss.org

    Networksolutioniteration(optional)

    dsNet.setNetEqnIterationWithEvent(int)dsNet.setNetEqnIterationNoEvent(int)

    Thedefaultvaluesare6(withanychange)and4(noevent),respectively

    5.4.3 Event setting TheeventconceptinInterPSSincludesboththefaultsordevicesetPointchanges.

    Eventtype Note

    Bus_Fault allkindsofbusfaults,LG,LL,LLG,3P

    Branch_Fault

    Branch_Outage

    Branch_Reclose

    Load_Change

    SetPoint_Change Controlreferencesetpointchange,e.g.,Vref

    (1)Faultsetting

    (a)Busfault

    Busfaultneedstospecifythe1)faultbus,2)faulttypeand3)faultimpedance(ZLGandZLL).Simplebusfault,symmetricandunsymmetric,isshownbelow:3PhaseLGFaultLLGFaultLLFault++++|+|+|+|+||+||+||+||+||||||||||||||||Zll/2Zll/2Zll/2Zll/2|ZlgZlgZlgZlg||||||||+|++++|+|Zlg|||===Note:Anykindofnetworktopologyand/orparametersettingchange,e.g.,faultorreferencepointsettingchange,ismodeledasanEventinInterPSS. Anexampleforcreatingathreephasesolidgroundfaultisgivenbelow:

    56

    http://www.google.com/url?q=http%3A%2F%2Fwww.interpss.org&sa=D&sntz=1&usg=AFQjCNFuWD5qyebV38VkZNbOpsw1esWEMA

  • DevTutorialwww.interpss.org

    //defineanevent,settheeventidandeventtype.DynamicEventevent1=DStabObjectFactory.createDEvent("BusFault3P@"+faultBusId,

    "BusFault3P@"+faultBusId,DynamicEventType.BUS_FAULT,net)event1.setStartTimeSec(startTime)event1.setDurationSec(durationTime)

    //defineabusfault

    DStabBusfaultBus=net.getDStabBus(faultBusId)AcscBusFaultfault=CoreObjectFactory.createAcscBusFault("BusFault

    3P@"+faultBusId,net) fault.setAcscBus(faultBus)

    fault.setFaultCode(SimpleFaultCode.GROUND_3P)fault.setZLGFault(NumericConstant.SmallScZ)

    //addthisfaulttotheevent,mustbeconsistwitheventtype//definitionbefore.

    event1.setBusFault(fault)TheeventcanbeaddedtotheDStabilityNetworkbeforerunningthedynamicsimulationasfollows:

    DStabilityNetwork.addDynamicEvent(event1)

    (b)BranchFault

    Therearetwotypesofbranchfault:shortcircuitandoutage,asshownintheabovediagram.

    BranchShortCircuit:Branchshortcircuitissimulatedbycreatinganequivalentfaultbussomedistancefromaterminalbus.

    Branchoutage:BranchoutageismodelledbyinsertinganequivalentZbetweenthetwoterminal

    buses.[TODO]Addmoresampleforothertypesofevents

    5.4.4 Monitoring and output

    (1)StateVariableRecorderTheusageofstatevariablerecordercanbefoundintheIEEE9BusexampleDStab_IEEE9Bus_Test.javaunderthech5_dstabofthetutorial.StateVariableRecorderssRecorder=newStateVariableRecorder(0.0001)//timetolerance

    ssRecorder.addCacheRecords("Bus2mach1",//machidMachineState,//recordtype

    57

    http://www.google.com/url?q=http%3A%2F%2Fwww.interpss.org&sa=D&sntz=1&usg=AFQjCNFuWD5qyebV38VkZNbOpsw1esWEMAhttps://www.google.com/url?q=https%3A%2F%2Fgithub.com%2FInterPSS-Project%2Fipss-common%2Fblob%2Fmaster%2Fipss.tutorial%2Fsrc%2Forg%2Finterpss%2Ftutorial%2Fch5_dstab%2FDStab_IEEE9Bus_Test.java&sa=D&sntz=1&usg=AFQjCNG7tJ0MeGgQTZE7g8AoGlzMVO5LaQ

  • DevTutorialwww.interpss.org

    DStabOutSymbol.OUT_SYMBOL_MACH_ANG,//statevariablename0.005,//timestepsforrecording1000)//totalpointstorecord

    //settheoutputhandler

    dstabAlgo.setSimuOutputHandler(ssRecorder) //Note:Herethedstabsimulationpartisskipped.//outputrecordedsimulationresultsafterthesimulation.Listlist=ssRecorder.getMachineRecords(

    "Bus2mach1",MachineState,DStabOutSymbol.OUT_SYMBOL_MACH_ANG)System.out.println("\n\nBus2MachineAnagle")for(StateRecordrec:list){

    System.out.println(Number2String.toStr(rec.t)+","+Number2String.toStr(rec.variableValue))}

    Perthesettingabove,thestatevariablesrecorderwillkeeparecordofthemachineangleoftheMachinewithIdBus2mach1,forevery0.005seconds.Werecommenduserssettingthetimesteptobeoneormultipletimesthesimulationtimestep.Afterthesimulation

    (2)StateMonitorDifferentfromthestateVariableRecorder,whichistimestamped,andvariableshavetodefinedonebyone.StaeMonitorisdesignedtohelpusereasilymonitormultipleimportantvariables,e.g.,machineangle,pe,pm,efd,busvoltageandangles,witheasysettingandoutput.Itissimulationstepbased.TheusageofthestateMonitorisdemonstratedasfollows:

    StateMonitorsm=newStateMonitor()

    //sm.addGeneratorStdMonitor(machId)sm.addGeneratorStdMonitor(newString[]{"Bus14931mach1"})

    //sm.addBusStdMonitor(busId)sm.addBusStdMonitor(newString[]{"Bus24151","Bus15021","Bus24085"})

    //settheoutputhandlerofDStabAlgorithmdstabAlgo.setSimuOutputHandler(sm)

    //setoutputfrequency,measuredbystepsdstabAlgo.setOutPutPerSteps(1)

    58

    http://www.google.com/url?q=http%3A%2F%2Fwww.interpss.org&sa=D&sntz=1&usg=AFQjCNFuWD5qyebV38VkZNbOpsw1esWEMA

  • DevTutorialwww.interpss.org

    //afterthesimulation,outputthemonitoredvariablesorparameters:

    System.out.println(sm.toCSVString(sm.getMachAngleTable()))System.out.println(sm.toCSVString(sm.getBusAngleTable()))System.out.println(sm.toCSVString(sm.getBusVoltTable()))

    //orsaveittoacsvfileFileUtil.writeText2File("E:/mach_angle.csv",sm.toCSVString(sm.getMachAngleTable()))

    Outputsample:Busvoltagetime,Bus30000,Bus14931,Bus24801,Bus24085,Bus47216,Bus15021,Bus241510.000,1.030,1.000,1.036,1.007,1.020,1.060,1.049,0.004,1.030,1.000,1.036,1.007,1.020,1.060,1.049,0.008,1.030,1.000,1.036,1.007,1.020,1.060,1.049,0.013,1.030,1.000,1.036,1.007,1.020,1.060,1.049,

    5.4.5 Load flow and system initialization Loadflowresultisalwaysrequiredtodeterminetheoperatingpointofthesystembeforeanyfaultisconsidered. DynamicSimuAlgorithmdstabAlgo=....

    LoadflowAlgorithmaclfAlgo=dstabAlgo.getAclfAlgorithm()aclfAlgo.loadflow()

    //makesureloadflowisconvergedbeforedstabinitializationSysteminitializationisthenperformedbasedonaconvergedloadflowresult,anditmainlyincludesfourparts:

    Generatorinitialization: Mapgeneratorsequencenetworkdatatothebuswhichitconnectsto,toformthe

    equivalentadmittance(Recallthatthegeneratorsareconvertedandrepresentedascurrentsourceinparallelwithequivalentadmittance,Yeq=1/Zsource)

    Initializevariablestatesofgeneratorsandtheircontrollers

    LoadconversionConstantpowerloadisusuallytoconstantadmittanceload:YLoad=(PLj*QL)/V^2andaddedtothebusshuntadmittance.

    DeviceinitializationForotherdynamicdevicesexceptgenerators,forexample,inductionmotors,initializationprocessisalsorequiredtodeterminethestatesunderprefaultconditions.

    Formthepositivesequenceadmittancematrix,whichwillbeusedinthenetworkequationsolutionI=YVduringsimulation.

    Syntax:DynamicSimuAlgorithm.initialization()

    59

    http://www.google.com/url?q=http%3A%2F%2Fwww.interpss.org&sa=D&sntz=1&usg=AFQjCNFuWD5qyebV38VkZNbOpsw1esWEMA

  • DevTutorialwww.interpss.org

    5.4.6 Simulation Normal(successive)simulation

    .Syntax:DynamicSimuAlgorithm.performSimulation()

    OnestepsimulationForcustomizationorextensionpurpose,onemightwhattostopaftereachorcertainstep,thenmakesomechangesorcontroltothesystemandcontinuetothenextstepsimulation.Inthisregard,asocallonestepsimulationfunctionisprovided(1)performOnestepSimulationSyntax:DynamicSimuAlgorithm.solveDEqnStep(booleanupdateTime)(2)getcurrenttimeinsecduringsimulationSyntax:DynamicSimuAlgorithm.getSimuTime()

    5.6 Data check and autocorrection Modeldatacheckisperformedaspartoftheinitializationprocess,whilelimiteddatacorrectionhavebeenconsideredsofar.

    5.7 Development of new dynamic device [Todo]

    5.8 Example IEEE9Bussystem

    Thisexamplewithinthetutorialunderthech5_dstabpackageincludesallthestepsofrunningdynamicsimulationinInterPSS.

    IEEE39Bussystem DevelopmentofSVCasanewdynamicdevice

    Reference[1]Kundur,Prabha.Powersystemstabilityandcontrol.NewYork:McGrawhill,1994.

    60

    http://www.google.com/url?q=http%3A%2F%2Fwww.interpss.org&sa=D&sntz=1&usg=AFQjCNFuWD5qyebV38VkZNbOpsw1esWEMA

  • DevTutorialwww.interpss.org

    Chapter6.PowersystemoptimizationthroughintegratingInterPSSwithGAMS

    Thepurposeofthisdocumentistoprovideinstruction,includingsamplecode,forInterPSSandGAMSintegration.

    6.1 GAMS V24

    (1)OverviewofGAMSnewAPI TheobjectorientedGAMSAPIallowstheseamlessintegrationofGAMSintoanapplicationby

    providingappropriateclassesfortheinteractionwithGAMS.TheGAMSDatabaseclassforinmemoryrepresentationofdatacanbeusedforconvenientexchangeofinputdataandmodelresults.ModelswritteninGAMScanberunwiththeGAMSJobclassandbyusingtheGAMSModelInstanceclassasequenceofcloselyrelatedmodelinstancescanbesolvedinthemostefficientway.TherearethreeversionsoftheobjectorientedGAMSAPI:Java,Pythonand.NET.TheseAPIsworkwithJavaSE5andup,Python2.7,and.NETframework4(VisualStudio2010)andup.Fordetails:seehttp://www.gams.com/dd/docs/api/

    ItisrecommendedtoreadthroughtheGAMSJavaAPIdocandthetutorialtolearnmorespecific

    informationregardingtheJavaAPIsandusage.

    http://www.gams.com/dd/docs/api/GAMS_java.pdf

    http://www.gams.com/dd/docs/api/GAMS_java_Tutorial.pdf

    (2)Installation1.DownloadfromGAMSdownloadwebside,V24.0.2ornewerversionshouldbeconsistentwiththis

    document.NOTE:Attentionshouldbepaidtochoosingthe64bitor32bitversionGAMS.ItwasfoundthatGAMSmustbeconsistentwiththeJRE.Thatis,iftheJREinstalledinyourmachineis64bit,the64bitversionGAMSshouldbeyourchoice,otherwisethe32bitversion.

    ErroroccurswheninconsistentversionofGAMSandJREareused:Exceptioninthread"main"com.gams.api.GAMSException:expect64bitGAMSsystemin[C:\ProgramFiles(x86)\GAMS24.0],butfound32bitinstead!

    2.WheninstallingtheGAMS,makesurechoose"addtheinstalldirtothesystem

    environment".

    61

    http://www.google.com/url?q=http%3A%2F%2Fwww.interpss.org&sa=D&sntz=1&usg=AFQjCNFuWD5qyebV38VkZNbOpsw1esWEMAhttp://www.google.com/url?q=http%3A%2F%2Fwww.gams.com%2Fdd%2Fdocs%2Fapi%2F&sa=D&sntz=1&usg=AFQjCNHCbzZEWHbMeRuHGWL72y48su4nVQhttp://www.google.com/url?q=http%3A%2F%2Fwww.gams.com%2Fdd%2Fdocs%2Fapi%2FGAMS_java.pdf&sa=D&sntz=1&usg=AFQjCNF4ZHTMqttiWuKpsjkX4zRvmTtFLAhttp://www.google.com/url?q=http%3A%2F%2Fwww.gams.com%2Fdd%2Fdocs%2Fapi%2FGAMS_java_Tutorial.pdf&sa=D&sntz=1&usg=AFQjCNERHQbplNNVl_4VcKLmhRVdfnlJ1Ahttp://www.google.com/url?q=http%3A%2F%2Fwww.gams.com%2Fdownload%2F&sa=D&sntz=1&usg=AFQjCNHQoaIn60o0m7Sz-Bs4T6LLPdg_Cw

  • DevTutorialwww.interpss.org

    6.2. Call GAMS from Java Sincev24.0,newGAMSJavaAPIsintroducethefollowingconcepts/classes,allowingbetterintegration

    withJavabasedprojects. GAMSWorkspace:WorkspaceinJavaenvironmentwhichhasmostofthefunctionsinthenative

    GAMSworkspace.ToIntegrateGAMSinanyJavaproject,firstweneedtocreateanGAMSWorkspace,asfollows:

    GAMSWorkspacews=newGAMSWorkspace()ThenwecanusewstocreatedatabaseGAMSDatabasedb=ws.addDatabase()andcreateGAMSJob:GAMSJobieee14ED=ws.addJobFromString(modelStr)

    GAMSDatabase:storingandprocessingthemodelingdataininmomorydatabase GAMSSetandGAMSParameter:Basedatasetforstoringtheindicesandmodelingdata,

    respectively.

    Example:GAMSSetloadBus=db.addSet("j",1,"loadbuses")GAMSParametergenPLow=db.addParameter("genPLow",1,"lowerboundof

    eachgeneratingunit")

    GAMSVariableRecord:Gettheoptimizationresultsdirectlyfromthedatabase Example:for(GAMSVariableRecordrec:ieee14ED.OutDB().getVariable("genp")){System.out.println("genP@Bus"+rec.getKeys()[0]+":

    Level="+rec.getLevel())} GAMSJob:NowwecancreateGAMSJobfrommodelingString,noindependent*.gmsmodeling

    fileisneeded. Example:GAMSJobieee14ED=ws.addJobFromString(modelStr)TheGAMSJavaLibraryGAMSJavaAPI.jarcanbefoundunderthefolder: \apifiles\Java\api(CorrespondingDLLscanalsobefoundunderthisfolder).Thishasbeenaddtothe

    ipss.lib.3rdPty/gams

    Note:GAMSRelatedclassrunconfigurationsettingwithinEclipseRuntheclassbyrun>runconfiguration>settingtheVMargumentsasfollows:Djava.library.path="\\apifiles\\Java\\api"62

    http://www.google.com/url?q=http%3A%2F%2Fwww.interpss.org&sa=D&sntz=1&usg=AFQjCNFuWD5qyebV38VkZNbOpsw1esWEMA

  • DevTutorialwww.interpss.org

    WhichguaranteesthattherequiredDLLsareaccessible/visiblefromtheclass.

    6.3 Economic dispatch Sample SampetestcaseEconomicDispatchGAMS.javaResult:

    genP@BusBus1:level=1.91,marginal=0.0genP@BusBus2:level=0.5,marginal=20.033200000000004genP@BusBus3:level=0.05,marginal=39.96479999999998genP@BusBus4:level=0.0,marginal=30.038200000000003genP@BusBus5:level=0.0,marginal=30.038200000000003genP@BusBus6:level=0.06,marginal=19.968999999999994genP@BusBus7:level=0.0,marginal=30.038200000000003genP@BusBus8:level=0.07,marginal=9.974400000000003genP@BusBus9:level=0.0,marginal=30.038200000000003genP@BusBus10:level=0.0,marginal=30.038200000000003genP@BusBus11:level=0.0,marginal=30.038200000000003genP@BusBus12:level=0.0,marginal=30.038200000000003genP@BusBus13:level=0.0,marginal=30.038200000000003genP@BusBus14:level=0.0,marginal=30.038200000000003

    DCLoadflowResultsBudIdVoltAng(deg)GenLoadShuntG=========================================================Bus10.00191.000.000.00

    63

    http://www.google.com/url?q=http%3A%2F%2Fwww.interpss.org&sa=D&sntz=1&usg=AFQjCNFuWD5qyebV38VkZNbOpsw1esWEMA

  • DevTutorialwww.interpss.org

    Bus24.3250.0021.700.00Bus311.805.0094.200.00Bus49.520.0047.800.00Bus58.130.007.600.00Bus613.416.0011.200.00Bus712.320.000.000.00Bus811.617.000.000.00Bus914.230.0029.500.00Bus1014.510.009.000.00Bus1114.170.003.500.00Bus1214.530.006.100.00Bus1314.700.0013.500.00Bus1415.730.0014.900.00FromId>ToIdPowerFlow(Mw)MWLimitLoading%Violation=============================================================Bus1>Bus2(1)127.390.00Bus1>Bus5(1)63.610.00Bus2>Bus3(1)65.950.00Bus2>Bus4(1)51.490.00Bus2>Bus5(1)38.250.00Bus3>Bus4(1)23.250.00Bus4>Bus5(1)57.660.00Bus4>Bus7(1)23.330.00Bus4>Bus9(1)14.770.00Bus5>