How to use the Feedback Item

The Feedback Item is designed to be used in large multi-layered systems to check that write operations are forwarded to other parts of the system. The feedback item is linked to the I/O item where a written value will be eventually forwarded to (the feedback reference) and checks it’s own value against it. If the values are the same (or within a given tolerance value) the Feedback Item will show a good (green) state. If the values are not the same (or the quality values differ) the Feedback Item shows a bad (red) state. This simple example will show how the feedback item works by creating some demonstration items. This is designed to demonstrate the concept and does not exactly reflect an exact use case in a large multi-layered system.

Feedback Item - Single Write Mode

The Feedback Item has three different write modes. The first and simplest to use, the Single Write mode, will be demonstrated here. To begin, create a new Feedback Item in the I/O Model tree by right clicking on the Core and selecting Admin  New  Data Processing  Feedback Item. In the Create Object wizard, give the object the name "Single Write Feedback Test" and click Create.

Feedback Item in I/O Model
Figure 1. Feedback Item in I/O Model

We will now create two DataHolder items to simulate the Target and Feedback reference items. The Target item (here named "out") simulates the first item that a written value is forwarded to in a system. The Feedback reference (here named "in") simulates the second item that the value is forwarded to that provides feedback to the Feedback item.

Target and Feedback References added to I/O Model tree
Figure 2. Target and Feedback References added to I/O Model tree

Select the Feedback Item that was just created and in the Object Properties panel, expand the Feedback Configuration section of the properties. By default, the Mode should be set to Single Write.

Feedback Item - Properties
Figure 3. Feedback Item - Properties

Now select the Target and Feedback properties and set them to the "out" and "in" DataHolder items respectively by choosing the items from the "Edit" dialog.

Set Target and Feedback References
Figure 4. Set Target and Feedback References
Please take care to configure the Target and Feedback properties as described otherwise the functionality will not work correctly.

Also set the Time-out property to 11,000 ms (we will add a delay in the forwarding of write values to the Feedback reference to simulate conditions that might be encountered in a larger multi-layer system). Click Apply to confirm the changes.

Feedback Item - Configured Properties
Figure 5. Feedback Item - Configured Properties

Once the Feedback Item has been configured along with its Target and Feedback references, an Generic Item will be created to write a value to the Feedback Item. The Feedback directs this value to its Target Reference. We will also create an Action Item to simulate the forwarding of the written value from the Target reference to the Feedback reference with a 10 second delay (this mimics the mechanism of forwarding values in multi-layered systems that the Feedback Item is designed to check). First, create a Generic Item underneath the Core and set the generation type to "Lua Script Data Generator" (set the Object Name to "Write Value"). Add the following Lua script to the "Lua Script Body" property:

local val = math.random() syslib.setvalue("Ref1", val)

Create the "Ref1" reference by dragging the Feedback Item "Single Write Feedback Test" onto the Gen Item and creating a passive link (uncheck the triggering link box). Next, create an Action Item underneath the Core, name it "Forward Value" and add the following Lua script to the "Lua script body" property:

local socket = require"socket" local val = syslib.getvalue("Ref1") socket.sleep(10) syslib.setvalue("Ref2", val)
return val

Create the references for the Action Item by drag and drop with the DataHolder created earlier:

  • Ref1 - Triggering link, drag and drop the "out" DataHolder onto the "Forward Value" Action Item

  • Ref2 - Passive link, drag and drop the "in" DataHolder item onto the "Forward Value" Action Item

The I/O model should now look similar to this:

I/O Model with all example items
Figure 6. I/O Model with all example items

The feedback works in the following way:

  • the Feedback Item receives a value from the "Write Value" every 30 seconds

  • the Feedback item forwards this value to its configured Target reference "out"

  • the Action Item "Forward Value" registers the change on "out" and forwards the value to the "in" DataHolder after 10 seconds"

  • the Feedback waits in an uncertain state until its own value matches the value of its Feedback reference "in"

  • the Feedback item shows a "good" state when the values match

To see the different states, add the "in", "out" and the Feedback item to a Dashboard display and change the tiles to display the Faceplate view:

Dashboard Display - Feedback Item with references
Figure 7. Dashboard Display - Feedback Item with references