SQL Data-recording with Redundant Servers

I have have a Standalone CitectSCADA System (2015) which executes Cicode on an event triggered by a PLC to log batch data to SQL.  The Cicode then "confirms" the datarecord by writting back to the PLC.  We are upgrading to running redundant 2018R2 CitectSCADA servers but I am unsure of how to configure the Cicode/event to only execute on one server (switching to the other in the event of failure).

Parents
  • Hi Tony,
    How about something like this? Call TaskNew() to start TaskOnAServer on both servers at startup. Each one will check if it the active server and only the active one will do the work.
    Kind regards
    David



    INT
    FUNCTION IsActiveServer()

    STRING sLocalServerName
    INT iResult;

    iResult = 0;
    sLocalServerName = ServerInfoEx ( "Server" , 0 , "IOServer" ) ;
    IF(IODeviceInfo("SomeDevice" , 17) = sLocalServerName) THEN
    iResult = 1;
    END

    RETURN iResult;
    END



    FUNCTION TaskOnAServer()

    WHILE 1 DO // endless loop

    IF (IsActiveServer() = 0) THEN
    WHILE (IsActiveServer() = 0) DO // if not currently the active server
    Sleep(10);
    END

    ELSE
    WHILE (IsActiveServer() = 1) DO // if currently the active server

    DoSomething(); // the thing you want only the active server to do

    Sleep(1); // sleep a bit
    END
    END

    END // while

    END
Reply
  • Hi Tony,
    How about something like this? Call TaskNew() to start TaskOnAServer on both servers at startup. Each one will check if it the active server and only the active one will do the work.
    Kind regards
    David



    INT
    FUNCTION IsActiveServer()

    STRING sLocalServerName
    INT iResult;

    iResult = 0;
    sLocalServerName = ServerInfoEx ( "Server" , 0 , "IOServer" ) ;
    IF(IODeviceInfo("SomeDevice" , 17) = sLocalServerName) THEN
    iResult = 1;
    END

    RETURN iResult;
    END



    FUNCTION TaskOnAServer()

    WHILE 1 DO // endless loop

    IF (IsActiveServer() = 0) THEN
    WHILE (IsActiveServer() = 0) DO // if not currently the active server
    Sleep(10);
    END

    ELSE
    WHILE (IsActiveServer() = 1) DO // if currently the active server

    DoSomething(); // the thing you want only the active server to do

    Sleep(1); // sleep a bit
    END
    END

    END // while

    END
Children
No Data