LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Stop/Start DAQ-mx acquisition with boolean

Solved!
Go to solution

Hi Kevin,

Thanks for your observations, as I mentioned I’m enjoying attacking this problem from two directions. So in parallel with working through mcduff’s elegant solution I would like to modify/rewrite etc. my original to learn and improve upon my mistakes so your insights are very much welcomed.

 My original upload was the preliminary work I did at home before work bought the hardware and I added some functionality since.

I have change to notifiers as you suggested but I’ve not had much time to implement your additional ideas.

I just hope the bolt-on’s  I added don’t invalidate your hard work.

I have attached my project work to date which despite appearances runs.

 Any critique or observations are welcome.

Regards

 

P.S. The timer isn’t my work but came from the package manager   

0 Kudos
Message 31 of 37
(806 Views)

I think your best course of action is following whatever Jeff/Kevin say. They are experts, I am more of a hack.

 

I assume you have 2018, looked over some of you VIs, your FGV Counter has a bug in the reset case, always 0 even if you choose not to reset. All of your actions can be combined into 1 VI, see attached. Also, try to place terminals when possible outside of structures.

 

You can make the similar modifications to your timer FGV.

 

Also you typically don't need error wires for your FGV, but it is up to you.

mcduff

 

Apologies, should have zipped the files

Message 32 of 37
(803 Views)

Hi mcduff,

Thanks for looking over my project – I completely missed the reset error and terminals outside the structure makes sense. Plus the enveloping error case structure would neaten my vi’s up.

 As for using xml, I just goggled the options and it just looked easier than a config file. I’ll play around to see if I can modify the file instead of replacing it.

You might be more of a hack but your advice has been totally spot on and I do appreciate all your hard work.

I’m off to play with ‘in place element structure’ as I’ve not used one but can see possibilities (another great tip thanks)

 

Regards

0 Kudos
Message 33 of 37
(789 Views)

@Simon-lee wrote:

I’m off to play with ‘in place element structure’ as I’ve not used one but can see possibilities (another great tip thanks)

 


Be careful with in place structures, they are good for somethings, not needed for other things, and bad for some things. I tend to use "a lot" of them in my JKI state machines as I prefer the aesthetics of the in place unbundle/bundle then making a unbundle cluster then a bundle cluster.

 

mcduff

Message 34 of 37
(786 Views)

Happened to be in the neighborhood, so dropping by this thread again.

 

To Simon-lee:   I think it's an excellent idea for you to approach this problem in two different ways.  You're gonna learn a lot from the process.

 

I gave suggestions based on sticking with the general structure you started from (with 3 parallel loops).  While doing it, I gotta say that the 3 separate loops felt like they were making the solution more complicated than necessary.

 

I haven't dug into any of mcduff's state machine approach, but when he first suggested a 1-loop solution, it sounded like good advice to me.  Don't believe him when he calls himself a hack. 

 

As you approach things in parallel, you might want to rethink the way you partition your 3-loop code and see if you could do it with 2 loops instead.  It might still be handy to have that 2nd loop because sometimes with only 1 loop certain processing gets a little "stuck" waiting in line for its turn.  A 2nd loop can defer the low priority things and keep them out of the way of the high priority things.

 

Still, I'd venture that you'll find the 1 loop state machine approach to be more straightforward to implement and debug.  I'd focus on that one and get it working correctly first before going after the parallel loop approach.  What you learn by getting the 1 loop version debugged will help you decide how to partition the 2 (or 3) loop version.

 

 

-Kevin

 

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
Message 35 of 37
(780 Views)

Hi Kevin,

Thanks for stopping by. I’m pleased to say that thanks to your and mcduff’s help there is an actuator chugging away in the corner of the workshop. I know the code is far from perfect but I have something to show management. I have added a logging function but on the way home I realised that I shouldn’t hold the file open unnecessarily. One oddity is I cant stop it without stopping Labview directly. I tried channel writers as the training advised but I slipped up somewhere. I also apologise for the lazy use of local variables – I was up against the clock.

I do plan to update this thread when I have mastered the single loop approach but that may that a little time, in the meanwhile I have added my latest project (with logging)

Regards

Message 36 of 37
(766 Views)

Hi Folks,

After a weekends play and testing on the real hardware I would like to say that mcduff’s solution is inspired. I just wish the training courses had covered this approach because It’s exactly what I needed and I feel it has given me the building blocks for many projects in the future.

 I owe much thanks to mcduff and others on this forum for their help and advancing my education.

Regards

0 Kudos
Message 37 of 37
(757 Views)