EasyManua.ls Logo

Siemens SIMATIC S7 - The ICPU Interface; Identifying CPU Devices in an Iprofinetdevicecollection

Siemens SIMATIC S7
134 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
SIMATIC Automation Tool API for .NET framework
6.9 The ICPU interface
SIMATIC Automation Tool V2.1 user guide
Manual, V2.1.1 07/2016, A5E33042676-AC
99
6.9
The ICPU interface
6.9.1
Identifying CPU devices in an IProfinetDeviceCollection
As discussed earlier, the ScanNetworkDevices method is called to generate an
IProfinetDeviceCollection. This collection contains an item for every accessible device on
the industrial network. These devices may include CPUs and decentralized I/O stations.
The
IProfinetDevice interface provides properties and methods that are applicable to both
categories of devices. However, there are properties and methods that are specific to a CPU
device. These properties and methods are accessible using the
ICPU interface.
To determine if a given
IProfinetDevice interface actually represents a CPU device, simply
cast it to an
ICPU. If this cast is successful, then the network device is a CPU, and the
properties/methods on the
ICPU interface can be used. The following example illustrates this.
IProfinetDeviceCollection scannedDevices = new IProfinetDeviceCollection();
Result retVal = myNetwork.ScanNetworkDevices(out scannedDevices);
if (retVal.Succeeded)
{
foreach (IProfinetDevice dev in scannedDevices)
{
ICPU devAsCpu = dev as ICPU;
if (devAsCpu != null)
{
//--------------------------------------------
// The device is a CPU.
// Use the ICPU interface to interact with it.
//--------------------------------------------
}
}
}
Note
Th
e ICPU interface inherits from IProfinetDevice. Therefore all the properties and methods
supported on
IProfinetDevice are also supported on ICPU
. This topic only provides details for
properties/methods that are unique to the ICPU
interface.

Table of Contents

Other manuals for Siemens SIMATIC S7

Related product manuals