Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

06-25-2020 09:37 PM

Options

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

Hi altenbach,

Where to change the order of polynomial in attached VI?

in My VI some of paramters are in languaae I cannot understand though?

What I want to do now keep on change order of polynimial on see the erro graph, and chose best fit for what minium polynomial order gives acceptable error.

altenbach

Knight of NI

06-26-2020 02:20 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

Who wrote this VI? I cannot read the labels either (unicode?) but the entire program is just a mess. Most of the FOR loops can be replaced by a single "index array"! Why such a convoluted formula node???

Sorry, I am on a laptop. No way to work with such an oversized VI. I am sure written properly it could fit on a postcard.

I have a look at it tomorrow.

altenbach

Knight of NI

06-26-2020 03:38 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

Do you have a link to a publication or website that explains the model? Whatever you have currently implemented is **not a polynomial**. Which terms are you trying to leave out to see if the fit is still sufficient?

06-26-2020 09:01 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

A) Here is datasheet and values of sensor. Page 6 mentions the formula. But somehow it doesnt fit. We have value of Vtp, Tsensor, need to calculate value of Tobject.

Temperature values are entered in kelvin instead of celsius

sensor: OTP-638D2_datasheet(R(0) and application(0-50)

B) Had a word with another manufactuere about the formula, from TE sensor, here is his reply in all the files are in here,image file has also reply.

(Tried attaching files here,but some error)

https://drive.google.com/drive/folders/1y3CeuI2JJiHkSXrAeQXknYa-iJVJ3zLk?usp=sharing

altenbach

Knight of NI

06-26-2020 11:12 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

@Vindhyachal.Takniki wrote:

A) Here is datasheet and values of sensor. Page 6 mentions the formula.

Your attachment only has one page. There is no page 6 Whatever is in the documentation has absolutely no resemblance to the formulas in the VI you attached earlier. Do you just want to parameterize the 2D V-T table on page 10-11 of the other document? Where did the data on your VI come from?

altenbach

Knight of NI

06-26-2020 02:08 PM - edited 06-26-2020 02:13 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

@Vindhyachal.Takniki wrote:

In my case error margin of less than +-0.5 is acceptable.

A first order 2D polynomial is within ±0.15, well within your specs (3 coeficients).

Z = -4.19E-1 -8.69E-2 * x +9.78E-2 * y.

A second order 2D polynomial is within ±0.012 (see image below. Green is difference between data and fit):

(6 terms: Z = +1.70E-1 -6.83E-2 * x +5.93E-2 * y -3.18E-4 * x^2 -6.54E-5 * xy +5.01E-4 * y^2)

A third order will be within ±0.005. I guess all you need is a first order 2D polynomial.

Attached is a quick draft. See if you understand it. I wasn't kidding when I said the code fits on a postcard. 🙂

Of course I wasn't sure what's x and y, so modify as needed. Also note that the data forms a regular integer grid, so it could be represented as a 2D array and reshaped for fitting. No need to drag along x and y if done correctly.

06-27-2020 03:24 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

Hi,

Thanks for reply.

I have attached the updated Vi with correct info. First column is "z", second col is "x" & third column is "y"

I tried 3 order equation, which shows acceptable min & max values.

But when i tried its equation in C code, it gives weird results. Though in labview error graphs shows no error. Below is my c code

I think the "Best Fit formula" has wrong coeff multiplication? Is it so?

void get_value(float32_t x , float32_t y)

{

float32_t x2 = x * x;

float32_t x3 = x2 * x;

float32_t y2 = y * y;

float32_t y3 = y2 * y;

float32_t xy = x * y;

float32_t x2y = xy * x;

float32_t xy2 = xy * y;

float32_t z;

z = (-0.856405103370700971000000f)

+(1.063190618820774920000000f * x)

+(14.209914285379092300000000f * y)

+(-0.001525431973314523430000f * x2)

+(-0.110425437452562752000000f * xy)

+(-0.561650715977711323000000f * y2)

+(0.000112007671458926302000f * x3)

+(0.000361024027398679400000f * x2y)

+(0.002619887991367739200000f * xy2)

+(-0.009204815618802958400000f * y3);

}

altenbach

Knight of NI

06-27-2020 10:36 AM - edited 06-27-2020 10:42 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

@Vindhyachal.Takniki wrote:

I have attached the updated Vi with correct info. First column is "z", second col is "x" & third column is "y"

You have not attached anything. It seems that the column designation I guessed is correct.

@Vindhyachal.Takniki wrote:

But when i tried its equation in C code, it gives weird results. Though in labview error graphs shows no error. Below is my c code

You are not showing much of any math. Who wrote the C code? What is a "LabVIEW error graph"?

@Vindhyachal.Takniki wrote:

I think the "Best Fit formula" has wrong coeff multiplication? Is it so?

What do you consider "right"?

06-27-2020 11:34 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

Sorry PFA the VI.

I have written C code.

Error in VI shows +-0.02 error.

Somehow when I put coordinates in C code they dont give correct results.

altenbach

Knight of NI

06-28-2020 01:10 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

This is the LabVIEW forum, so let's focus on the LabVIEW solution.

If c code does not give the correct result, you need to ask elsewhere to find what could be wrong with it.