DQMH Consortium Toolkits Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Use a Private Request to update the data in the helper loop

Solved!
Go to solution

Hi,

 

I am attempting to update data in a helper loop from my MHL. The authoritative blog post on helper loops and the DQMH Best Practices state "When coding a repetitive operation, use a helper loop that is registered to the stop Module event and does the repetitive operation inside the timeout case. Leave the changes to the local data cluster to be handled via the traditional EHL->MHL and then use a Private Request to update the data in the helper loop. This ensures that if the event structure in the helper loop has several events already in the queue, it contains the latest information the next time the timeout is handled."

 

I have only created user events using the DQMH scripting tools, so creating a new event and registering to listen for it is a little beyond my abilities. I understand the concepts but the necessary actions are unclear to me.

 

Is there a step-by-step walkthrough or other documentation/examples to create a Private Request and use it to update the data in a helper loop? If not, can someone recommend a tutorial for creating and using user events? Thanks!

0 Kudos
Message 1 of 13
(2,154 Views)
Solution
Accepted by topic author dvonch

I'm not aware of another resource for private events and helper loops beyond the HSE link you referenced. I'll try to describe the easiest way to do it, as you shouldn't need to create any user events yourself:

 

1. Create a new DQMH request just like you normally would. This will be your private request.

2. Delete the EHL and MHL frames that were automatically created for the new private request.

3. For your helper loop, unbundle and register for the new private request's event just like you already are for the Stop Module event.

4. Call the private request VI from your module code (usually somewhere in the MHL).

5. Move the new request VI in the project from the 'Public API' folder (where it was automatically generated) to the private 'Requests' folder.

 

Also note that the DQMH Consortium is working on automating this process in a future release of DQMH.

Message 2 of 13
(2,139 Views)

Hi Darren,

Thanks for the assist! I implemented the change the way you described. Just have a few added details for posterity.

 

0. Initialize the helper loop data cluster with the same typedef used to initialize the MHL data cluster.

1. Create a new DQMH request just like you normally would. This will be your private request. Use the data cluster typedef as the event argument. If the data cluster typedef is private, don't add any arguments at this stage and manually add the argument after step 5.

2. Delete the EHL and MHL frames that were automatically created for the new private request.

3. For your helper loop, unbundle and register for the new private request's event just like you already are for the Stop Module event.

4. Call the private request VI from your module code (usually somewhere in the MHL).

5. Move the new request VI in the project from the 'Public API' folder (where it was automatically generated) to the private 'Requests' folder.

6. Create a new event case in your helper loop to handle the newly created dynamic event. Within the new event case, update the helper loop data from the event data with a bundle by name function.

 

Thanks so much for your help!

0 Kudos
Message 3 of 13
(2,109 Views)

@dvonch wrote:

 

I have only created user events using the DQMH scripting tools, so creating a new event and registering to listen for it is a little beyond my abilities. I understand the concepts but the necessary actions are unclear to me.


Creating and using a User Event isn't that complicated.  Once you learned it it would be quicker (and, more importantly, clearer to read) than what you are doing.  And you could reuse the knowledge outside of just DQMH.

Message 4 of 13
(2,067 Views)

@drjdpowell wrote:

@dvonch wrote:

 

I have only created user events using the DQMH scripting tools, so creating a new event and registering to listen for it is a little beyond my abilities. I understand the concepts but the necessary actions are unclear to me.


Creating and using a User Event [..] would be [..] clearer to read


I disagree. Sometimes sticking with the basic/default framework mechanism has its merits. 




DSH Pragmatic Software Development Workshops (Fab, Steve, Brian and me)
Release Automation Tools for LabVIEW (CI/CD integration with LabVIEW)
HSE Discord Server (Discuss our free and commercial tools and services)
DQMH® (The Future of Team-Based LabVIEW Development)


0 Kudos
Message 5 of 13
(2,061 Views)

@dvonch wrote:

0. Initialize the helper loop data cluster with the same typedef used to initialize the MHL data cluster.


I would suggest to only maintain such data in the helper loop that the helper loop actually needs, and keep that to a minimum. Keeping coupling at a minimum is always good for cohesion.




DSH Pragmatic Software Development Workshops (Fab, Steve, Brian and me)
Release Automation Tools for LabVIEW (CI/CD integration with LabVIEW)
HSE Discord Server (Discuss our free and commercial tools and services)
DQMH® (The Future of Team-Based LabVIEW Development)


0 Kudos
Message 6 of 13
(2,056 Views)

Also, thank you for pointing out that there isn't enough information in the blog post. I will add Darren's comments to it, and I will actually remove and rewrite the paragraph you quoted - I think we can do a better job of wording this 🙂




DSH Pragmatic Software Development Workshops (Fab, Steve, Brian and me)
Release Automation Tools for LabVIEW (CI/CD integration with LabVIEW)
HSE Discord Server (Discuss our free and commercial tools and services)
DQMH® (The Future of Team-Based LabVIEW Development)


0 Kudos
Message 7 of 13
(2,051 Views)

@drjdpowell wrote:

@dvonch wrote:

 

I have only created user events using the DQMH scripting tools, so creating a new event and registering to listen for it is a little beyond my abilities. I understand the concepts but the necessary actions are unclear to me.


Creating and using a User Event isn't that complicated.  Once you learned it it would be quicker (and, more importantly, clearer to read) than what you are doing.  And you could reuse the knowledge outside of just DQMH.


I agree it is a gap in my knowledge that I would like to fill. Is there a tutorial or other resource that you recommend?

0 Kudos
Message 8 of 13
(1,979 Views)

@dvonch wrote:.

I agree it is a gap in my knowledge that I would like to fill. Is there a tutorial or other resource that you recommend?


Just the basic stuff on ni.com, like this: https://www.ni.com/docs/en-US/bundle/labview/page/lvhowto/creating_user_events.html

 

 

Message 9 of 13
(1,952 Views)

@joerg.hampel wrote:

@drjdpowell wrote:

Creating and using a User Event [..] would be [..] clearer to read


I disagree. Sometimes sticking with the basic/default framework mechanism has its merits. 


Sometimes. But you're using a mechanism designed for globally-scoped communication between modules as a local-to-one-block-diagram interaction between Message-Handling Loop and Helper Loop.  A wire connecting those loops would definitely be clearer in expressing where messages are being sent to the Helper.

Message 10 of 13
(1,946 Views)