blog banner temp.jpg


Multithreaded Sequences Using DQMH

On Dec 21, 2020

Multithreading is used to allow parallel processes to execute simultaneously, and independently. This is valuable in a wide range of scenarios, and certainly in testing scenarios where multiple actions must be made in sync or in the least independently. Multithreading also allows for interrupts, such as an emergency stop, to be processed more immediately. Another use is being able to wait for multiple triggers and process them as they happen rather than sequentially.

The Delacor Queued Message Handler (DQMH) Framework was created as a template for LabVIEW developers to use when developing applications for myriad uses. The template is based on the National Instruments Queued Message Handler, written in LabVIEW, and has a similar structure. Modules created using the DQMH Framework can communicate and take asynchronous actions and are built with communications ingrained. Modules can make a request, broadcast, request and wait for reply, and round trip. These events allow for outside VI’s and other modules to communicate and affect DQMH modules. For any module that monitors an input at a consistent rate a helper loop can be created to allow for messages to be processed during monitoring in the helper loop.

Multithreading DQMH

Using DQMH in a program makes it inherently multithreaded, assuming multiple modules are used. Each DQMH module can be used to actively monitor or control an aspect of a system. If one module hangs for any reason, the other modules do not have to wait to take actions, which makes a physical system safer. The communications that allow for a response have a timeout built in to allow for a reaction no matter the outcome. Actions can then be taken to react to the timeout, such as safe shutdown procedures on power supplies or dynamic mechanical devices.

The use of templates makes development quicker and more consistent. The use of these premade and proven structures increases stability and makes any updates or code changes simpler given the standard structure. This template in particular takes the burdensome work of inter-module communication out of the developers’ hands as stated previously. The developer may also decide to make their own templates for convenience.

For example, consider a thermostat programmed with DQMH modules. There could be three modules; one to monitor temperature and humidity, one to control an air conditioner, and one to control a dehumidifier. A helper loop would be used in the monitoring module to check for any necessary actions based on the measured values. Once those actions are needed, a request and reply broadcast could be used to start or stop the air conditioner or dehumidifier and be sure those modules are still working if they do not time out. The monitor is multithreaded in that the monitoring loop will still be running and making requests while waiting on broadcasts from other modules.

The Delacor Queued Message Handler has many advantages, not least of all its ability to be used in a multithreaded application. The structure in place and tools to generate code lead to consistently stable software packages. A system hardly ever must do only one thing, which makes a multithreaded DQMH application an easy pick for structuring a test system.

Contact the experts at Ball Systems today to see how we can help with your toughest engineering challenges.

Contact Us

Blog Comments