Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topicStart Poll

> How to program a formula, High decimal representation
Outline · [ Standard ] · Linear+
Kwagga
post Jul 8 2011, 05:36 AM
Post #1


New Member
*

Group: Members
Posts: 5
Joined: 18-May 09
Member No.: 6,862



Hi guys,

I'm building a little test unit that will interface with our refrigeration equipment and it will carry out certain tests.

I need to be able to program the following 2 formulas and simply display the answer on the LCD of the XD12.

The X value will actually be from a 0-10V input connected to a pressure transducer. The answer (Y-value) will be displayed.

Y=0.0000002X^3 - 0.000253X^2 + 0.167X - 44.46
The only X values that will go into this formula are between 29.5 and 492.5 as these I'll manipulate from the 0-10V input.

Y=0.0000042X^2 + 0.038X - 13.05
The only X values that will go into this formula are between 976.2 and 2766.6 as these will be manipulated values from the 0-10V input.

If it helps, these 2 formulas are close fit graphs to a pressure/temperature table for R404a refrigerant.

If it's impossible to program these formulas, how would I go about entering a pressure temperature chart from 7.6kPa to 2766.6kPA, and have the PLC read a corresponding temperature from the table, and be able to take a linear average for values between the table values.
Top
User is offlinePM
Quote Post
Jesus Miranda
post Jul 14 2011, 04:53 PM
Post #2


Forum Savant
*******

Group: Authorized Member
Posts: 125
Joined: 26-June 09
Member No.: 6,956



Hello.

There is no way that you can load this formula into the Millenium 3.

The Millenium 3 doesn't have any floating point arithmetic. All the numbers processed by the controller are 16-bit integers. The value for these numbers can range between -32768 and 32767.

You can somehow manage values with a decimal point by using a Display block (e.g. 1205 displayed with 2 decimal places is shown on the screen as 12.05).

The only thing that you can do in this case is to use a lookup table (use block Y=F(x)).

Could you please clarify what do you mean by "be able to take a linear average for values between the table values".

What exactly do you want to do?
Top
User is offlinePMEmail Poster
Quote Post
Kwagga
post Oct 6 2011, 05:58 AM
Post #3


New Member
*

Group: Members
Posts: 5
Joined: 18-May 09
Member No.: 6,862



I hope my attachment attached properly.

I actually got it right in my program.
M04 and M05 labelled LPPT and HPPT are the macros where I actually do this.

It takes a 0-10V input from a pressure transducer and converts is to an actual pressure reading in kPa.
Then I have 2 formulas like the one I presented that converts that pressure to a temperature for R404A refrigerant.
The formula presents the relationship between the 2.
So with pressure as my input to the macro, my output is temperaute according to formula.


Attached File(s)
Attached File  TestBox1.zip ( 41.66k ) Number of downloads: 337
Top
User is offlinePM
Quote Post
Kwagga
post Oct 6 2011, 06:12 AM
Post #4


New Member
*

Group: Members
Posts: 5
Joined: 18-May 09
Member No.: 6,862



QUOTE(Jesus Miranda @ Jul 15 2011, 12:53 AM)
Could you please clarify what do you mean by "be able to take a linear average for values between the table values".
*


What I mean here was only applicable to a look-up table...

If I create a lookup table like the following...
Input 1 = Output 15
Input 5 = Output 75
Input 10 = Output 200

Looking at a table like that we can see that the relationship between the input growth and output growth is not linear.
So what happens if I Input 3? That's not a value in the table. So how is it's output calculated?
3 is pretty much halfway between 1 and 5. Will the output be a number halfway between 15 and 75?

Top
User is offlinePM
Quote Post

1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

Reply to this topicTopic OptionsStart new topic

 


Lo-Fi Version
Time is now: 31st October 2014 - 10:45 PM