Function DoFault

 

Function DoFault( ByVal nDevHnd&, ByRef vnFltConn() As Long, _

       ByRef vdFltOpt() as Double, ByRef vnOutageOpt() as Long, _

       ByRef vnOutageLst() as Long, _

       ByVal dFltR#, ByVal dFltX#, ByVal nClearPrev& ) As Long

Purpose: Simulate one or more faults.

Works in:      OneLiner only.

Parameters:     

nDevHnd       [in] handle of a bus, branch or a relay group.

vnFltConn   [in] fault connection flags. 0 - reset
vnFltConn(1) – 1=3PH
vnFltConn(2) – 1=2LG_BC;2= 2LG_CA;3= 2LG_AB
vnFltConn(3) – 1=1LG_A; 2=1LG_B; 3=1LG_C;
vnFltConn(4) – 1=LL_BC; 2=LL_CA; 3=LL_AB;

vdFltOpt    [in] fault options flags. 1 – set; 0 - reset
vdFltOpt(1)  - Close-in
vdFltOpt(2)  -
Close-in w/ outage
vdFltOpt(3)  -
Close-in with end opened
vdFltOpt(4)  -
Close-in with end opened w/ outage
vdFltOpt(5)  -
Remote bus
vdFltOpt(6)  -
Remote bus w/ outage
vdFltOpt(7)  -
Line end
vdFltOpt(8)  -
Line end w/ outage
vdFltOpt(9)  -
Intermediate %
vdFltOpt(10) -
Intermediate % w/ outage
vdFltOpt(11) -
Intermediate % with end opened
vdFltOpt(12) -
Intermediate % with end opened w/ outage
vdFltOpt(13) -
Auto seq. Intermediate % from (*)
vdFltOpt(14) -
Auto seq. Intermediate % to (*)
vdFltOpt(15) – Outage line grounding admittance in mho (***).

vnOutageLst [in] list of handles of branches to be outaged; 0 terminated

vnOutageOpt [in] branch outage option flags. 1 – set; 0 - reset
vnOutageOpt(1) - one at a time
vnOutageOpt(2) - two at a time
vnOutageOpt(3) - all at once
vnOutageOpt(4) – breaker failure (**)

dFltR       [in] fault resistance, in Ohm

dFltX       [in] fault reactance, in Ohm

nClearPrev  [in] clear previous result flag. 1 – set; 0 - reset

Return value:

N>0            Index number of the last fault simulated by the function

0               failure

Remarks:

(*)  To simulate a single intermediate fault without auto-sequencing, set both vdFltOpt(13)and vdFltOpt(14) to zero

(**) Set this flag to 1 to simulate breaker open failure condition that caused two lines that share a common breaker to be separated from the bus while still connected to each other as shown in the picture below. TC_BRANCH handle of the two lines must be included in the array vnOutageLst.

(***)    To simulate fault with outaged lines that are solidly grounded at both ends, use 999999.0 for this parameter.

Example:

 

' Simulate the faults

If DoFault( nBusHnd, vnFltConn, vdFltOpt, vnOutageOpt, vnOutageLst, dFltR, _

     dFltX, nClearPrev ) = 0 Then GoTo HasError

 

' Print output

sBusName1 = FullBusName( nBusHnd )

Print #1, "Fault simulation at Bus: ", sBusName1

Print #1, ""

Print #1, "                                  Phase A      Phase B      Phase C"

Print #1, ""

 

' Start from the first fault

If PickFault( 1 ) = 0 Then GoTo HasError

Do

  If GetSCCurrent( HND_SC, vdVal1, vdVal2, 4 ) = 0 Then GoTo HasError

  Print #1, FaultDescription(); Chr(10); _

     "                                     "; _

     Format( vdVal1(1), "####0.0"); "@"; Format( vdVal2(1), "#0.0"), Space(5), _

     Format( vdVal1(2), "####0.0"); "@"; Format( vdVal2(2), "#0.0"), Space(5), _

     Format( vdVal1(3), "####0.0"); "@"; Format( vdVal2(3), "#0.0")

Loop While PickFault( SF_NEXT ) > 0

Print "Simulation complete. Report is in " & fileName

Stop

HasError:

Print "Error: ", ErrorString( )

Stop