08-29-2024 10:57 AM - edited 08-29-2024 11:13 AM
Understood - but at some point doing this with producer/consumer QMH leads to an unmanageable number of queues/ messaging loops!
If you put each task in a different loop how do you usually record all the data so it lines up with all the channels on all modules?
08-29-2024 06:26 PM - edited 08-29-2024 07:18 PM
one more follow up to this-
Once I write to a DO module, do those values "stick" - i.e. will the module retain those values until I change them?
Or do I need to have the Digital write in a loop constantly writing over the same values?
(sorry for the basic question but it is related to the timing questions)
to clarify, there is a loop running but the digital write only happens on demand. So the task exists the whole time.
08-30-2024 12:42 AM
Hi GOB,
@GOB34 wrote:
Once I write to a DO module, do those values "stick" - i.e. will the module retain those values until I change them?
Or do I need to have the Digital write in a loop constantly writing over the same values?
to clarify, there is a loop running but the digital write only happens on demand. So the task exists the whole time.
08-30-2024 06:00 AM - edited 08-30-2024 06:42 AM
Thanks GerdW - I don’t have access to the hardware right now so can’t test DO’s on the physical device.
I appreciate your explanation!
Any advice on my question to message 10 above on recording the data from tasks in different loops as you described above?
08-31-2024 07:22 AM
@GerdW-
There is still something baffling me in understanding software timing with acquisition when using the QMH structure similar to the one in the Continuous Acquisition and Logging (daqMx) template.
this is my difficulty:
The messenger loop sends messages to the acquisition loop via one queue. So the acquisition loop only runs when a message gets dequeud from that queue OR if I set up a timeout on that deque function.
As built in the template, the acquisition loop is set up for the loggging state to acquire samples then send a message to itself in the acquisition queue to go back into the logging state and repeat on and on.
this is great if using hardware timing.
if using software timing, how do you accomplish a set sample rate?
I can see making the acquisition loop a timed loop, and removing the step where the logging case calls itself - but then aren’t things just determined by the timeout on the messenger loop dequeue?
If I keep the setup with the logging queue calling itself won’t it just run continuously at max speed because the queue is always full?
do I put a delay (wait in ms) the actual acquire step? I’m afraid of this as (1) it is sort of buried and (2) it seems like there are lots of other contributors to when the time is that that step would actually execute.
as always i appreciate your help and guidance!
08-31-2024 11:06 AM
Would this approach work:
put a timeout on the deque of the message queue in the acquisition loop;
this will be the data rate;
Check the state enum in the “ ” case and if in “logging mode” have the “ ” case change the state enum to “acquire” ; -or- should I enqueu a message to data queue to acquire here?
go to acquire state and do one round of daqmx read (or whatever); enqueu data to data queue;
keep state in “log” but don’t send enque message to data queue to repeat logging
i will put the code here once I experiment with this but appreciate any advice along the way!
09-02-2024 09:41 PM
Is it as simple as removing the daqMx timing in the configure hardware VI (attached) and putting a wait in the Acquire.vi?
It works, *except* I have found this issue:
In the Main VI (from the template of the Continuous Acquisition and Logging (DaqMX)) -:
I've tried to track down if this is a result of the acquisition queue calling itself to aquire again via it's own queue, and there being an issue where the queue is already destroyed but I can't seem to track it down - it looks like it is doing the right thing flushing the queue on stop command from the messenger loop.
Thanks for the help!
09-05-2024 08:11 AM
Hi,
any thoughts on this last post?
thanks!