From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Parallel loops

tbob 🙂 gotcha! This was just an example to show you. I will definitely clear up the wires coz I hate to have to do it later. I am doing that right now actually on the program I am revamping. Hell I tell ya! 🙂 Thanks a ton! Pleasure learning from you. You make it so easy.

 

@imstruck thanks! that makes total sense 🙂

 

V

I may not be perfect, but I'm all I got!
0 Kudos
Message 21 of 50
(1,471 Views)

Please refer the attachements.. I am not sure why this is happening.. Here's the explaination.

 

These front panel displays are run in parallel loops. SPeed and elevation run in loops of 250ms and 100ms respectively. When I start the test and run the speed case to start its loop, the graph goes haywire as seen. But, when the elevation case is started, both loops run in paralel and both are stable. Again, when I stop the elevation case, The speed graph goes haywire as seen in the attache'.the speed loop counts pulses over 250 ms from a flywheel. Physically, there is no evidence of such reved up speed, but the graph shows so. Any thoughts? 

 

In brief. When both loops run, there seems to be no problem. WHen just speed loop is run, there seems to be abnormal behaviour.

 

Thanks!

 

 

V

I may not be perfect, but I'm all I got!
Download All
0 Kudos
Message 22 of 50
(1,433 Views)

VeeJay:  Please attach your vi.  Can't tell anything from a picture of the front panel.

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 23 of 50
(1,415 Views)

Here is the attached vi... I am just trying a few things out. So the wiring is haywire. What I see is that when the first parallel loop is not running , the second one works abnormally but when both are run, I get what I need. But again when the first one is turned off, second loop goes bonkers as shown in the front panel before. What is happening here?

 

V

Message Edited by VeeJay on 05-25-2010 09:47 AM
I may not be perfect, but I'm all I got!
0 Kudos
Message 24 of 50
(1,388 Views)

This VI is way to HUGE.  There is no way that I can even begin to follow the code.  I would need 5 monitor high by 10 monitors wide to see the entire block diagram.  You need to break this up to chunks that fit on one screen by using subvi's.  Learn modular programming.  Keep the funtions simple and limited to one screen by creating subvi's.  Use several subvi's to create the larger program.  I really can't follow your code at all.

 

Also, you create separate threads for the same DAQmx device.  Instead of creating a channel for Dev1\port0\line0 and one for Dev1\port0\line1, create a task that uses both lines into one thread.  Here is an example of how to create a task:

 

CreateTask.png

 

Then use the task output to DAQmx writes and reads.  All lines will be read or written at one time.  Use this scheme where possible.  This will help to reduce the complexity of your vi.

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 25 of 50
(1,372 Views)

Thanks tbob. I know that my vi's get really large. It has been just 6 months since I started learning LabVIEW by myself, hence you wouldn't  see modular programming, although I know the concept, I haven't been successful with implementing it in LabVIEW. Have done it in MATLAB though. The problem I face with modular programming in LabVIEW is the Front panel for each subvi. I want all the front panel parameters in one front panel. Is there any way of doing that?

 

V

 

 

Message Edited by VeeJay on 05-25-2010 03:22 PM
I may not be perfect, but I'm all I got!
0 Kudos
Message 26 of 50
(1,359 Views)

If you have a lot of controls, create a cluster of them.  Pass the cluster to each subvi and have the subvi return the modified cluster.

 

You could also create an array of control references.  Just create a control reference for each control and put them all into an array or a cluster.  Send this array or cluster to the subvi.  The subvi will have to use a property node to change the value of the main control.  But there will not be any passing clusters back to main since the property node will effectively change the main control value.

 

See these two vi's as an example of how to use control references and property nodes to control a main item from a subvi.

 

 

- tbob

Inventor of the WORM Global
Download All
0 Kudos
Message 27 of 50
(1,351 Views)

Hi tbob! 🙂 I am revisiting the concept of starting multiple i/o lines on the same thread. Is this how I would access each line that has different purpose from the array we feed into the flatten channel string? Thanks!

 

V

I may not be perfect, but I'm all I got!
0 Kudos
Message 28 of 50
(1,245 Views)

I dont know if it's already been mentioned, but with OP's solution there's no guarantee in which order the properties (sic!) are read. I assume every so often a couple of loops only runs once (getting the old True and stop). 


With that solution you'll need something like a Invoke Node - Reset to default values, wired to all loops to make sure they're properly reset before reading ... or even worse a sequence to make sure ...

I really, really liked the notifier solution, especially as it allows Latching. 🙂

/Y
G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 29 of 50
(1,226 Views)

Thanks Yamaeda! I already got the answer for that though 🙂 My question was for just a couple of replies back regarding creating the same task for multiple channels and how to access individual channels.

 

V

I may not be perfect, but I'm all I got!
0 Kudos
Message 30 of 50
(1,215 Views)