LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Newbie problems

Good afternoon.

Windows 7

LabVIEW 13.1

USB-6218 DAQ

 

Attached is my VI to extend and retract a linear actuator using a PID controller. Setpoint is controlled by a .csv file with distance measurements per second converted to approximate voltage levels. Process variable is being controlled by a string pot attached to the linear actuator. I'm wanting to run this autonomously and after its final itereation (about 1510 lines in my csv file) I would like to restart the cycle(haven't worked all the rest out to even start looking into how this works yet, maybe someone could give me some insight on how to begin on that)

 

I can get everything to work (mostly). My problem is I can't get the index array to index once per second. I've put it in its own while loop, but I can't output from the while loop (While_loop_test1.jpg for example). 

 

Also, my error handling is sub-par. Can I have some suggestions for that? I would like to stop on error and if possible log the error in a separate log file. 

 

Another thing (I know, i feel like Dude, Where's my Car... and then?). The stop button doesn't stop my VI. I'm sure I do not have it set up right.

 

 

 

Download All
0 Kudos
Message 1 of 7
(2,704 Views)

You need to learn about dataflow.

 

Your stop terminal is read once and the value is passed into the inner while loops.  If True, those loops will run once.  If False, those loops will run forever.  Turn on highlight execution and watch the dataflow, you'll understand.

 

I would recommend looking at the online LabVIEW tutorials
LabVIEW Introduction Course - Three Hours
LabVIEW Introduction Course - Six Hours

0 Kudos
Message 2 of 7
(2,703 Views)

You also need to learn to "help us help you" -- do not attach photos of your code, but attach the actual code.  We can better view your code when we can manipulate it ourselves (you wouldn't believe some of the pictures that we get), we can test it by trying to run it, we can make some edits and show you "a better way", etc.

 

Bob Schor

Message 3 of 7
(2,653 Views)

RavensFan, 

 

I will check out the dataflow, thanks.

0 Kudos
Message 4 of 7
(2,637 Views)

Bob,

 

I didn't attach the code for the while loop because i just threw it together for an example of what I was trying to do with the VI. Like i mentioned, I cannot get the read from spreadsheet while loop to output to the PID while loop. I need the two seperate because I need the spreadsheet section to only cycle ever second and I want the PID section to run at real time. So if there's a way that I can combine the two in one section and index the index array separately once per second I'm all for trying that out.

 

Attached is the VI

0 Kudos
Message 5 of 7
(2,636 Views)

OK, you clearly haven't understood LabVIEW's Principle of Data Flow.  Let me introduce you to a Very Valuable Tool for LabVIEW Development -- the Pencil and Piece of Paper.  Here's what you need to do:  Write down what you want to do, in the broadest possible terms, not worrying about "how" (or "loops" or "Case Statements").  It clearly involves creating some Delimited Spreadsheets in LabVIEW 2013 (hmm).  So give the names of the Spreadsheets, what they are supposed to contain, and how the data are created (you can say something like "Create pairs of random numbers to be arranged in rows until <some condition to stop, or a specific number of rows, it's up to you>").  If something happens next, when does it start, and what is it.

 

Your description in the previous post says "Spreadsheet section to cycle ever(y?) second" and "PID section to run (at?) real time".  I'm not sure what you mean by that, so this is what you have to explain.  Are you running two processes simultaneously?  [This turns out to be something that LabVIEW does very easily, because of Data Flow -- if you explain what you want, we can probably show you how to do it].  One thing with parallel processes is to understand when they start (simultaneously?) and when they end (they don't need to end at the same time, but the program can't end until both simultaneous processes end).

 

Bob Schor 

Message 6 of 7
(2,607 Views)

You know. 

 

Bob's advice is really good 

 

As an aside I will mention that the best interview I ever had.... included a whiteboard,  several colored markers and a problem. 

 

THE POINT: know what 

Yes, I've written LabVIEW code with markers on a whiteboard!  It didn't compile but, I nailed that project and made some $$$

 

 


"Should be" isn't "Is" -Jay
Message 7 of 7
(2,604 Views)