Showing results for 
Search instead for 
Did you mean: 

Need hwlp with writing a VI program for current, voltage and energy DAQ

Go to solution

Need help writing a basic program. The program takes input from a voltage and current sensors from NI cDAQ hardware and records it and saves it into a excel sheet. I also want the program to calculate the energy and power consumption from the voltage and current data. I am completely new to LabView and dont even know if I am using the right packages. I am attaching my current program. Thank you in advance.

Download All
0 Kudos
Message 1 of 17

I'm guessing you are a (graduate?) student in engineering, and as this is your first post on the Forum, are largely inexperienced (and perhaps untaught) in LabVIEW.  I also assume that being able to acquire data and process it will be important in your career (at least in getting your degree).  So here are some suggestions:

  • Spend the time to learn LabVIEW.  Take a class, find a LabVIEW Guru or Mentor, and definitely spend time with the tutorial material (more is better) listed on the first page of this Forum.
  • Try to avoid using the Dreaded DAQ Assistant and its evil twin, the Dynamic Data Wire.  They are for "Quick Fixes", hide too many details from you, and discourage "thinking before acting (coding)", leading to incomprehensible Block Diagrams and frustration on your part.
  • LabVIEW is a Laboratory Virtual Instrument Engineering Workbench.  Use it as such.  Experiment.  Write tiny little programs to solve pieces of your problem, then put the pieces together.  For example, think about having a Control called "Voltage", a Control called "Current", and writing a VI that takes these two Inputs and creates Indicators Energy and Power.  How would you do this?
  • If you had a VI that takes V and I and outputs Eng and Pow, how could you use LabVIEW to get the V and I measurements you need?  Think about what you want to measure, how fast you want to measure it, and learn about DAQmx (do a Web Search for "Learn 10 Functions in NI-DAQmx" and read the article, remembering you do not want to use the DAQ Assistant).
  • Another piece of your puzzle is saving data to an Excel Worksheet.  There are a number of questions here, as well -- do you mean to write a "native Excel file (.xlsx)", or a text file with rows and columns of numbers?  In any case, creating the final File output is a separate task that you can think about once you have the rest of your project functioning well.
  • Ah, I used the word "Project" in the previous sentence.  If you are going to use LabVIEW, you need to use the LabVIEW Project (and if you don't know what this is, learn).

Bob Schor 

Message 2 of 17



Thank you for the advice and information you have provided. I am currently following many tutorials and learning to use LabVIEW. That being said, this program is for a mini project for a course I am currently taking and I am on a deadline. My current knowledge and expertise in the software is not sufficient for me to assess if I have a workable program for the end result I am looking for. Any help and advice regarding the same would be very much appreciated and any feedback regarding my current program (even though it uses the DAQ Assistant). 


I would also like your advice another issue I have been having:


 The experiment requires me to run the DAQ software to acquire the readings for a period of over 2 hours. When I try to right click on the graph and try to export it to excel (currently the only way i know of to get the data in tabular form) , the program either crashes or shuts down making me loose all the data in the process, or I get an error message saying there is not enough memory for the process to be completed, even though my RAM is free and available. Is this because of the system or am I doing something wrong?

0 Kudos
Message 3 of 17

When you use the DAQ asssitant there is a tab for logging, that will allow you to save a file in TDMS format. Configure it and you will have your file.


There is a plug-in for Excel that allows you to open TDMS files. Hint Search Google



Message 4 of 17

Will that prevent the crashing of the software that I am experiencing when i try to manually convert the graphs to excel directly?

0 Kudos
Message 5 of 17

Maybe, probably. You need to try it. Isn't that the point of your class?



0 Kudos
Message 6 of 17

@jama223 wrote:

Will that prevent the crashing of the software that I am experiencing when i try to manually convert the graphs to excel directly?

It will log the data in the background, eliminating the need for you to export from the graph.

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 7 of 17

I am getting broken wires for power and energy measurements when trying to write them into a tdms file. I am attaching the image of the program with the error. Please let me know where I am going wrong. Thank you.

0 Kudos
Message 8 of 17

You can configure logging DIRECTLY from the DAQ assistant, use that.







0 Kudos
Message 9 of 17

The error is not at the DAQ assistant terminal but at the power and energy VIs. Those are individual VIs themselves and that is where the broken wire is at.

0 Kudos
Message 10 of 17