RobotStudio event

Subscribe variables in Yumi with PCSDK

When I use PCSDK to read variable values in Yumi, I got a problem.
When the program started, it need register variable events, but it cost too much time.
what's the reason about this, too many variables or other reasons.
Thanks in advance.
program as below:
diWpcReadyLeft.Changed += new EventHandler<SignalChangedEventArgs>(SignalValueChanged);


  • Maxim Riabichev
    Hello ZhangKeke,

    How long does it take to create an event? And how long did you expect it to take?

    Maxim Riabichev
    PC Software Support Engineer
  • Dear ZhangKeke,

    If you want to subscribe to Rapid Data, this can be the code - Your Rapid Data must be PERS
    Module myModule = ...;
    RapidSymbol rapidSymbol = ...;
    RapidData rapidData = myModule.GetRapidData(rapidSymbol);
    rapidData.ValueChanged += (sender, e) => RapidDataValChanged_Method(sender, e);

    Best regards,
  • ZhangKeke
    Dear Maxim
    I am not sure how long to create an event, may be one or two seconds. 
    Is that normal?
    In addition, how can I get the symbol 'MachanicalUnitServiceInfo', such as 'ElapsedProductionTime' or 'LastStart'.
    Last but not the least, how can I get the realtime CPU load, this is very import for me.
    Sorry for so many questions. Thanks for your advice.
  • Maxim Riabichev
    edited March 2021
    Hello ZhangKeke,

    From my experience with PCSDK an event should not take 1 or 2 seconds to set up. Something seems strange in this regard.
    I recommend downloading the PCSDK sample I've created and trying it to see if you get similar times with this code (because I do not when trying vs. a Virtual Controller).

    Regarding 'MachanicalUnitServiceInfo', such as 'ElapsedProductionTime' or 'LastStart': see this resource:

    How can I get the realtime CPU load, this is very import for me.
    You "can't". The CPU Load indicator that might be available would be the same as is available via the device tree in RobotStudio but since the controller has a prioritized CPU management (motion tasks will always be prioritized for example), this indicator doesn't really say anything of importance.

    Maxim Riabichev
    PC Software Support Engineer