Function GetSCVoltage

 

Function GetSCVoltage( ByVal nHandle&, ByRef vdOut1() as double, _

               ByRef vdOut2() as double, ByVal nStyle& ) As Long

Purpose: Retrieves post-fault voltage of a bus, or of connected buses of a line, transformer, switch or phase shifter.

Works in:      OneLiner only.

Parameters:     

nHandle       [in] data object handle

vdOut1      [out] voltage result, real part or magnitude, at equipment terminals

vdOut2      [out] voltage result, imaginary part or angle in degree, at equipment terminals

nStyle      [in] voltage result style
=1: output 012 sequence voltage in rectangular form
=2: output 012 sequence voltage in polar form
=2: output ABC phase voltage in rectangular form
=4: output ABC phase voltage in polar form

Return value:

1               success

0               failure

Remarks: The size of arrays vdOut1 and vdOut2 must be at least equal to 3 times the number of buses connected to the equipment: 1 for a Bus; 2 for a Line, 2-winding transformer, phase shifter, switch; 3 for a 3-winding transformer. For equipment that is connected to more than one bus, voltage result is stored in the arrays in group of 3 phases ABC (or 3 sequences Zero, Positive, Negative) in the following order:
- vdOut1(1…3), vnOut2(1…3):  Voltage at equipment’s Bus1
- vdOut1(4…6), vnOut2(4…6):  Voltage at equipment’s Bus2
- vdOut1(7…9), vnOut2(7…9):  Voltage at equipment’s Bus3

 

Example:

 

  If GetEquipment( TC_PICKED, nDevHnd ) = 0 Then

   Print "Must select a line"

   Stop

  End If

  If EquipmentType( nDevHnd ) <> TC_LINE Then

   Print "Must select a line"

   Stop

  End If

  ' Get line’s end buses

  If GetData( nDevHnd&, LN_sID, sVal1$ ) = 0 Then GoTo HasError

  If GetData( nDevHnd&, LN_nBus1Hnd, nBusHnd& ) = 0 Then GoTo HasError

  sVal2$ = FullBusName( nBusHnd& )

  If GetData( nDevHnd&, LN_nBus2Hnd, nBusHnd& ) = 0 Then GoTo HasError

  sVal3$ = FullBusName( nBusHnd& )

  ' Show the fault

  If PickFault( 1 ) Then GoTo HasError

  'Get voltagge at the end bus

  If GetSCVoltage( nDevHnd&, vdVal1, vdVal2, 4 ) = 0 Then GoTo HasError

  ' Show it

  Print "Voltage on line: "; sVal2$ & "-"; sVal3$ & " ID= "; sVal1$; ": "; Chr(10); _

         "V1a = "; Format( vdVal1(1), "#0.0"); "@"; Format( vdVal2(1), "#0.0"); _

            "; V1b = "; Format( vdVal1(2), "#0.0"); "@"; Format( vdVal2(2), "#0.0"); _

            "; V1c = "; Format( vdVal1(3), "#0.0"); "@"; Format( vdVal2(3), "#0.0"); Chr(10); _

            "V2a = "; Format( vdVal1(4), "#0.0"); "@"; Format( vdVal2(4), "#0.0"); _

            "; V2b = "; Format( vdVal1(5), "#0.0"); "@"; Format( vdVal2(5), "#0.0"); _

            "; V2c = "; Format( vdVal1(6), "#0.0"); "@"; Format( vdVal2(6), "#0.0")