DSPRelated.com
Forums

floating point to fixed point conversion-in implementation of navigation system algorithm

Started by divya_divee February 13, 2012
This is again regarding the navigation algorithm for inertial navigation
system.

I am already halfway through the conversion.

I observed that there is a large variation in the values of the numbers in
the algorithm.

The inputs vary from 0.0001 to 9.9  and the covariance vectors are of the
order of 10 power -10 to -15. There re some intermediate values in the algo
 where in the values go upto 10 power -23.

Now how do i represent them in the fixed point? especially the covariance
vectors?

will the 64x+ processor be able to handle such low numbers since it is a 32
bit processor.

i ll have to use a Qformat greater than Q31 in order to get correct
results.

Is this the right way of dealing with these small numbers? else how do i
represent them?




On 2/26/2012 9:24 AM, divya_divee wrote:
> This is again regarding the navigation algorithm for inertial navigation > system. > > I am already halfway through the conversion. > > I observed that there is a large variation in the values of the numbers in > the algorithm. > > The inputs vary from 0.0001 to 9.9 and the covariance vectors are of the > order of 10 power -10 to -15. There re some intermediate values in the algo > where in the values go upto 10 power -23. > > Now how do i represent them in the fixed point? especially the covariance > vectors? > > will the 64x+ processor be able to handle such low numbers since it is a 32 > bit processor. > > i ll have to use a Qformat greater than Q31 in order to get correct > results. > > Is this the right way of dealing with these small numbers? else how do i > represent them?
You will need to apply scaling factors, the equivalents of floating-point's exponent to some of your numbers and see that they are carried along as the numbers are manipulated. Since two number's scales must be the same to make addition possible, wou would do well to consider "block floating point" (look that up). Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������
On Sun, 26 Feb 2012 08:24:39 -0600, divya_divee wrote:

> This is again regarding the navigation algorithm for inertial navigation > system. > > I am already halfway through the conversion. > > I observed that there is a large variation in the values of the numbers > in the algorithm. > > The inputs vary from 0.0001 to 9.9 and the covariance vectors are of > the order of 10 power -10 to -15. There re some intermediate values in > the algo > where in the values go upto 10 power -23. > > Now how do i represent them in the fixed point? especially the > covariance vectors? > > will the 64x+ processor be able to handle such low numbers since it is a > 32 bit processor. > > i ll have to use a Qformat greater than Q31 in order to get correct > results. > > Is this the right way of dealing with these small numbers? else how do i > represent them?
9.9/0.0001 = 99000, which easily fits into 31 bits, so by scaling your input as Jerry recommends you should be able to easily fit your input and state data into 32 bit fixed point. Actually, if you choose an ECEF coordinate system and you need centimeter accuracy, you need more than 32 bits of precision in the position numbers -- ask yourself what the radius of the earth divided by 2^31 is. This insight should either guide the precision you use, or it should guide the coordinate system that you choose. There are two measures to take with your covariance vectors: first is to ask what the maximum value is. When scaling to fit into fixed-point numbers, the important numbers are the maximum absolute value you'll ever see, and the minimum increment that you need to keep track of (note that the number may ever get down to that minimum resolution). The number of bits you need is determined by the ratio of that max value and min resolution. But you can take it much farther than that, because the initial values of the covariance matrix are your choice: The first thing that you can do is just scale the covariance matrix carefully, then choose initial values of covariance that don't blow your numbers up past your chosen word size. You need to make sure that you get your initial convergence behaving right. The second thing to do is to look at re-structuring your algorithm so that it can handle an infinite covariance. Probably the easiest way to do this is to use an information matrix instead of a covariance matrix, because then infinite covariance just becomes zero information -- but I suspect that if you pound your head against the linear algebra long enough, you can figure out what to do if a covariance is infinite. The third thing to do (or perhaps you should move this up to second) is to use a matrix square-root algorithm, and carry the square root of the covariance. The square root of the covariance matrix should have a required precision that's much closer to the needs of your state variable. -- Tim Wescott Control system and signal processing consulting www.wescottdesign.com