EasyManua.ls Logo

Siemens SIMATIC S7 - Page 115

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
115
Using the Devices property of the IRemoteInterface, it is possible to inspect all the stations
on the decentralized network.
To extend the earlier example:
retVal = myNetwork.ScanNetworkDevices(out scannedDevices);
if (!retVal.Succeeded)
return;
foreach (IProfinetDevice dev in scannedDevices)
{
ICPU devAsCpu = dev as ICPU;
if (devAsCpu == null)
continue;
//----------------------------------------------------------
// A call to RefreshStatus() is needed to gather information
// about decentral network(s)
//----------------------------------------------------------
retVal = devAsCpu.RefreshStatus(new EncryptedString(""));
if (!retVal.Succeeded)
return;
List<IRemoteInterface> decentalNets = devAsCpu.RemoteInterfaces;
List<string> orderNumbers = new List<string>();
foreach (IRemoteInterface net in decentalNets)
{
//-----------------------------
// Inspect the remote interface
//-----------------------------
if (net.InterfaceType == RemoteInterfaceType.Profinet)
{
//--------------------------------
// Look at each decentral stations
//--------------------------------
List<IBaseDevice> stations = net.Devices;
foreach (IBaseDevice station in stations)
{
orderNumbers.Add(station.ArticleNumber);
}
}
}
}
This example traverses all remote PROFINET interfaces and creates a list of the order
numbers for all decentralized stations on the industrial network.
Since the
IBaseDevice also supports the Modules property, it would be simple to extend the
example further to look at not only the decentralized stations, but also all the locally-plugged
modules on each station.

Table of Contents

Other manuals for Siemens SIMATIC S7

Related product manuals