SIMATIC S7 MatLab Toolbox

Public Member Functions | Public Attributes | Protected Member Functions | List of all members
PlcDevice Class Reference

Provides an abstract base class which represents a single programmable logic controller (PLC). More...

Inheritance diagram for PlcDevice:

## Public Member Functions
function get | EndPoint (in this)
| Gets the PlcDeviceEndPoint of the PLC device.
function set | EndPoint (in this, in value)
| Sets the PlcDeviceEndPoint of the PLC device.
virtual function | CreateConnection (in createNew)
| Creates a new instance of an object implementing the PlcDeviceConnection class which is associated with the device, if createNew is equals to the value true. More...

## Public Attributes
Property | Connection
| This property is not intended to be used outside of the toolbox.
Property | ManagedInstance
| This property is not intended to be used outside of the toolbox.

## Protected Member Functions
function | PlcDevice (in endPoint)
| Initializes a new instance of the PlcDevice class using the specified endPoint. More...

## Detailed Description

Provides an abstract base class which represents a single programmable logic controller (PLC).

## Constructor & Destructor Documentation

## ◆ PlcDevice()

function PlcDevice::PlcDevice | ( | in | endPoint | ) |
| protected

Initializes a new instance of the PlcDevice class using the specified endPoint.

Parameters

  endPoint | The PlcDeviceEndPoint which identifies the network address of the device.

Errors

- The endPoint is not an instance of the IPDeviceEndPoint class.

## Member Function Documentation

## ◆ CreateConnection()

virtual function PlcDevice::CreateConnection | ( | in | createNew | ) |
| virtual

Creates a new instance of an object implementing the PlcDeviceConnection class which is associated with the device, if createNew is equals to the value true.

Parameters

  createNew | A value indicating whether a new instance is to be created (the value true) or if there is already an existing instance of the PlcDeviceConnection class in usable state is to be returned (the value false).

Return values

  An | instance of the PlcDeviceConnection class which is associated with the device.

Remarks

Any changes made on EndPoint and any changes made on the configuration of the returned PlcDeviceConnection will take affect when calling PlcDeviceConnection.Open. Any further changes made on the EndPoint or on the PlcDeviceConnection instance will when only take affect after closing (using PlcDeviceConnection.Close) and re-opening (using PlcDeviceConnection.Open) the connection.

In multi-threaded environments it is important to take care about which thread does open/close a connection and which threads do use the same connection concurrent. Scenarios there multiple threads do share the same connection instance have to ensure that changes to the PlcDevice (e.g. EndPoint changes) to that a PlcDeviceConnection does belong or any changes made on the connection itself will take affect in all threads (which share the same connection instance) immediately after closing and re-opening the connection.

If there was a connection created for the first time using this PlcDevice instance these connection will be always returned by any subsequent calls to CreateConnection(bool) using createNew with the value false. This is the case until the cached connection will be discarded. A cached connection will be discarded then it is not in created nor in closed state and any changes are made to the configuration of this PlcDevice (e.g. EndPoint).

The documentation for this class was generated from the following file:

- PlcDevice.m