Overview – Recipe

The OAS Recipe product allows you to source your Tag data from a table in a database using either a continuous, event driven or time of day execution method.

A common use case for the recipe feature is to allow a PLC to set a boolean Tag, which causes the next set of data to be loaded from the database. This data is then written back to the PLC for execution. The recipe feature also includes a confirmation tag and an error tag to indicate to the PLC whether the data is read or there was an error. This type of two-way feedback mechanism makes it easy for you to integrate your database data with any supported PLC protocol.

💡
The recipe feature is designed as a read-only method of sourcing Tag data from a database. To connect your Tags to a database as a data source with both read and write capabilities, see the Database Tag feature.

A Recipe configuration supports writing to local tags as well as tags on a remote OAS instance. When using OPC protocol, a remote OAS instance can help simplify security connections as there will be no remote DCOM setup necessary as all OPC Servers can be connected to the a local instance. The database and Recipe server can be on a different instance for security reasons.

The execution of a Recipe can be continuous at up to one execution per second, event driven based on another boolean Tag, or at a specific time of day.

The database providers can be SQL Server, Access, Oracle, MySQL, PostgreSQL, Cassandra, MariaDB, SQLite, MongoDB, InfluxDB, Redshift or Firebase.

There are two basic database table structures that can be used as a data source.

Narrow Table

The narrow table method, also sometimes referred to as the multiple records method, only uses two fields in a database table. The first field stores the path of the Tag where the value is to be written and the second stores the value itself. This is called a narrow format, because rather than storing each tag as a separate field, Tag data is stored in individual rows.

Wide Table

The wide table method, also sometimes referred to as the single record method, defines the mapping between each table field and a corresponding Tag path. This is a single record method because all the Tag values in your query are returned in a single row. The Recipe will always return the TOP 1 result, so you can define the WHERE and and ORDER BY statements using the Query String configuration parameter.

Queued Tables

Both the wide and narrow table structures support a Queued type, which will have the same behavior as explained in the previous sections, but after the Tag values have been successfully written to the Tags, the database row is deleted. This allows you to create a data queue. Your integration between the Recipe feature and a PLC, for example, will be able to consume the data as it comes in.

Confirmation Tag

The Confirmation Tag can be set to a Boolean Tag to give feedback that the recipe has succeeded.

The Tag value will be set to False when the execution of the Recipe starts, then when the values have been successfully read from the database and transferred to the Tags the value of the Confirmation Tag will be set to True.

As part of the confirmation process, OAS will compare the loaded Tags with the values in the database. If they match then the Confirmation Tag will be set to True. Any floating point values are considered to be equal if within range of the configured Deadband setting.

If the Write All Values Without Feedback setting is enabled, then the confirmation is set immediately after writing to the Tags, but does not wait for the verification of the values.

Error Tag

The Error Tag can be set to an Integer Tag to give feedback when a recipe has failed to execute. The Error Tag will be set to a positive integer with a range of 1 to 8 to indicate an error reason. The Tag value will be set to 0 when the recipe first executes, then when the transfer has been successfully completed the value of the Confirmation Tag will be set to True and the Error Tag should remain at 0.

You can get more information about the error codes on the Recipe Common Properties page.


Refer to Getting Started – Recipe section for a step by step example of using the Recipe feature.

For description of all properties of the recipe configuration refer to the Recipe Properties section.



More: