OPC Workflow 1.5 Documentation

Introduction

Overview

OPC Workflow is a multi purpose workflow application focusing on simplifying communication between IT systems and OPC sources such as PLC, DCS and various other types of equipment. The goal for OPC Workflow is to be generic enough to solve even of the most complex OPC communication issues, while still being simple and easy to work with.

System Architecture

OPC Workflow has two main components.

  • OPC Workflow Studio
  • OPC Workflow Engine

The connection between the different components are depicted below:

Getting Started

The easiest way to get started with OPC Workflow, is to take a look at the examples that are included with the default installation of OPC Workflow. They give a good introduction to the capability of OPC Workflow Software.

OPC Workflow is designed to be a generic workflow application that can be used to solve any OPC communication issues. For inquiries  on how OPC Workflow can solve your specific problem contact us at support@bluxware.com

System Requirements

OPC Workflow has minimum system requirements for both software and hardware. These requirements must be met for the application to operate as designed.

This application supports the following Microsoft Windows operating systems:

  • Windows 10
  • Windows 8
  • Windows 7 Professional, Enterprise, and Ultimate
  • Windows Server 2012 / 2012 R2
  • Windows Server 2008 / 2008 R2
  • Windows Server 2003 (Service Pack 2)

User Interface

Windows Tool Panels

This section document the tool panels available in OPC Workflow Studio. The default location of each the tool panels are depicted below

Solution Explorer

Solution explorer gives an overview of all the solution specific files are part of the workflow solution. This includes Workflows and Database connections. To see where the files are located in the Windows File System, most of the folders has a “Open In Explorer” function on their right-click menu. To open of a file the Solution Explorer can be opened by double clicking them.

Workflow folder

The workflow folder contains all the workflows that is part of the solution.

Workflow\Runtime folder

Workflows places in the special “Runtime” folder will executed by the OPC Workflow service. Besides executing the workflows on startup, the OPC Workflow Service will monitor this folder, and react on filesystem changes in the following way

If Then OPC Workflow Service will
A new Workflow is saved to this folder Start the workflow
A existing Workflow is saved to this folder Reload the workflow
A Workflow is renamed Reload the workflow

Connections Folder

The Connections Folder Contains all the Database connections that will be available from the Workflows. Currently only MS SQL Servers are supported.

Database connections supports both Windows Authentication and SQL Authentication.

NOTE: If SQL Authentication is used, then the database password will be stored encrypted. If the connection is copied to another computer, then the password needs to be entered into the connection again.

Properties Panel

The Property Editor will show the properties for the currently selected Activity in the Workflow Designer. Most Properties can be set via the Workflow Designer, but some properties are only available via the Properties Panel. The properties panel can also be used to set dynamic values to most of properties

Toolbox Panel

The Toolbox panel contains all the building blocks (called activities) which are used to build a Workflow. Drag-n-drop an activity into the Workflow designer to use it. A Search-bar in the top of the editor makes it easy to find a specific activity.

Output window

The output windows shows output for the currently selected workflow. Output are normally generated from the workflow using the WriteLine Activity. 

Error List Window

The Error List windows shows validation errors for the currently selected workflow. Its not possible to run the workflow, if there is any errors.

Datatypes

The section contains information about public types which are not part of the .NET framework. for documentation of the .NET types, the Microsoft Documentation will contain the latest information.

OPCItemValue

OPCItemValue represents a value read from a OPC server. The item contains the actual value as well as meta data for the value. Metadata includes timestamp, quality and source information.

OPCItemValue has the following Properties:

Property

Type

Description

ValueAsString

String

Value as string.

ValueAsInteger

Integer

Value as Integer. If its not possible to cast/convert to integer, the Activity will throw a ArgumentException

ValueAs<T>

T

Convert the Value into T

QualityGood

bool

True if the OPC Quality is good

Timestamp

DateTime

Timestamp for the value

Activities

The activities can be found in the Toolbox, which is accessed by clicking the Toolbox tab.


The activities can be dragged from the Toolbox and dropped on to the Workflow Designer surface wherever activities are usually placed, such as inside a Sequence. This creates an activity with a default DisplayName. The DisplayName can be edited in the header of the activity designer or in the DisplayName box of the property grid.

Control Flow

ForEach<T>

Executes an activity action once for each value provided in the Values collection.

Property

Required

Description

DisplayName

No

The friendly name of the activity. Although the DisplayName is not strictly required, it is best practice to use one.

Body

No

The ActivityAction to be executed for each item in the Values collection.

Values

YES

The activity’s collection of inputs for the execution of the Body activity action.

Sequence

Executes a set of child activities according to a single, defined ordering.

Property

Required

Description

DisplayName

No

The friendly name of the activity. Although the DisplayName is not strictly required, it is best practice to use one.

Activities

No

The collection of contained activities to be executed in sequence.

Variables

No

The collection of contained variables.

 

While

Executes a contained activity while a condition evaluate to true.

 

Property

Required

Description

DisplayName

No

The friendly name of the activity. Although the DisplayName is not strictly required, it is best practice to use one.

Body

No

The Activity to execute in the While loop.

Condition

No

The Expression to be evaluated before each iteration of the While loop.

Variables

No

The collection of contained variables.

 

Parallel

A Parallel Activity contains two or more Sequence child activities. Sequence is the only activity that can be a child of a Parallel activity.


The Parallel activity lets you schedule two or more child Sequence activity branches for processing at the same time. Although branch Sequence activities are scheduled to start processing at the same time, they do not start processing at the same time. Processing begins with the execution of one activity that is contained in one of the Sequence branches.

When that activity is completed, the next activity in sequence in another branch executes, and so on. Activity execution switches between the Sequence branches, with one activity executing at a time until all the Sequence branches finish executing. This completes the processing of the Parallel activity. Parallel does not guarantee the exact order of execution across the Sequence branches.


If a Sequence branch contains an activity such as a blocked Wait activity, execution does not stop and wait for the activity to be unblocked. Instead, the next activity in sequence in the next Sequence branch is executed.


Although the Sequence  child branches are processed at the same time, the branch activities do not execute in a true concurrent manner. The OPC Workflow Engine uses one thread per workflow instance. All the separate branches in the Parallel activity share the same single workflow instance thread. Therefore, only one activity of one branch executes at a time.

Flowchart

A flowchart is normally the root activity in most workflows (except State-Machines). A flowchart can also be used as a child activity for any flowchart or State-Machine workflows.

FlowDecision

A specialized FlowNode that provides the ability to model a conditional node with two outcomes.

FlowSwitch<T>

The FlowSwitch<T> activity is a conditional node that provides branching for the flow of control based on match criterion when more than two alternative branches are required. If the flow branching requires only two paths, use the FlowDecision activity instead.

Primitives

Assign

Assign can be used to assign a value to a variable

Property

Required

Description

DisplayName

No

The friendly name of the activity. Although the DisplayName is not strictly required, it is best practice to use one.

To

YES

The variable or argument to which the Value is assigned. This must be a valid Visual Basic identifier. To set the property, type a Visual Basic expression in the To box on the Assign activity designer or in the property grid.

Value

YES

The value that is assigned to the variable. To set the Value, type a Visual Basic expression in the Value box on the Assign activity designer or in the property grid.

Wait

Use the Wait activity to cause the branch of a workflow that contains it to wait for a specified period of time. For example, you could set a time-out while waiting for a response from some external system, or you could use the Wait activity to run a scheduled job at a specified time.


To specify the delay time, set the Wait activity TimeoutDuration property to a valid TimeSpan value. Supply a literal value such as "0.01:10:30", or assign a value to a variable of type TimeSpan. The default TimeSpan value is 00:00:00.

Property

Required

Description

DisplayName

No

The friendly name of the Wait activity. The default is WriteLine. Although the DisplayName is not strictly required, it is best practice to use one.

TimeoutDuration

No

Supply a literal value such as "0.01:10:30", or assign a value to a variable of type TimeSpan. The default TimeSpan value is 00:00:00.

 

InvokeMethod

The InvokeMethod activity is another way to implement a code which is outside of the standard built-in activities. You can use this activity to invoke a method of a class. The class does not need to be part of the workflow or use any of the workflow base classes. The InvokeMethod calls a public method of a specified object or type.

Property

Required

Description

DisplayName

No

The friendly name of the WriteLine activity. The default is WriteLine. Although the DisplayName is not strictly required, it is best practice to use one.

MethodName

No

Assign the method name to this property..

TargetObject

No

When we want to invoke non-static methods, we need first to create an object that contains the method to execute.

TargetType

No

When we want to invoke static methods, we specify the type that contains the static method to execute.

GenericTypeArguments

No

When we want to invoke a generic method, we specify generic types in this collection.

Parameters

No

The parameter collection of the method to be invoked.

Result

No

The return value of the method execution.

WriteLine

WriteLine Activity is used to write debug messages to OPC Workflow Log files. This Activity is intended for debug and troubleshooting purposes.

Property

Required

Description

DisplayName

No

The friendly name of the WriteLine activity. The default is WriteLine. Although the DisplayName is not strictly required, it is best practice to use one.

Text

No

The text to write. To set the property, type a Visual Basic expression in the Text box on the WriteLine activity designer or in the property grid.

TextWriter

No

The TextWriter to which the WriteLine writes the Text. The default will write to the log files.

Error Handling

TryCatch

The TryCatch activity contains a Try activity, a collection of Catch<TException> and a Finally activity. A Catch<TException> of type TException contains an ExceptionType and an Action.

Together they are used to implement a typical exception-based error handling mechanism. A TryCatch activity tries to execute its Try activity. If the Try activity throws any exception, the TryCatch activity uses its Catch<TException> collection to match the exception. If there is a match, then the Action of the corresponding Catch<TException> is executed, serving as the error handling logic for the exception. If the activities in the Try section successfully complete or the activities in the Catches successfully complete, the TryCatch activity executes its Finally activity.

Throw

The purpose of the Throw Activity activity is to raise exceptions declaratively, usually in response to exceptional conditions detected in a workflow.


The Throw activity can point to an exception object in the workflow that is derived from Exception, using the Fault property; if the Fault property is set to a specific exception instance, setting the FaultType property is not required.

ReThrow

The Rethrow activity throws a previously thrown exception. This activity can only be used in a Catch handler in the TryCatch activity.

Collections

AddToCollection<T>

Adds an item to a specified collection.

ClearCollection<T>

Clears all items from a specified collection.

RemoveFromCollection<T>

Removes an item from a specified collection and returns true if the item was successfully removed

ExistsInCollection<T>

Returns true if an item exists in a collection.

Database

Database Query

The database query activity makes it possible to execute a database query. The activity will be executed using a Database connection that can be configured using the Solution Explorer.

OPC

OPC is an industry standard to communication with equipment normally found in industrial production facilities like PLCs or SCADA systems.

OPC Read

Read a Value from a OPC DA Server.

Property

Required

Description

DisplayName

No

The friendly name of the activity. Although the DisplayName is not strictly required, it is best practice to use one.

OPCServer

YES

OPC Server

OPCItem

YES

OPC Item

Value

YES

The Value to Read. The Value is a OPCItemValue.

OPC Write

OPC Write can be used to write values to a OPC item.

Property

Required

Description

DisplayName

No

The friendly name of the activity. Although the DisplayName is not strictly required, it is best practice to use one.

OPCServer

YES

OPC Server

OPCItem

YES

OPC Item

Value

YES

The Value to Write. The Value could be a primitive or a OPCItemValue.

OPC Wait

OPC Wait activity wait for OPC items to change value. If the value is left blank, the wait activty wait for next time the the value changes value. If a value is specified then the activity will wait until the value changes to that specific value. Timeout can be used to specify a maximum time to wait for the value to change before continuing. If timeout is reached, then the value will have quality of timeout.

Property

Required

Description

DisplayName

No

The friendly name of the activity. Although the DisplayName is not strictly required, it is best practice to use one.

OPCServer

YES

OPC Server

OPCItem

YES

OPC Item

Value

YES

The value to wait for

Timeout

YES

Max time to wait

 

Scripting

C# Script

The C# Script Activity is used to execute custom C# scripts that can be coded in Workflow Studio, via the built-in code syntax editor . The code will saved as code(xml) in the workflow definition, and will be complied and executed asynchronous just-in-time in an isolated app domain. The Code activity can reference any .NET 3rd party assemblies, making it idea for integration to systems that is not natively supported by OPC Workflow.

The Script Activity can exchange data with the workflow using the Input and Output Properties of the Code Activity. This makes this Activity ideal for handing sub-tasks that can not be archived via the standard Activities.

Property

Required

Description

DisplayName

No

The friendly name of the activity. Although the DisplayName is not strictly required, it is best practice to use one.

CodeText

YES

C# Script that will be executed

FileReferences

NO

A collection of References to file based .NET assemblies

GACReferences

NO

A collection of References to .NET assemblies in the GAC

Imports

NO

A collection of Namespace imports

Input

NO

Input Object that can be used in the C# Code

Output

NO

Output Object that can be outputted from the Code Activity to the Workflow

Plug-in Development

Overview

You can extend the options available within OPC Workflow Studio by adding extra activities. These activities are added by adding an assembly to the plug-in directory that contains a class the extends the CodeActivity class. These extensions are commonly called workflow assemblies or workflow activities.

You can use these custom extensions within the designer used for workflows. 

Plug-in Development

Custom workflow activities require creating a .NET Framework assembly that includes one or more classes that are derived from the abstract CodeActivity Class. This class provides the Execute(CodeActivityContext) Method called by the OPC Workflow engine when the activity is executed. Each class in your assembly will define a specific activity.

Workflow activities should define input and output parameters which are visible in the OPC Workflow designer and enable someone to pass data into the workflow activity and receive the processed output. When you write the class you will add properties for these parameters and annotate them with .NET attributes to provide the metadata that OPC Workflow Studio will use to expose your custom workflow activity with any parameters in the designer.

A detailed documentation on how to develop custom Activities can be found on Microsoft Workflow Foundation Webpage

Plug-in Installation

Plug-ins are installed by copying the .Net assembly containing the plugins to the plugins directory located in the folder where OPC Workflow is installed.