LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Charging of capacitor, timing and flat-sequence struture

Solved!
Go to solution

Hello:)

 

First I'll give you some information about my project:

 

I'm quite new to Labview, but I have programmed alot with C++/C/Assembly. The attached program is a small part of a bigger system, but I made a quick version of it, just to get the hang of it. A capacitor (image) will be charged up to 3,3V. I'll do two measurement at 2,5 V and 3,3 V, at about 3 tau and 5 tau of the charging. There are some timelimits and it's here I got some problems.

 

22138iD8C205E048205844

 

Sequence:

  • From start the signal have to be 0V for atleast 300 ms.
  • The the capacitor have to reach atleast 2,5V within 430 ms from start.
  • Then the capacitor have to reach 3,3 V within a maximum of 510 ms from start.

My attached program is built in a flat-sequence structure (maybe statemachine is better?). If I change the "Wait 300 ms" to "Wait 80" ms, the first time-check will pass. If I use 300 ms, the first time-check is about 600 ms and the last 950 ms (It should have been 430 ms  - 300 ms = 130 ms, and 510 ms).

 

I'm not asking you to make anything for me, but maybe give me a hint where to look. Would a statemachine do better than the flat-sequence? Am I on the right track regarding time-checking, or is the Tick Count useless in this case?

 

Is the code within the Ruby Goldberg category?

 

Extra info: I got LV 2009 and 2010, but only the basic versions. The DAQ in my program can be replaced with a signalgenerator of 2,5 V and 3,3 V just for testing.

 

I think the program does its job, but my timing is not on track.

 

Thanks for any help.

 

Regards,

Even

Regards,
Even
_________________________________
Certified LabVIEW Associate Developer

Automated Test Developer
Topro AS
Norway
0 Kudos
Message 1 of 15
(3,643 Views)
Solution
Accepted by topic author EvenDeejay

I'd do the timing completly on the DAQ, this is much better than WinOS. You can sync the AO and the AI to have a shared sample clock and a shared strat trigger. When you start the AO task, the AI task is running as well (you can also do it the other way round).

At the end you just need to analyze the data from the AI task. From the sampling rate you can calculated which are the data points in the array that correspond to your time limits and then index the array and check if the voltage is greater than your limit.

In addition you have the complete characteristic curve.

 

Felix

Message 2 of 15
(3,635 Views)

Thanks alot for fast answer:)

 

Just so I understood it right:

 

Start AO with a trigger. AI responds to the same trigger and starts collecting samples at, for example, 1 sample per ms for a total of 1000 ms. Saves the whole thing into an array, and then I check the samples between 300 and 430 ms, and between 431 and 510 ms. With the array I can also print a graph.

 

I think this would do the trick:) Much easier code also.

 

I'll give a kudos and put you answer as solution, but may I ask one more question?

 

I would like to test 10 capacitors within one program run. Do you think LV can do all then at the same time or should I do one at a time? I'm just a bit worried about that the 8th, 9th, 10th capacitor or so would get some ms delay from the first capacitors.

Regards,
Even
_________________________________
Certified LabVIEW Associate Developer

Automated Test Developer
Topro AS
Norway
0 Kudos
Message 3 of 15
(3,628 Views)

You actually don't need an external trigger, but the start task for the AO willprovide this trigger from the software side. But you need to have the AI waiting for a trigger (and set this to the AO:start trigger).

 

For 10 capacitors, you can actually use the multiplexing capability of the DAQ card. This is automatically active when you configure the task as AI0:9. The timing delay would be minimal, for a sampling rate of 1 kS/s (1ms) this very ms all 10 measurements will be performed. If you need even more resolution, standard boards can offer you 500 kS/s shared, so it would result in 50 kS/s. Then you can use the decimate array to only take every 50th sample.

 

It is a bit dependent on the type of your card.

 

From a practical side, it also depends on the quality of the capacitors/your process. If you have shortened capacitors, you wont be able to charge the whole batch if you measure in parallel.

 

Felix

Message 4 of 15
(3,616 Views)

I got a NI USB-6225 M-series with 250 ks/S. Today my brain is not in place. Maybe because it's mondaySmiley Indifferent Having some trouble understanding all the information and getting together a VI.

 

Anyways I've got some good tips, so I'll spend some time the next days getting the program right:)

Regards,
Even
_________________________________
Certified LabVIEW Associate Developer

Automated Test Developer
Topro AS
Norway
0 Kudos
Message 5 of 15
(3,609 Views)

I'll be on my office PC tomorrow about noon (europa), where I've got the bookmarks explaining the sync process/code. Will send you the links.

 

Felix

0 Kudos
Message 6 of 15
(3,584 Views)

@emyh wrote:

: Having some trouble understanding all the information and getting together a VI.

 


I'm not sure what part you are having trouble understanding, but I would guess it's this:  (If not, then ignore this post)Here is an example of how to set it up so that the AO Start triggers the AI Read.  It is very important to have the error wires going to the right places because this is what dictates the execution flow.  As you can see, the AI is setup to wait for the trigger, so even though you call the AI Read before the AO Start, the AI will not start reading until it sees the AO Start trigger.  This is because of the way the AI Trigger function is set up.

 

22188iAA3E95378A3D6C4A

 

The above is just an example.  I did not fill in most of the inputs, like physical channel, clock rate, etc...  You fill these in as needed.

- tbob

Inventor of the WORM Global
Message 7 of 15
(3,572 Views)

Hi again guys=)

 

Well yesterday I used the Daq Assist. I find it quite useful, but since I've used it alot now, I think it would be better to use something like tbob put together.The thing I had some problems with was:

 

I used the Daq Assist to get 1000 samples in 1000 ms. 1 sample per ms. Then I put that into an array using build array. After that I made a for-loop with 100 interrations, in other words I wanted 100 samples of the total of 1000, but on my graph I could not see anything.

 

22230i5D08446849E65879

 

As soon I has connected A, the counter C would not count from 100 til 200, but only switching between 100 and 101. If I removed the connection A, the counter worked fine. The conversion of dynamic data automatically popped up when I made the connection. I also thought the index array worked like this:

 

I can say which number in the array I want to read the data from.

 

The problem is that it returns a value only at index 0 or 1.

 

Then I finished at work. Today I'll study the context help abit more and try to find some other examples on how to extract data from an array.

 

For now I'll study your snippet, tbob, and learn howto set-up Daq without the Daq Assist. I also see that my attempt to extract data from an array also was wrong so I'll try again in an other way.

 

Thanks for the help guys:)

 

Regards,
Even
_________________________________
Certified LabVIEW Associate Developer

Automated Test Developer
Topro AS
Norway
0 Kudos
Message 8 of 15
(3,550 Views)

Well, guys. i have to throw in the towel now 😞

 

Just to get to know how to read certain elements in the array, I created this setup:

22242i1A7465717FBA5601

 

I have use A0, A1, A2 and GND on my DAQ to measure this. I can do compares and watch a boolean LED light up when I use the hardware switches. So far so good. Then I would like to collect 1000 samples at 1kHz into and array. That should be 1 sample every millisecond for a total of 1000 milliseconds. I put this into an array using Build Array. Somewhere within this second i press the switch. Lets say after 350 samples ( 350 ms). In C++ it's easy to check elements in an array or specific elements, but for me getting this done in Labview, it's like running marathon backwards.

 

If I can check every sample I can determine how long it took me to press the switch from i pressed start in Labview.

 

I found some arraytoturials on the net and checked out Decimate 1D array, but I don't have the knowledge to get something useful out of it.

 

Think I have to put this project away for a while.

 

Anyways thanks alot for the tips around acquire data with the AO and AI trigger. It worked perfectly=)

 

Regards,
Even
_________________________________
Certified LabVIEW Associate Developer

Automated Test Developer
Topro AS
Norway
0 Kudos
Message 9 of 15
(3,523 Views)

Here is the link promised:

 

http://zone.ni.com/devzone/cda/tut/p/id/3615

 

The DAQ Assistant doesn't offer the flexibility you need for the syncronization, so you will need to learn how to use the basic DAQmx functions.

 

On your example above: only use the ddt to [dbl] conversion to get the array. The dynamic data is not good to work with. Then you use the array subset function of the array palette.

 

Felix

Message 10 of 15
(3,521 Views)