Documente Academic
Documente Profesional
Documente Cultură
org
InterPSS
DevelopmentTutorial
Inprogress...
Version:<V0.42>
Date:<7/23/2014>
DevTutorialwww.interpss.org
DocumentVersionHistory
VersionNo.
ReleaseDate
Description
Preparedby
V0.1
12/17/2013
startworkingonthefirstversion,theoutlineof
tutorial
T.Huang
V0.2
1/25/2014
completedch2:introtothethreebasicpower
systemmodels,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
DevTutorialwww.interpss.org
TableofContents
Introduction
Chapter1.SettinguptheInterPSSDevelopmentEnvironment
1.1ImportInterPSSlibraryprojects
1.1.1Libraryrepositoryasazipfile
1.1.2CloneLibraryprojectrepositoryviaEgit
(1)GitHubEclipseplugin
(2)ClonetherepositorytolocalPCandimporttheprojectsintoworkspace
1.2Runsampleloadflowtestcase
Chapter2.AnintroductiontothepowersystembasicmodelsinInterPSS
2.1.OverviewofpowersystemmodelinginInterPSS
2.2.Inheritanceandclasshierarchystructure
2.3Threebasictypesofpowersystemmodels
2.3.1Networkobject
2.3.2Bus
2.3.3Branch
2.4.Gettingandsettingthedataofanobject
2.4.1Network
2.4.2Bus
2.3.3Branch
2.4Example
Chapter3.Powersystemloadflowanalysis
Introductiontopowersystemloadflow
3.1Datarequiredforloadflowanalysis
3.1.1System/networkdata
3.1.2Busdata
3.1.3Branchdata
3.2.Supportedpowersystemmodels
3.3.Solutionmethodsandinternalsparsematrixdatastructure
3.3.1NewtonRaphson
3.3.2FastDecoupled
3.3.3DCloadflow
3.4AdjustmentDuringloadflow
3.5Configurationofloadflowalgorithm
3.6Example
3.6.1Runloadflowandoutputresult
3.6.2CustomizeNRloadflow
Chapter4.Shortcircuitanalysis
Introductiontoshortcircuitanalysis
4.1Powersystemsequencedata
4.2Busbasedsimpleshortcircuit
4.3Branchbasedsimpleshortcircuit
4.4ShortcircuitanalysisinInterPSS
3
DevTutorialwww.interpss.org
4.4.1CreateACSCnetwork
4.4.2Defineafault
4.4.3Calculateshortcircuit
4.4.4Obtainresults
4.5Example
4.5.1Buildasystemforshortcircuitanalysis
4.5.2Shortcircuitanalysiswithloadflowandsequencedata
Chapter5.Transientstabilitysimulation
5.1Introductiontotransientstabilitysimulation
5.2Dynamicmodels
5.2.1Machinemodel
(1)MachinemodelinaDStabBus
(2)Machinemodelsofdifferentlevelsofmodelingdetails
(3)Modelingtheeffectsofsaturation
5.2.2Excitor
5.2.3Turbineandgovernor
5.2.5Loadmodel
5.2.7BusFrequencyMeasurement
5.3NumericalSolution
5.4Simulationprocedure
5.4.1Simulationdatapreparation
5.4.2Simulationsetting
5.4.3Eventsetting
(1)Faultsetting
(a)Busfault
(b)BranchFault
5.4.4Monitoringandoutput
5.4.5Loadflowandsysteminitialization
5.4.6Simulation
5.6Datacheckandautocorrection
5.7Developmentofnewdynamicdevice
5.8Example
Chapter6.PowersystemoptimizationthroughintegratingInterPSSwithGAMS
6.1GAMSV24
6.2.CallGAMSfromJava
6.3EconomicdispatchSample
Chapter7.SensitivityAnalysisandDCLFbasedcontingencyanalysis
Chapter8.NewcontrollermodeldevelopmentwithControllerModelingLanguage
Chapter9.Graphbasedpowersystemapplications
AppendixASparseMatrix
AppendixBOpenDataModelfordataimport/output
1.Prerequisite
1.1BasicunderstandingofXML:schema,databindingandJAXB
1.2Basicknowledgeofdataforpowersystemsimulation
2.ODMinanutshell
2.1ODMasadataformatfreeintermediaryfordataexchange
2.2XMLSchemaforpowersystemsimulationdatamodeling
2.2.1BasicSchema
4
DevTutorialwww.interpss.org
NamingConvention
NameSpace
VersionNumber
PUSystem
Extension
SchemaRootElement
BaseRecord
IDRecord
2.2.2BaseCase
2.2.3BusRecord
2.2.3.1BusRecordforACLoadflow
BusGenerationDataBusGenDataXmlType
BusLoadData
2.2.3.2BusRecordforACshortcircuit
2.2.3.3BusRecordfortransientstability
2.2.4BranchRecord
BaseBranchData
LoadflowLineData
LoadflowTransformerData
TransformerData
TransformerTapAdjustment
TransformerTapAdjustmentforBusVoltage
TransformerTapAdjustmentforMVarFlow
LoadflowPhaseShiftTransformerData
PhaseAngleAdjustment
BranchRatingLimit
3Windingtransformer
Modification
Contingency
StudyScenario
2.3DatabindingwithJAXB
2.4DataimporttoODM/XML
2.4.1Modeldataparserandmapper
2.4.1.1InputLineStringParser
ParseinputlineString
2.4.2Implementaspecificdataparserandmapper
2.4.2.1Implementinputlinestringparser
2.4.2.2Implementinputlinestringmapper
2.4.3DataAdapter
2.5ODM>InterPSS
DevTutorialwww.interpss.org
Introduction
ThisdevelopmenttutorialisintendedtohelpusersofInterPSStolearnInterPSSandhowtouseitbetter
andfaster.BackgroundknowledgeofbasicJavaprogrammingandsomeknowledgeofpowersystem
modelingandsimulationisrequired.ForthosewhosearenotthatfamiliarwithJavaprogrammingand
EclipseIDE,Itissuggestedthatyouspendoneortwoweeksonthosestufffirstandthencomebackto
thistutorial.TherearemanyonlinelearningmaterialforyouwhenyougoogleJavatutorialorEclipse
tutorial.Forexample:
Javalearning:http://www.learnjavaonline.org/
Eclipse:http://eclipsetutorial.sourceforge.net/totalbeginner.html
IfyouhavesomebackgroundinJavaandinterestedtolearnInterPSS,thenitisrightforyou.Thistutorial
willfirstguideyouthroughsettingupthedevelopmentenvironmentinChapter1.InChapter2,introduction
tothebasicpowersystemmodelsinInterPSSispresented.InthefollowingChapter3to5,themodeling
andsimulationalgorithminInterPSSfortypicalapplicationsarediscussed,includingpowerflow,short
circuitandtransientstability.InChapter6,integrationofInterPSSwiththeGAMS(ahighlevelmodeling
systemformathematicalprogrammingandoptimization)willbepresented,alongwithasimpleSCED
example.Foreachchapter,simpleapplicationexamplesiscreatedtohelpuserstohavebetter
understandingofthematerialinthechapter.Youareencouragedtocreateyourownstudycasebyfollowing
thoseexamples.
Tutorialexampleandcode
Thistutorialisaccompaniedbysimpleexamplesforeachchapter.Thecodeforallexamplesisavailableon
GitHub:https://github.com/InterPSSProject/ipsscommon/tree/master/ipss.tutorial.
DevTutorialwww.interpss.org
Chapter1.SettinguptheInterPSSDevelopment
Environment
InterPSSprojecthasbeentryingtocreateanewopenplatform,tosupportthenextgenerationpower
systemsimulationandanalysis.ThefoundationofthisplatformisInterPSScoreengine,whichincludesbut
notlimitedtopowersystemnetworkobjectmodelandpowersystemanalysisfunctions,e.g.,powerflow,
shortcircuitandtransientstability.
InterPSSnowsupportstwoversions,i.e.,cloudeditionanddevelopmentedition.Botheditionsrunonthe
samecoresimulationengine.InterPSScloudeditionrunsontheGooglecloudplatformandprovidespower
systemanalysisasaservice,24/7,anywhereintheworldwiththeInternetaccess.Formoreinformation,
pleasevisitwww.interpss.org.Thecloudeditionprovidesbasicanalysisfunctionsanditissimpletouse.
However,flexibilityandcapabilityofInterPSScoreengineisstillnotfullyexploited.Forthosewhowantto
haveabettercontrolofInterPSS,orcustomizeitfortheirapplications,InterPSSdevelopmenteditionis
recommended.ThedevelopmenteditionisbasedontheEclipseIDEandInterPSScorelibraries.
ThosefamiliarwiththeJavaprogrammingknowsthatbasicandcorejavafunctionsareprovidedinJava
systemlibraries.EachjavaprojectsshouldhaveareferencetotheseJRESystemlibrary.Similarly,for
powersystemsimulationandanalysiswithInterPSS,InterPSScorelibrariesandtheirdependentthird
partylibrariesarerequired.
PrerequisiteofInterPSSdevelopmentenvironmentisasfollows:
JavaEnvironmentSetup
MakesureyouhaveJavaSDKinstalledonyourcomputer.YoucancheckyourJavainstallationby
launchingaCMDwindowfromStart/run/cmd.Typethefollowingcommand
javaversion
tomakesurethatyourhaveJavaversionis1.7.xxorabove.
EclipseIDESetup
InterPSSiswritteninJava.InterPSSdevelopmentteamusesEclipseasthemainJavaIDE.Currently,
InterPSSusesEclipseKepler(4.3.1),whichcanbedownloadedfromwww.eclipse.org.Youcanusethe
"EclipseIDEforJavaDevelopers"version.
1.1 ImportInterPSSlibraryprojects
InterPSScorelibrariesandalldependentlibraries(*.Jar)arestoredinthefollowingGitHubrepository
https://github.com/InterPSSProject/ipsscommon
ThelibraryprojectscanbedownloadedfullyasaZIPfile(about60MB),orclonetothedesktopthroughGit
cloneasindicatedbythetwooperationbuttonsontherightbottom.
7
DevTutorialwww.interpss.org
Sometestcasesarealsoavailablewithintheipss.sampleprojectstoredintheipsspluginrepository
https://github.com/InterPSSProject/ipssplugin
Inthefollowingtwosubsections,twoapproachesofimportingtheInterPSScorelibprojectsand
ipss.sampleprojectintoyourworkingworkspaceofEclipsewillbeintroduced,andtheyare1)downloading
thewholerepositoryZipfileand2)clonetherepositoriesonGithubviaEclipseEGitplugin.
1.1.1Libraryrepositoryasazipfile
1)ClickontheDownloadZipbuttontodownloadazipfilecontainingallthethreelibprojects
2)Extract(unzip)theprojectsfromthedownloadedzipfile
3)Import>General>Existingprojectsintoworkspace
4)Followingthesameprocessasbeforetodownloadtheipss.sampleprojectfrom
8
DevTutorialwww.interpss.org
https://github.com/InterPSSProject/ipsspluginandrunthesamplecases.
1.1.2CloneLibraryprojectrepositoryviaEgit
(1)GitHubEclipseplugin
TheEGitpluginisavailablefromhttp://eclipse.org/egit/download/orEclipse>Help>Installnewsoftware
1)Selectoradd:WorkwithKeplerhttp://download.eclipse.org/releases/kepler
2)ChooseEclipseGitTeamrelatedinstallationsasshowninfigurebelow
3)Installandrestart
FortheuseofEGit,thefollowinguserguideisrecommended
http://wiki.eclipse.org/EGit/User_Guide
(2)ClonetherepositorytolocalPCandimporttheprojectsintoworkspace
1)GettheprojectHTTPScloneURLbycopyingtheURLtoclipboard
DevTutorialwww.interpss.org
InterPSSlibprojects:
https://github.com/InterPSSProject/ipsscommon.git
InterPSSpluginincludingtheipss.sampleproject:
https://github.com/InterPSSProject/ipssplugin.git
2)OpentheGitrepositoriesperspectivethroughEclipse>Window>Openperspective>Others>Git
RepositoryExploring
3)SelectCloneaGitrepositoryfromtheGitrepositoryperspective
Clonetheipsscommonandtheipsspluginrepositoriestoyourlocalstorage.Stepsforcloningthe
ipsspluginrepositorywillbeshownbelow,andtheprocessisthesameforipsscommonrepository.
10
DevTutorialwww.interpss.org
Note:Alwayschoosethecommon_libwhichmeanstheprojectbuildpatharelinkingtothecommon
libraryJars.
11
DevTutorialwww.interpss.org
ChooseLocalandthenselectIpssplugininthenextstep
12
DevTutorialwww.interpss.org
13
DevTutorialwww.interpss.org
Checkthebuildpathofipss.sampletomakesurealltherequiredlibsareloadedandthereisnoerrorinthe
[Problems]viewwindow.
14
DevTutorialwww.interpss.org
1.2 Runsampleloadflowtestcase
RightclicktheSampleLoadflow.javaandRunAs"JavaApplication"
Twobusloadflowresultisasfollows:
15
DevTutorialwww.interpss.org
Chapter2.Anintroductiontothepower
systembasicmodelsinInterPSS
AsJavalanguageistheprogramminglanguageadoptedbyInterPSS,theobjectorientedprogramming
(OOP)techniqueiswidelyusedinthedesignanddevelopmentofInterPSS.Asisknowntoall,oneofthe
mostbasicconceptinOOPistheobject.TounderstandInterPSS,andsubsequentlyextendInterPSSfor
yourownpurpose,itisimportanttobefamiliarwiththethreebasictypesofpowersystemmodelswithin
thecoreofInterPSS,andtheyarenetwork,busandbranch.FormoreinformationofOOPandInterPSS,
pleasereadthisIEEETransactionpaper"ObjectorientedProgramming,C++andPowerSystem
Simulation",IEEETransactionsonPowerSystems,Vol.11,No.1,pp.206215,1996
InterPSSfollowsthebusorientedconventiontorepresentthenetwork.Accordingly,Busisdefinedtostore
allinformation(definedasattributesofthebusclass)relatedtoabus,forexample,busIdandbusvoltage,
aswellasallcomponentsconnectedtoabus,e.g.,ageneratororacapacitor.Theotherbasicmodelis
branch.Itisusedtorepresentoverheadline,transformer(conventionaltwowindingtransformer,phaseshift
transformer).Specialtypebranches,currentlyincludingthreewindingtransformerandHVDCtransmission
lines,andseriesFACTsdevicesinthefuture,arestoredinanotherlistnamedspecialBranchList.Within
InterPSS,athreewindingtransformerisautomaticallyconvertedtothreetwowindingtransformers.
InFig.2.1,Thebusandbranchmutualreferencehelptodefinethetopologyofthenetworkasagraph:the
fromBusIdandtoBusIdofabrancharethetwoattributestorelatetwobusestoatwoterminalbranch,while
thebranchListofabusstorethebranchobjectsconnectedtothebusatthefromendandtoendofthe
branch,respectively.
Fig.2.1InterPSSnetworkmodel
16
DevTutorialwww.interpss.org
LetsfirstlookatthetwobussystemexampledefinedinthesampleLoadflow.javawithintheipss.sample
projectunderipss.plugin,asthisexamplegiveyousomeideaofthesethreetypesofobjectsandthey
togetherformsapowersystemnetworkobjectforloadflowanalysis.
publicstaticvoidsimpleLoadflow(IPSSMsgHubmsg){
//CreateanAclfNetworkobject
AclfNetworknet=CoreObjectFactory.createAclfNetwork()
doublebaseKva=100000.0
//setsystembasekvaforloadflowcalculation
net.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
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,whichstoresallbusesandbranchesofapower
systeminInterPSS.Thus,itshouldbecreatedattheverybeginning.
Busarecreatedlatterandthenbranch.Suchsequenceisimportantasabranchneedstoreferto
thebusobjectsconnectedattheterminalsinordertoproperlysetupthebusbranchconnection
relations,hencethebusobjectsmustbecreatedbeforeabranchtriestoreferorconnecttoit.
BothBusandBranchobjectsareaccessedandreferredtobytheirIDs,forexample,
AclfBusbus1=CoreObjectFactory.createAclfBus("Bus1",net)
net.addBranch(branch,"Bus1","Bus2").
WhereBus1andBus2aretheIDsofbus1andbus2,foridentificationpurpose.
Objectattributesand/orinformationissettotheobjectthroughthesettermethods
(network/bus/branch.setX(value))
NOTE:Thisexamplemaygivesomeofyouawrongimpressionthatitneedstowritethousandsoflinesof
codetocreateanetworkforlargepowersystems.ActuallyThereisanotheropenprojectcalledOpen
ModelforExchangingPowerSystemSimulationDatathatInterPSShasbeendevotingto.InterPSS
hasdevelopedODMbasedadaptersandmappertoimportavailablenetworkdatadefinedincommonly
useddataformat,suchIEEECDF,PSS/E,PowerWorld,PSDBPAformattocreateanetworkobjectin
InterPSS,Formoreinformation,pleaserefertoAppendixBIntroductiontoODM.
18
DevTutorialwww.interpss.org
Whyinheritance?
InheritanceisanimportantconceptforobjectsinOOP.Asubclass,orchildclass,canbederivedfrom
thebase,orparent,classthroughinheritance,suchthatthechildclasswillinheritalltheattributesand
methoddefinedthebaseclass.Withinheritance,wedonthavetorewriteallthecommonorsimilarpartsof
codeagainandagain.Thatiscommonlyknownascodereuseincomputerscience.
HowistheclassinheritancedesignedinInterPSS
Basedonthenatureofpowersystemanalysis,weknowthatthemostbasicinformationforrepresentinga
powersystemisthenetworktopology,aswellasbasicbusandbranchidentificationattributes.The
informationisrequiredforallpowersystemanalysis.Therefore,itisreasonabletoabstractthesebasic,
commoninformationandbehaviorintobasenetwork,busandbranchclasses.
Secondly,letslookatthecharacteristicsofthethreebasicpowersystemanalysisfunctions,i.e.,load
flow,shortcircuitcalculationorfaultanalysis,transientstabilitysimulation.Loadflowisthemostbasic
function,andbothshortcircuitanalysisandtransientstabilitysimulationrelyonloadflowdataandresults.
Thus,loadflowrelatedobjectsshouldbeonthesecondlevelofthehierarchystructure,fromwhichtheshort
circuitandtransientstabilityrelatedobjectsarederived.
Shortcircuit(SC)analysisusuallyrequiresloadflowresultstodeterminetheoperatingpoint.Further,
positivesequencenetworkdataforshortcircuitanalysisisgenerallythesameasthatusedinloadflow
study.Shortcircuitrelatedobjectscanandshouldreuseloadflowdataandmethodsbyinheritingtheload
flowobjects.Moreover,thenegativeandzerosequencedata,ifavailable,willbeincludedinthebusand
branchobjectsforshortcircuitanalysis.
Dynamicstability(DStab)simulationreliesontheloadflowdataforconstructingthenetworkadmittanceas
wellastheequationYV=Iandloadflowresultsfordeterminingtheprefaultsystemcondition.Duringthe
faultperiod,alsoitneedstoformthesequencenetworkandcalculatethepositivesequenceequivalentfault
impedanceatthefaultpointforunsymmetricalfaults.Consideringthatsuchfunctionisavailableinshort
circuitanalysis.Thusbothloadflowandshortcircuitanalysisshouldbereusedfordynamicstability.For
thebusobjectsforstabilityanalysis(DStabBus),detailedgenerator(machine)model,withthecontrollers
(exciter,governor,stabilizer)forthegeneratorbeingapartofthegeneratormodel,willbeincludedasa
componentinthebusobject.Branchclassforstabilityanalysis(DstabBranch)extendsfromthebranch
classforshortcircuitandaddsattributesandmethodsforrelayandprotectionsetting.
ThenetworkclassstructureinInterPSSisshownasfollows:
19
DevTutorialwww.interpss.org
Noteforthenaminginthefigureabove:
AclfACloadflow
AcscACshortcircuit
DstabDynamicstabilityorTransientstability
DistDistribution
Thebusandbranchclasshaveasimilarhierarchystructure,asfollows:
Bus<AclfBus<AcscBus<DStabBus
Branch<AclfBranch<AcscBranch<DstabBranch
wherethe<indicatesthatthelatterextendstheformer.
InterPSSemploystheseparatinginterfacefromimplementationclassconceptinternallywhen
implementingthethecorenetworkobjectsmentionedbefore.Forexample,abusisfirstdefinedasan
interface,whichdefinesallthepublicoperationsorAPIsaccessiblefromoutside,thenitisimplementedin
aseparateclass,i.e.,BusImpl.
20
DevTutorialwww.interpss.org
BasicNetwork
TheNetworkclassandthecorrespondingimplementationNetworkImplclassistoformthenetwork
topologywithbusList,theconnectionrelationshipamongbusesthroughbranches.
LoadflowNetwork
ThemajordifferencebetweenNetworkandAclfNetworkisthatallthebusesandbranchesobjects
containedinAclfNetworkobjectmustbeoftypeAclfBus/AclfBranchclassoritssubclass,whichmeans
theycontainalltheinformationrequiredforloadflowanalysis.
Also,theadmittancematrix,orYmatrix,andJacobianmatrix,asthebasicunderlyingdatastructureforload
flowanalysis,areformedintheAclfNetwork.
ShortCircuitNetwork
BaseAcscNetworkandAcscNetworkclassisforshortcircuitanalysis.BaseAcscNetworkisextended
fromtheBaseAclfNework,themajordifferenceisthatsequencenetworkadmittancematrixcanbeformed
andaccessedinAcscNetwork,besidesalltheAclfNetworkoperations.Busesandbranchesinthe
AcscNetworkareofAcscBusandAcscBranchtype.Thesequencenetworkdata,includingsequence
impedanceofgenerators,equivalentimpedanceoradmittanceofloadandsequenceimpedanceof
branches,shouldbeprovided.
TransientstabilityNetwork
DStabilityNetworkclassisfortransientstabilityanalysis.allthebusesandbranchesobjectscontainedin
thisobjectmustbeoftypeDStabBus/DStabBranch.Themainfunctionsofthisclassincludenetwork
initializationandsolvingnetworkdynamicequationduringsimulation.
2.3.2 Bus
Recalltheclassstructure,Bus<AclfBus<AcscBus<DStabBus.Businterface(andBusImplclass)is
thebasicclassforabus,andbusId,baseVoltage.
Thebusmodelforloadflow,shortcircuitandtransientstabilityisshowninFig.2.3.Abusobjectcontainsa
genListandloadListtostorethegeneration/loadinformation,whichmeansmultiplegeneratorsandloads
areallowedtoconnecttothesamebus,withdifferentIDforeachgenerator/load.Inaddition,thereisat
mostonefixedshuntandoneswitchedshunt.Abusisconnectedtootherbusesthroughlineor
transformer.TheBranchListofabusstoresallthebranchesconnectedtoit.
21
DevTutorialwww.interpss.org
Forshortcircuitanalysis,sequencenetworkdataforgeneratorandloadconnectedtothebusisrequired.
Fortransientstability,detaileddynamicmodeldataofthegenerators,ifany,isrequired,dynamicload
modeldatawillalsobenecessaryifdynamicsoftheloadsaretobeincludedinthesimulation.
Fig.2.3BusmodelinInterPSS
2.3.3 Branch
Overheadlineandundergroundcable,transformersaretreatedasanabstractBranchinanetwork,which
connectstwoormorebuses.SoBranchisthebasicclassforalltheseconnectiontypecomponentsinthe
powersystems.ThebasicattributesforabrancharethefromBus,toBus(tertBusifitisathreewinding
transformer).
OverheadlinesandundergroundcablesaremodeledbytheLineclassinInterPSS.Transformersinpower
systemsincludetwowindingtransformerandthreewindingtransformer,andtheyaremodeledseparately.
InternallyonethreewindingtransformerismodeledbythreetwowindingtransformerthroughYDelta
transformation.
Fig2.4LinemodelinInterPSS
22
DevTutorialwww.interpss.org
Fig2.5TwowindingtransformermodelinInterPSS
Fig2.6ThreewindingtransformermodelinInterPSS
Line
AclfBranch<AcscBranch<DStabBranch
|||
|||
AclfLine<AcscLine<DStabLine
Theobjectsonthesecondrowareobjectadaptersofthecorrespondingobjectonthefirstrow.Thefirstrow
isthegeneral.Formoreinfoaboutsuchimplementation,pleaserefertotheadapterpattern.
Intheexamplebelow,thereissuchalinerelatedtothisadapterpattern:
//adapttheabstractbranchobjecttoaspecificlinebranchobject
AclfLinelineBranch=branch.toLine()
Transformer
twowinding
AclfBranch<AcscBranch<DStabBranch
|||
|||
AclfXformer<AcscXformer<DStabXformer
threewinding
Aclf3WBranch<Acsc3WBranch<DStab3WBranch
23
DevTutorialwww.interpss.org
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.,those
outofservicebranchesarenotincluded.
getBranch(StringbranchId)
getaspecificbranchbyitsid
addBranch(AclfBranchbranch)
addanewbranchtothenetwork
getBranchList()
Returnalistofbranchobjectswhichhavetwo
terminals
NOTE:accessingabus/branchobjectfromanetworkobjectisusedquiteoften,andthemethodviathe
bus/branchIdisrecommendedtouse.
2.4.2 Bus
Getandsetbusvoltages
getVoltage()
getVoltage(UnitType)
setVoltage(Complexvolt)
setVoltage(Complexvolt,UnitTypetype)
getandsetvoltageasacomplex,voltageunitType
canalsobeused
24
DevTutorialwww.interpss.org
getVoltageMag()
getVoltageMag(UnitType)
setVoltageMag(doublevolt)
setVoltageMag(doublevolt,UnitTypetype)
getandsetvoltagemagnitudeasadouble,voltage
unitTypecanalsobeused
getVoltageAng()
getVoltageAng(UnitType)
setVoltageAng(doublevolt)
setVoltageAng(doublevolt,UnitTypetype)
getandsetvoltageangleasadouble,voltage
unitType(e.g.,V,kV,pu)canalsobeused
Getandsetbusgenerationdata
getGenCode()
setGenCode(AclfGenCodegenCode)
fourstypesofGenCode:Swing,PV,PQand
NoneGen
isGen()
isSwing()
isGenPV()
isGenPQ()
checkthebustype,basedonthegenerationcode.
getGenList()
getGenerator(StringgenId)
Multiplegeneratorconnectintothesamebusis
supported.
Thefirstmethodgetsallthegeneratorconnected
tothebusandreturnasalist
Thesecondonegetaspecificgeneratorbyitsid
get/setGen()
get/setGenP()
get/setGenQ()
1)ForSwingbus,genPusedtostoreVoltMag,
genQusedtostoreVoltAng
2)ForPVbus,genPusedtostoregenP,genQ
usedtostoreVoltMag
3)ForPQbus,genPusedtostoregenP,genQ
usedtostoregenQ
getGenResult()
gettheeffectivepowergenerationatthebus.
Getandsetbusloaddata
getLoadCode()
setLoadCode(AclfLoadCodeLoadCode)
tourstypesofLoadCode:Swing,PV,PQand
NoneLoad
isLoad()
checkifthereisanyloadatthebus
getLoadList()
getLoad(StringloadId)
getalltheloadconnectedtothebusandreturnas
alist
getaspecificloadbyitsid
get/setLoad()
get/setLoadP()
getthetotalinserviceloadofthebusincomplex
form,orrealandreactivepoweroftheload.
25
DevTutorialwww.interpss.org
get/setLoadQ()
getLoadResult()
gettheactualloadatthebusconsideringtheload
typeandbusvoltageatthemoment.
Getconnectedbranchesofabus
getBranchList()
getFromBranchList()
getToBranchList()
returnalltheconnectedbranchesasalist,orthe
brancheswhichareconnectedtothisbusatthe
fromendorthetoend(putitanotherway,the
brancheswhosetromend/toendterminalisthis
processingbus).NOTE:Threewinding
transformerisalsoconsideredinthis
operation.
nNonGroundBranchConnected(boolean
inclActiveOnly)
Thenumberofthetotalconnectedbrancheswhich
areNOTgroundbranch,orconnectedtothe
ground,forexample,shuntcapacitorbranch.
nBranchConnected
thenumberofthetotalconnectedbranches
noConnectedBranch(AclfBranchCodetype)
Thenumberofthetotalconnectedbranchesofa
certaintype.
SortNumber
Certaintypeofsortingalgorithm(includingTinney1,2and3,andTinney2isthedefault)isusuallyapplied
toarrangetheinternalsequenceofthebusesforloadflowandshortcircuitanalysis,andthena
sortNumberisassignedtoeachbusafterapplyingthesortingalgorithm,bothactiveandinactive
(outofservice).ThissortNumberhelpsgetaccesstotheinternalstorageofAdmittancematrix,Jacobian
matrixandthenetworkequationsolutionresults.
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
DevTutorialwww.interpss.org
set/getToBus
set/getFromBusId
set/getToBusId
set/getthefromortobusId.
Branchimpedanceandadmittance
set/getZ()
branchimpedanceZ=r+j*x
getY()
admittanceY=1/Z
get/setFromShuntY()
get/setToShuntY()
shuntadmittanceatthefromsideandtosideof
thebranch
get/setHShuntY()
halfofthetotalbranchshuntadmittance
Tapratioandphaseshiftanglefortransformer
get/setFromTurnRatio()
get/setToTurnRatio()
get/setTertTurnRatio()[forthreewinding
transformeronly]
InterPSSsupporttodefinethetapratioatboth
sides
get/setFromPSXfrAngle()
get/setToPSXfrAngle()
phaseshiftangleatthefromsideandtoside
2.4 Example
TheexampleintroNetworkObjectSample.javaunderthech2_introfolderofthetutorialpackageservesto
helpusersanddeveloperstolearnhowthemodelsintroducedbeforeareusedinnetworkcreationandbus
dataextraction.Withinthesample,youwillgothroughcreatingasimple2busnetworkandtooutputthe
busdatafollowingspecifictxtformat,withtheInterPSSCoreAPI.
Thenetworkcreationpartinthisexampleisthesameasthatprovidedinthischapterbefore,soitisnot
replicatedhere.ThefollowingbusOrientedOutPut()methodistooutputthebusvoltage,generationand
loadandthepowerflowtoconnectedbuses.
privatestaticStringbusOrientedOutPut(AclfNetworknet,AclfBusbus){
StringBufferstr=newStringBuffer("")
str.append("
\n")
str.append("BusIDBusVoltageGenerationLoad
ToBranchP+jQXfrRatioPSXfrAng\n")
str.append("baseKVMag/puAng/deg(mW)(mVar)(mW)(mVar)
BusID(mW)(mVar)(kA)(From)(To)(from)(to)\n")
27
DevTutorialwww.interpss.org
str.append("
\n")
doublebaseKVA=net.getBaseKva()
AclfGenBusAdaptergenBus=bus.toGenBus()
//getthegenerationandload
ComplexbusGen=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
offline
for(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.0
AclfBustoBus=null
if(bra.isActive()){
//todeterminewhetherthebusisatthefromortoendofthe
branch.
if(bus.getId().equals(bra.getFromAclfBus().getId())){
toBus=bra.getToAclfBus()
//powertransferfromfromendtotoendofthe
branch
pq=bra.powerFrom2To(UnitType.mVA)
28
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)+"")
else
str.append("")
if(toRatio!=1.0)
str.append(Number2String.toStr("0.0###",toRatio))
29
DevTutorialwww.interpss.org
else
str.append("")
if(bra.isPSXfr()){
if(fromAng!=0.0)
str.append(""+Number2String.toStr("##0.0",
fromAng))
else
str.append("")
if(toAng!=0.0)
str.append(""+Number2String.toStr("##0.0",
toAng))
else
str.append("")
}
str.append("\n")
}else{
str.append("\n")
}
}
}
returnstr.toString()
AsyouhavelearntthebasicandcoremodelsofInterPSS,youcanrollupsleevesandstartto
playwithInterPSS!
30
DevTutorialwww.interpss.org
Chapter3.Powersystemloadflow
analysis
Introduction to power system load flow
Thegoalofapowerflowstudyistoobtaincompletevoltageangleandmagnitudeinformationforeachbusin
apowersystemforspecifiedloadandgeneratorrealpowerandvoltageconditions.Forthegeneratorbuses,
theexactvoltageanglesarenotprovidedandaretobedetermined.Generallyspeaking,thevoltage
magnitudeandtheactivepowergenerationoutputareassumedtobeknownandkeptconstantduringthe
solution.Consideringthenonlinearrelationshipbetweenvoltageandpower,loadflowproblemisanonlinear
problembynature,numericalmethodsareemployedtoobtainasolutionthatiswithinanacceptable
tolerance.Oncethebusvoltagemagnitudesandanglesareknown,realandreactivepowerflowoneach
branchaswellasgeneratorreactivepoweroutputcanbedetermined.
Bustype
Basedonthecharacteristicsofthebusesinthepowersystem,theyareusuallycategorizedintothree
types,namely,Swingorslackbus,PQbusandPVbus.Theywillbeexplainedwitha5bussystemshown
inFig.3.1.
Swing/slackbus:Withinoneinterconnectedpowersystem,areferencebusangleisrequiredtodetermine
theangleoftherestofbuses,analogoustoareferencezerovoltagepointinanelectriccircuit.Also,asthe
totalgeneration=totalload+totallossinthesystem.Thelosscannotbeexactlydeterminedbeforethe
loadflow,thusgenerationoutputofatleastonebusneedtobedeterminedbytheloadflowtocoverthe
systemloss.Thisbusiscalledslackbus.Forthesakeofconvenience,bothswingandslackbusare
combinedandmodeledbyonebuswith(large)generatorconnectedtoit.Thebusvoltagemagnitudeand
voltagemustbepredefined(usuallytheangleissettobezerodegree).Inthe5bussystem,therearetwo
busesthathasgenerator,thuseitheronecanbechosentobetheswingbus.SupposetheBus5is
selectedastheswingbus.
Fig.3.1Onelinediagramofa5buspowersystem
PQbus:PQmeansthebusnetpowerinjectionintothenetworkisconstant,orasastaticfunctionofthe
voltage.Thisisusuallyusedtomodelthesubstationservinglocalloadsoraconnectionpointinthesystem
withoutanygenerationorload.Thus,Bus1,Bus2andBus3arePQtypebus.
31
DevTutorialwww.interpss.org
PVbus:therealpowerPandvoltagemagnitudeVareknownforthiskindofbus.Thisisusuallyusedto
modelthebuswithgeneratorconnectedtoit.Sometimeabuswhosevoltageiscontrolledbyalocalor
remotereactivesourcecanalsomodeledasaPVbus.Bus4isaPVtypebus.
Networkdata
Busdata,includingloaddataandgenerationdata.
Branchdata,usuallyincludingbothlinesandtransformers
Otheroptional:HVDC,switchedshunt
BaseMVAAlltheperunitinthesystemforloadflowstudyisbasedonthesystembaseMVA,
whichisusuallysettobe100MVA
Areadata,optional:Foralargepowersystemwithmultipleareas,areapowerinterchangedata
shouldbeprovided.
Zonedata,optional
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)mustbedefinedanditisassumedtobe
constant.
Fig.3.2AclfBusmodelinInterPSS
32
DevTutorialwww.interpss.org
Fixedshuntdata:Itcanbeafixedrectororshuntcapacitor.TheVarcanbespecifiedinPU(on
systemMVArating)orMVAR=V^2*Bsh,Bshisthebusfixedshunt.
Switchedshunt:theinitialshunt,andtheavailablevarbanksdataisneeded.
Basicbranchdata:fromBus,toBus,impedanceZ,branchtype
Transmissionline/cable:modeledasequivalentPImodel.Shuntadmittanceisrequiredbesidesthe
basicbranchdata
Transformer
Twowindingtransformer:tapratioisrequired,forphaseshiftingtransformer,the
phaseshiftingangleisneeded.
Threewindingtransformer:tapratiooneachwindingisrequired,windingequivalent
impedanceZ12,Z23,Z13shouldalsobeprovided.
Forfurtherreading,pleaserefertotheIEEECommondataformatdocument,andfindouthowthesedata
aredocumentedandprovided.
PleasenotethatInterPSSitselfdoesnothaveorlimittoaspecificdataformatfordefiningthedatarequired
forloadflowanalysis.Instead,itsupportsthosewidelyusedintheindustry,e.g.,IEEECDF,PSS/E,
PowerWorld,UCTEandBPA,throughtheadaptersdevelopedundertheOpenDataModel(ODM)project.
33
DevTutorialwww.interpss.org
Model
Details
Generation
onegeneratorormultiplegeneratorsareallowedtoconnectedtoabus.
Whentherearemorethanonegenerators,theywillbemergedtoan
equivalentgenerator,whosegenPisthetotalrealpoweroutputofall
generators.
Load
oneload,ormultipleloadsareallowedtoconnectedtoabus.constant
power,constantcurrent,constantimpedanceandZIPtypeofloadsare
supported
Branch
line,twowindingtransformerandphaseshifttransformer,3winding
transformer.
SwitchedShunt
supportedswitchedshuntupto8Varbanks,withthreecontrolmodes:Fixed,
DiscreteandContinuous
Transformercorrection
table
compatibletothePSS/Emodel
HVDC
canbemodeledincoreengine,butnotsupportedintheloadflowalgorithm
yet
FACTs
canbemodeledincoreengine,butnotsupportedintheloadflowalgorithm
yet
[A]x[x]=[B]
3.3.1 Newton-Raphson
NewtonRaphson(NR)isthedefaultsolutionmethodinInterPSS.TheNRimplementationusespolar
coordinates.JacobianmatrixcanbeformedbycallingaclfNetwork.formJMaxtrix().Thematrixis
representedbytheSparseEqnMatrix2X2classinInterPSS.Formoreinformationofthesparsematrixused
inInterPSS,pleaserefertotheAppendixA.ThestructureoftheJacobianmatrixisshownasfollows:
34
DevTutorialwww.interpss.org
Powerintothenetworkisdefinedasthepositivedirectionwhencalculatingthepowermismatch
(dP,dQ)
Foreachbus,itselementsintheJacobianmatrixisalwaysrepresentedbya2X2blockmatrix
[dP_dangdP_dV]
[dQ_dangdQ_dV]
This2X2blockmatrixisrepresentedasMatrix_xyclassinInterPSS,whichhasthefollowing
structure
[xxxy]
[yxyy]
Thus,foracertainbus,ifthecorrespondingMatrix_xyisobtained,thendP_dAng=Matrix_xy.xx,
dP_dV=Matrix_xy.xy
BusarrangementisoptimizedbeforeformingtheJacobianmatrix
Thepositionofthevector[dPi,dQi]ontherighthandsideoftheequationmustbeconsistentwith
the2X2submatrixwiththeJacobianmatrix.Inaddition,botharearrangedaccordingtothebus
internalsortNumber.
Forthepurposeofcustomization,itisdesirabletoaugmenttheoriginaljacobianmatrixinordertoinclude
extraequationsforanewmodelorcontrolstrategy.Forsuchrequirement,extradimensionscanbeadded
attheendoftheJmatrixwhencallingtheformJMatrix(n,msg)method,asshowninthefollowing
equation.Whenn=1,tworowsandtwocolumns(tobeconsistentwiththeinternal2X2blockstorage
scheme)willbeaddedontherightandbottomoftheoriginalJacobianmatrix.Theextracolumnsandrows
couldbeusedtoimplementnewmodel,forexample,SVC.
ToimplementacustomNRmethod,firststepistocreateacustomNRsolverclass,extendingthe
DefaultNrSolverclassandoverridingthethreemethods.TheDefaultNrSolverhasmethodstobuildthe[J]
partandassociateditemsintherighthandsideofeqn(1)( Pi, Qi ),whichshouldbeinherited.
35
DevTutorialwww.interpss.org
TheDefaultNrSolverclassdefinestheframeworkforcustomization.Therearethreemethodstooverride.
classCustomNrSolverextendsDefaultNrSolver{
publicCustomNrSolver(AclfNetworknet){
//ReusetheconstructoroftheDefaultNrSolverclass
super(net)
}
/**
*formJMatrixmethodiscalledatthebeginningofeachNRiteration
*/
@Override
publicSparseEqnMatrix2x2formJMatrix(IPSSMsgHubmsg){
//createnetworkJmatrixwithnextradimension
intn=1
SparseEqnMatrix2x2lfEqn=getAclfNet().formJMatrix(n,msg)
//atthispointtheoriginalpowernetworkJmatrixisalreadystored
//inthelfEqn.Youcanaddextraelementshere
returnlfEqn
}
/**
*setPowerMismatchmethodiscalledatthebeginningofeachNR
iterationtocalculatethepowermismatchtoupdatethevectoronthe
righthandsideoftheequation
*/
@Override
publicvoidsetPowerMismatch(SparseEqnMatrix2x2lfEqn){
//calculatebuspowermismatch.Themismatchstoredon
//therighthandsideofthesparseeqn
super.setPowerMismatch(lfEqn)
//atthispoint,buspowermismatchalreadystoredinB[1,n].You
//addextradatatotherighthandsideoftheeqn
}
/**
*updateBusVoltagemethodiscalledatattheendofeachNRiteration,
*afterthesparseeqnhasbeensolved.Theresultsofthesparseeqn
*solutionisstoredinthesparseeqn.
*/
@Override
publicvoidupdateBusVoltage(SparseEqnMatrix2x2lfEqn){
//updatethebusvoltageusingthesolutionresultsstoreinthe
//sparseeqn
super.updateBusVoltage(lfEqn)
//thesolutionresultoftheextravariabledefinedisstoredat//B[n+1...]
}
}
Asforthepartofnewlyaddedcolumnsandrows,whichiscorrespondingthederivationofexistingbusand
thenewlyaddedvariables,ifany,elementsareoftypeMatrix_xyandareassociatedwithbusobject.You
36
DevTutorialwww.interpss.org
needtousebus.sortNumbertodecidetheelementpositioninthematrix,sincethebusnumberhasbeen
optimizedtominimizethenonzerofillinsintheLUdecomposition.Thefollowingaresomesamplecode:
Matrix_xym=newMatrix_xy()
m.xx=//definetheelementvalues
m.xy=
Stringid=...//getbusidassociatedwiththeelement
Busbus=aclfNet().getBus(id)
inti=bus.getSortNumber()//getbussortNumber
n=aclfNet.getNoBus()//Jmatrixdimension
lfEqn.setAij(m,i,n+1)//n+1pointtothelastcolumn.
ThenthecustomNRsolverclasscanbeusedtooverridethedefaultNRsolverintheLoadflowAlgorithm
object.
AclfNetworkaclfNet=...//assumewehaveanAclfNetworkobject
//createaLoadflowalgoobject
LoadflowAlgorithmalgo=CoreObjectFactory.createLoadflowAlgorithm(msg)
//setalgoNRsolvertotheCustomNrSolver
algo.setNrSolver(newCustomNrSolver(aclfNet))
//applythealgototheaclfNetobjecttorunLoadflowanalysis.
aclfNet.accept(algo)
P/V = [B1]
Q/V = [B11]V
whereB1andB11matrixcanbeformbyaclfNetwork.formB1Matrix()andaclfNetwork.formB11Matrix(),
respectively.
Thissolutionalgorithmcanbeusedbysettingthemethodofloadflowalgorithm:
LoadflowAlgorithmalgo=CoreObjectFactory.createLoadflowAlgorithm(net)
algo.setLfMethod(AclfMethod.PQ)
DevTutorialwww.interpss.org
setMaxIterations()
maximumiterationnumber
setTolerance()
toleranceinpu.
setInitBusVoltage()
Thisconcernswhetherflatstart(busvoltage
magnitude1.0,angle0degree)isenabled.
IftheinitBusVoltagesettobetrue,thenflatstart
willbeused.
setLfMethod()
NR,PQ(Fastdecoupled)arerecommended.
setNonDivergent(boolean)
settruetousethenondivergentsolutionmethod
bysolvingtheloadflowwithoptimalacceleration
factorFasfollows: x(k + 1) = x(k) + F * x
3.6 Example
3.6.1 Run load flow and output result
packageorg.interpss.tutorial.loadflow
importorg.interpss.CorePluginObjFactory
importorg.interpss.IpssCorePlugin
importorg.interpss.display.AclfOutFunc
importorg.interpss.fadapter.IpssFileAdapter
importcom.interpss.CoreObjectFactory
importcom.interpss.common.exp.InterpssException
importcom.interpss.core.aclf.AclfNetwork
importcom.interpss.core.algo.LoadflowAlgorithm
publicclassIEEE9BusLoadFlow{
publicstaticvoidmain(String[]args)throwsInterpssException{
//InitializeloggerandSpringconfig
IpssCorePlugin.init()
//importIEEECDFformatdatatocreateanetworkobject
38
DevTutorialwww.interpss.org
AclfNetworknet=CorePluginObjFactory
.getFileAdapter(IpssFileAdapter.FileFormat.IEEECDF)
.load("testData/ieee/009ieee.dat")
.getAclfNet()
//createaloadflowalgorithmobject
LoadflowAlgorithmalgo=CoreObjectFactory.createLoadflowAlgorithm(net)
//runloadflowusingdefaultsetting,whichusestheNRmethod
algo.loadflow()
//outputloadflowresult
System.out.println(AclfOutFunc.loadFlowSummary(net))
}
}
packageorg.interpss.tutorial.loadflow
importorg.apache.commons.math3.complex.Complex
importorg.interpss.IpssCorePlugin
importorg.interpss.display.AclfOutFunc
importorg.interpss.numeric.datatype.Matrix_xy
importorg.interpss.numeric.sparse.ISparseEqnMatrix2x2
importcom.interpss.CoreObjectFactory
importcom.interpss.core.aclf.AclfNetwork
importcom.interpss.core.algo.LoadflowAlgorithm
importcom.interpss.core.algo.impl.DefaultNrSolver
importcom.interpss.simu.util.sample.SampleCases
publicclassCustomLoadFlowExample{
/**
*DefineacustomNRsolver
*
*/
staticclassCustomNrSolverextendsDefaultNrSolver{
publicCustomNrSolver(AclfNetworknet){
super(net)
}
/**
*formJMatrixmethodiscalledatthebeginningofeachNRiteration
*/
@Override
publicISparseEqnMatrix2x2formJMatrix(){
//createnetworkJmatrixwithoneextradimension
39
DevTutorialwww.interpss.org
//suchthatuptotwoaddtionalequationscanbeconsidered
//andincludedintheaugmentedJacobianequations.
ISparseEqnMatrix2x2lfEqn=aclfNet.formJMatrix(1)
//createa2x2matrixelement
Matrix_xym=newMatrix_xy()
m.xx=2.0
m.xy=0.0
m.yx=0.0
m.yy=2.0
//setthematrixelementtoJmatrix
intn=aclfNet.getNoBus()
//indexis0based,whichmeanstheindexoriginallyis
//0,1...n1,nowthelastelementindexisn
lfEqn.setA(m,n,n)
returnlfEqn
}
//thisisdummyvariableforsettingtheextramismatchfield
privatedoublemis=1.0
/**
*setPowerMismatchmethodiscalledatthebeginningofeachNR
*iteration
*/
@Override
publicvoidsetPowerMismatch(ISparseEqnMatrix2x2lfEqn){
//calculatebuspowermismatch.Themismatchstoredon
//therighthandsideofthesparseeqn
super.setPowerMismatch(lfEqn)
//definea2x1vector
Complexb=newComplex(1.0,1.0)
//setthevectortotherighthandsideofthesparseeqn
intn=aclfNet.getNoBus()
//Again,indexis0based,whichmeanstheindexoriginallyis
0,1...n1,andnowthelastelementindexisn
lfEqn.setB(b,n)
}
/**
*updateBusVoltagemethodiscalledatattheendofeachNR
iteration,afterthesparseeqnhasbeensolved.Theresults
ofthesparseeqnsolutionisstoredinthesparseeqn.
40
DevTutorialwww.interpss.org
*/
@Override
publicvoidupdateBusVoltage(ISparseEqnMatrix2x2lfEqn){
//updatethebusvoltageusingthesolutionresults
//storeinthesparseeqn
super.updateBusVoltage(lfEqn)
//thesolutionresultoftheextravariabledefinedis
//storedatB(n)
intn=aclfNet.getNoBus()
System.out.println("mis:"+this.mis+">"+
lfEqn.getX(n))
//reducethedummyvariablesothattheloadflowcanconverge
this.mis*=0.1
}
}
publicstaticvoidmain(Stringargs[]){
//InitializeloggerandSpringconfiguration
IpssCorePlugin.init()
//createasample5bussystemforLoadflow
AclfNetworknet=CoreObjectFactory.createAclfNetwork()
SampleCases.load_LF_5BusSystem(net)
//System.out.println(net.net2String())
//createaLoadflowalgoobject
LoadflowAlgorithmalgo=
CoreObjectFactory.createLoadflowAlgorithm()
//setalgoNRsolvertotheCustomNrSolver
algo.setNrSolver(newCustomNrSolver(net))
//runLoadflow,thecustomNRLoadflowalgorithmisregarded
//asavisitor
net.accept(algo)
//outputloadflowcalculationresults
System.out.println(AclfOutFunc.loadFlowSummary(net))
}
41
DevTutorialwww.interpss.org
Chapter4.Shortcircuitanalysis
Introduction to short circuit analysis
Superpositionmethod
Thebasicassumptionofshortcircuitisthat,duringtheveryshortperiodofinterest(rightafterthefault),the
faultcurrentcontributingsources,mainlygeneratorsandinductionmotors,canberegardedasconstant
voltagesourcesbehindtheircorrespondingimpedances(usuallyeithertransientorsubtransientimpedance
willbeused).Thevoltagesourceareknown,eitherbasedontheloadflowsolutionorregardedasflat(vmag
=1.0pu).Further,theloadsareallconvertedtotheconstantimpedances.Withtheseassumptionand
simplification,thenetworkisabasicallyalinearcircuit.Fromtheelectriccircuitcourse,welearntthatthe
superpositiontheoremisvalidforlinearcircuitanditisapowerfultooltoanalysisthiskindofcircuit.
Basedonthesuperpositionmethod,thetotaleffectofnetworkunderthefaultcouldbeseparatedintotwo
parts:1)theeffectofnormaloperationand2)theeffectofthefaultcurrent,whichisillustratedinFig.4.1.
(Vactual)(Vnormal)(Vfault)
Fig.4.1Superpositionmethodforshortcircuitanalysis
Withthismethod,busvoltageiscalculatedby
Vactual=Vnormal+Vfault
whereVnormalistheprefault,normaloperationvoltage,Vfaultisthebusvoltagewiththeonlysourceinthe
systemisthefaultcurrentinjectionathefaultpoint.
Regardingthecalculationofthefaultcurrent,itcanbedirectlycalculatedthroughnetworksolutionfor
balancedfaults.Forunsymmectricalfaultitisbasedonthesymmetricalcomponentandthepositive
sequenceequivalentmethod,whichwillbediscussedinthefollowing.
Symmetricalcomponentmethod
Inthepaper[1],Fortescuefoundthatasystemofthreeunbalancedphasorscanbetransformedintotwo
setsofbalancedphasorsandanaddItionalsetofphasors,whichareidentical.Thesethreesetsofphasors
areknownaspositive,negativeandzerosequencecomponents.Undertheconditionofthreephase
symmetricimpedance,thethreecomponentsofthenetworkaredecoupled,whichmeanstheycanbe
analyzedseparately.Mostoftheactualpowersystemssatisfysuchcondition,thus,thethreecomponent
methodsiswidelyused.Basedonthefaultpointboundarycondition,thethreesequencenetworksarebuilt
andconnected.Furthermore,thevoltagesourcesonlyexistinpositivesequencenetwork,whilethereisno
42
DevTutorialwww.interpss.org
voltagesourceinnegativeandzerosequencenetwork,thusbotharepassivecircuitnetworks,andcanbe
treatedasequivalentimpedanceviewedatthefaultpointofthepositivesequencenetwork.Thisisthe
socalledpositivesequenceequivalentmethod.
Formoreinformationofthesequenceimpedanceofeachmodelandbuildingofsequencenetwork,please
refertothefollowingreferencesforshortcircuitanalysis:
English:P.M.Anderson,Analysisoffaultpowersystems
Chinese:(2/3)
Model
Positivesequence
Negativesequence
Zerosequence
Generator
positivesequence
impedance
Generatorsubtransient
ortransientimpedance
canbeusedhere
Sameasthepositive
sequenceunless
otherwisespecified
Sameasthepositive
sequenceunless
otherwisespecified.
However,usuallyitis
lessthanpositive
sequence.
Load
Alltheloadsare
convertedtoconstant
impedancebasedon
thebusvoltage.
Sameasthepositive
sequenceunless
otherwisespecified
zerobydefault(dueto
theDeltaWye
connectionof
distributiontransformer),
unlessotherwise
specified
Nontransformer
sameastheloadflow
data
Sameasthepositive
sequenceunless
otherwisespecified
zeroimpedanceis
2.53.5timesofthe
positiveimpedance
*zerosequencemutual
impedancebetweentwo
parallellinesisnot
supportedyet
Transformer
sameasdefinedinthe
loadflowdata
ImpedanceisSameas
thepositivesequence
unlessspecified
Phaseshiftangle
becomeopposite
Attentionmustbepaid
tothetransformer
windingconnection.
Theconnectionand
groundinginfomustbe
provided.
ifzerosequencepath
available,zero
impedanceissameas
thepositiveimpedance
43
DevTutorialwww.interpss.org
Switchshunt
sameasdefinedinthe
loadflowdata
Sameasthepositive
sequenceunless
otherwisespecified
zerobydefault,unless
otherwisespecified
HVDC
regardedasopenor
converttoequivalent
loadatterminals
zerobydefault,unless
otherwisespecified
Note:Currently,InterPSSsupportsthesequencedatainputwithPSS/EV30format,whichisusedinthe
secondexampleinSection4.5.AsamplesequencedataofIEEE9Busisprovidedinthe
org.interpss.tutorial/testdata/psse/IEEE9Bus(download)
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*Zlg
Note:
Zlg:Phasetogroundimpedance
Zll:TotalphasetophaseimpedanceforLinetoLinefault.
zdd0:Thezerosequenceequivalentimpedanceviewedatthefaultpoint
zdd2:Thenegativesequenceequivalentimpedanceviewedatthefaultpoint
Negativeandzerosequencecurrenti2andi0arecalculatedbasedonpositivesequencevoltagev1onthe
44
DevTutorialwww.interpss.org
faultpoint.
Method1:AcscInputUtilFuncandAPI
//createanacscBus
AcscInputUtilFunc.addScNonContributeBusTo(net,IdPrefix+"1","Bus1",13800,1,
1)
//createanacscBranch
AcscBranchbra=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)methodin
Acsc5BusExample.Java
Note:Asallthedataissetbycoding,Thismethod,ifdirectlyused,issuitablefordefiningasmallsystem.
However,youmayusetheAPIsanddevelopyourcustomizeddataimporter,toloaddatafromcsv,excelor
anyotherformatdatafiletocreateanAcscnetwork.
Method2:PSSEAdapter
AnexampleofusingthePSSEAdaptertoimportandcreateanACSCnetworkobjectisprovidedbelow:
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
DevTutorialwww.interpss.org
Hereisanexampleofdefininga3phasebusfault:
AcscBusFaultfault=CoreObjectFactory.createAcscBusFault("Bus4",acscAlgo)
fault.setFaultCode(SimpleFaultCode.GROUND_3P)//faulttype
fault.setZLGFault(newComplex(0.0,0.0))//faultimpedancezlg
fault.setZLLFault(newComplex(0.0,0.0))//faultimpedancezll
Example:
//prefaultprofile:solvedpowerflow
acscAlgo.setScBusVoltage(ScBusVoltageType.LOADFLOW_VOLT)
acscAlgo.calculateBusFault(fault)
Faultcurrent:eitherabcor012coordinate
fault.getFaultResult().getSCCurrent_012()
Busvoltage:eitherabcor012coordinate
fault.getFaultResult().getBusVoltage_012(Bus)
4.5 Example
Thecorrespondingcodeoftheexamplesisprovidedinthech4_shortcircuitpackageofthetutorialproject
4.5.2 Short circuit analysis with load flow and sequence data
SeetheexampleofIEEE9Bus_Acsc_test.java
Reference:
46
DevTutorialwww.interpss.org
[1]Fortescue,CharlesL."Methodofsymmetricalcoordinatesappliedtothesolutionofpolyphase
networks."AmericanInstituteofElectricalEngineers,Transactionsofthe37.2(1918):10271140.
47
DevTutorialwww.interpss.org
Chapter5.Transientstabilitysimulation
5.1 Introduction to transient stability simulation
Electromechanicaltransientstability
Transientstabilityistheabilityofthepowersystemtomaintainsynchronismwhensubjectedtoasevere
transientdisturbancesuchasafaultonthetransmissionline,lossoflargegenerationorlossoflargeload.
Thesynchronismismainlymeasuredbythelargestgeneratorangledifferenceamongallthegenerators,
thusitisheavilyrelatedtothedynamicresponseofthegeneratorstothefault,whichisgovernedbyboth
theirmechanicalinputandelectricaloutput.Thusthestabilityofconcernisalsoknownas
electromechanicaltransientstability.
Stabilitystudieswithpositivesequencenetwork
Powersystemsareusuallyoperatedunderbalancedconditions,andsuchthreephasesystemscanbe
representedbyanequivalentsinglephasenetwork,withallvoltageandcurrentsrepresentedinphasorform.
Whenunsymmetricalfaultsareconsidered,thethreephasesystemcanbemodeledasthreesymmetrical
systems,i.e.,positive,negativeandzerosequencesystems,usingthesymmetricalcomponentmethod.
Consideringthatthemotionofthegeneratorsismainlyaffectedbythepositivesequence,andthatthe
negativeandzerosequencevoltageandcurrentsarenotofinterestinstabilitystudies,stabilitystudiescan
concentrateonpositivesequencenetwork,withtheoveralleffectsofthenegativeandzerosequence
networkonthepositivesequencerepresentedbyeffectiveequivalentimpedanceviewedatthefaultpoint,
whichisshownasfollows:
Fig.5.1Positivesequenceequivalentmethod[1]
Diagrambelowshowsthekeymodelsofinterest(generation,loadandthenetwork)andtheinteractionsof
them
48
DevTutorialwww.interpss.org
Fig.5.2Structureofthecompletepowersystemmodelfortransientstabilitysimulation[1]
Withthenetworkmodeledbynodaladmittance,thenetworkloadingcomponents(load,generator,SVC,
HVDC,etc)areconvertedintoNortonequivalentsofinjectedcurrentsinparallelwithadmittance.For
constantimpedanceload,thecurrentinjectioniszero.Theequivalentadmittancesareaddedintothe
networktoformamodifiedadmittancematrix.Thethenetworkequationbecomes:
[I]=[Y][V]
Solutionprocessissummarizedasfollows:
(1)Foreachloadingcomponent,calculatethecurrentinjectionsbysolvingitsdifferentialand
algebraicequations.
(2)Determinenetworkvoltagesfromtheinjectioncurrents
Asthebusvoltagesaffecttheloadingcomponents,aniterativeprocessisrequiredfortheabovetwosteps.
RecallthebusmodeldepictedinFig.2.3,thegeneratorforloadflowstudyismodeledbyaAclfGen,which
isanentryintheGenListofabus.Fordynamicstudy,DStabGenmodelisused,anditisextendedfrom
theAclfGenwiththefollowinghierarchystructure:
AclfGenAcscGenDStabGen
Machineisnotdirectlyconnectingtoabus,instead,itiscontainedwithinaDStabGenobject.The
relationshipsamongthebus,dstabGen,machine,andothermachinecontrollers(turbinegovernor,exciter
49
DevTutorialwww.interpss.org
andpss)canbeillustratedbythefollowingFig.5.3.Thus,adstabGenmustbecreatedandaddedtothe
genListbeforethecreationandmodelingofamachine.Thisrequirementisalsoappliedtoamachine
controllerastoamachine.
Fig.5.3Relationshipsofcontroller,machine,dstabGenandbus
(2)Machinemodelsofdifferentlevelsofmodelingdetails
InterPSSmachinemodelimplementationisbasedonIEEEStd1110
2002:IEEEGuideforSynchronous
GeneratorModelingPracticesandApplicationsinPowerSystemStabilityAnalysis.Currentlythefollowing
modelsareimplemented.
Tab.5.1Machinemodels
InterPSS
MachineModel
IEEEStd
11102002
Model
EConstant
N/A
Modelingconsideration
axiswindings
Note
N/A
InfinitBus
N/A
N/A
50
classicalmodelor
constantvoltagebehind
reactancemodel
2order
Tomodeltheinfinitebus,
similartoclassical
modellwithverylarge
machineMVA,e.g.,
999999MVA
2order
DevTutorialwww.interpss.org
Eq1Model
IEEE1.0
Onlyfieldwindingf
Eq1Ed1Model
IEEE1.1
E11RoundRotor
IEEE2.2
E11SalientPole
IEEE2.1
Salientpolemodel
3order
daxis:fieldwindingf
qaxis:Qdamper
winding
Twoaxismodel
4order
daxis:fieldwindingf,
damperwindingD
qaxis:damper
windingQandG
detailedmodelforround
rotormachines,
6order
daxis:fieldwindingf,
damperwindingD
qaxis:damper
windingQ
detailedmodelforsalient
polemachines,
5order
Tab.5.2Machinemodelingparametersandunit
Parameter
Unit
MachineratingRating
MVA
MachineratedvoltageRatedVolt
ShaftMechanicalDampingFactorD
%MW/Hz
ArmatureLeakageReactanceXl
pu
ArmatureResistanceRa
pu
SynchronousDirectAxisReactanceXd
pu
SynchronousQuadratureAxisReactanceXq
pu
TransientDirectAxisReactanceXd1
pu
TransientQuadratureAxisReactanceXq1
pu
OpenCircuitTransientDirectAxisTime
ConstantTd01
OpenCircuitTransientQuadratureAxisTime
ConstantTq01
SubtransientDirectAxisReactanceXd11
pu
SubtransientQuadratureAxisReactanceXq11
pu
OpenCircuitSubtransientDirectAxisTime
ConstantTd011
51
DevTutorialwww.interpss.org
OpenCircuitSubtransientQuadratureAxisTime
ConstantTq011
SaturationFactorat100%TerminalVoltageSE100
SaturationFactorat120%TerminalVoltageSE120
Poles
optional,forinformationonly
PleaseNote:
PerUnitsystemAllmachineparameters,youenteredintoInterPSSare,assumedbasedonthe
machineratingandmachineratedvoltage.Internally,thesemachinesaretransferredtothesystem
Kvabaseandthebusbasevoltage,towhichthemachineisconnectedto,whennecessary.
MachineoutputAllmachineoutput,suchasPm,Pearebasedonmachinerating.
Roundrotormodel:
Salientrotormodel:
Itisalmostthesameasabove,exceptthereisonlyonedamperwindinginqaxis,thereforethisisno
modelingofEd,withxq=xqandTq0=0.
(3)Modelingtheeffectsofsaturation
Defaultmethod:Quadraticfunction:
S =
B(EA)2
E
EistheinputandAandBaredeterminedbyfittingthetwopointsinputasgeneratorparameters,i.e.
(1.0,S1.0)and(1.2,S1.2)
Otheravailablemethods:
Exponentialfunction
52
DevTutorialwww.interpss.org
Threesectionmethod
Saturationdatainput
SlinerVoltageattheEndPointofLinerAreaonGeneratorOCCCurve.0.80.9puisrecommended
5.2.2 Excitor
[Todo]Addmoredescription
5.2.4 PSS
[Todo]Addmoredescription
53
DevTutorialwww.interpss.org
[Todo]Addmoredescription
Fig.5.4Busfrequencymeasurementblockdiagram
Thefollowingvaluesareset:
Tf=0.01sec
Tw=0.01sec
Youcanmodifytheproperties/coreLibContext.xmltochangetheirvalues:
<beanid="busFreqMeasurementImpl"
class="org.interpss.dstab.measure.BusFreqMeasurementImpl"
scope="prototype">
<constructorargindex="0"><value>0.01</value></constructorarg>
<constructorargindex="1"><value>0.01</value></constructorarg>
</bean>
InterPSSbusfrequencyimplementationJavasourcecodecanbefoundHere.
X = F(X, V ) (5.1)
I (X, V ) = Y V (5.2)
54
DevTutorialwww.interpss.org
ThereisgenerallytwosolutionmethodsfortheDAEsabove,oneisiterativemethodandthereotheristo
solvebothsimultaneouslyusingimplicitsolution,e.g.Trapezoidalmethod.InterPSSchoosetheformer
method.Foreachstep,differentialequationsforthedynamicmodels(Eqn.5.1)aresolvedfirstusingthe
ForwardEulermethod,thenthedynamicmodelsinterfacewiththenetworkascurrentsourcesinparallel
withequivalentadmittance.
Astheinterfaceerrorexistsfortheiterativemethod,iterationbetweennetworkequationanddynamicmodel
solutionisoftenrequiredtoeliminatesucherrors.Duringtheperiodwhenthesystemexperiences
considerablechangesinthestatevariables,theiterationisconductedfor6times,whilemaximumiteration
issettobe4fortherestofthesimulation.
Fig.5.5FlowdiagramofInterPSStransientstabilitysimulationprocedure
NowInterPSSsupportsloadflowdatadefinedinavarietyofformats,forexample,IEEECDF,
PSS/E(V29V33),PowerWorld(v16),GEPSLF.However,forthedynamicmodelandsequencenetwork
data,theODMadapternowsupportsthePSS/EandPSDBPAformatdataaswellasdatainODM/XML
format.Dynamicmodelsdefinedinotherformatsmightbesupportedinthenearfuture.
Simulationtime
DynamicSimuAlgorithm
.setTotalSimuTimeSec()
totalsimulationtimein
seconds
Simulationtimestep
DynamicSimuAlgorithm
.setSimuStepSec()
shouldbelessthanhalfofthe
smallesttimeconstantinthe
system
Simulationmethod
DynamicSimuAlgorithm.setSimuMethod(
DynamicSimuMethod.MODIFIED_EULER)
nowONLYthemodifiedeuler
issupported.
Referencemachine
DynamicSimuAlgorithm..setRefMachine(
dsNet.getMachine(MachineId))
MachineIdisformedas:
BusId_GeneratorId
55
DevTutorialwww.interpss.org
Networksolution
iteration(optional)
dsNet.setNetEqnIterationWithEvent(int)
dsNet.setNetEqnIterationNoEvent(int)
Thedefaultvaluesare6(with
anychange)and4(noevent),
respectively
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.,faultorreferencepointsetting
change,ismodeledasanEventinInterPSS.
Anexampleforcreatingathreephasesolidgroundfaultisgivenbelow:
56
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:Branchshortcircuitissimulatedbycreatinganequivalentfaultbussome
distancefromaterminalbus.
Branchoutage:BranchoutageismodelledbyinsertinganequivalentZbetweenthetwoterminal
buses.
[TODO]Addmoresampleforothertypesofevents
StateVariableRecorderssRecorder
=newStateVariableRecorder(0.0001)//timetolerance
ssRecorder.addCacheRecords("Bus2mach1",//machid
MachineState,//recordtype
57
DevTutorialwww.interpss.org
DStabOutSymbol.OUT_SYMBOL_MACH_ANG,//statevariablename
0.005,//timestepsforrecording
1000)//totalpointstorecord
//settheoutputhandler
dstabAlgo.setSimuOutputHandler(ssRecorder)
//Note:Herethedstabsimulationpartisskipped.
//outputrecordedsimulationresultsafterthesimulation.
List<StateRecord>list=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,thestatevariablesrecorderwillkeeparecordofthemachineangleoftheMachine
withIdBus2mach1,forevery0.005seconds.Werecommenduserssettingthetimesteptobeoneor
multipletimesthesimulationtimestep.Afterthesimulation
(2)StateMonitor
DifferentfromthestateVariableRecorder,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"})
//settheoutputhandlerofDStabAlgorithm
dstabAlgo.setSimuOutputHandler(sm)
//setoutputfrequency,measuredbysteps
dstabAlgo.setOutPutPerSteps(1)
58
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()))
//orsaveittoacsvfile
FileUtil.writeText2File("E:/mach_angle.csv",
sm.toCSVString(sm.getMachAngleTable()))
Outputsample:Busvoltage
time,Bus30000,Bus14931,Bus24801,Bus24085,Bus47216,Bus15021,Bus24151
0.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,
DynamicSimuAlgorithmdstabAlgo=....
LoadflowAlgorithmaclfAlgo=dstabAlgo.getAclfAlgorithm()
aclfAlgo.loadflow()
//makesureloadflowisconvergedbeforedstabinitialization
Systeminitializationisthenperformedbasedonaconvergedloadflowresult,anditmainlyincludesfour
parts:
Generatorinitialization:
Mapgeneratorsequencenetworkdatatothebuswhichitconnectsto,toformthe
equivalentadmittance(Recallthatthegeneratorsareconvertedandrepresentedascurrent
sourceinparallelwithequivalentadmittance,Yeq=1/Zsource)
Initializevariablestatesofgeneratorsandtheircontrollers
Loadconversion
Constantpowerloadisusuallytoconstantadmittanceload:YLoad=(PLj*QL)/V^2andaddedtothebus
shuntadmittance.
Deviceinitialization
Forotherdynamicdevicesexceptgenerators,forexample,inductionmotors,initializationprocessisalso
requiredtodeterminethestatesunderprefaultconditions.
Formthepositivesequenceadmittancematrix,whichwillbeusedinthenetworkequationsolution
I=YVduringsimulation.
Syntax:DynamicSimuAlgorithm.initialization()
59
DevTutorialwww.interpss.org
5.4.6 Simulation
Normal(successive)simulation
.Syntax:DynamicSimuAlgorithm.performSimulation()
Onestepsimulation
Forcustomizationorextensionpurpose,onemightwhattostopaftereachorcertainstep,thenmakesome
changesorcontroltothesystemandcontinuetothenextstepsimulation.Inthisregard,asocallone
stepsimulationfunctionisprovided
(1)performOnestepSimulation
Syntax:DynamicSimuAlgorithm.solveDEqnStep(booleanupdateTime)
(2)getcurrenttimeinsecduringsimulation
Syntax:DynamicSimuAlgorithm.getSimuTime()
5.8 Example
IEEE9Bussystem
Thisexamplewithinthetutorialunderthech5_dstabpackageincludesallthestepsofrunningdynamic
simulationinInterPSS.
IEEE39Bussystem
DevelopmentofSVCasanewdynamicdevice
Reference
[1]Kundur,Prabha.Powersystemstabilityandcontrol.NewYork:McGrawhill,1994.
60
DevTutorialwww.interpss.org
Chapter6.Powersystemoptimization
throughintegratingInterPSSwithGAMS
Thepurposeofthisdocumentistoprovideinstruction,includingsamplecode,forInterPSSandGAMS
integration.
(2)Installation
1.DownloadfromGAMSdownloadwebside,V24.0.2ornewerversionshouldbeconsistentwiththis
document.
NOTE:Attentionshouldbepaidtochoosingthe64bitor32bitversionGAMS.ItwasfoundthatGAMS
mustbeconsistentwiththeJRE.Thatis,iftheJREinstalledinyourmachineis64bit,the64bitversion
GAMSshouldbeyourchoice,otherwisethe32bitversion.
ErroroccurswheninconsistentversionofGAMSandJREareused:
Exceptioninthread"main"com.gams.api.GAMSException:expect64bitGAMSsystemin[C:\Program
Files(x86)\GAMS24.0],butfound32bitinstead!
2.WheninstallingtheGAMS,makesurechoose"addtheinstalldirtothesystem
environment".
61
DevTutorialwww.interpss.org
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:
<PathtoGAMS>\apifiles\Java\api
(CorrespondingDLLscanalsobefoundunderthisfolder).Thishasbeenaddtothe
ipss.lib.3rdPty/gams
Note:GAMSRelatedclassrunconfigurationsettingwithinEclipse
Runtheclassbyrun>runconfiguration>settingtheVMargumentsasfollows:
Djava.library.path="<GAMSInstall
Dir>\\apifiles\\Java\\api"
62
DevTutorialwww.interpss.org
WhichguaranteesthattherequiredDLLsareaccessible/visiblefromtheclass.
genP@BusBus1:level=1.91,marginal=0.0
genP@BusBus2:level=0.5,marginal=20.033200000000004
genP@BusBus3:level=0.05,marginal=39.96479999999998
genP@BusBus4:level=0.0,marginal=30.038200000000003
genP@BusBus5:level=0.0,marginal=30.038200000000003
genP@BusBus6:level=0.06,marginal=19.968999999999994
genP@BusBus7:level=0.0,marginal=30.038200000000003
genP@BusBus8:level=0.07,marginal=9.974400000000003
genP@BusBus9:level=0.0,marginal=30.038200000000003
genP@BusBus10:level=0.0,marginal=30.038200000000003
genP@BusBus11:level=0.0,marginal=30.038200000000003
genP@BusBus12:level=0.0,marginal=30.038200000000003
genP@BusBus13:level=0.0,marginal=30.038200000000003
genP@BusBus14:level=0.0,marginal=30.038200000000003
DCLoadflowResults
BudIdVoltAng(deg)GenLoadShuntG
=========================================================
Bus10.00191.000.000.00
63
DevTutorialwww.interpss.org
Bus24.3250.0021.700.00
Bus311.805.0094.200.00
Bus49.520.0047.800.00
Bus58.130.007.600.00
Bus613.416.0011.200.00
Bus712.320.000.000.00
Bus811.617.000.000.00
Bus914.230.0029.500.00
Bus1014.510.009.000.00
Bus1114.170.003.500.00
Bus1214.530.006.100.00
Bus1314.700.0013.500.00
Bus1415.730.0014.900.00
FromId>ToIdPowerFlow(Mw)MWLimitLoading%Violation
=============================================================
Bus1>Bus2(1)127.390.00
Bus1>Bus5(1)63.610.00
Bus2>Bus3(1)65.950.00
Bus2>Bus4(1)51.490.00
Bus2>Bus5(1)38.250.00
Bus3>Bus4(1)23.250.00
Bus4>Bus5(1)57.660.00
Bus4>Bus7(1)23.330.00
Bus4>Bus9(1)14.770.00
Bus5>Bus6(1)36.600.00
Bus6>Bus11(1)6.620.00
Bus6>Bus12(1)7.590.00
Bus6>Bus13(1)17.190.00
Bus7>Bus8(1)7.000.00
Bus7>Bus9(1)30.330.00
Bus9>Bus10(1)5.880.00
Bus9>Bus14(1)9.710.00
Bus10>Bus11(1)3.120.00
Bus12>Bus13(1)1.490.00
Bus13>Bus14(1)5.190.00
64
DevTutorialwww.interpss.org
Chapter7.SensitivityAnalysisand
DCLFbasedcontingencyanalysis
65
DevTutorialwww.interpss.org
Chapter8.Newcontrollermodel
developmentwithControllerModeling
Language
66
DevTutorialwww.interpss.org
Chapter9.Graphbasedpowersystem
applications
9.1NetworkTopologyprocessing
9.2Distributionnetworkpowerflow
67
DevTutorialwww.interpss.org
Chapter10.InterPSSExtensionexample
Chapter6presentsagoodexampleoffunctionalextensionbyintegratingInterPSSandGAMS.Inthis
chapter,twomoreexampleswillbegiveninthischaptertohelpusersbetterrealizethatInterPSSis
designedforextension,andthatitcanbeappliedtoabroadrangeofpowersystemapplicationsthrough
modeland/oralgorithmextension.
10.1ADCOPFmodulebyintegratingQuadProgJ
10.2NetworktopologyvisualizationbyintegratingJGraphX
68
DevTutorialwww.interpss.org
AppendixASparseMatrixandSolver
A-1. SparseEqn classes
(1) Overview
SparseMatrixisthemostbasicandcommonlyuseddatastructureinpowersystemsimulations.For
example,theAdmittancematrix,JacobianmatrixforACloadflow,BabdBmatrixforDCloadfloware
sparseduetotheinherenttopologystructureofpowersystems.Inaddition,weobservethatpowerflow,
shortcircuitandtransientstabilitysimulationallneedsolvingthesparseLinearEquationsinvolvingthese
sparsematrix,like[Y][V]=[I],[J][dX]=[dPQ].Thesefore,wecombinetheconceptofsparsematrixand
linearequationstogetherandcreatetheSparseEqnclass.
TwomainattributesofaSparseEqnisthesparseMatrixAandsparseVectorB,whichiscorrespondingto
thelefthandsideandrighthandsideoflinearequationsetAX=b.SparseEqnalsorefersto,oruses,a
SparseEqnSolverobject,whichactuallyperformsmatrixmanipulation,forexample,LUdecomposition,and
cachesthefactorizationtable.
69
DevTutorialwww.interpss.org
Theclasshierarchystructureisshownabove.ISparseEqnisthebasicinterface,thenforeachnumeric
type,thereisacorrespondinginterface.Inparticular,fortheJacobianmatrixusing2X2blockmatrix
stroingstructure,theinterfaceISparseEqnMatrix2X2isdefined.AbstractSparseEqnisanabstractclass
forsparseEqn,allimplementationshouldextendsit.Inthefigureabove,onlythesparseEqnfordoubletype
isshownastheconcreteandcompleteimplementationexample,withtheApachecommonmath3linear
classesused.
SparseEqnforinteger,complexandMatrix2X2datatypearealsodefined,astheiractualimplementations
areverysimilartothedoubletype,theyarenotshowninthefigureabove.SparseEqnComplexismainly
usedinformingadmittancematrix(Y)andimpedancematrix(Z),whileSparseEqnMatrix2X2isusedto
representtheJacobianmatrix(J),withthe[dPdAng,dPdVdQdAng,dQdV]2X2blockmatrixrepresented
byaMatrix2X2classobjectinside.
Forthecode,pleaserefertothefollowinglink:
https://github.com/InterPSSProject/ipsscommon/tree/master/ipss.numeric/src/org/interpss/numeric/sparse
Method
Description
setDimension
setthematrixdimension
increaseDimension
increasematrixdimension,theincrementalpartis
augmentedintherightandbottomsideofthe
originalnetwork
addToAij(d,i,j)
Amatrixaij=aij0+d
get/setElem(i)
getandsetaiiofAmatrix
get/setAij
getandsetaijofAmatrix
setB2Zero
setallentriesintheBvectortozero
setB2Unity
setallentriesintheBvectorto1
getXi
getthesolutionresultofAX=b,indexofiisbased
ontheinternalstorage.ThesortNumberofthebus
isusedbydefault.
getXVector
returnthesolutionXintheformofanarray
setBVector
setBintheformofanarray
setBi
setbioftheBvector
addToBi
usedtoupdatetheBbybi=bi0+updateBi
setToZero
setallaijandbito0.0
70
DevTutorialwww.interpss.org
luMatrix
performlufactorizationtotheAmatrix
solveEqn
solveAX=b
publicinterfaceISparseEqnSolver{
/**
*settheAmatrixdirtystatustotrue,duetochangeofitselement
*/
voidsetMatrixDirty()
/**
*Solvethe[A]X=Bproblem
*
*/
voidsolveEqn()throwsIpssNumericException
/**
*LUdecompositionofthematrix.
*
*@paramtolerancethetoleranceformatrixsingulardetection
*@returnifsucceedreturntrue.
*/
booleanluMatrix(finaldoubletolerance)throwsIpssNumericException
}
(2) How SparseEqn object uses a solver to solve the equation set :
[A]X = b
RecallthatSparseEqnobjectstoresthematrixAandvectorb.Withthat,thebasiclogicofsolving[A]X=b
is
i)createanewSparseEqnsoverinstanceandthentheSparseEqnobjectreferstoit
ii)thesolverLUfactorizetheAmatrix
iii)Withthefactorizedresult,thesolversolvetheequationset:[A]X=b
ExampleSparseEqnDoubleImpl
publicSparseEqnDoubleImpl(intn){
71
DevTutorialwww.interpss.org
//createanewSparseEqnsoverinstanceandthenSparseEqnobjectrefertoit
this.solver=SparseEqnSolverFactory.createSparseEqnDoubleSolver(this)
//thesolverLUfactorizetheAmatrix
publicbooleanluMatrix(finaldoubletolerance)throwsIpssNumericException{
returnthis.solver.luMatrix(tolerance)
}
/*
*solvetheequationset
*/
publicvoidsolveEqn()throwsIpssNumericException{
this.solver.solveEqn()
}
Withtherapiddevelopmentofhardwareandsoftware,itisprobablythatyouwanttousethelatest
developednumericalsolvertoreplacetheexistingdefaultnumericalsolverofInterPSS.Itisquitestraight
forwardtocustomizethesolver,astherearemainlytwostepsinvovled:
1)Developyourownsolveroradaptinganexistingsolverbyimplementingthethesolverinterfaceshownin
A2part(1).Specially,theSparseEqnDoubleCommonMathImpl.javaisgivenoutasacustomizedsolver
reference.
2)Configurethecom.interpss.core.sparse.SparseEqnSolverFactorytoassignyournewsolvertothe
solvercreator.
Note:theJava8Functioninterfaceisusedbelow
// configure the sparse eqn solvers
SparseEqnSolverFactory.setDoubleSolverCreator(
(ISparseEqnDouble eqn) -> new CustomDoubleSparseEqnSolver(eqn));
SparseEqnSolverFactory.setComplexSolverCreator(
(ISparseEqnComplex eqn) -> new CustomComplexSparseEqnSolver(eqn));
72
DevTutorialwww.interpss.org
73
DevTutorialwww.interpss.org
AppendixBOpenDataModelfordata
import/output
Manyyearsago,IEEErecommendedaCommonDataFormat(IEEECDF)forexchangingLoadflowstudy
data[1]usingflatfile.Powersystemsoftwarecompaniesusestheirowninternaldataformat,somehave
featuressimilartoamarkuplanguage.However,itisourobservationthattheseformatsareproprietaryand
areoftennotwelldocumented.Wethinkthatthepowerengineeringcommunityneedsacompletelyopen,
free,flexibleandwelldocumentedmodel/formatforpowersystemanalysisinformationexchange.XMLisan
obviouschoice,sinceitisaverymaturetechnologyandhasbecomethedefactostandardfordefining
informationexchangestandards.Also,numerousopensourceandfreeXMLprocessingtoolsarecurrently
available.ForthosewhoareunfamiliarwithXML,someintroductoryinformationrelevanttopowersystem
representationcanbefoundinRef[2].(E.Z.Zhou,XMLandDataExchange",IEEEPowerEngineering
Review,April2000)
1. Prerequisite
1.1 Basic understanding of XML: schema, data binding and JAXB
ExtensibleMarkupLanguage(XML)isamarkuplanguagethatdefinesasetofrulesforencoding
documentsinaformatthatisbothhumanreadableandmachinereadable.
FormoredetailedofXML,pleaseseehttp://en.wikipedia.org/wiki/XML
XMLSchema
http://www.w3schools.com/schema/
XmldatabindingandJAXB
WhatisXMLbinding
XMLdatabindingistheprocessofrepresentingtheinformationinanXMLdocumentasanobjectin
computermemory(deserialization).WithXMLdatabinding,applicationsaccessXMLdatadirectfromthe
objectinsteadofusingtheDocumentObjectModel(DOM)toretrieveitfromtheXMLfile.UsingXML
binding,youcanintegrateXMLdataintoabusinessruleapplication.
IntroductiontoJAXB
http://docs.oracle.com/javase/tutorial/jaxb/intro/
tutorial
http://www.javacodegeeks.com/2013/02/jaxbtutorialgettingstarted.html
74
DevTutorialwww.interpss.org
2. ODM in a nutshell
Someusefulonlineresources:
IEEEPESGM2009paper:OpenModelForExchangingPowerSystemData
IntroductiontoODM@www.InterPSS.org
https://sites.google.com/a/interpss.org/interpss/Home/ieeepesoss
ODMprojectonGitHub:https://github.com/InterPSSProject/ipssodm
Note:IfyouwanttoworkontheadapterdevelopmentbasedonODM,pleasecheckoutthisprojecttoyour
computer,byfollowingtheapproachdiscussedinChapter1
75
DevTutorialwww.interpss.org
Fromthebasecasefolder,onecaneasilyfindtheanalysiscategoriesoftheODMschemaitcoversawide
rangeofdatamodelingfromtheconventionalloadflow,shortcircuit,dynamic(transientstability)toOPFand
distributionnetworkanalysis.Datatypesandunittypesaredefinedunderthecommonfolder.
ODMSchema.xsdisthemainschemadefinitionfile.EclipseXMLSchemaEditorviewoftheODMschema
(ODMSchema.xsd)isshownbelow:
76
DevTutorialwww.interpss.org
NOTE:Wethinkitisbettertoinfousers/developers,beforeanyfurtherintroduction,thatyouarenot
requiredtounderstandtheschemacompletelyinordertomodifytheODMmodelordevelopacustom
adapter.Infact,somecommonandusefulutilitieshavebeendevelopedtohelpusertodevelop
customizedODMadaptertoimport/outputdatathroughODM.Youareencouragedtocontinuetothe
adapterimplementationexamplesinSection2.4afteryouhavesomebasicunderstandingofODMschema.
Youwillfinditiseasiertouseitthanexpected!
2.2.1BasicSchema
NamingConvention
ThereistwomainXmldatastructuresusedinODM,inadditiontostandarddatatypesdefinedinXml
schema.
ComplexType:<...>XmlType,isfordefiningcomplexdatastructurewithdifferenttypesof
attributesandelements,forexample,PSSNetworkXmlType.Complextypealwaysends"XmlType".
SimpleType:<...>EnumTypeofStringisfordefiningenumerationofsimpletokens,forexample,
LFGenCodeEnumTypehas[Swing,PV,PQ].Simpletypeofstringalwaysendswith"EnumType".
UnitType:<...>UnitTypeisspecialsimpletypefordefiningunit.forexample,
ApparentPowerUnitTypehas[Mva,Kva...].
77
DevTutorialwww.interpss.org
NameSpace
TheODMSchematargetnamespaceis"http://www.ieee.org/odm/Schema/2008".Alltypesdefinedinthe
ODMSchemaare"qualified"withanamespaceprefixpss.
<schemaxmlns="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.ieee.org/odm/Schema/2008"
xmlns:pss="http://www.ieee.org/odm/Schema/2008"
elementFormDefault="qualified">
...
<elementname="PSSStudyCase"type="pss:StudyCaseXmlType"></element>
...
</schema>
PleaseseeNamespacesinXMLformoreindepthdiscussionaboutnamespace.
VersionNumber
TheSchemarootelementtypeStudyCaseXmlTypehasaattributeschemaVersionforindicatingschema
versionnumber.
PUSystem
Actualunits,suchasKV,MVA,andPUcouldbeusedintheODMModel.AllPUvaluesinthemodelare
basedonthebasecasebaseKvaandbusbasevoltage,unlessotherwisespecified.
Extension
ODMisdesignedtobeextended.TheextensionfolderisforODMextensionbyanyinterestedparty.
Currently,ithasafoldercontainingextensionbyInterPSS.Thefollowingnamespacehasbeenintroducedin
InterPSSextension.
xmlns:ipss="http://www.interpss.org/Schema/odm/2008"
SchemaRootElement
TheODMschemarootelementPSSStudyCaseisoftypeStudyCaseXmlType.
<schemaxmlns="http://www.w3.org/2001/XMLSchema"...>
<elementname="PSSStudyCase"type="pss:StudyCaseXmlType"></element>
...
</shema>
78
DevTutorialwww.interpss.org
TheStudyCaseXmlTypehasthefollowingelements:
schemaVersionversionnumber
originalFormat[IEEECDF|PSSE|UCTEDEF|InterPSS|PSAT|PowerWorld|BPA|PSLF|
Custom]originaldataformat.
adapterProviderNameoptional,datatransformationadapterprovidername
adapterProviderVersionoptional,datatransformationadapterproviderversion
analysisCategory[Loadflow|ShortCircuit|TransientStability]analysistypecategory.Thiscould
beexpendedtoincludemoretypesinthefutureschemaversion
networkCategory[Transmission|Distribution]networktypecategory.
baseCaseelementoftypePSSNetworkXmlTypefordescribingapowernetworkasthebasecase.
modificationListoptional,alistofmodificationtothebasecase
scenarioListoptional,alistofscenarios,builtonthebasecase.
BaseRecord
TheinformationareorganizedintheSchemausingtherecordconcept.
nameOptional,elementname
descOptional,elementdescription
isoCodeOptional,elementISOcode
offLineOptional,elementactualofflinestatus
normalOffLineStatusOptional,normalelementofflinestatus
numberOptional,elementnumber
areaAreanumber.Itisoptionalandshouldbeanonzeronumber.
zoneZonenumber.Itisoptionalandshouldbeanonzeronumber.
ownerListOptional,ownerlistoftheelement
nvPairListOptional,namevaluepairforthoseelementsnotdefinedintheschema
extensionOptional,extensionpoint.OnecanaddanelementofAnytype(anyschematype)to
extendtheschema.
79
DevTutorialwww.interpss.org
IDRecord
AIDrecordhasanidofTypexsd:ID,whichguaranteesitsuniquenessinanODMxmlfile.Itistheparentof
allsearchablerecords,suchBusRecord,BranchRecord.
2.2.2BaseCase
ThebasecaseelementisoftypePSSNetworkXmlType.Itisintendtodescribeapowernetworkfor
simulationpurpose.Currently,itourfocusisonLoadflowstudyinformation.Thestructurehasbeen
designedinsuchawaythatitcouldbeextendedtoincludemoresimulationinformation,suchasshort
circuit,transientstability.
baseKvaBasekvaforthePUsystem.
baseKvaUnit[KVA|MVA]basekavunit
busListnetworkbusrecordlist
branchListnetworkbranchrecordlist
loseZoneListlosezonelistperIEEECDF.Itmaybeextendedtocoverotherformats
interchangeListinterchangelistperIEEECDF.Itmaybeextendedtocoverotherformats
tieLineListtielinelistperIEEECDF.Itmaybeextendedtocoverotherformats
80
DevTutorialwww.interpss.org
2.2.3BusRecord
BusrecordisbasicallydefinedbyfollowingasimilarclasshierarchyoftheBusinInterPSScorewiththe
followingstructure:
IDRecord<CimRdf<Bus<LoadflowBus<ShortcircuitBus<DynamicBus
ThebasicBusrecordisisBusXmlType
81
DevTutorialwww.interpss.org
2.2.3.1BusRecordforACLoadflow
BusLoadflowdataisdescribedbytheLoadflowBusDataXmlType.
baseVoltageBusbasevoltage
baseVoltageUnit[VOLT|KV]Busbasevoltageunit
voltageBusvoltage
angleBusangle
genDataBusgenerationdata,seemoredescriptionbelow
loadDataBusloaddata,seemoredescriptionbelow
shuntYBusshuntY
powerInjectionpowerinjectionintothenetwork,forstoreLoadflowresults
BusGenerationDataBusGenDataXmlType
code[PQ,PV,SWING]
contributeGenlist:alistforstoringtherecordsofgenerator(s)connectingtothebus.Thus,the
scenarioofmultiplegeneratorsconnectedtothesamebusissupported.
Therecordofageneratorforloadflowincludes:
powergeneration,p,qplusaunit[PU|KVA|MVA](required)
desiredVoltage/Anglescheduledvoltagemagnitude/angle(required,ifnotprovidedatthebuslevel)
pLimitgeneratorrealpowerlimit(optional)
qLimitgeneratorreactivepowerlimit,usedforPVbus(required)
vLimitgeneratorvoltagelimit(optional)
mvaBasegeneratorMVABase(required)
remoteVoltageControlBusdescribingdesiredremotebuswhenthegeneratorQisusedtocontrol
theremotebusvoltage.(optional)
XfrZstepuptransformerimpedance(optional)
82
DevTutorialwww.interpss.org
XfrTapstepuptransformertap,definedatthehighvoltageside(optional)
TheacscContributeGenanddstabContributeGenmodelsforshortcircuitandthetransientstabilityanalysis,
respectively:
Machine,exciter,turbineandgovernoraswellasstabilizer(PSS),ifany,arelinkedtoa
dstabContibuteGenmodel.
83
DevTutorialwww.interpss.org
BusLoadData
code[CONST_P,CONST_I,CONST_Z]constantpower,constantcurrentorconstantzload.
contributeloadlistalistforstoringallrecordsofloadsconnectedtothebus
ModeledbyBusLoadDataXmlType
Acontributingloadrecord
ModeledbyLoadflowLoadDataXmlType
Therearethreecomponentsforeachloadrecord,i.e.,constantpower,constantcurrentand
constantimpedancecomponent.Acontributingloadcanbeacombinationofthesecomponents.
2.2.3.2BusRecordforACshortcircuit
84
DevTutorialwww.interpss.org
2.2.3.3BusRecordfortransientstability
2.2.4BranchRecord
Branchrecordhasanuniqueid,anidreferencetoafrombusrecord,anidreferencetoatobusrecord,a
circuitid.ThetereiayBusisoptional,whichcouldbeusedtodefinea3windingtransformer.Italsoholds
branchrelatedsimulationdata.
Asageneralpractice,Lineand2windingtransformeraremodeledseparately,buttheysharesome
commoninformation,e.g.,terminalsaredefinedbytwobuses.Theclassinheritancestructureisasfollows:
BaseBranch<Branch<LineBranch(conventionalline/cable)
\
\<XfrBranch(Xfrstandsfor2windingtransformer)
BaseBranchData
LoadflowLineData
zlineimpedance,r,x,plusaunit[PU|OHM]
totalShuntYtotallinechargingshuntY,g,b,plusaunit[PU|MHO|MICROMHO]
fromShuntYextrashuntYatthefrombusendoftheline
toShuntYextrashuntYatthetobusendoftheline
85
DevTutorialwww.interpss.org
ratingLimitthermalorcontingencyratinglimit
LineInfoisoptional
LoadflowTransformerData
Byanalysisdifferentdataformats,webelievetheabovetransformermodelcapturedallpossible
permutationsofalocaltransformeroralogicalphaseshifttransformermodelforloadflowanalysispurpose.
AdjustmentcouldbeappliedtotransformertaptoadjustbusvoltageorMvarflow,ortophaseshifting
transformerangletoadjustMwflow.
TransformerData
ztransformerimpedance,r,x,plusaunit[PU|Ohm].
ratingDatatransformerratingdata.VoltageunitshouldbeVOLTorKVandthesameforbothside.
fromTurnRatioPUbasedonthetransformerratedvoltage
toTurnRatioPUbasedonthetransformerratedvoltage
tapAdjustmenttransformertapadjustmentinfo,seemorebelow.
86
DevTutorialwww.interpss.org
Inthetransformerdataschemadefinition,onlytransformerimpedancezarerequiredelements.The
fromTurnRationandtoTurnRatioshouldbesetto1.0ifnotdefined.Theotheroptionalelementsshouldbe
settozeroifnotspecified.
PleaseNote:WhentransformerZandYarespecifiedinactualvalue,inOhmorMho,thesidewherethe
valueismeasuredneedtobespecified.ODMassumesthatthevalueismeasuredatthehighvoltageside.
TransformerTapAdjustment
adjustmentType[Voltage|MvarFlow]tapadjustmenttype,voltageadjustmentormvarflow
adjustment
tapLimittaplimit
tapLimitUnit[PU|PERCENT]taplimitunit
tapAdjStepSizetapadjustmentstepsize.If0.0ornotdefined,assumecontinuousadjustment
tapAdjOnFromSideTurnratioatfromsideortosidecouldbeadjusted.
voltageAdjDatavoltageadjustmentdata,seemorebelow
mvarFlowAdjDatamvarflowadjustmentdata,seemorebelow.
TransformerTapAdjustmentforBusVoltage
mode[ValueAdjustment|RangeAdjustment]adjustmentcouldbebasedonadesiredvalueor
desiredrange.
desiredValuedesiredValuefordesiredbusvoltagefortheValueAdjustment
desiredRangedesiredRangefordesiredbusvoltagerangefortheRangeAdjustment
desiredVoltageUnitdesiredvoltageunit[PU|Volt|KV]
adjVoltageBusadjustmentvoltage
adjBusLocation[TerminalBus|NearFromBus|NearToBus|FromBus|ToBus]adjustmentbus
location
87
DevTutorialwww.interpss.org
TransformerTapAdjustmentforMVarFlow
mode[ValueAdjustment|RangeAdjustment]adjustmentcouldbebasedonadesiredvalueor
desiredrange.
desiredValuedesiredValuefordesiredmvarflowfortheValueAdjustment
desiredRangedesiredRangefordesiredmvarflowrangefortheRangeAdjustment
desiredMvarFlowUnitdesiredmvarunit[PU|KVAR|MVAR]
mvarMeasuredOnFromSidedescribingmvarmeasuringlocation,frombussideortobusside
LoadflowPhaseShiftTransformerData
PhaseShifttransformerinheritsfromtransformer.Inadditionithasthefollowingfields
fromAnglefrombussideangle
toAngletobussideangle
angleAdjustmentphaseshiftingangleadjustmenttocontrolMWflow.
PhaseAngleAdjustment
mode[ValueAdjustment|RangeAdjustment]adjustmentcouldbebasedonadesiredvalueor
desiredrange.
desiredValuedesiredValuefordesiredMWflowfortheValueAdjustment
desiredRangedesiredRangefordesiredMWflowrangefortheRangeAdjustment
angleDegLimitphaseshiftinganglelimitindegrees
desiredPowerUnit[PU|KW|MW]desiredMWflowunit
desiredMeasuredOnFromSidedesiredMWflowmeasuredonfrombusortobusside
BranchRatingLimit
Threemvaratinglimitsandacurrentratinglimitcouldbedefined
mvaRating1branchmvaratinglimit
mvaRating2branchmvaratinglimit
mvaRating3branchmvaratinglimit
currentRatingbranchcurrentratinglimit
mvaRatingUnit[PU|KVA|MVA]branchmvaratinglimitunit
currentRatingUnit[PU|Amp|KA]currentratinglimitunit
3Windingtransformer
88
DevTutorialwww.interpss.org
Asageneralmodelingpractice,theimpedanceofthethreewidingtransformerisdeterminedbythe
followingprocedure:onewindingisshortcircuitedandoneisleftopencircuited,whileavoltageisappliedto
theremainingwinding.Thistestyieldsthemagnitudesofthethreeleakageimpedances,ZLH,ZLT,and
ZHT.Theimpedance,ZLH,isthesumoflowandhighvoltagewindingleakageimpedanceswhenthe
tertiarywindingisopen
IntheODM,thedefaultbranchZ=Z12=ZLH,Z23=ZLT,Z31=ZHT
Modification
AlistofmodificationscouldbedefinedinaStudyCase,asshowninthefollowingfigure:
89
DevTutorialwww.interpss.org
ThemodificationelementisoftypeModifyRecordXmlType,whichisabstract.Inactualapplication,itneeds
tobereplacedwithaconcreteXmltype,forexample,theNetModificationXmlType,inthefollowingfigure:
Contingency
Incontingencyanalysis,thereisaneedtodefinealistofcontingencieswhichmightbeappliedtothebase
case.Herewepresentonepossiblewaystodefinecontingencies.
Acontingencycouldbedescribedasasetofbranchofflinestatuschanges
AmodificationoftypeNetModificaitonXmlTypecouldbedefinedtorepresentacontingency
AStudyCaseXMLfilecouldcontainalistofmodificationsforcontingencyanalysis
StudyScenario
AstudyScenariocouldbedefinedinaStudyCase,asshowninthefollowingfigure:
90
DevTutorialwww.interpss.org
Whenyoucheckouttheieee.odm.schemaprojectfromtherepo,itisempty.Thereisnosourcecode
inside.ItisforhostingcompiledODMschemaJavacode.Afterthecheckout,youneedtocompilethe
schemabyrightclicktheODMSchema.xsdfile,selectJABX2.1>XJC,andsetparametersasfollows:
outputdirectoryshouldbepointedtoyourlocalsrcfolderoftheieee.odm.schemaproject.
DevTutorialwww.interpss.org
formatdefinedwithmultiplelines.Thefollowingtablepresentthesurveyresultofthemostcommondata
formats:
*source:Milano,F.,M.Zhou,andGuanJiHou."Openmodelforexchangingpowersystemdata."Power&
EnergySocietyGeneralMeeting,2009.PES'09.IEEE.IEEE,2009.
Athighlevel,ODMdataflowprocessofanODMadapterisshowninthefollowingdiagram:
Inputtextfileisprocessedlinebyline.Foreachinputdatalinestring,acorrespondingdataline
stringparserisinvokedtoparsethedata
Aftertheinputlinestringisparsed,acorrespondingdatalinestringmapperisinvokedtomapthe
datastoreininputlinestringparsertoanODMParserobject,whichstoresinputfileinfointhe
ODMformat.
Foreachdatasegmentintheinputfile,acorrespondingDataMapperandDataParserneedtobe
implemented.Andthemapperiscalledinsidetheparsertoparsetheinputlinestring.
2.4.1.1InputLineStringParser
Sincethedatarecordisusuallydefinedinasinglelineormultiplelines,ageneraldataparser
92
DevTutorialwww.interpss.org
BaseInputLineStringParserhasbeendefined,whichdefinesthemethodtofacilitatethetextbaseddata
processing.Further,theAbstractDataFieldParserclassprovidesahigherlevelabstractionfordataparser.
Twomajormethodstobeimplemented/customizedforeachdataadapterare:getMetadata()and
parseFields(String)
Inthecaseofpositionfreedatafile,suchasPowerWorld,inputfilehasthefollowingdatastructure.
A,B,C,D,A:1,E,F<Metadata
1.0,2.0,3.0,4.0,5.0,6.0<Actualdata
1.0,2.0,3.0<Datacouldbeinmultiline
4.0,5.0,6.0
Thefollowingaresomesamplecodetoparsetheinputdatalinestring.
//assumewehaveadataparserclassdefined
parser=newParser()
//firstparsethemetadatalineandcachetheinfo
parser.parseMetaData(A,B,C,D,E,F)
//parseadataline
parser.parseData(1.0,2.0,3.0,4.0,5.0)
doublea=parser.getDouble(A)
if(parser.exist(A:1)
a=parser.getDouble(A:1)
Incaseoffixpositioninputdatafile,suchasIEEECDF,PSS/E,thereisnoexplicitmetadatadefined,use
thegetMetadata()todefinemetadatafortheinputlinestringparsing.
@OverridepublicString[]getMetadata(){
returnnewString[]{
//01234
"BusNumber","BusName","Area","Zone","Type",
//56789
"VMag","VAng","LoadP","LoadQ","GenP",
//1011121314
"GenQ","BaseKV","DesiredV","MaxVarVolt","MinVarVolt",
//151617
"ShuntG","ShuntB","RemoteBusNumber"
}
}
PleaseNote:becauseofusingthelinestringparser,wecanusefieldname,e.g.,BusNumber,toaccess
theinputdatafield,insteadofusingfieldposition.Thisdecouplesthemapperfromtheunderlyinginputdata
structure.
ParseinputlineString
Syntax:dataParser.parseFields(str)
93
DevTutorialwww.interpss.org
Thismethodneedstobeimplementedandoverridedtoreflecthowthedataisdefinedintheinputlinestring
2.4.2.1Implementinputlinestringparser
ThemajorworkofimplementinginputlinestringparseristorealizeandoverridethegetMetadata()and
parseFields(finalStringstr)method.ThefollowingissomesamplecodeofIEEECDFbusdataparser.
publicclassIeeeCDFBusDataParserextendsAbstractDataFieldParser{
@OverridepublicString[]getMetadata(){
returnnewString[]{
//01234
"BusNumber","BusName","Area","Zone","Type",
//56789
"VMag","VAng","LoadP","LoadQ","GenP",
//1011121314
"GenQ","BaseKV","DesiredV","MaxVarVolt","MinVarVolt",
//151617
"ShuntG","ShuntB","RemoteBusNumber"
}
}
@OverridepublicvoidparseFields(finalStringstr)throwsODMException{
if(str.indexOf(',')>=0){
finalStringTokenizerst=newStringTokenizer(str,",")
intcnt=0
while(st.hasMoreTokens()){
this.setValue(cnt++,st.nextToken().trim())
}
}else{
//Columns14Busnumber[I]*
this.setValue(0,str.substring(0,4).trim())
//Columns617Name[A](leftjustify)*
this.setValue(1,str.substring(5,17).trim())
...
}
2.4.2.2Implementinputlinestringmapper
Foralinestringmapper,thereisacorrespondinglinestringparser,whichparsetheinputdatafirst,thenthe
mappercaneasilyaccessthedataandmapitaccordinglytotheODMjavaobjects.
Thefollowingaresomesamplecodetoimplementinputlinestringmapper:
//definedataparser
94
DevTutorialwww.interpss.org
IeeeCDFBusDataParserdataParser=newIeeeCDFBusDataParser()
publicvoidmapInputLine(finalStringstr,AclfModelParserparser){
//parsetheinputdataline
dataParser.parseFields(str)
//mapdatatoODM
StringbusId=dataParser.getString("BusNumber")
LoadflowBusXmlTypeaclfBus=parser.createAclfBus(busId)
...
}
Asimplelogicforprocessingsuchsequentialdatawouldbe:1)iterateovereachlineoftheinputdatafile2)
determinewhattypeofdataisunderprocessing3)applytheproperdatamappertoparseandmaptodata
intoODM.TheoutlineoftheIEEECDFadapterimplementationisgivenbelow:
95
DevTutorialwww.interpss.org
//readthefirstlineheadline
//sample:
//08/19/93UWARCHIVE100.01962WIEEE14BusTestCase
Stringstr=din.readLine()
netDataMappe.mapInputLine(str,parser)
intdataLineIndicator=DataNotDefine
do{
str=din.readLine()
if(str!=null){
if(str.trim().equals("ENDOFDATA"))
break
try{
/*
*processsectionheadrecordforexample
*
*BUSDATAFOLLOWS
*/
if((str.length()>3)
&&str.substring(0,3).equals("BUS")){
dataLineIndicator=BusData
ODMLogger.getLogger().fine("loadbusdata")
}
elseif(
/*
*Endofprocessingsectionheadrecord
*parsedataline
*/
elseif(dataLineIndicator==BusData){
busDataMapper.mapInputLine(str,parser)
}
elseif(dataLineIndicator==BranchData){
branchDataMapper.mapInputLine(str,parser)
}
IEEECDFFormatAdapter:
ThecompleteimplementationofIEEECDFadapterisavailablefrom:
https://github.com/InterPSSProject/ipssodm/tree/master/ieee.odm_pss/src/org/ieee/odm/adapter/ieeecdf
DevTutorialwww.interpss.org
97