In production, you will want to separate networking (i.e. sending data to Initial State) from acquisition, deterministic code, and/or UI loops. This is commonly done using a producer-consumer architecture. This article is not meant to explain that architecture in detail for a refresher on that go here - Application Design Patterns: Producer/Consumer You can also use the VI Snippet below to explore a simple version of the code.
Producer-Consumer Example
As seen in the block diagram above we are:
- In the acquisition loop we are enqueueing JSON Cluster arrays destined for the IS Send.vi. The typedef cluster has the side affect of allowing the data of different types (i.e. DBL, string, etc.) to be combined into a homogeneous type which can be used directly in LabVIEW Queues.
- You have options in the consumer loop. In the block diagram above, we flush the whole queue and try to send.
- Not shown in the diagram is Handling Rate Limiting - In order to do so, we would monitor "Rate Limit Exceeded" output of the IS Send.vi, and re-enqueue the data so that it would be picked up on the next iteration of the consumer loop. This technique can also work for other intermittent errors.
Comments
0 comments
Article is closed for comments.