AssociateReq

AssociateReq 1:

This method activates the Associate service. A client can use this service to establish a connection to the server.

METHOD AssociateReq : BOOL
VAR_INPUT
    ipSink   : I_ScsmAssociateCnfEventSink;
END_VAR
VAR_OUTPUT
    ipResult : I_AsyncServiceResultClass;
END_VAR

ipSink: Interface pointer of type I_ScsmAssociateCnfEventSink of an object with a user-defined implementation of the event handling routine OnAssociateCnf (service feedback). This parameter is optional and reserved for future use. The pointer value 0 defines the parameter as optional.

ipResult: Interface pointer of type: I_AsyncServiceResultClass This pointer can be used to query and monitor the status/progress and the result of the service execution.

Return parameter: Positive feedback (TRUE) if the service primitive was sent/started successfully, negative feedback (FALSE) on error.

Example (extract):

Declaration part:

FUNCTION_BLOCK FB_My61850Client IMPLEMENTS I_ScsmAbortEventSink
VAR
    fbClient         : FB_IEC61850CommonClass := ( ipIED := IED, settings := ( nRemotePort := 102, sRemoteHost := '192.168.10.145' ), ipAbort := THIS^ );
    state            : BYTE;
    bSuccess         : BOOL;
    ipAsyncResult    : I_AsyncServiceResultClass;
END_VAR

Implementation:

CASE state OF
    0:(* idle state *)    
        IF bAssociateReq THEN(* Establish connection *)
            bAssociateReq := FALSE;
            bSuccess := fbClient.AssociateReq( ipSink := 0, ipResult=>ipAsyncResult );
            state := SEL( bSuccess, 100, 1 );
        END_IF
    1:(* wait until connection established *)
        IF ipAsyncResult <> 0 THEN
            IF NOT ipAsyncResult.IsBusy() THEN
                state := SEL( ipAsyncResult.IsCompleted(), 100, 10 );
            END_IF
        END_IF
    10:(* connection established *)
        ;
    100:(* error state *)
        state := 0;
END_CASE