LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to set linearizer function for frequency input to rate output

Solved!
Go to solution

I have a input range of 0-2000 Hz from a digital flow meter. I need to convert the signal to gallons per minute (GPM) using a non-linear process with 10 scaling points. Here are the 10 scaling points.

 

                 Input                             Display

 

INP 0    = .64 Hz          DSP0 = 0.001 GPM

INP 1    = .83 Hz          DSP1 = 0.002 GPM

INP 2    = 0.03 Hz        DSP2 = 0.007 GPM

INP 3    = 0.83 Hz        DSP3 = 0.025 GPM

INP 4    = 0.12 Hz        DSP4 = 0.038 GPM

INP 5    = 01.16 Hz      DSP5 = 0.126 GPM

INP 6    = 07.77 Hz      DSP6 = 0.380 GPM

INP 7    = 02.43 Hz      DSP7 = 0.503 GPM

INP 8    = 016.33 Hz    DSP8 = 0.637 GPM

INP 9    = 695.22 Hz    DSP9 = 1.056 GPM

 

I need Labview to provide a linear display throughout each segment (i.e. between sequential scaling points) so that any input into the system in Hz will result in a GPM rate. Any ideas?

 

Thank you,

 

Toddzilla

0 Kudos
Message 1 of 14
(2,907 Views)

Hi

You can use select case sirectly; you can wire values, range or constants. It is simple, or I don't understand your question...

N

0 Kudos
Message 2 of 14
(2,899 Views)

Nitad,

 

Values and ranges as case selectors only work for integers.  How would you have 0.64 of a case?

 

Toddzilla,

 

I think I would create an array of the Input values and then use the Threshold 1D Array function to get the index of the array element which meets the selection criterion. The fractional part of the index can be used to interpolate within segments.

 

Also, it looks like you may have some typing errors.  The Inputs are not monotonic.

 

Lynn

Message 3 of 14
(2,888 Views)

Thank you for the responses, you are correct about the typographical errors. All of the inputs should have a "1" in front of them.

 

I got it to work using the scaling and mapping function. But it's not quite right yet. It works well below 600 Hz, above that it does some weird stuff. I am using "simulate signal" and "timing and transition measurements" to create and feed the signal into the "scaling and mapping" function. The frequency coming out of the "timing and transition measurements" function bounces. I think I just need a way to feed it a clean simulated frequency.

 

What do you think?

 

Thank you.

0 Kudos
Message 4 of 14
(2,878 Views)

 


@johnsold wrote:

Nitad,

 

Values and ranges as case selectors only work for integers.  How would you have 0.64 of a case?

--

like multiply everything by 1000 (or so), convert to integer and that's it

N

 

0 Kudos
Message 5 of 14
(2,876 Views)

The Frequency must be input to at least 20 for the VI to work...

0 Kudos
Message 6 of 14
(2,873 Views)

 


@toddzilla wrote:

The Frequency must be input to at least 20 for the VI to work...


 

hi, I don't get it..

Let's say you have either 1.02, 1.31, 2.51 to convert to a, b, c

take the value : multiply by 1000, Cint, wire this to select case, in select case you can have three sets

0 to 1021, 1022..1032, 1032..2511 (you can add one for other out of range values if you want)

in each case you put the corresponding value a, b or c.

I don t have LV here so I can not make a vi but, as I said, it is easy (or I did not understand the question).

N

0 Kudos
Message 7 of 14
(2,864 Views)
Solution
Accepted by topic author toddzilla

This VI works perfectly now. I had to increase the samples per second to 80k to get it to smooth out. The "Scaling and Mapping" function was the key to this.

 

Make sure to enter at least 20 in the frequency input block on the front panel before you try running it, increase the freq input as high as 1700 to see the GPM indicator work...

 

Thank you all for taking the time to help me.

 

Regards,

 

Toddzilla

0 Kudos
Message 8 of 14
(2,851 Views)

toddzilla,

 

As previously mentioned, Interpolate 1D Array is a good way to do this.  I've attached a vi snippet.  When using the Express vi's to measure frequency, you need to make sure that the waveform you input contains an integer number of cycles.  In other words the length of the waveform in time should be a multiple of the period.  1KHz should be in multiples of 1ms, 10Hz should be in multiples of 100ms etc.  There is a setting for this in the Simulate Signal Express vi.  And as you found out make sure that your sample rate is high enough as well.

 

0 Kudos
Message 9 of 14
(2,848 Views)

Wayne, Thank you for your reply, I wanted to learn it the way you showed me. I revised the setting in the simulate signal VI to make the signal into an integer. I also added a convert from dynamic data function to supply the Threshold 1D array. So I know that I am feeding the Threshold 1D array the correct frequency in a interger format. But I stll cant get it to work. In my attached snippet, you can see that 1.00 is coming out of the Threshold 1D array everytime and 0.001 comes out of the Interpolate 1D array. The only difference I can see is the index array row and colum symbols are reveresed top to bottom.

 

Thank you,

 

Todd

 

 

0 Kudos
Message 10 of 14
(2,787 Views)