phpkb Knowledge Base Logo
 
OLDI KB
Online Knowledgebase System  
Knowledge Base Home Knowledge Base Home | Knowledge Base Glossary Glossary
Home > All Categories > eATM Products > eATM (xCoupler) products > xCoupler Example : Write structured text CLX program one to load array and another task to unload for the xCoupler
Question Title xCoupler Example : Write structured text CLX program one to load array and another task to unload for the xCoupler
NOTE:
This example was supplied to a customer with a very slow process cycle time of 5 minutes so speed was not an issue. 
If faster cycle times are needed, similar queuing logic is also recommend; however, in that case, the task would need to run async instead of sync as shown here.
Both the CLX and the xCoupler files are attached to this solution.
 
 

The following methods of queuing in the CLX arrays and unloading via use of the xCoupler trigger handshaking has been used by many customers in the past few years to guarantee no miss data transitions even when the round-trip times to the database/MQ have temporary slowdowns in their response time.

 

NOTE: This example is provided as just that an example of the concept of the data queuing for our customer.

 

The xc_queue program is an example of how the xCoupler can record the values of many different UDTs while only actually monitoring a few tags, which also allows the xCoupler to run much faster and more efficiently.

 

The basic concept is that the controller copies all the data into arrayed variables, and then copies elements from the array one at a time into a few tags which the xCoupler then takes and sends to the database.

 

In this example program, the program has 100 virtual “meter” structures. The Load routine will copy the data from each of these meters into a 100 element structure array.  After this completes a bit is set, which causes the Unload routine to run.

 

The Unload routine uses a FOR loop to run through the structure array.

1.        Each element is first copied to the tags monitored by the xCoupler.

2.        The routine waits a second (Note: trigger priority=1s), to ensure the correct values are read by the xCoupler,

3.        Then, the xC_Ready tag is incremented, to cause the trigger in the xCoupler to fire.

4.        The routine waits until the xCoupler returns a value to the xC_Complete tag, signaling that the trigger has completed,

5.        Then, the loop executes again, for the next element of the array. This happens for every element of the array, which each contains data from one of the meter structures.

 

In the main routine a timer is used so that data is only collected from the meter structures every 5 minutes (300,000 milliseconds). This is a predefined time which can be configured by editing the qTimer tag’s Preset value.

Authored by: Laurie Wilson
Click Here to View all the questions in eATM (xCoupler) products category.
File Attachments File Attachments
Article Information Additional Information
Article Number: 271
Created: 2008-04-07 2:54 PM
Rating 5 Stars
 
Article Options Article Options
Print Question Print this Question
Email Question Email this Question to Friend
Export to Adobe PDF Export to PDF File
Export to MS Word Export to MS Word
Bookmark Article
 
 

Powered by Online Development Inc