Function GetPFCurrent

 

Function GetPFCurrent( ByVal hHandle&, ByRef vdOut1() as double, _

       ByRef vdOut2() as double ) As Long

Purpose: Retrieve current in load flow simulation for a generator, load, shunt, switched shunt, generating unit, load unit, shunt unit, transmission line, transformer, switch, or phase shifter.

Works in:      Power Flow only.

Parameters:     

nHandle       [in] data object handle

vdOut1      [out] current result  magnitude into equipment terminals

vdOut2      [out] current result angle in degree, into equipment terminals

nStyle      [in] current result style
=0: output current in Amperes
=1: output current in per-unit

Return value:

1               success

0               failure

Remarks: The size of arrays vdOut1 and vdOut2 must be at least equal to the number of buses connected to the equipment: 1 for generator, load, shunt, switched shunt, generating unit, load unit, shunt unit; 2 for Line, 2-winding transformer, phase shifter, switch; 3 for 3-winding transformer. For equipment that has more than one connected bus, the current results are stored in the following order:
- vdOut1(1), vnOut2(1):  current from equipment’s Bus1
- vdOut1(2), vnOut2(2):  current from equipment’s Bus2
- vdOut1(3), vnOut2(3):  current from equipment’s Bus3

 

Example:

 

   Dim MagArray(3) As Double, AngArray(3) As Double

   ‘ Get end bus names

   If GetData( LineHnd, LN_nBus1Hnd, BusHnd ) = 0 Then GoTo HasError

   Bus1ID = FullBusName( BusHnd )

   If GetData(LineHnd, LN_nBus2Hnd, BusHnd ) = 0 Then GoTo HasError

   Bus2ID = FullBusName( BusHnd )

   ‘ Get current

   If GetPFCurrent( LineHnd, MagArray, AngArray, 0 ) = 0 Then GoTo HasError

   ‘ Show them

   Print _

        "Current on line: "; Bus1ID & "-"; Bus2ID & " ID= "; LineID$; ": "; Chr(10); _

       "I1 = "; Format( MagArray(1), "#0.0"); "@"; Format( AngArray(1), "#0.0"); Chr(10) _

       "I2 = "; Format( MagArray(2), "#0.0"); "@"; Format( AngArray(2), "#0.0")