Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

Set device to simulation mode

sg
2016-02-05
2016-02-08
  • sg - 2016-02-05

    I cant find a way to set the device, which my active application belongs to, in simulation mode. How do I get the reference to the interface IScriptDeviceObject for it.

    Any help is appreciated.

     
  • mkeller - 2016-02-08

    Hi Shabroz.Gill.

    Shabroz.Gill hat geschrieben:
    I cant find a way to set the device, which my active application belongs to, in simulation mode. How do I get the reference to the interface IScriptDeviceObject for it.

    Search for the device object by using find() and use the method set_simulation_mode() for setting the simulation mode.

    For example:

    proj = projects.primary
    found = proj.find("Device", True)
    assert(len(found) == 1, "No or too many devices with the name 'Device' found")
    dev = found[0]
    dev.set_simulation_mode(True)
    assert(dev.get_simulation_mode() == True, "Simulation not active")
    

    BR
    Martin

     

Log in to post a comment.