RobotStudio event

ABB IRC5 OPC Server - Alarms and Events

Hi, for an upcoming jobs we have bought the IRC-5 controller with the PC interface option which includes the OPC Server.  The task I've been assigned to do mimic the "Event Viewer" that's on the teach pendant onto a PC.  The problem I'm having is that I can recieve all new events but I can't recieve events from the IRC-5 that occured before making my OPC connection.  To retrieve these this I would like to call the Refresh() function from the "Subscription" object.  However, I receive an exception when I attempt to call it.

//////////////////////////////////////////////////////////// /////////

error:

ResultIDException ->E_FAIL, IOPCEventSubscriptionMgt.Refresh

//////////////////////////////////////////////////////////// ////////

source code:

private Opc.Ae.Server server;
private Opc.Ae.ISubscription subscription;

void StartAlarmServer()
{
      Opc.URL url = new Opc.URL();
      url.Path = "ABB.IRC5.OPC.Server.AE";
      url.Scheme = Opc.UrlScheme.AE;

      server = new Opc.Ae.Server(new OpcCom.Factory(true), url);
      server.Connect();

      Opc.Ae.SubscriptionState subState =
 new  Opc.Ae.SubscriptionState();

      subState.Active = true;
      subState.BufferTime = 1000;
      subState.ClientHandle = 999;
      subState.Name = "test";
      subState.MaxSize = 100;

      subscription = server.CreateSubscription(subState);

      Opc.Ae.EventChangedEventHandler ceh = new Opc.Ae.EventChangedEventHandler(subscription_EventChanged);
      subscription.EventChanged += ceh;
     

     //!!!!!!!CAUSES exception!!!!!!

     subscription.Refresh();
}

void subscription_EventChanged(Opc.Ae.EventNotification[] notifications, bool refresh, bool lastRefresh)
{
 ...
}

//////////////////////////////////////////////////////////// ////////////

bvenhaus2007-5-24 19:14:17