Sample case, use a SCADA system with OPC DA to monitor production status


A production plant has four production lines that needs to be supplied with product parts. Each production line has room for 100 parts, if the number of product parts drops below 10 the inventory should be refilled manually. The number of parts in the inventory for each line is monitored by a PLC that is accessible via an OLE for Process Control Data Access (OPC DA) server.

The person in charge of refilling the inventory can send an SMS message with the text ON to subscribe to the low inventory warnings and OFF to unsubscribe. After the subscription he will get an SMS message with the inventory of each line and an SMS message when the inventory of one of the production line drops below 10 items.

OLE for Process Control

OPC is an industrial standard to access data from process control devices like sensors, PLCs or SCADA applications. It has a set of specifications to communicate between different multi vendor devices and control applications. OPC specifications are maintained by the OPC foundation.

In this sample case we used the Advosol OPC client drivers for .NET to connect Diafaan SMS Server to the OPC server.

Install OPC Client drivers

First, the Advosol OPC client drivers must be installed on the server where Diafaan SMS Server is installed. The Advosol .NET assembly OpcDaNet.dll can be copied to the plugins folder in the Diafaan SMS Server installation folder.

After a new Scripting Connector is added to Diafaan SMS Server the OpcDaNet.dll assembly must be added to the ReferenceList in the advanced tab page of the Scripting Connector Properties. You should use the full path to the assembly, e.g.:
C:\Program Files\Diafaan SMS Server\Plugins\OpcDaNet.dll

The script

See OPCClientSample.cs in the Scripting pack for the full script.

In the OnLoad method, the script connects to the OPC server and subscribes to the four item id’s that contain the inventory of the four production lines. In the OnUnload method the script disconnects from the OPC server.

When an SMS message is received with the text ON, the number of the GSM phone is stored in a Windows registry value. If another GSM number was subscribed to the inventory warnings it will be automatically unsubscribed and an SMS message is sent to inform him about the removal. When an SMS message is received with the text OFF, the number is removed from the Windows registry.

If the number of inventory parts for a production line drops below 10, the script reads the registry and if a GSM phone number is available it sends a message with the low inventory warning.

The script is kept as simply as possible, in a real life application checks should be made if an OPC item still exists and if the data is valid. It might also be advisable to give only some GSM numbers the possibility to subscribe to the system.


With OPC it is not difficult to extend a production or process control system with SMS messaging. Since OPC is not vendor specific, the script can be used to monitor and control a range of devices without the need to use different protocols for each device. The integration with Diafaan SMS Server makes some very powerful SMS enabled applications relatively easy to set up.