DQMH Consortium Toolkits Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

DQMH Events not firing?

Solved!
Go to solution

Hi Delacor,

 

I've been using the DQMH to create a plug and play architecture for a project at work. The project requires a DUT to respond to an identifying command and then to populate a user interface accordingly. It then updates it's stats on a 0.5s interval. It's all going reasonably well but I seem to be missing events. I suspect that some modules are not initialising and shutting down in the correct order so I created a module to monitor this and nothing else, and to output a timestamped entry to a text log. The logging module starts up with the main user interface and I get an entry that the UI (the red module) has started and stopped, but not for the others. Occasionally I get an entry that the "CHAS" module has stopped, but not started? I can definitely see these events in the Test VI's, and if I breakpoint on any module before the Init broadcast the VI pauses, but I don't see the event being triggered in the monitoring module?

macjock_0-1581942353171.png

 

0 Kudos
Message 1 of 18
(6,279 Views)

My best guess is that the order of starting a module and registering for its broadcasts is off.

 

As the broadcast events are created during launching a module, we can only register for these events after the module was started. Also, in order to see all the broadcast events of a module, we need to register before the module starts doing stuff.

 

If you look at the API tester, you'll see that it uses the (1) "Obtain Broadcast Events for Registration.vi" outside the for loop / event structure to register for the broadcasts events, and then (2) takes the event references from "Start Module.vi" to overwrite the registration with the actual event references when actually starting the module. It then uses "Synchronize Module Events.vi" to make sure that the module only continues execution after the registration has been done. 

 

reg-broadcasts.png

There's a bit more information available in this discussion




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 2 of 18
(6,271 Views)

Thanks Joerg,

 

I think I get you - my monitor module will never respond to these events as it it running prior to the other modules starting. This is a lot different from events in text based languages (such as VB.Net). My assumption was that a module would just "listen" for any event it is registered to.

 

Labview bites me again....

0 Kudos
Message 3 of 18
(6,246 Views)

You just need to coordinate with your monitor module.

 

For example if your main launches Module A and the monitor is already running, then create a request and wait for reply to send the broadcast events from A to the monitor. Call that before you call the sychronize VI and you should be good.  Then the monitor will be registered before Module A starts broadcasting anything.

 

It may not be the most elegant solution, but it should work.

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 4 of 18
(6,240 Views)

Hi macjock,

 

Here is another related post: https://forums.ni.com/t5/Delacor-Toolkits-Discussions/Module-broadcasts-registered-but-events-never-...

 

On Joerg's picture, the first registration is just "declaring the events data type". If the module is already running, it also registers for the events but if it is not already running, it only specifies the data type.

 

When the module starts and creates its own events, now the second registration for sure registers for the events. 

 

Thanks for your trust in DQMH.

Regards,

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?
0 Kudos
Message 5 of 18
(6,233 Views)

Thanks Fabiola,

 

That makes more sense - I'll give a try and get back to you. 

 

 

Message 6 of 18
(6,231 Views)

Hi Delacor,

 

I created an event in my logging module to re-obtain broadcasts. When should this event be fired? I tried putting the event inside the Initialize for the Logging module, as per the solution shown, but I still don't get any Init events for some modules.

Capture.PNGCapture.PNG

 

 

Also, I don't know which modules may be started at any given time - for these I attempted to put the event inside the Initialize section of the MHL, prior to their Init event being called. Again, I don't get the event.

 

 

Capture.PNG

 

 

Thanks for your patience!

 

 
 

 

 

 

 

0 Kudos
Message 7 of 18
(6,183 Views)
Solution
Accepted by topic author macjock

Would you make a diagram, it can be back of the napkin type of deal that shows who is calling the Start Module for who?

Also, sequence diagrams can help.

Tip 1 of this blogpost discusses modeling:

https://delacor.com/tips-and-tricks-for-a-successful-dqmh-based-project/

 

This will help us (you included) find where to fire the event to register for all the events.

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?
0 Kudos
Message 8 of 18
(6,175 Views)

Hi Fabiola,

 

I created a tester project to get my head around this. 

 

Module 1 launches Module 2, which launches module 3.

macjock_0-1582104895572.jpeg

Each module is registered to each other events. Module 1 has no reference to Module 3, other than Obtain Registration.

macjock_1-1582104895572.png

Module 1 launches Module 2 (and Mod2 launches Mod 3):

macjock_2-1582104895577.png

Module 1 can make a request to Modules 2 and 3, and both respond.

macjock_3-1582104895583.jpeg

Module 1 can say hello to Module 2, and hear back from it:

macjock_4-1582104895588.jpeg

If Module 3 broadcasts, it is not heard by Module 1:

macjock_5-1582104895593.jpeg

If I now send a request to Module 1 to re-register for Module 3 events, it will now be heard:

macjock_6-1582104895599.jpeg

Noted that if Module 3 is restarted, Module 1 must re-register for these events

macjock_7-1582104895605.png

So tried to capture Module 3 Init broadcast, which didn’t work, but I was registered for later events.

macjock_8-1582104895610.png

macjock_9-1582104895615.jpeg

Then I put a stall between Module 1 re-register broadcast and Module 3 Did Init:

 

macjock_10-1582104895621.png

Module 1 now registers to Module 3 Init event:

 

macjock_11-1582104895624.jpeg

I experimented with a few values in the stall – even 1ms seemed sufficient, but I guess that is dependent on processor speed, memory etc.

 

 

Anyway, this is much clearer now. Thanks for you help!

Message 9 of 18
(6,160 Views)
Solution
Accepted by topic author macjock

Hey macjock, if you're already looking into removing dependencies between 1 and 3, you might want to remove them completely.

 

You could adopt a tree-like structure, where module 1 would not know anything about module 3, but module 2 would have to "forward" broadcasts from module 3 to module 1.

 

There's a thread with more information on this topic:

https://forums.ni.com/t5/Delacor-Toolkits-Discussions/What-is-a-good-method-that-is-used-specificall...

 

PS: I dare say that having to put wait or stall VIs is almost always a code smell...




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 10 of 18
(6,152 Views)