LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Polarimetric Sensor for pressure measurement

Please refer to the attached VI and the excel sheet.
As I run the VI and vary the pressure through the dial, SOP values are generated and plotted against time. Now as soon as the SOP value crosses -0.21, an alarm goes on. It switches off when I lower the pressure. I want to calculate for how much time the alarm remains ON.
Secondly, the generated SOP values correspond to certain pressure values as stored in the excel sheet. How do I compare the generated SOP with the pressure values. Basically I want a graph to show me what is the corresponding pressure. Right now I am directly plotting P v/s SOP in the VI. But in reality, I will just know the values of SOP and will have to what pressure it corresponds to. Moreover I have to pass this info to a program in matlab. So how do I achieve this??

Regards,
Dhiraj
0 Kudos
Message 1 of 5
(2,388 Views)
Oops........ here's the excel sheet.
0 Kudos
Message 2 of 5
(2,386 Views)
Hello,
 
I think you really have 3 questions/issues here:
 
1. "calculate for how much time the alarm remains ON"
To compute the time between points in your code you can use the attached little example called "ms stopwatch.vi" which uses a functional global (uninitialized shift register) to store the value of the ms timer across runs.  The other VI calls this VI (twice) to illustrate how to use it.  Basically, it should be called with the "Reset" parameter just before the code to time, and then called with the "Get Elapsed Time Since Last Reset" just after the code to time.
 
 
2. "How do I compare the generated SOP with the pressure values. Basically I want a graph to show me what is the corresponding pressure."
 
If you describe exactly what data you have, and exactly what you would like to compute, I think I can help you further.  When you say, "But in reality, I will just know the values of SOP and will have to what pressure it corresponds to"  do you mean that you will have to compute which pressures they correspond to using an equation?  For this you will use the numeric palette.  Do you mean you need to use a table to "look up" which pressure correponds to a given SOP value?  If so, how is that table stored - you could put it into a 2D array and then index the values using the array index function to get the correct pressure.
 
 
3. "pass this info to a program in matlab"
For this you can have your LabVIEW program write whatever data you will need in your matlab program to a file, and then read that file in your matlab program.
 
 
I hope this helps!  Please study the example code carefully so that you understand how to use the timer VI I have attached.  The concept is rather simple once you understand that the shift register (the left terminal of the shift register) in the ms stopwatch VI will retain the value that was last written to it across calls to the VI.
 
Best Regards,
 
JLS
Best,
JLS
Sixclear
Download All
0 Kudos
Message 3 of 5
(2,365 Views)

Thanks a lot for the reply.

The SOP and corresponding pressure values are stored in an excel file, which I have attached in the post just before this. Just have a look.

 

Thanks,

Dhiraj

0 Kudos
Message 4 of 5
(2,358 Views)
Hello,
 
What wasn't clear was exactly what you wanted to do with your data.  In any event, I am not sure how your data is stored in your excel file - usually it is just a large string, where cell values are delimited by tabs along a row, and rows are delimited by carriage return and/or linefeed characters, but if you read the contents of the file programmatically it clearly is not.  So, I copied your data (excluding the column headers you had of P and SOP) to a text file, and then threw together a program to plot your data, both P vs SOP and SOP vs P to illustarate how to extract your data from a file, get it into numeric form, and plot it.
 
Do the following with the attached files:
 
1. save the attached files to the same directory
2. run the VI and observe all objects on the front panel on the front panel
3. open the attached text file and observe its contents
4. open the block diagram of the VI, read the comments, and study the code to understand how to read your data
 
I think you'll be able to learn from the attached code and implement your desired functionality!
 
Best Regards,
 
JLS
Best,
JLS
Sixclear
Download All
0 Kudos
Message 5 of 5
(2,344 Views)