Function GetFlow

 

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

       ByRef vdOut2() as double ) As Long

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

Works in:      Power Flow only.

Parameters:     

nHandle       [in] data object handle

vdOut1      [out] Real power in MW into equipment terminal(s)

vdOut2      [out] Reactive power in MVAR into equipment terminal(s)

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, switch, 3 for 3-winding transformer. For equipment that has more than one connected bus, the flow results are stored in the following order:
- vdOut1(1), vnOut2(1):  flow from equipment’s Bus1
- vdOut1(2), vnOut2(2):  flow from equipment’s Bus2
- vdOut1(3), vnOut2(3):  flow from equipment’s Bus3

 

Example:

 

   Dim Parray(3) As Double, Qarray(9) 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 GetFlow( LineHnd, Parray, Qarray, 4 ) = 0 Then GoTo HasError

   ‘ Show them

   Print _

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

       "P1 = "; Format( Parray(1), "#0.0"); " Q1= "; Format( Qarray(1), "#0.0"); _

        "; P2 = "; Format( Parray(2), "#0.0"); " Q2 = "; Format( Qarray(2), "#0.0")