LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

write to spreadsheet in intervals

I need to acquire and graph analog voltage and then record it in a spreadsheet. I need to read and write the input and output analog voltages.
There is only one thing with recording the data to the spreadsheet. I want it to record about 20 samples every 2 mins. Only when the voltage goes above or below a certain range it should record the voltage till it comes back in the required range. I'm going to measure line voltage. But it will be stepped down to (0-5V) because the DAQ (USB 6216) ofcourse cannot acquire line voltage.
I don't have access to the shipped examples on my computer because of an untimely crash and bug in the software.
It'll be great if someone could help me with this issue and maybe send me the attachment of cont acq graph and write to spreadsheet.vi
 
0 Kudos
Message 1 of 16
(3,916 Views)
Hi smm,

I need some clarification on what you are trying to do.  You have mentioned a couple different programming goals for this application.

To start with, you are acquiring a line voltage, stepped down to a 0-5V DAQ range.  You are going to be checking the voltage level and when the voltage drops out of an acceptable range, you want to record date to a spreadsheet at the rate of 20 samples/ 2mins OR 1 sample every 6 seconds?

This problem needs to be tackled in stages.
1.  To start with, you need to setup the data acquisition part of your application to do continuous sampling. 
2.  Check that every data value falls between your acceptable range.  This can easily be accomplished using comparison functions. 
3.  Use a case structure when your values fall out of range to initiate the steps to write information to your spreadsheet.
4.  To write to the spreadsheet only once every 2 mins with 20 samples, then you should take the datapoint every 6 seconds and append it to a string.
5.  At the 2 minute mark, use the "Write to Spreadsheet File" VI to copy the data over and use the string as an input

Is my interpretation of your intended application correct?

Regards,
Rishi L
National Instruments
Applications Engineer
0 Kudos
Message 2 of 16
(3,888 Views)

You are pretty much in the ball park. But let me make this a little more clearer.

So what we have is a type of regulator circuit and I'm only going to make an application to continuously monitor the voltage.  So it's like this. We have line voltage as input fromt eh electric company which will typically be an AC voltage in the range of 180-300VC. The circuit we have regulates this input to give an output of 208V +/- 5%.

So my Labview application is supposed to monitor the inout and the output voltage. We have to tkae input and output readings at approximately 20 samples for 2 mins. Now if either the input or the output voltage go outside of the range of +/-5% the values should be written to the spreadsheet till the values are regulated back to the required range.

I hope this makes it more clear.

And I did think of the comparison function ofcourse but it's the spreadsheet issue that I cannot resolve. Also can you tell me how can I make it read and graphically display both the inputs and outputs simultaneously ?

I appreciate any kind of inputs. Thank you so much.

0 Kudos
Message 3 of 16
(3,882 Views)
Hi smm,

I understand now.  Basically the input and output that you are reading will be treated as 'inputs' as far as LabVIEW is concerned (both signals are being fed into your DAQ card and you aren't generating anything).

As you mentioned your sample rate is 1/6 Hz (20 over 2 minutes).  I have attached a VI that should give you some more guidance.

I setup a DAQmx task called "LineInputs" that reads in channel 0 and 1 from USB DAQ 6216 at a rate of 1/6 Hz.  Every value that comes in is compared to your upper and lower threshold limits for the Line Input and Line Output.  If either is met, then the data points are converted into spreadsheet strings and added into a spreadsheet file along with a timestamp.

I hope this answers your question.  Let me know if you need some more information!

Regards

Rishi L
National Instruments
Applications Engineer
0 Kudos
Message 4 of 16
(3,862 Views)

This was great. But what I also had in mind was to write the readings to the spreadsheet irrespective of their values. As in, if the readings have values in between the threshold range the values should be written less frequently to the spreadsheet, but if they fall outside the thresholdrange, then they must be written more often. I hope this makes sense. Could you tell me what to do in this respect?

Thanks.

0 Kudos
Message 5 of 16
(3,840 Views)
One more thing. I'm using the NI USB 6216. In this VI we are measurig 180-300V etc.( implies large values). Can the DAQ unit measure such values without any step down transformer? As in do we compare the voltages to 100 and 100 etc as comapred to a smaller range of 0-5V or 0-10V?
0 Kudos
Message 6 of 16
(3,833 Views)

Hey iRish,

I had one question. In the VI you have posted here, doesn't the result output of the compound arithmetic block get connected anywhere? How will we view the resule then?

 

Shreya

0 Kudos
Message 7 of 16
(3,819 Views)
Hi Shreya,

My apologies.  I forgot to reconnect the result of the compound arithmetic statement to the case structure.  With regards to the second part of your question, we need to modify the logic of when the spreadsheet file gets written in order to pass it data even when points are within bounds.

Take a look at the newest version of the VI I attached.  It is setup so data is written to the spreadsheet, (i.e. a TRUE case) every loop iteration that your data is outside of the tolerance range, OR every second iteration of the loop.  If you want it to write data even less frequently than that, then you can modify the constant divisor connected to the Remainder/Quotient function.

With regards to your question about using the USB 6216 to read large voltage values, it is limited to 60V Industrial isolation, which means that the maximum voltage the device can safely input (without a step-down transformer) is 60V.  It allows for a +-10V range, so you could measure 40-60V with it.  None of our DAQ products will handle upto 300 VDC like you need.  I recommend having a look at our DMM product page:  http://www.ni.com/digitalmultimeters/

Regards,
Rishi L
National Instruments
Applications Engineer
0 Kudos
Message 8 of 16
(3,808 Views)

Thanks a ton. This was great help. You were great. I really appreciate the NI Applications Engineers help. All you guys do a great job Smiley Happy

 

0 Kudos
Message 9 of 16
(3,804 Views)

I now have a question on a totally unrelated project.

This project is for testing thermostat testers. The attached V shows 6 SUbvis whioch are similar because this is going to be used to test 6 t'stats.

I'm using LV 8.5 and DAQ- PCI 6515

Now my question is... This VI implements soft start and stop buttons. But we wantr to get rid of the soft start and stop and instead use a hard start and stop button. So what I figured is that, we'll have to use DAQ to read signals from the start/stop button. Considering a digital 1 bit for start and 0 bit for stop. Can you tell me how the start and stop in my VI can be replaced by the DAQmx read and case structure.

I hope you understand what I am saying. I have attached the VI and subVI

Download All
0 Kudos
Message 10 of 16
(3,786 Views)