Function GetRelay

 

Function GetRelay( ByVal nRlyGrp&, ByRef nRlyHandle& ) As Long

Purpose: Get handle of the next relay or fuse in a relay group.

Works in:      OneLiner only.

Parameters:     

nRlyGrp       [in] relay group handle.

nRlyHandle   [int/out] relay handle.

Return value:

1               success

-1              already at last relay

0               failure

Remarks: Set nRlyHandle to zero to get the handle to the first relay in the relay group.

Example:

 

   ' Pick the first fault

   If PickFault( 1 ) Then GoTo HasError

 

   ' Loop through all relays in the database and find their operating times

   nRelayCount& = 0

   nRelayHnd&   = 0

   While GetRelay( nPickedHnd, nRelayHnd& ) > 0

     nRelayCount = nRelayCount + 1

     nType = EquipmentType( nRelayHnd )

     If nType = TC_RLYOCG Then nParamID& = OG_sID

     If nType = TC_RLYOCP Then nParamID& = OP_sID

     If nType = TC_RLYDSG Then nParamID& = DG_sID

     If nType = TC_RLYDSP Then nParamID& = DP_sID

     If nType = TC_FUSE   Then nParamID& = FS_sID

     If GetData( nRelayHnd, nParamID, sID$ ) = 0 Then GoTo HasError

     If GetRelayTime( nRelayHnd, 1.0, dTime# ) = 0 Then GoTo HasError

     Print "Relay " & sID & ": "; Format( dTime, "#0.#0s" )

   Wend

   Print "Relays in this group = "; nRelayCount

   Stop

   ' Error handling

   HasError:

   Print "Error: ", ErrorString( )

   Stop