Autor Thema: some ideas  (Gelesen 5898 mal)

0 Mitglieder und 1 Gast betrachten dieses Thema.

Kim

  • Gast
some ideas
« am: 03. Januar 2010, 13:27:27 »
Dear all

Sorry that i dont writt in german, but you can reply in german, no problem to reading it..

i have to function bloks that i think the liberay need.

Number 1
A multi calibrate function, so that if you have a non linary sensor input you can make it linary, but i need multibly clalibrating points.
Please see my littel picture, to better understanding

Test input
a input that is a bool value that that is messurring the sensor and calibrat it to the value that the calibratman specify.
a Real input to sensor
a Real input to what messuring soudt be.

Number 2
Is a function to convert the real number to more understanding numbers. change the amount of decimals

Real input
Int input  to detmanin how many decimals there soudt be.
Real out.

the idea how to make it is multiply the input withe the factor specify by the decimal input then round it and div the with the same faktor.

eks.

5,4324324 we want 3 decimal

5,4324324x1000 =5432,4324 round it then is = 5432/1000 = 5,432

[gelöscht durch Administrator]

Offline hugo

  • Global Moderator
  • *****
  • Beiträge: 2 150
    • Profil anzeigen
Re:some ideas
« Antwort #1 am: 04. Januar 2010, 12:15:25 »
This Boards operates in english and German no Problem!

number 1

a multi calibrate function already exists in the library its called LINEAR_INT and can handle up to 20 data points.
in case you want a more natural polynomical courve you can use POLYNOM_INT.

number 2
pls look at the functions RND and ROUND they should do what you look for
however, pls be careful, the computer representation of a real number does not match a decimal representation, so when you round a number in real it does not necessarily mean that you have a fixed amount of decimal representations.
further reading is provided by wickipedia under floting poit, or real numbers