LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Contenating .BIN files (similar to R16 format) to Graph

You probably don't want a plot legend with 64 entries and visibility checkboxes. What's the maximum number of traces you want to show to the user?

0 Kudos
Message 11 of 18
(1,102 Views)

@divgup1986 wrote:

@altenbach wrote:

We really need to have more information on the "algorithms"

There are total 4-5 types of algorithms / parameter types.


Later you say there are six types. Can you cove a complete list?

 

All inputs need to have the same representation and all outputs need to have the same representation.

 

The input datatype is obviously U16, so the output should probably be DBL.or SGL. SGL is sufficient! (all your 16bits will comfortably fit into the 22bit mantissa of SGL). If all scaling is a multiplication by integers, the output can be integer of course (e.g. I32).

 

All the scaling you showed can easily be done very efficiently using some bit shifting and scaling. Some are not well described, see below.

 

0 Kudos
Message 12 of 18
(1,100 Views)

@divgup1986 wrote:
For Eg: in 16 bit signed two 16bit values are taken from two adjacent offsets. In higher (16-8 bits) are right shifted and then the lower 16 bits are added,after adding the result is scaled .
altenbach_0-1659367915522.png

See, that is incomplete. If you take two adjacent 16 bit values, you actually have 32 bits, but you only show 16. What gives? Do you have a link to the actual manual?

 

0 Kudos
Message 13 of 18
(1,096 Views)

@altenbach wrote:

@divgup1986 wrote:
For Eg: in 16 bit signed two 16bit values are taken from two adjacent offsets. In higher (16-8 bits) are right shifted and then the lower 16 bits are added,after adding the result is scaled 

You are not wrong, actually this diagram is mis leading.As there are no manuals , I have interpreted , in above lines.

In higher 16 bits i.e offset 5 only  16-8 bits are important and in lower offset i.e 4 0-8 bits are important.

So to get a 16 bit signed from 32 bit unsigned, lower 8 bits from offset 4 are added to upper 8 bits obtained from offset 5( left shift by 8).

 


To explain by problem, I am giving example of an equivalent algorithm if written in c/c++.for my problem.

As there are 6 algorithms, for each algorithm , I create a function and pass variable depending on parameter scaling/ shifting requirement for eg:

long 16bitsigned(char shift, char scale, unsigned char offset) // alias ( FX1)

long 12bitsigned ( char L_shift, char scale,  unsigned char offset )  // alias (FX2)

long 12bitunsigned ( char L_shift, char scale, unsigned char offset ) // alias ( FX3)

 

Like above there can be functions for all algorithms.

Problem at hand.

 

As there are 64 parameters , so I have to mention which function out of  FX1 , FX2 or FX3  will be called and I can create an array of 2D array of 64 x 4 length to store the complete information.

#define FX1 1

#define FX2 2

#define FX3 3

int fx_ param[64][3]={ { FX1,8,30,0} , { FX2,5, 10,1}};

 

Using above fx_param would mean,  for Parameter 1 , FX1 algorithms will be used with 8 shift and 30 scaling factor and values are to be fetched from offset 0.

(FX1 will contain actual commands)

 

Like above we can map parameter to there respective algorithms and create an output array to store the result parameter wise.

 


How can a mapping routine like above can be made using Labview, the best idea , I could think off is by creating 6 different sub-vi for 6 algorithms and using a 64 x 4 size array somehow to call various sub-vi with values taken from 64 x4 array.

 

My question is how can we implement and algorithm like above in Labview.

Thanks

0 Kudos
Message 14 of 18
(1,080 Views)

You can have a case structure with exactly six cases, where each case contains the algorithm for a list of indexes.

For operations on 32 bits, you can keep the first 16 bits in a shift register (using a false for the conditional output tunnel), then process both in the second iteration.

 

How exactly are you "adding" bits?

 

Can you show the 32 bits and show they end up in the 16 bit output?

0 Kudos
Message 15 of 18
(1,073 Views)

Hi,
I am sorry for late reply, I am not able to make algorithm for scaling.


 

Can you show the 32 bits and show they end up in the 16 bit output?


Here is how I was doing it earlier,I put an algorithm node, and input array, then write a C function in algorithm node, to get the data out or do shift operations, math functions etc, it was working fine.I have also provided the VI in my earlier posts,

divgup1986_0-1659680347768.png

 

My problem is , how can I put 64 such algorithms, in same VI.

Thanks

 

0 Kudos
Message 16 of 18
(1,060 Views)

Hi,
I have found a way (alternative) , which is working , I have put the formula node inside a case structure.
I have attached the .VI file.

Now , there are two problems.
In array , declaration inside formula node, I have to fix the routine by somehow getting the length of the array.
I may be able to achieve this.

divgup1986_0-1659693467505.png


Part-2

Can any algorithm be made , to make the multiplots , by providing a check box alongside the offset column ?

For Eg: after running the Vi, we first select offset , which we want to see on graph, we type offset press enter, store our check box value in an array and somehow , use that array to bundle the grpahs ?


Thanks

0 Kudos
Message 17 of 18
(1,049 Views)

Ah, what a mess!!!

 

Why do you now reshape to 1024 sensor if you only have 64? Why do you disable and grey out indicators? Indicators cannot be modified at runtime.

 


@divgup1986 wrote:

In array , declaration inside formula node, I have to fix the routine by somehow getting the length of the array.


Since you are indexing out of a 2D array, all columns will have the same size, guaranteed.

 


@divgup1986 wrote:

Can any algorithm be made , to make the multiplots , by providing a check box alongside the offset column ?


I don't think you are using the word "algorithm" correctly. What is an "offset column"? A checkbox is just a boolean. You can find it in the palettes. What exactly is it supposed to do?

 

 

You simply do some piecewise linear interpolation. Here's how that could look like for two of the cases!

 

(Since the data originates from U16, the boundaries are well defined!)

 

altenbach_0-1659746418204.png

 

 

Why do your offsets go all the way up to 420 if you only have 64 sensors? Why do you generate these gigantic arrays inside the formula node? How many rows do you actually have? So. Many. Questions!

0 Kudos
Message 18 of 18
(1,023 Views)