LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Running SubVIs in Parallel along with a few other procedural issues - LabView 2012 32-Bit on Windows 7

I'm going to preface this with that fact that I've just started using LabView about 2 weeks ago and have been working on this one project the whole time.  So I've been learning as I go.  

 

My overall objective is to control a DC Load over LXI, a DC Power Supply over RS232, and read from a CAN bus with an IXXAT USB-CAN converter.  So far I can make each part work individually, that is, I've created a separate VI that can run independentely for each system.  I've then created an overall VI to combine them all.  My problem right now is that while I need the Power Supply VI to run first, followed by the Load VI (once the Power Supply VI has finished), I also need the Power Supply VI to be reading data from the CAN bus VI, as it has the Current commands to give to the Power Supply.  Right now, the overall VI runs fine up until it gets to the CAN bus VI, then it just gets stuck there and won't exit.  I need it to run alongside the Power Supply so it can feed it the Current command. 

 

I know this is a lot, and I appologize, I'm still new to this, but am very open to any tips you may have to make this work.  The VIs are attached for reference.

 

Thanks,

Austin Bartz

 

 

0 Kudos
Message 1 of 5
(2,891 Views)

Unfortunately i can't run VI and check. Some tips for code organisation:

-Use Project to group vi's together instead of separate vis. https://zone.ni.com/reference/en-XX/help/371361J-01/lvhowto/creating_lv_projects/

-While creating SubVIs :http://www.ni.com/white-paper/7593/en/ : Try to maintain the number of controls and indcators to 4x2x2x4 structure.

-I would suggest to use bundle by name cluster and unbundle by name so that you can reduce the nnumber of wires.

-I guess it is stuck there because there's stop button for a while loop inside the fucntion which you might have tested using independently.

-How does it come out of that loop when running from main vi?

Thanks
uday
Message 2 of 5
(2,881 Views)

I know this is a little much for a newbie, but what you need to learn is the State Machine and the Queued Message Handler.

 

What I would do is have seperate loops for each instrument (Queued Message Handlers) and another loop for the main control (State Machine).  The QMHs can recieve commands coming from your main state machine loop via a queue and send data back through a Notifier, Queue, User Event, etc.  Thinking about this a little more, you really should have a good look at the Delacore Queued Message Handler (DQMH) which is available for free via the LabVIEW Tools Network and/or VI Package Manager (VIPM).


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 3 of 5
(2,859 Views)

udka,

 

Thanks for the tips, I'll create a Project to combine everything. Since I already have the VIs made, is there a way to import them into a new Project?  I wouldn't seem to find an import function like that.  I'll also add cluters for the outputs of the VIs to reduce them to that 4x2x2x4 structure.

As for the stop button in the CAN loop, I tried changing it to run when true, so that it goes through once, but that didn't work.  When I ran it independently, I would just manually hit the stop button when I was done.  

 

 

crossrulz,

 

I looked at state machines intitally since I felt like this would be an approporiate use for them and I'm familiar with making state machines in FPGAs, but I got a bit discouraged as I was struggling to get it to work, so I went back to the approach I'm at now.  I'll take a look at it again and see if I can figure it out.  

I checked out the DQMH and it seems it would be perfect, except it is only compatable with LV 2014 and up, but I'm on 2012, so no luck there.  So I'll try my hand at the regular QMH format.

 

Thanks for the help!

0 Kudos
Message 4 of 5
(2,842 Views)

-You can add files to the project by steps in this link: https://zone.ni.com/reference/en-XX/help/371361J-01/lvhowto/adding_items_project/

-One other way is open all vis->File create Project->select Balnk Project-> Then pop will ask there are opened vis do you wnat to add to project-> Done.

-If you want to run the loop once then why do you need the loop remove it.

Thanks
uday
Message 5 of 5
(2,834 Views)