DQMH Consortium Toolkits Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Helper loops for active / repetitive tasks

Solved!
Go to solution

Thanks Joerg that makes sense.

 

Sorry to go a little of topic here but.....

 

I have used and do use User Events, I understand and am comfortable with creating a user event then, registering for that event you have created and then wiring that into your event structure.

 

But I am not sure I really understand the use of the constant RefNum for an event not yet created as in this case it feels sort of wrong to me, thought obviously works and is something I can use. 

 

Is there any material you know covering this a little more 

 

many thanks

 

Danny Thomson AshVire Ltd
0 Kudos
Message 11 of 24
(7,011 Views)

Perhaps it's easier to grasp if you think about the requirements of the LabVIEW IDE and not so much about the user event's lifetime. What I'm trying to say is think about the constant's data type, not the user event it's derived from.

 

1. If you want to handle a user event in your event structure, you need to wire an Event Registration Refnum to the Dynamic Event Terminal of the event structure. Only then can you you select the Event Source (the "event handled by this case"). 

 

2. You cannot wire a generic or an arbitrary Event Registration Refnum, it has to be of the exact data type you want to handle, or otherwise the Event Data Node - the node inside the event structure providing the data you want your user event to send - cannot identify the data LabVIEW returns when an event occurs (and we wouldn't be able to change it during runtime).

 

3. If you only wired the actual User Event Refnum (from the Obtain Blabla.vi) and the resulting Event Registration Refnum to the Dynamic Event Terminal from the inside, you'd still be unable to choose the event source for your event case.

 

So, it really all comes down to the following: If the user event that you want to handle is not created yet at the time you start executing your event structure, you have to wire a placeholder of the exact same datatype to the outer Dynamic Event Terminal.

 

Hope that makes sense(?).




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® (Developer Experience that makes you smile )


Message 12 of 24
(7,000 Views)

Hi Joerg, I just had a couple of practical questions about using an event structure in the helper loop.

1. When you want a new event for the helper loop, do you use the "Create new DQMH event..." tool? If yes, do you move that event out of the API virtual folder and into a privately scoped folder?

2. Do you handle errors in the helper loop? If yes, does it send the error to the message handling loop or broadcast it?

 

I tend to use a queue to send messages from the message handling loop to the helper loop, but this event structure approach interests me!

0 Kudos
Message 13 of 24
(6,459 Views)

1. Yes, I do exactly that. Use the scripting tools to create the event, then move it to the private 'Requests' folder. If I remember, I'll also document the event as private in its description when I create it. Note that after the scripting is done I usually delete the scripted code in the tester, the Main EHL, and the Main MHL, then I add an event frame in the helper loop for the private event.

 

2. Most of the time I don't add error handling in the helper loop. But on occasion, I'll just drop a copy of the error handling VI from the EHL into the helper loop and use that.

 

P.S. - No, I'm not Joerg, but I am a fan of helper loops, so I thought I'd throw in my two cents. 🙂

Message 14 of 24
(6,452 Views)
Same as Darren here...

1. Create a new virtual folder "Private Requests" that's privately scoped.
2. For error handling, took a quick look at my helper loops. They do not include much error handling, which now I am going to wait how others handle errors from the helper loop and see if I need to add some error handling to them.
Message 15 of 24
(6,449 Views)

I just use the normal error handling VI like Darren.

Sam Taggart
CLA, CPI, CTD, LabVIEW Champion
DQMH Trusted Advisor
Read about my thoughts on Software Development at sasworkshops.com/blog
GCentral
0 Kudos
Message 16 of 24
(6,441 Views)

All very similar to Darren.

 

1.) We will create a virtual folder named "Private API", move the request VI there, update its icon, delete both EHL and MHL cases, add an event case to the helper loop.

 

2.) Either use the MHL(*) Error Handling VI to send errors to the MHL, or do something else (like close/reset a communication channel if the communication fails). So that really depends on the module. Now that I think of it, I gotta say that we very rarely use the Error and Status broadcasts (cause we use our hse-logger instead)...

 

You can find the same information in our KB -> Best Practices -> Style Guide:

https://dokuwiki.hampel-soft.com/kb/bestpractices/codingconventions/dqmh#helper_loops 

 

(*) Even though there are two different Error Handling VIs for EHL and MHL,  as far as I can tell there's no difference?




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® (Developer Experience that makes you smile )


Message 17 of 24
(6,417 Views)

Hello everyone,

 

I just discovered the DQMH and I find it a really  powerful tool ( kudos to Delacor!). Since is a maintained, well documented  and powerful framework we decided to use it together with an OOP HAL  to build our testing application (motor efficiency testing which will have 8-10 modules). Since i'm just starting with the DQMH (shame on me) I would be more than happy to get your input regarding the below questions:  

 

Using a module for data acquisition, similar to the one shipped with DQMH CML template, how would you send the acquired data from a helper loop to a logger module using a queue instead of events ?

 

 

Marius_T_0-1593800716244.png

 

Would this approach be against DQMH best practices?

Or a queue  is not even needed, is safe to use the events and all the acquire data will be logged?

 

Many thanks.

 

Regards,

Marius

 

CLD
0 Kudos
Message 18 of 24
(6,107 Views)

@Marius_T wrote:

Using a module for data acquisition, similar to the one shipped with DQMH CML template, how would you send the acquired data from a helper loop to a logger module using a queue instead of events ?

 

 

Marius_T_0-1593800716244.png

 

Would this approach be against DQMH best practices?

Or a queue  is not even needed, is safe to use the events and all the acquire data will be logged?


Hi Marius,

 

Thanks for your vote of confidence on DQMH and for the compliments. A queue is not even needed. The event handling code works as a queue. The logger can even implement a buffering mechanism so it is not writing to file every single time it gets a piece of data. If the data you are sending to the logger is too big, then consider wrapping it in a DVR and send the DVR reference instead via the event. 

 

The only time we have moved to a queue approach was on an application that we were acquiring huge data sets and we were acquiring them at 2 gigasamples per second!! We had other problems there and we eventually moved to an FPGA approach instead of using third party hardware but that is another story.

 

Like anything else, please benchmark your own implementation and see if this solution fits for you. A quick test would be to acquire for a couple of minutes and make sure that your logger keeps up. One more thing, we tend to make the Stop Module request for a DQMH Logger to not be high priority, to ensure it has a chance to log any remaining data in the "event queue".

 

Thanks again for your trust in DQMH and in Delacor. 

 

Happy wiring,

Fab

For an opportunity to learn from experienced developers / entrepeneurs (Steve, Joerg, and Brian amongst them):
Check out DSH Pragmatic Software Development Workshop!

DQMH Lead Architect * DQMH Trusted Advisor * Certified LabVIEW Architect * Certified LabVIEW Embedded Developer * Certified Professional Instructor * LabVIEW Champion * Code Janitor

Have you been nice to future you?
Message 19 of 24
(6,102 Views)

Hi Fab,

 

Thank you for the provided info, your reply  answers to my questions and helps me to move on  in this  "go/no go" situation.

Again, I can't emphasize how much this framework will help me in my future projects. Thank you and keep up the amazing work!

 

Kind regards,

Marius

 

 

 

 

CLD
Message 20 of 24
(6,096 Views)