# Programmatically Enabling a Simulation Device

To enable the simulation of a Camera or Cognex Communications Card programmatically, use the SetSimulationDevice function. This example is based on a Camera device and an Image File device, where the Camera device is named Camera_01, and the Image File device is named Camera_Simulator.

SetSimulationDevice takes two arguments, the first being the name of the actual device, and the second being the simulation device: $System.Devices.SetSimulationDevice(deviceName, simulationDeviceName)

Use the following call to enable the simulation of the Camera device: $System.Devices.SetSimulationDevice("Devices.Camera_01", "Devices.Camera_Simulator")

Note: You can also programmatically change the simulation device by providing the new simulation device name (e.g $System.Devices.SetSimulationDevice("Devices.Camera_01", "Devices.Camera_Simulator2").