Function GetBusEquipment

 

Function GetBusEquipment( ByVal nBusHnd&, ByVal nType&, _

                          ByRef nHandle& ) As Long

Purpose: Retrieves the handle of the next equipment of a given type that is attached to a bus.

Works in:      OneLiner and Power Flow.

Parameters:     

nBusHnd       [in] Bus handle

nType       [in] Equipment type. See remark below.

nHandle     [in/out] Equipment handle. Set to zero for the first item. Otherwise, leave it at the value of the previous item.

Return value:

1               success

-1              already at the end of the list

0               failure

Remarks: Set nHandle to zero to get the first equipment handle. You must get the bus handle prior to calling this function. The equipment type can be one of the following:

TC_GEN:            to get the handle for the generator. There can be at most one at a bus.

TC_LOAD:           to get the handle for the load. There can be at most one at a bus.

TC_SHUNT:         to get the handle for the shunt. There can be at most one at a bus.

TC_SVD:            to get the handle for the switched shunt. There can be at most one at a bus.

TC_GENUNIT:      to get the handle for the next generating unit.

TC_LOADUNIT:    to get the handle for the next load unit.

TC_SHUNTUNIT: to get the handle for the next shunt unit.

TC_BRANCH:       to get the handle for the next branch.

 

Example:

 

‘ Put all bus branches in outage list for fault simulation

For ii = 1 To 20  ' max 20 outage

   If GetBusEquipment( nBusHnd, TC_BRANCH, nBrHnd ) > 0 Then

     vnOutageLst(ii) = nBrHnd

   Else

Exit For

   End If

Next

vnOutageLst(ii) = 0  ' Must always close the list