DQMH Consortium Toolkits Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

How to run a module every n-th time ?

Hello community,

 

currently I am using the DQMH CML template. The acquisition module collects my data every 0.2 seconds. Now I need another module to accumulate the data for 1 second and then do a calculation. How would I do that?

 

a) have the acquisition module accumulate the data and send it every 5th iteration (that does not sound right to me)

b) have the calculation module run at every iteration (=0.2 seconds) and accumulate the data for 5 iterations via shift register and then do the calculation

c) something else, that I haven't thought of

 

Thank you for your help

Martin

 

 

0 Kudos
Message 1 of 6
(1,468 Views)

I like option B. Have the calculation module subscribe to a broadcast event which contains the acquired data. If you turn the calculation off you can unsubscribe to the event (subscribe to null event) to save processing power.

Message 2 of 6
(1,449 Views)

I would always execute the functions where they are logically assigned. This also means that if you make a calculation and have a separate module for it, then all steps that are needed for it should be executed in this module.
That would be incredibly important for documentation and changeability. Imagine you have to change or add to the calculation and calculate a floating value additionally. Then it becomes incredibly complicated with method A.

Message 3 of 6
(1,426 Views)

Another approach is that the acquisition module also does the calculation.  I accept that this may not make your acquisition module generic, but maybe a calculation module (and by that I presume we mean another DQMH module) might be overkill?

Christopher Farmer

Certified LabVIEW Architect and LabVIEW Champion
DQMH Trusted Advisor
https://wiredinsoftware.com.au

0 Kudos
Message 4 of 6
(1,370 Views)

Thank you all for your feedback.

 

As Ludwig72 explained (which makes a lot of sense to me) I will try to implement option B.

 

I do agree with Ozfarmboy that this might be overkill, but this is sort of my first attempt at the DQMH CML and I want to adhere to the structure of the template as best as possible, even if it might be only for a better understanding / overview for myself.

 

Unfortunately I was unable to work on this project since I posted here, but I will post my progress here asap.

0 Kudos
Message 5 of 6
(1,348 Views)

I can't remember a single time thinking "if only I had saved on this module". Quite the opposite, actually. Even DQMH's lead architect has stories to tell where not going with an additional, separate module for some minor functionality turned out to come back and bite them.

 

Trying not to sound too dogmatic, I would advise to go with separate modules in the vast majority of cases.




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 6
(1,344 Views)