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.
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.
02-17-2014 04:09 PM
Hey guys.
I am making a Labview VI that control's servo, by comparing onboard acclerometer readings. A set profile(in excel) will be used and compared against an onboard acclerometer's z-axis reading's. When the acclerometer reading's are above or below the expected value the servo will get a signal to adjust manually, this will be done by a Case structure.
My question is about comparing the reading's. Can anyone point out how can I get labview to compare excel readings against onboard readings?
The image below shows a block diagram of what I am trying to obtain. The end result is to try and alter thrust on board a rocket. We will be using a Myrio which was donated for this project.
Any advice is much appriciated!
Caleb
Thanks
Caleb
02-18-2014 03:21 AM
Hi Caleb,
As you are using myRIO, You might want to have a look at this youtube video link: http://www.youtube.com/watch?v=BuREWnD6Eno
There is a section in the video regarding file I/O. In function palette, there is a function for you to read data out of the file. You can start from reading something from the file.
Hope this help
Best regards,
TuiTui
02-18-2014 01:22 PM
Hey cwatts26,
I'm not sure if I completely understand what you mean by compare the values. Are you not sure how to acquire the onboard readings into a usable form in LabVIEW? For the Excel data, you can use VIs in the File I/O category to read values in from your Excel document. From there, you would simply compare the values using boolean logic as usual. Is this the type of comparison you are referring to, or is there more to it?
Regards,
Ryan
02-19-2014 10:34 PM
I understand I currently don't have the excel data on me, but I am just experimenting with the code.
But anytime I add a comparator it won't hook up with a case structure.
02-20-2014 11:20 AM
Hey cwatts26,
That's because in the above screenshot you are comparing an array of values to a single value, which produces an array of booleans as a result. A case structure cannot have an array as an input to it's "?" terminal. You can add a For Loop to auto-index and compare the Excel values one at a time, or you can index the resultant boolean array to get the individual results which can be used with a case structure.
I hope this helps.
Regards,
Ryan
02-21-2014 12:53 AM
Ultimately I will be comparing an input to a spreadsheet file. Is a for Loop the best way to do this?
I would like something similar as shown below, but it should be important to note that in the end the input is adjusted for cailberating of a acclerometer.
02-21-2014 01:34 PM
Are you trying to compare the analog value AI0 to every value in the spreasheet by looking to see if AI0 is greater than all of the values in the spreadsheet? Essentially, do want code that generates a FALSE if all the values in the spreadsheet are less than the AI0, but generates a TRUE if only one is greater? If so, here's how I would acheive that:
02-23-2014 05:30 AM
Preferably the spreadsheet will have different value's in each cell.
The input from the analog port at any given time will match with the corresponding cell, as in:
Cell 1 compared to
Analog input at that time
Cell 2 compared to
Analog input at that time
And then depending on compareson a PWM signal will be sent out to operate a servo or not. As stated eariler after the comparison I can use a case study as a generator of the PWM, it's just the comparison i'm kinda confused about. I will definitely try that later in the week when I get the chance. I do appriciate it!
02-24-2014 02:34 PM - edited 02-24-2014 02:35 PM
Based on your updated description, I think that this may be what you are looking for. The For Loop reads data from the Excel sheet one at a time because of the Auto-Indexing Tunnel. It is then compared to the current Analog value (just replace my Analog In with your DAQ Assistant Express VI). Based on whether or not it is FALSE or not, the servo will or won't be updated. The Wait (ms) function in the corner controls how fast the values are compared and the servo gets updated since it pauses each loop interation for the displayed period of time in milliseconds.