Click or drag to resize

ModuleSyncPers Method

Updates the persistent data of the module with their real values. As this cannot be done while the task is executing any call in ExecutionState Started will be disregarded and false will be returned.

Namespace:  ABB.Robotics.Controllers.RapidDomain
Assembly:  ABB.Robotics.Controllers (in ABB.Robotics.Controllers.dll) Version: 6.5.129.0
Syntax
C#
public bool SyncPers()

Return Value

Type: Boolean
Returns true if the operation generated a change of the module, else false.
Exceptions
ExceptionCondition
GeneralExceptionA General Exception has occurred.
MasterRejectExceptionThe user failed to get required mastership for the operation.
Examples
In this example a check is done each time the task is stopped to find out whether the values of the persistent variables of the module are in sync with the real values in the controller. If not a SyncPers call is made.
using ABB.Robotics;
using ABB.Robotics.Controllers;
using ABB.Robotics.Controllers.RapidDomain;
...
Controller c = new Controller();
Rapid r = c.Rapid;
Task t = r.GetTask("T_ROB1");
t.ExecutionStateChanged += new ABB.Robotics.Controllers.RapidDomain.ExecutionStateChangedEventHandler(t_ExecutionStateChanged);
...
private void t_ExecutionStateChanged(object sender, ABB.Robotics.Controllers.RapidDomain.ExecutionStateChangedEventArgs e)
{
  try
  {
    if (e.ExecutionState == ExecutionState.Stopped)
    {
      // iterate modules and read its PersInSync property to see if the PERS variables have been updated
      modules = t.GetModules();
      for(int i = 0; i < modules; i++
      {
          bool sync = modules[i].PersInSync;
          if(sync == false)
          {
              //update the PERS variables of the module to their current values
              bool updated = modules[i].SyncPers();
          }
       }
     }
  }
  catch (GeneralException ge)
  {
    // TODO: Add error handling
  }
  catch (System.Exception se)
  {
    // TODO: Add error handling
  }
}
See Also