Sunteți pe pagina 1din 14

Best

of the Discussion Forum Part II


On MaxControlIterations ...
FromRogerDugan:

IseemanyscriptscomebymyinboxwhereusershavesetMaxIterationsto100or1000thinkingthat
willhelpwithconvergenceproblems.Likewise,IseeMaxControlIterationssettoveryhighnumbers.
Thisisseldomhelpful.

ThedefaultMaxIterationsis15andthedefaultMaxControlIterationsis10.Thisisnearlyalways
sufficientforreasonablymodeleddistributioncircuits.

ThefixedpointiterationsolutiontechniqueessentiallyusestheYmatrixastheJacobian.Wedon't
updatetheYmatrixbetweeniterations,ortimesteps,unlesstherehasbeenamajorchangesuchasa
regulatortapchangeoracapacitorswitching.AslongastheYmatrixisgenerallypointingintheright
directionforthesolutionatwhichallcurrentsatanodewillsumtozero,theiterativeprocesswill
usuallygetthereeventually.ItwilltakemoreiterationsthanaNewtonmethodthatupdatesYatevery
iteration,butitwillgenerallynottakehundredsofiterations.TheworstIhaveseenis81andthatwas
foracircuitmodelingerror.TheIEEE8500nodeTestCasetakes16iterationsonthefirstcontrol
iteration,butfeweronsubsequentcontroliterations(thereare5totalcontroliterationsseeShow
Summaryafterthesolution).Sointhescript,wesetMaxIterations=20.

Itmostlyhastodowithhowclosethefirstguessatthevoltagesistothefinalsolution.Thefixedpoint
iterationrequiresthefirstguesstobecloserthanothermethods.Theworstcaseisgenerallythefirst
snapshotpowerflow.Thereafter,forasequentialtimepowerflowsolution,theresultforonetimestep
isareallygoodstartingpointforthenexttimestep.Thus,mostsolutionsinayearlyordailysimulation
takeonly2iterationsonetogetthereandonetoverifyconvergence.

Sothemethodisnotasgoodasothermethodsintermsofnumberofiterationsfortheinitialsolution,
butitisnotterribleeither.SoyoushouldneverhavetosetMaxIterationstoahighvalue.Infact,ifyou
aregettingconvergenceonlyafter100iterations,thereisprobablysomethingwrongwithyourmodel
suchasaLoadorGeneratordefinedwiththewrongvoltagerating.Notethatyoucaneasilyfixthatif
you'vegotthevoltagebasedefinedforeachbusbyusingtheSetLoadandGenkVcommand.This
correctsthekVdefinedforLoadsandGeneratorstomatchthekVbaseofthebustowhichtheyare
connected.NotethatthismismatchcouldalsohappenforanincorrectdefinitionofaTransformer
objectorVsourceobject.

IfOpenDSSreportsthatyoursolutiondidnotconverge,firsttryexecuting'Solve'again.Aswithmost
thingsinOpenDSS,theprogramremainsinthelaststateitwasinwhenitstoppeddoingsomething.
HittingtheSolvebuttonagainwillcontinuetheiterationsfromwhereitleftoff.Ifitstilldoesn't
convergeaftertwomoreSolves,thereislikelysomethinghappeningthatwillpreventconvergenceno
matterhowmanyiterations.

1
OPENDSSForum
UserswererecentlyhavingdifficultieswithconvergenceafteropeningLineobjects.Partofthiswasdue
totheLoadmodelsnotworkingwellatnearzerovoltagesandpartwasduetotinyperturbationsinthe
zerosequence,orground,path.Themodelfrequentlylosesconnectiontoastronggroundsourcewhen
alineisopen,makingitmoredifficulttofigureoutwheretheneutralshouldbe.Build7.6.3.26
correctedmostofthisbutIwouldn'tguaranteeitforallcases.Butdoingmoreiterationswillgenerally
nothelp.

OnMaxControlIterations,theprogramfirstachievesaconvergedpowerflowsolutionthenqueriesall
thecontroldevicestoseeiftheyneedtoadjustsomething.Ifso,theadjustmentismadeandanew
powerflowsolutionisexecuted.Thisiterationprocesscontinuesuntilallcontrolactionsforthepresent
timearedone.

TheusualreasonforexceedingMaxControlIterationsisconflictingcontrols.Onecommononeiswhere
allthecapacitorcontroltimedelaysaresettothesamevalue.Thus,theywillallswitchONatthesame
time.Thatresultsintoomuchvarsupport,sointhenextcontroliterationtheyallswitchOFF.Thiswill
continueforeverifyouletit.ThevalueyousetforMaxControlIterationswillhavenoeffectotherthan
thestoptheprocesswhenMaxControlIterationsisreached.

NotethatwhenyougetthemessagethatMaxControlIterationswereexceeded,thepowerflowsolution
islikelyOK.Youcanuseitifyouwantto.Itisoftenareasonablesolution.

Thecureforthecontroloscillationsistostaggerthetimedelays.Forexample,ifalltheCapControl
objectshaveadelayof60s,settheoneclosertothesubstationto61s.Thiswillforcetheotherone(s)
toactfirstandwilloftenfixtheproblem.InSTATICcontrolmode(thedefaultforSnapshot,Daily,and
Yearlymodes),OpenDSSwillexecuteonlythecontrolswiththeshortesttimedelayoneachcontrol
iteration.InTIMEcontrolmodewithatimestepshorterthanthedelaytimeofthecontrol,suchasyou
woulddoindutycyclemodeforsolarPVgenerationstudies,thisisusuallynotaproblembecausethe
controlactionwaitsuntilthesolutiontimereachesthedelaytime.Itislesslikelythattwocapacitorsin
differentpartsofthecircuitwillarmtoswitchonexactlythesametimestep.Whenitcomestimeto
switch,iftheadditionalcapacitorisnolongerneeded,thecontrolactionispoppedoffthecontrol
queueanddiscarded.

Sothecontrolswillgenerallysortthemselvesoutwhensimulatinginsmalltimesteps.Theproblemis
generallywhensimulatinginlargetimestepslargerthanthedelaytimeinthecontrolorinthestandard
Snapshotmode.InSnapshotmode,thecontrolsimulationstrategyistosortoutthecontrolactionsin
theordertheywouldactuallyoccurinreallife.Thisisdifferentthanmostotherdistributionsystem
analysistools,soitiscommonforOpenDSStopredictdifferentregulatortapsandcapacitorswitch
positions.Ofcourse,wethinkourmethodisbetter;)

TherearelegitimatereasonsforincreasingMaxControlIterations.YouwillseethisinsomeoftheIEEE
TestFeederscripts.

2
OPENDSSForum
Onereasoniswhenyoulimitthemaxtapchangeofregulatorstoonetappercontroliteration.This
frequentlygivesthebestsimulationofanactualvoltageregulator,butrequiresmorecontroliterations.
Anexampleofthiscanbefoundhere:

https://sourceforge.net/p/electricdss/code/HEAD/tree/trunk/Distrib/IEEETestCases/123Bus/Run_IEEE1
23Bus.DSS

AnothercasewouldbeifyouarerunningInvControlonseveralPVSystems.Someofthecontrolmodes
sneakuponthefinalanswerslowlyandrequiremanypassesthroughthecontroliterationloop.

FromWesSunderman:

IfyouhavetheInvControlcontrollingseveralPVSystems,itisgenerally'slow'inarrivingatthefinal
answer.Onereasonitwasprogrammedthisway,istotrytokeepPVSystemsthatareelectricallyclose
tooneanotherfrominteractingwitheachother,forinstanceinvoltvarmode.

Sowepurposefullyslowdownthemaximumreactivepowerchangepercontroliterationtokeepthe
PVSystemsfrominterferingwitheachotherandcausing'hunting'oroscillatorybehavior.

TheusersettableparameterdeltaQ_factor(andthecorrespondingdeltaP_factorforvoltwattcontrol)
canbeusedtoeitherspeedupthearrivalatthesolutiononthevoltvarcurve(withthepotentialof
introducinghuntingoroscillatorybehavior)orslowdownthearrivalatthesolution,percontrol
iteration.

ThedefaultfordeltaQ_factoris0.7.Thatmeansthatthechangeinreactivepowerwillonlybe70%of
thedesiredchange(target)inreactivepowerpercontroliteration.

Itisnottoounusualtohavemaxcontroliterequalto300or500forcasesinvolvingmultiplePVSystems
underInvControl.Oncetheuserisgettinggoodsolutions,thentheycanturnoffloggingofthesecontrol
entriestotheeventlogbysettingEventLog=No,andthiswillspeedthingsupabit

Getting Access to CktElement data via UserWritten DLLs


Question
InmyuserwrittenDLLcodehowcanIgetaccesstocurrentsinneighboringdevices?

Answer
IntheNewprocedureofyourDLL,whichmakeanewinstanceofyouruserdefinedmodel,yougeta
pointertotheCallBacksstruct:

FNew: Function(Var GenVars:TGeneratorVars; Var DynaData:TDynamicsRec; Var


CallBacks:TDSSCallBacks): Integer; Stdcall;// Make a new instance

Thisstructisdefinedasfollows:

TDSSCallBacks = Packed Record

3
OPENDSSForum
MsgCallBack: Procedure (S : pAnsiChar; Maxlen:Cardinal);Stdcall; {Make use of DSS
Message handling}

{Routines for using DSS Parser. This allows you to write models that accept
syntax like other DSS scripts.}
GetIntValue: Procedure(var i : Integer);Stdcall; {Get next param as an integer}
GetDblValue: Procedure(var x : Double); Stdcall; {Get next param as a double}
GetStrValue: Procedure(s : pAnsiChar; maxlen : Cardinal); Stdcall;
{Get next param as a string <= maxlen characters (Cardinal = 32-bit
unsigned)}
{caller must allocate space for s (Maxlen chars)}
LoadParser: Procedure(S : pAnsiChar; maxlen : Cardinal); Stdcall; // Copies a string
into a special instance of the DSS parser
NextParam: Function (ParamName : pAnsiChar; Maxlen : Cardinal):Integer; Stdcall;
{Advance to the next parameter and
Get name of the param just retrieved, if one was given.
Returns length of parameter found. If 0, then end of string.
This is to handle the syntax "paramname=paramvalue" commonly used in DSS
scripts
Copies the string to the location specified by s up to maxlen
characters.
Caller must allocate space (Maxlen chars)}

DoDSSCommand: Procedure(S : pAnsiChar; Maxlen : Cardinal); StdCall;


GetActiveElementBusNames: Procedure(Name1 : pAnsiChar; Len1 : Cardinal; Name2 :
pAnsiChar; Len2 : Cardinal); StdCall;
GetActiveElementVoltages: Procedure(Var NumVoltages : Integer; V : pComplexArray);
StdCall;
GetActiveElementCurrents: Procedure(Var NumCurrents : Integer; Curr : pComplexArray);
StdCall;
GetActiveElementLosses: Procedure(Var TotalLosses, LoadLosses, NoLoadLosses :
Complex); StdCall;
GetActiveElementPower: Procedure(Terminal : Integer; Var TotalPower : Complex);
StdCall;
GetActiveElementNumCust: Procedure(Var NumCust, TotalCust : Integer); StdCall;
GetActiveElementNodeRef: Procedure(Maxsize : Integer; NodeReferenceArray :
pIntegerArray); StdCall;// calling program must allocate
GetActiveElementBusRef: Function(Terminal : Integer) : Integer; StdCall;
GetActiveElementTerminalInfo: Procedure(Var NumTerminals, NumConds, NumPhases :
Integer); StdCall;
GetPtrToSystemVarray: Procedure(var V : Pointer; var iNumNodes : Integer);
StdCall; // Returns pointer to Solution.V and size
GetActiveElementIndex: Function() : Integer; StdCall;
IsActiveElementEnabled: Function() : Boolean; StdCall;
IsBusCoordinateDefined: Function(BusRef : Integer) : Boolean; StdCall;
GetBusCoordinate: Procedure(BusRef : Integer; Var X, Y : Double); StdCall;
GetBuskVBase: Function(BusRef : Integer) : Double; StdCall;
GetBusDistFromMeter: Function(BusRef : Integer) : Double; StdCall;

GetDynamicsStruct: Procedure(var pDynamicsStruct : Pointer); StdCall; //


Returns pointer to dynamics variables structure
GetStepSize: Function() : Double; StdCall; // Return just 'h' from
dynamics record
GetTimeSec: Function() : Double; StdCall; // returns t in sec from top
of hour
GetTimeHr: Function() : Double; StdCall; // returns time as a double in
hours

GetPublicDataPtr: Procedure(var pPublicData : Pointer; Var PublicDataBytes :


Integer); StdCall;
GetActiveElementName: Function(FullName : pAnsiChar; MaxNameLen : Cardinal) :
Integer; StdCall;

4
OPENDSSForum
GetActiveElementPtr: Function() : Pointer; StdCall; // Returns pointer to active
circuit element
ControlQueuePush: Function(Const Hour:Integer; Const Sec:Double; Const Code,
ProxyHdl:Integer; Owner:Pointer):Integer; StdCall;
GetResultStr: Procedure(S : pAnsiChar; Maxlen : Cardinal); StdCall;

FromthisyoucanaccessthingsintheOpenDSSdatastructuresthatyouwouldnoteasilyhaveaccessto
otherwise,forexampletousethesimpleerrormessagemechanism,youcoulddosomethinglike:

CallBack^.MsgCallBack(pAnsichar(AnsiHelpStr), Length(HelpStr));

WhereCallbackisalocalvariablecontainingthepointertothestructthatispassedviatheNew
procedurecall.NotethatstringspassedbetweenDLLsandOpenDSSarelimitedtoANSIstringsfornow.
Also,notethestringlengthargument.Delphidoesn'tneedthis,butifyouwerewritingyourDLLin
Fortran,itwouldpushanotherargument,length,ontothestack.

IwouldusetheDoDSSCommandproceduretoselectanelementandthenIcangetaccesstothat
element'scurrents,losses,power,andvoltages:

MyCmdString= 'Select Line.MyLine 1';

CallBack^.DoDSSCommand(pAnsiChar(MyCmdString), Length(MyCmdString));

CallBack^.GetActiveElementCurrents(NumCurrents, MyCurrents);

// where MyCurrents is a pointer to a complex array

YoucanalsogetaccesstotheSystemVarray,whichisallthenodevoltages:

CallBack^.GetPtrToSystemVarray(MyVarray, NumberofNodes);

// then ...

Avoltage := MyVarray^[index]; // This is a complex number

Thereisnotglobalcurrentarray.Currentsarecomputedasneededbycallingthedeviceforwhichthe
currentsaredesired.

Keepinmindthereispotentialdangerintinkeringwiththeglobalarrays.Youcanbreakyourmodelif
youaren'tcareful.

Also,letmeremindyouthatthedesignphilosophyofOpenDSSisthatnocircuitelementknows
anythingaboutanothercircuitelement.Therearefewexceptions(metersandcontrolelements).Ifyour
modelneedstoknowsomethinglikevoltageorcurrentfromsomeothercircuitelementinorderto
function,youmightwanttoreconsiderthedesign.

5
OPENDSSForum
Getting the System Jacobian Matrix
Question
IseethereisaNewtonsolutionmethods.HowcanIgettheJacobian?

Answer
The system Y matrix is used as the Jacobian in the Newton algorithm. It is the same Y matrix as in the
"normal" fixed point solution. So you can get it from either solution algorithm.
Note that you get the Y matrix in different formats depending on whether you get it from "Show Y",
"Export Y", or through the SystemY property of the Circuit interface when driving the program from COM.
OnethingyouwillhavetodecideiswhetheryouwantLoadandGeneratorequivalentsintheYmatrix
foryouralgorithm.IfyoudefineLoadandGeneratorobjectsyouwillgettheNortonequivalent
admittancesintheYmatrix.Soifthatmessesupyouralgorithm(whichitfrequentlydoes),doaSolveof
somesortbeforeyoudefineLoadandGeneratorobjects,etc.,andextracttheYmatriximmediately
aftertheSolvecommand.

TheYmatrixisacommonnodaladmittancematrixinallformulationsthatwecurrentlyhave
implemented.YoucouldformadifferentsetofequationssuchasanaugmentedYmatrixlike
SuperHarmuses,butwejusthaven'tdoneit.Infact,the"normal"fixedpointsolutionusingYworksjust
finefornearlyallthethingswearedoing.

Earlyon,whenthesystemgotalittleillconditionedweusedaNewton(technicallyaNewtonRaphson)
methodtogetbetterconvergencethanthefixedpointmethod.Now,Idon'tknowifthereisreally
muchdifferencebetweenthetwoafterimplementingsometrickstogetthefixedpointtoworkbetter.

Thefixedpointsolutionmightbewritten:

Vn+1=[Y]1*Icomp(Vn)

WhereIcompisthecompensationcurrentfromthenonlinearloads,etc.(SeetheUser
Manual;OpenDSSManual.pdf)

TheNewtonmethodinOpenDSSmightbewritten:

Vn+1=Vn[Y]1*Itermn

WhereItermisthearrayofterminalcurrentsumsforallnodes.Thisformulationtriestoforcethecurrent
tosumtozeroateachnode.Itwillconvergealittlebetterforcasesthatarereallynonlinearand/orill
conditioned.However,wecurrentlydon'tupdateYbetweeniterations,soitreallyisn'tmuchofan
advantageoverthefixedpointandtakestwiceasmanyarithmeticoperations.Sowepreferthefixed
pointfortimesequentialsimulationsfortheobviousreasonthatifyouarerunningan8760hour
simulationitisfaster.

SotheYmatrixisusedastheJacobianinthisformulation.Aslongasthederivativespointintheright
direction,thesolutionislikelytogetthereeventually.Itwouldconvergeinfeweriterationsifwe

6
OPENDSSForum
updatedtheYmatrixforthenonlinearloadderivativesateachiterationasmyfriendsinBrazil(Sando
Carneiro,Jr.,JoseLuizPereira,et.al.)do,butiterationsarecheapcomputationally.RebuildingYismore
expensive.Besides,onceyougetatimeseriessimulationgoing,thereisfrequentlyonly2iterations
betweentimestepsonetogetthereandonetoproveyougottherebecausethesolutionatone
timestepisarealgoodstartingpointforthesolutionatthenext.

Thehistoryis:wetriedacrudefixedpointin1997whenitwasinamuchmoreprimitivestatethanitis
nowanditworkedfornearlyalldistributionsystemsweweresimulating.Welaterranintoa
transmissionsystemthatwouldn'tconvergeandsolvedthatwiththeNewtonalgorithm.Butdon't
confusethatwiththeNewtonRaphsonalgorithmyoufindinmostpowersystemanalysistextbooks.
Thatusesadifferentformulationofthepowerflowproblem.Butitisstillasystemofnonlinear
equationssolvedbyNewton'smethod.

Subsequently,wehaveevolvedthepowerconversionmodelsandthemethodofobtainingthefirst
guesstothepowerflowsolutionsothatthefixedpointcansolvenearlyeverythingwedo.Gettinga
betterfirstguessatthevoltageswasakey.Thatsolvedalotofconvergenceproblems.

Precision Issues with MATLAB and Python


ShortlyafterpostingOpenDSSonlinewestartedhearingaboutapparentprecisionproblemsfrom
MATLABusersdrivingOpenDSSthroughitsCOMinterface.TheusualcomplaintwasthatOpenDSS.EXE
gaveagoodanswerbutMATLAByieldedbadvaluesforthecurrentsandpowers.Wesuspectedthat
MATLABwassettingtheprecisionofthemathbecausetheproblemcameupwithveryshortlineswith
tinyimpedances.OpenDSSusesanodaladmittanceformulationandcomputesthenodevoltagesfrom
solvingI=[Y]V.Thenthevoltagesareusedtocomputethecurrents,whicharesubsequentlyusedto
computethepowers.

Ifabranchinthecircuithasverysmallimpedance,thevoltagesonbothendsofthebranchhavenearly
thesamevalues.Thenwemultiplythedifferenceinthevoltages,whichcouldbeinaccurate,byvery
largeadmittances,sometimesyieldsverylarge,incorrectcurrents.

RecentlythesamecomplaintarosewhenusingPythontodriveOpenDSS.UserChristopherWilliams
isolatedtheproblemtotheswitcheshewasmodelingwithverysmallimpedances.Aquicksearchofthe
internetcameupwiththesuggestionthatsomethingcalledtheFPCW(floatingpointcontrolword)
mightbeattheheartofthematter.AdamBirchfieldwastaskedwithfindingouthowtosettheFPCW
fromPythonandtestingtoseeifitwouldexplainthedifferencesweareseeing.Hispostonthesite
explainstheproblemandresolutionquitewell:

Christopher, thank you for all your work to demonstrate this calculation inconsistency with using
Python through the OpenDSS COM server. I was able to reproduce the inconsistency using the
IEEE 13 bus network switch, when the switch was reduced to a resistance of 1e-11 ohms. I
discovered that, at least on my machine with an Intel(R) Core(TM) i5-3470 CPU using Windows 7

7
OPENDSSForum
Professional, the Floating Point Control Word (FPCW) can be controlled in a Python program,
and the default precision level is 64-bit with a 53-bit mantissa. Since OpenDSS calculates with
80-bit precision on my machine, a small switch like that can produce erroneous currents on 64-bit
precision when the correct currents are given for 80-bit. When I manually changed the FPCW
precision level in Python to 80-bit, the results matched OpenDSS exactly.
The following link shows how to use the C function "_controlfp", which allows one to change the
FPCW in C. The first argument should be 0x00010000 for 64/53 precision and 0x00000000 for
80/64 precision. The second argument should be 0x00030000 to mask the FPCW for the
precision bits.
https://msdn.microsoft.com/en-us/library/e9b52ceh.aspx
The C function "_controlfp" can be accessed through the DLL "msvcrt" which I access through the
module "ctypes.cdll." Here's my Python code to access the FPCW:

1 # Test program to change FPCW and run something on OpenDSS


import win32com.client
2
from ctypes import cdll
3
4
def opendss_do_something():
5
# Some basic code to run OpenDSS and get some results
6 results = "123"
7 engine = win32com.client.Dispatch("OpenDSSEngine.DSS")
8 engine.Start("0")
9 engine.text.Command = "redirect (IEEE13Test.dss)"
10 #...do some more stuff to get currents we want
11 return results
12
13 def main():
14 # run before changing FPCW
15 results_prelim = opendss_do_something()
16
17 # now change FPCW to 64-bit and run
18 cdll.msvcrt._controlfp(0x10000, 0x30000)
19 results_64 = opendss_do_something()
20
21 # now change FPCW to 80-bit and run
22 cdll.msvcrt._controlfp(0x00000, 0x30000) # <-- this is the magic line
results_80 = opendss_do_something()
23
24
print results_prelim, results_64, results_80
25
26 if __name__=="__main__": main()
27

28
With the right model, you should see a difference between the 64-bit results and what you get
from OpenDSS directly. However, the 80-bit results should match OpenDSS exactly.

8
OPENDSSForum
InOpenDSS,allfloatingpointnumbersarestoredasdoubles,or64bitvalues.Thedefaultmathco
processorprecisionisused,whichonthemodernIntelprocessorsisIEEE80bitmath.Sowhen
OpenDSS.EXEisruntherecouldbeupto11morebitsaccuracywhenamathoperationisperformed.
Thisobviouslymakesadifference.BothMATLABandPythonapparentlychangetheFPCWbydefaultto
limittheprecisionto64bits.Onereasonfordoingthismightbesothatyougetthesameansweron
differenthardwareplatforms.Nevertheless,youcanchangetheFPCWwitheitherprogramasdescribed
aboveifyouwanttheresultsofasimulationperformedthroughtheCOMinterfacetoexactlymatchthe
resultsfromthestandaloneEXE.

Thisproblemcanalsobealleviatedbymorejudiciousmodeling.Ifyouchoosetomodelswitches
explicitly,choosearesmallbutreasonablevalue.WhenyoudefineaLineobjectwithSWITCH=Ythe
defaultisalinewithbasicallyZ=0.001+j0.001ohms.Thatshouldbesufficientlysmallformost
simulations.YoumayhavetogoalittlesmalleronsomeLVcircuits.

TheproblemofshortlineswasanticipatedwhenOpenDSSwasoriginallydesigned.Toavoidhavingto
specificallymodelswitches,eachterminalofeachcircuitelementisassumedtohaveaswitchthatyou
cancontrolwiththeOPENandCLOSEcommands.

Fuse Simulation
Question
I'verunanumberofsimulationswithvarioustypesoffaultssuccessfully.IdeallyIwouldliketoinclude
fusebahaviorasI'minterestedinwhatcanbeobservedofanLVfaultattheMVsideoftheMVLV
transformer.Ididdoasuccesfuldemorunwithafuse,butthatonlyresultedinzerocurrent.

IdeallyIwouldliketogetasimulationresultshowingmeforaparticularLVfaultandnetwork
configuration:
1.thetimeittakesforthefusetoblowforthegivenfault
2.thecutoffcurrentofthefuse(lowerthantheprospectivecurrentforshortfusetimes)atthe
momentthefuseblows
3.theothercurrentspresentinthesystematthemomentofcutoff

Ihaven'tbeenabletofindcleardocumentationonthefusefeature,norgavethecodeadefinitive
answer.Normallythismightbemoreappropriateforatimebasedsimulator,butOpenDSSshouldbe
abletogivemetheindicationaslistedabove.

AnotherwayofgoingaboutisbydeterminingtheshortcircuitcurrentattheLVsideanddeterminethe
fusetimesandthecutoffcurrentsusingthedatasheet.Ididthatalready,butthisisn'tasaccurateand
asfastasafullfeaturedsimulation.AlsoIwouldhavetotranslatetheLVcurrentstotheMVsideto
determinetheobservableeffect.

DoesOpenDSShavebuiltinfeaturesIhaveoverlookedthatmighthelpmewiththissimulation?

9
OPENDSSForum

Answer
OpenDSSperformsovercurrentprotectionanalysisbysimulatingthefault.IfyouareapplyingtheFAULT
objectinSnapshotmode,thecontrolmodeisSTATIC,whichmeansitwillexecuteallcontrolactionsin
timesequencebutatthesametimestep.Soitsimulatedthefuseaction,butitappearstohave
happenedallatonce.

ToseethetimevariationinFUSEandotherprotectivedeviceactions(RECLOSER,RELAY)youwoulduse
Dynamicsmodewithasmalltimestep.IloadeduptheIEEE123testfeeder,whichyoushouldhave
installedwithOpenDSSandthenaddedthisscriptafteraninitialsolve:

/*
FUSE model demo for IEEE 123 test feeder supplied with OpenDSS

Define a lateral fuse and put a Monitor at the same location


Fuse will have the same number of phases as the monitored element (1 in this case)
Two TCC_Curve objects for fuses are defined by default for every circuit: KLINK and
TLINK

*/

New Fuse.Fuse1 line.L2 1 Fusecurve=TLINK ratedcurrent=65 ! 65T fuse


New Monitor.Fuse1 Line.L2 1

solve ! snapshot prior to dynamics mode to get Monitor and Fuse assimilated into
circuit

// solve a few steps (1 60-Hz cycle) in Dynamics mode just to get everything going
Solve mode=dynamics stepsize=0.0016666666 number=10

// Add a fault at the end of the lateral


New Fault.F1 phases=1 Bus1=6.3
Solve number=100 ! solve 10 cycles, still in Dynamics mode

// check out the results of the simulation


show monitor fuse1

Export monitors fuse1


Plot monitor object= fuse1 channels=(3 ) ! currents
Plot monitor object= fuse1 channels=(1) ! voltage
Show Eventlog
Thissimulatesalateralfuseonthe1phaselateralonphase3nearthesubstationwithafaultattheend
ofthelateral(node6.3).Youshouldbeabletoseethecurrentinthelinegouptoabout6000Aandthe
voltageatthefuselocationdropduringthefault.Thenwhenthefuseblows,thecurrentshouldgoto
zeroandthevoltagebouncesbackup.

AFUSEelementisaCONTROLelement.Thatis,itmonitorsthecurrentinTerminal1ofLine.L2butisn't
actuallyinthecircuit.WhentheFUSEdeterminesitshouldblowitopenstheterminalofLINE.L2,which
iscarryingcurrentinthecircuit.

SometimesyouhavetoputtheMONITORatadifferentlocationtogettherightvalues,butitappearsto
workfineinthesimulation.

10
OPENDSSForum
Sothatisbasicallyhowyoudoit.IfyouwanttohavesomefunputaRECLOSERandFUSEinseriesina
circuitwithatleastonefastcurve(e.g.theAcurvedefinedwhenthecircuitiscreated)andadelayed
curve.WhenyouputaFAULTdownstreamoftheFUSE,youshouldseetheRECLOSERoperateonthe
fastcurveandthentheFUSEblowaftertherecloseacouplesecondslater.Canbealittletrickytoset
up,butitworkedthelasttimeItestedit.

FaultStudy Mode
Question
IhavereadmanualandpapersIfoundwithcodeaboutfaultstudyanddynamicsmode(OpenDSS
FaultStudyMode.pdfandOpenDSSDynamicsMode.pdf).IfoundthataGeneratorobjectconvertsintoa
formofTheveninequivalentwhenswitchingtoDynamics,butinFaultStudypaperitsaysthatVoltage
objectsandanyGeneratorsareconvertedtoNortonequivalentsaftertheyhasbeenconvertedto
dynamicequivalent.Iamconfused,whenswitchingtoDynamicsareGeneratorsconvertedfromNorton
toTheveninequivalentandthenbacktoNorton?
Thankyouforanswersinadvance.

Answer
Itisinterestingyoushouldbeaskingthisatthistime.Lastweek,Ididanextensiveinvestigationinto
howOpenDSSishandlingtheFaultStudymodebecausetheX/Rvaluesweren'tcomingoutcorrectfor
oneuser.WefixedthatbyaddingtheXRdppropertytotheGeneratormodeltoproperlysetthe
resistancewheninDynamicsmode.Youshoulddownloadthelatestversiontogetthatbugfix.

WhatIdidn'trealize(probablysimplyforgotitwasdonebefore2003)isthatwhenyouenter
FaultStudymode,OpenDSSswitchestoDynamicsmodeautomatically.SoSolvemode=FaultStudywill
buildYandtheshortcircuitmatrices(ZscandYsc)usingXd'fortheGeneratormodel.Soyounolonger
needtosetMode=Dynamicsanddooneortwosmalltimestepslikeyouusedtohavetodo.Ofcourse,
youwillstilldothatwhenyoumodelafaultbyapplyingoneormoreFAULTobjects.

Ididn'trealizethisbecausethefaultcurrentswerecomingoutlow,soIassumedYwasbeingbuiltfrom
theequivalentadmittanceforthepoweroutputasitisforothersolutionmodes.Thefaultcurrentsare
computedfromtheprefaultvoltageandtheYscateachbuscomputedfromY.Sothetrickistogetthe
prefaultvoltagesascloseto1.0perunitaspossiblebeforeperformingSolveMode=Faultstudy.Thenthe
faultcurrentswillmorecloselymatchconventionalshortcircuitanalysisresultswithgenerator
contributions.

TheuserwhowashavingthedifficultyandIcameupwiththefollowingscripttoaccomplishthisandI
gotareporttodaythatitisworkingquitewell.

...
(set source at 1.0 per unit)

11
OPENDSSForum
Solve loadmult=0.001 genmult=0.001
Solve Mode=Faultstudy
Export Faultstudy or Show Faultstudy
...

On OpenDSS Solution Techniques

Question
IhaveafewbasicquestionstobetterunderstandthesolutiontechniquesbehindOpenDSSandbetter
useitscapabilities.

1 OpenDSSisaHarmonicssolverratherthanpowerflow,whatdoesthatmeanexactly?What's
thesolutiontechniquesbehindsolvingpowerflowinOpenDSSandhowcanithandle
harmonics?
2 HowdoesOpenDSSsolveforelectromechanicaltransient??Andifthesolutionisfrequency
domain(phasors)doesn'tthatassumeaconstantfrequencyforthesolution?
3 IfOpenDSSsolvesforharmonicsdoesthatmakeitsimilartoEMTeventhoughitdoesn'tsolve
timedomainequations?
4 IseethatOpenDSSismostlybeingappliedforPowerflowandQSTSsimulations,sowhatare
someoftheapplicationofOpenDSSforDynamicandHarmonicstudies?

Answer
1. ThebasicsolutionmethodsasfarasbuildingtheYmatrixandmodelinglines,
transformers,andotherelementswereborrowedfromaseriesofprogramsdeveloped
forharmonicsanalysis.IdeascamefromSuperHarm,VHarm,andDFHAharmonics
analysisprogramsaswellastheMETAPprogramfromtheMid1970's(seeTalukdar's
paperfromabout1976).Theharmonicsprogramsarealllinear,multifrequency,multi
phase,phasorsolversthatbuildanodaladmittancematrixateachfrequencyandsolve
itdirectly.TheyallhadobjectorientedprogrammingstucturesevenbeforeOOP
becamepopular,makingformodularrobustmodeling.OpenDSSretainsthese
capabilitiesbutalsoaddspowerflowsolutioncapabilityforthefundamentalfrequency.
AsIsaidinanIEEEpaperabout34yearsago,itiseasiertoteachaharmonicssolver
howdoapowerflowproblemthantomakeapowerflowalgorithmsolvethe
harmonicsproblem.TheharmonicssolverheritagegivesOpenDSStheabiilitytomodel
justaboutanycircuittopologyonemightencounterinactualpowersystems.Since
mostharmonicsproblemsoccurindistributionorindustrialsystemswithcomplex,
unbalancedtopologies,theheritageimpartsthesecapabilitiestothepowerflow
problemwithafew,minortweakstomodelingthenonlinearelements(PCElements
inOpenDSSterminology).Thesolutiontechniqueisdescribedinonefigureinthe

12
OPENDSSForum
OpenDSSusermanualandthatisallitis.Manyusersarelookingforsomethingmore
complicated,butit'snot.

2. OpenDSSisstructuredmorelikeatransientstabilityprogramthanatraditionalpower
flowprogram.CertainPCelementslikeGeneratorsareprovidedwithtraditional,simple
singlemassswingequationcapability.PCElementslikeGeneratorscanemployasimple
predictorcorrectoralgorithmtomodeldifferentialequations.WheninDynamicsmode,
theintegrationroutinesgetautomaticallycalledtocomputethenewvaluesofthestate
variables.Yes,thenetworkfrequencyisgenerallyassumedtobeconstant,butrotating
machinescanchangespeeds.Thisisprettymuchwhatyouhaveonadistributioncircuit
whereadisturbanceisnotlikelytochangethefrequencyofthebulkpowersystem.So
weusethiscapabilityforislandingandsinglephasinganalysesprimarily.However,we
dohaveafewusersexperimentingwithchangingthenetworkfrequency(Set
Frequency=...)whichforcesaYmatrixrebuild.Aswedevelopbettermicrogrid
capabilities,Iexpectthistoevolve.

3. ItsstuctureissimilartosomeEMTsolvers,andyoucouldprobablyaddtheappropriate
modelsandsupportalgorithms.I'veactuallyhadafewgradstudentssaytheywanted
todothat,butIthinkitturnedouttobeabiggerchorethantheyanticipated.We'vegot
accesstoreallygoodEMTsolvers,sothere'slittleincentiveforustoinvestinthat
capability.Itisouropinionthatwecantackled95%oftheproblemsweareinterestedin
solvingfromtheplanningperspectiveinthephasordomain.Occasionally,wewillfind
wehavetomodeltheswitchingofaninverterindetailoraferroresonanceproblemin
anEMTmodel.Butwe'vegotmoreissuestostudywithphasormodelsthanwecanget
to.Ifwecandoitacceptablywithaveragemodelsinthephasordomain,solutiontimes
aremorethan100timesfasterandwecanevaluatemanymoreoptionsinthesame
amountoftime.SomeoftheEMTsimulationswerunaredonetoprovetoskeptical
clientsthatOpenDSSgottherightanswer!

4. TheoriginalapplicationofdynamicswasforislandinganalysisofrotatingmachineDG.
CantheDGchangevoltageorfrequencyfastenoughtogetofflinebeforethereclose?
Wehavealsouseditforstoragesimulationsofultracapbasedstorageelementsthat
canchargeanddischargequickly(usesauserwritten"DynaDLL").Wealsousethis
modeforsomefaultcurrentcontributionanalysesandanalysesofsinglephasingofDG.
Weexpectthismodewillbeusedextensivelyforourupcomingmicrogridresearch.
Harmonicsmodeisusedforanynumberofharmonicsanalysisproblems.Wehavesome
serioususersstudyingtheimpactofEVchargersusingtherecentlyaddedsequential

13
OPENDSSForum
harmonicsmode.TheEPRIHarmonicsEvaluationModuleusesthismodeextensively
andIhaveseenademoofasimilarappdoneforCEATI.Useyourimagination!

14
OPENDSSForum

S-ar putea să vă placă și