Navigation: Processing Concepts >

Processing Queue

 

 

 

 

All data, instructions and other strings to be processed are placed into the Processing Queue for processing.

 

The queue is a stack in nature with first-in, first out processing. Arriving data is placed on the bottom of the stack while data processing is done from the top-down. An exception to this is Event Code. When Event Code is triggered it is placed on the top of the Queue for processing so that when events, such as data arriving or a control is clicked, triggering Event Code, it will be the first code to be processed in order to be current with operations.

 

Strings to be processed can arrive from a serial control, the Debug/CLI, opening an interface, setting file or macro, or from control's Event Code.

 

MakerPlot-J is performs line processing. All code and data is processed as a single line ending with a carriage return or new line. There are no multi-line instructions in MPJ. An if-then conditional is all processed on a single line. There are no blocks of code, but the true-false instructions may use as semi-colon to separate multiple instruction:

!if conditional !then true instruction; true instruction !else false !instruction; false !instruction

!if (ain0) > 100 !then !txtValue.backColor=RED; !bell !else txtValue.backColor=GREEN

 

When code is processed, the following events occur:

The string is pulled from the top of the stack

Replacements are made of values, such as replacing [ain0] with the appropriate analog value received.

Math operations are performed in the string and replaced with values.

The string is checked for anymore values for replacing from the math operations.

Analog, Digital and Message strings are sent to the interfaces and controls for use.

Control properties and instructions are passed to the referenced controls or interfaces for action.

 

Update Values for controls are not processed through the Queue. Controls are triggered sequentially every 50 milliseconds to update their properties with the appropriate data.

 

The following instructions may be used for Queue processing:

!queClear                    Empties the Queue

!queAdd string          Adds the string to the bottom of the queue

!queAddTop string          Adds the string to the top of the queue for immediate processing

 

The following value is available for the Queue:

[queSize]                    Returns the size of the Queue in lines to be processed

 

Should an error occur in the processing of the Queue and no data is processed for several seconds, the Queue will shut down and start a new processing Queue and log an error to the Debug/CLI Window.

 

When Serial Controls are on the interface, the bottom status bar of the control will show the amount of data in the Queue, based on the maximum size. If this maximum is exceeded the Queue will be emptied and an error logged.

 

The serial control can be used to set the maximum size of the Queue with the maxQueSize property. Note that when opening an interface, a large amount of data is placed in the Queue for processing to create the Interface. When processing this data, and hiding the interface build is enabled, the queue will not clear if exceeded.

 

The top progress bar of a serial shows the number of bytes awaiting to be placed in the Queue. The maximum may be set using maxBufferSize. If exceeded, a warning message will logged to the Debug/CLI window.

 

It's important to monitor both status bars when testing interfaces. While incoming data may not be excessive, it can generate a lot of event code to be processed by various controls and math operations take some time to process. Ensure your data rates are not causing the Queue to fill - it should remain fairly empty without growing larger as time passes. If you distribute your interface to others, keep in mind their computers may not be as fast as the one you are working with.

 

MakerPlot-J is many times faster than its predecessor MakerPlot. But monitoring of the queue is highly recommended when testing or you may not recognize that the information being updated is seconds or minutes old.

 

String Value Replacements During Processing

 

Replacement of value strings in processing can be a powerful tool for advanced use, such as indexing. An example use would be in using a drop-down control (comboBox) to select an analog channel value to be displayed in a textbox.

 

!txtValue = [ain[cboChannel.index]] Volts

 

If the comboBox is selected to the item with an index of 3, through replacement the channel value to display would be [ain3], which would be replaced with its value.

 

 

 

 

 

 

 

 

 

 

Copyright © 2024 SelmaWare Solutions, LLC