Configure Recipes

Recipes are used to transfer values from a database to OPC Systems.NET Tags.  If the Tags Data Source is set to OPC Item the values will also be written to the OPC Item the Tag is defined to.  The most common implementation is to have a variable in a PLC trigger the recipe execution.  The PLC will then wait for either the Confirmation or Error Code to be written to the PLC to indicate if the recipe execution has completed.  If in Error the PLC can then retry the Trigger.

Follow the steps listed below or view the following video on defining recipes.

For a complete list of all Recipe properties refer to the OPC Systems Configuration-Recipes section in this help file.




Start Configure OPC Systems application if it is not already running.


Select Configure-Tags to add some Tags to use with the Recipe execution.


Select the Local OPC Systems Service by selecting the Select button or the Local node in the service tree to the left.


If you are working on an existing Tag configuration you want to keep save it now.

Right Click in the Tag Window and select Delete All to clear all Tags.


Add the following Tags with the specific Data Types


Trigger as a Boolean

Value01 as an Integer

Value02 as an Integer

Lot as a String with the Value A

Confirmation as a Boolean

Error Code as an Integer

Query String as a String with Data Source of Calculation

     "WHERE Lot = " & "'" & [Lot.Value] & "'"


Select the Save button on the toolbar at the top and use the file name Recipe Tags.


Use Microsoft SQL Server, Oracle, Access, or mySQL to create the following Table.

Create a Database called OPCSystemsRecipes

Create a Table called RecipeValues with the following structure.

Enter the following values to the Table RecipeValues.


With the Configure OPC Systems application select Configure-Recipes.


Select the Local OPC Systems Service by selecting the Select button or the Local node in the service tree to the left.



Enter the Recipe Name Recipe 01.

Set the Recipe Active.

Set the Recipe Type to SingleRecord.

Set the Tag to Execute Recipe as Trigger.Value.

Enable Confirmation Tag as Confirmation.Value.

Enable Error Tag as Error Code.Value.


Select the Tags Tab

With the Tags properties you can assign the database table fields to the OPC Systems.NET Tags to write to when the recipe executes.  If the Data Source of the OPC Systems.NET Tag is defined as an OPC Item it will automatically write the value to the OPC Item.

You could also optionally use the DirectOPC selection to connect directly to OPC Items on OPC Servers instead of OPC Systems.NET Tags.

Select the Add Field button.


Select the Tag and Parameter Value01.Value.

Change the Field Name to Value01.

Change the Data Type to Integer.

Select OK.


Select the Add Field button.


Select the Tag and Parameter Value02.Value.

Change the Field Name to Value02.

Change the Data Type to Integer.

Select OK.



Select the Database Tab.

Define the proper database connection.

Enable the property Set Query String with Tag and set to Query String.Value.


Select the Add button in the lower left to add the Recipe.


Select the Save button on the toolbar at the top.

Save the file RecipeExample.Recipes in the directory C:\OPCSystemsDemo.



At this point you are ready to execute the recipe which you can do with Configure-Tags to set the Lot to A, B, or C and set the Trigger from False to True.  You can then see that the Confirmation Tag will be set to True and Value01 and Value02 update if the Recipe is successful or the Error Code Tag will be a positive number if there is an error.  Review the Recipe Execution Log found in the Error Log directly if there is an error.

Optionally create a Standard Windows application or WPF application with the following on a Form or Window to view recipe execution in a more interactive execution.  If you are unfamiliar with the OPC Windows HMI.NET product you may want to follow the steps in this Training Guide on Add HMI Controls to Visual Studio.


   Text = Trigger

   SetValueOPCSystems_Tag = True

   SetValueOPCSystems_Tag = Trigger.Value

   BackColorOPCSystems_Tag = Trigger.Value



   TextOPCSystems_Tag = Lot.Value



   TextOPCSystems_Tag = Confirmation.Value



   TextOPCSystems_Tag = Error Code.Value



   TextOPCSystems_Tag = Value01.Value



   TextOPCSystems_Tag = Value02.Value


Run the Recipe Example application and enter the Lot as A, B, or C and click on the Trigger Button to see the values being set.


When you execute a Recipe with Error Logging enabled under Configure-Options a log will be generated for the recipe execution in the same directory as the Error Log.

A Queued Recipe Type will delete the returned record with the recipe execution is successful.

A Multiple Record Recipe Type has only 2 fields, one for the Tag Name to set and one for the Value to write to the Tag.  Using this type you can define what Tags to write to in the database.

When a recipe is executed it will only write to Tags where the desired value from the database is different than the current value of the Tag.  For floating point values use the Float Deadband property under the Common tab to define what is the allowable range to determine if a value is the same or different.

The Timeout property is the amount of time the recipe execution will wait for all values to be returned from the Tags.  If one or more of the values does not read back from the OPC Server if defined as an OPC Item Data Source the recipe execution will end with an Error Code of Timeout.

The property Write All Values Without Feedback will not wait for the values to be returned and will write all database values to all defined Tags.  This is preferred for a faster execution when using the Execution Type Continuous.



Recipes CSV Export and Import

Recipes Programmatic Interface