LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

"relative" real time

My mistake, consider this post as non existing Smiley Tongue
0 Kudos
Message 21 of 32
(810 Views)

Hi Tim,

 

Thanks again for taking a crack at this.

 

The previous code you posted wasn't giving me the correct values. I looked at the new code and didn't see exactly what i was looking for I don't think.

 

The RPM from my program I get correctly.

 

maybe i'm not being clear but i'll try again:

 

If I am sampling at 10000 HZ and taking 3000 samples then in 0.3 seconds of data I could have 2 and sometimes 3, 5-volt spikes.  I am able to pull the RPM out of this already from my program.

 

I would like to calculate future position, i.e. the next 2 spikes based on the last two spikes RPM and position.  I would like I think some sort of counter that either counts how many milliseconds it takes to get from one peak to the next.  If I have that then I believe I can predict the future position of the shaft pretty accurately.

 

Let me know if I'm still unclear or not getting something...

 

(As of now purchasing new hardware is not an option)

0 Kudos
Message 22 of 32
(792 Views)

correction - i would like that counter to work in "real time. (really past time but count)"  i.e. not just tell me the differecne (period) but tell me how the input signal varies with time.  This i believe will give me a pretty accurate indication of future angle in at ANY given time.

0 Kudos
Message 23 of 32
(790 Views)

@kramerfrog wrote:

If I am sampling at 10000 HZ and taking 3000 samples then in 0.3 seconds of data I could have 2 and sometimes 3, 5-volt spikes.  I am able to pull the RPM out of this already from my program.

 

I would like to calculate future position, i.e. the next 2 spikes based on the last two spikes RPM and position.  I would like I think some sort of counter that either counts how many milliseconds it takes to get from one peak to the next.  If I have that then I believe I can predict the future position of the shaft pretty accurately.


Just count the amount of samples and multiply by 100µs (1/10kHz).

But that is complete nonsens!!

Why try to calculate the future position??

To do something at two different angular positions like you suggested in the other post??

 

You said it yourself, in one acquisition you get 2 or 3 spikes, read 2 or 3 rotations of the shaft, and now you ask for a way to do something in between two spikes, read during 1 rotation?

Those positions you look for are long gone by the end of the acquisition!!

 

 

You need a triggerd acquisition system so that your software can act the moment one pulse comes in.

Even then it will be hard to calculate/estimate the position of the shaft since both systems, hardware = the shaft vs. software = your code, has complete different, non synchronized timings.

 

In this or the other thread (can't remember) you talked about a windtunnel (hugh, expensive stuff bla bla bla), is there really no way two add one more switch so that your software can be triggered by those switches.

 

You also never answered my question about digital acquisition instead of analog Smiley Sad

0 Kudos
Message 24 of 32
(783 Views)

i tried counting number of samples and then multiplying by 1/10khz but it wouldn't count.

 

From what i'm understanding my setup sucks and i need to improve it. 

 

i'm new to labview and data acquisition (as you can tell) so i don't really understand what i benefit by taking an analog signal and converting it through software to a digital signal.

 

I was looking at the analog example you showed me.  Where do I go from there once I setup the data acquisition?  I guess I need help writing this program from scratch then because I don't understand.

 

0 Kudos
Message 25 of 32
(775 Views)

@kramerfrog wrote:

i tried counting number of samples and then multiplying by 1/10khz but it wouldn't count.


Consider the array of 3000 samples.

First rising edge is at location 683.

Second rising edge is at location 2475

So time between the two edges is (2475 - 683) * 100µs = 0.1792 sec = 5.5807 rpm

That wasn't so hard, right?

 


@kramerfrog wrote:

i'm new to labview and data acquisition (as you can tell) so i don't really understand what i benefit by taking an analog signal and converting it through software to a digital signal.


You don't have to convert anything!

The signal from the switch is or 0V or 5V right?

Then that can be seen by a digital I/O pin as "0" and "1" respectively.

So you can use that signal as a digital input signal.

If by "swith" you really mean a switch, then you should use a pull up or pull down resistor to ensure both levels.

I mean, you can't leave the digital I/O pin "free". It has to be or 0V or 5V never floating.

Check with the MAX if the hardware detect the levels correctly.

Once you got that right start with the triggered digital acquisition.

Just take 1 sample with a sample rate of e.g. 10kHz

The hardware will check the rising edge of the switch for you at high speed.

The software will do nothing while waiting for a trigger from the hardware.

 

Don't forget that at 1000rpm you have only 60msec in between 2 pulses.

So if your code takes more than 60msec to execute things will go wrong Smiley Surprised

0 Kudos
Message 26 of 32
(757 Views)

Yes, I can calculate the time between rising edges too.  As I said earlier I want to know between rising edges what is happening and you said i can't do do that if my code is taking too long. 

I'll try and look at the digital setup you are suggesting

 

 

0 Kudos
Message 27 of 32
(755 Views)

Somehow I have the impression you want a high speed version of this:

http://www.ladyada.net/make/spokepov/index.html

 

 

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


0 Kudos
Message 28 of 32
(749 Views)

Uum, i'm not sure what you sent me.  I don't really know how to be any clearer of my goals then what I have stated already.

 

The end all result needs to be the following:

 

At a certain shaft degree say 20 degrees, a trigger needs to go off which will start a VI, and at say 30 degrees a trigger will go off to end a VI.  This is why I wanted to find the position of the shaft.

0 Kudos
Message 29 of 32
(745 Views)

@kramerfrog wrote:

At a certain shaft degree say 20 degrees, a trigger needs to go off which will start a VI, and at say 30 degrees a trigger will go off to end a VI.  This is why I wanted to find the position of the shaft.


Those 20° and 30° are, I suppose, after the trigger from the switch, right?

 

Suppose speed is 1000rpm, then 360° = 60msec, 1° = 0.16666msec

Trigger switch is time 0, 20° is at t= 3.3333msec and 30° is at t= 5 msec

You want to run a VI for only 1.666 msec Smiley Mad

What is that VI doing for 1.666msec?

 

 

This is definetly not a task for a PC!

This is a task for a stand alone µC like this one for example. 

0 Kudos
Message 30 of 32
(742 Views)