### Author Topic: 4-20ma Calculation with 249ohms Res  (Read 17354 times)

#### edgar

• Guest ##### 4-20ma Calculation with 249ohms Res
« on: January 31, 2005, 07:11:46 PM »
Hey guys how is every body any way....

I use a 249 ohms res to convert 4 to 20ma to 998 to 4.98 well the reason is i don't have the 250 ohms but that's not the problem i can buy it. but being that the voltage goes up 4.98@20ma ensted of 5V and  0.996@4 ma .i'm trying to calculate the Values by Converting them to ma but the PLC don't understand or see Floating point correct. well i use the traditional Formula the other formula i use within the vb6 program.

1st: Use within the PLC
(ADC(1)*220)/4096+30 =  106??F

2nd: use within VB6
Ma = ADC(1)/4096 * 0.02  (ma = 0.006 Ma)
F = (ma-0.004)/0.016 * 220 + 30
F = 71.1?F where the value of the ADC(1) = 1432

with the same AD Value why do i get a different Temp reading..

Now how can i get the right value of the Temperature Transmitter
the actual room temperature is 69.8 why the different in value what other way to get the real value of the transmitter....
I use the 2nd Formula on the PC but the 1st in the PLC and i can't get it to read the right value.
the sensor range is 4ma = 30?F , 20ma = 250?F

wich is the best formula to use in this case where you have a 249ohms res not a 250 ohms res...
This is for a Multy Chiller system Control
Thanks for any input i will keep trying this stuff...

#### EDGAR

• Guest ##### Re:4-20ma Calculation with 249ohms Res
« Reply #1 on: January 31, 2005, 08:42:48 PM »
Hey never mind i got it
just in case i'm wrong
in order to get the ma value i have to use higher value for the calculation...
A = (ADC(2)*200)/4092 'where 200 reprecent .020 ma
DM = ((A - 40) * 220) /160 + 30 'where 40 reprecent .004 and 160 reprecent .016 ma so

Ma = (1432*200)/4092
Ma = 69.9 that is equivalent to .0699ma
Temp = (69-40)*220/160+30
Temp = 70

this convertion it seems to be working a lot better
I found the key of convertion with this PLC is don't let the value get below 0 like 0.90 or else. being that the PLC don't use floating point 0.9 will be 0 and your whole calculation will return 0 or the runtime error
so with the above convertion you get the voltage value and convert it yo milliamparage and then to temperature this is just in case some body run in to the same proble i did.. Thanks anyway....

#### support

• Global Moderator
• Hero Member
•     • • Posts: 3090 ##### Re:4-20ma Calculation with 249ohms Res
« Reply #2 on: February 01, 2005, 11:10:21 PM »
To reduce trancation error, you can multiply the expression by a factor of 10 or 100 before any division. That way the resulting answer can represent more accurate resolution. E.g. the number 1234 can mean quantity of 123.4, or 12.34 or 1.234, it is up to your program to keep track of its exact meaning.
Email: support@triplc.com
Tel: 1-877-TRI-PLCS

#### EDGAR

• Guest ##### Re:4-20ma Calculation with 249ohms Res
« Reply #3 on: February 02, 2005, 06:22:09 PM »
I did the last convertion converting amp *10 cause i'm using the
PID Function to maintaine temperature ,"Static" pressure,line pressure
but i get the AD Value and store it on the DM memory and for the PLC can do the job i have to internally convert it but at PC the PC get the raw value of the AD channel to be able to show the decimal place at the pc. but if i multiply by the factor of 100 would it get a runtime error "Overflow" or no cause it be like

This formula is by 10
Ma = (1432*200)/4092
Ma = 69.9 that is equivalent to .0699ma
Temp = (69-40)*220/160+30
Temp = 70

This formula is by 100 but been the in real number 20ma is .020 correct and 4ma is .0040 correct there for the only number that i can actually multiply by 100 is the 20ma to 2000 and 16 ma to 1600 the 4ma has to stay by 10 = 400 correct i use the battom formula i multiply by 10 and add 300 wich is the 30 and i can deisplay the decimal place.

Ma = (1432*2000)/4092
Ma = 699.9 that is equivalent to .00699ma
Temp = (699-400)*220/1600 * 10 +300
Temp = 712 wich is 71.2 in real numbers

Is there another way of doing this Thanks guy's

is that what you mean or how can get better presition on my calculation another thing i will use the 2 A.O of the PLC as PID what clock speed can i use when i use the PID Function for fast reaction... according the setpoint... and is it 4092 or 4096 on the above equestion.. thanks

#### support

• Global Moderator
• Hero Member
•     • • Posts: 3090 ##### Re:4-20ma Calculation with 249ohms Res
« Reply #4 on: February 03, 2005, 05:27:43 PM »
You can calibrate the PLC's analog reference by turning the potentiometer on board the PLC until you get the readings you want.

You can also compensate for the error introduced by inexact resistor in software.  You don't have to convert it to 4mA since 4mA is not your actual unit of measurement. It is just a reading used for indicating the actual stuff that you are measuring. Please look at our FAQ page for the following thread:

http://www.tri-plc.com/yabbse/index.php?board=2;action=display;threadid=349

This thread show you how to convert the readings from the 0 to 4096 to the actual measurement unit. In your case the reading will be from 816 to 4080 and you can map it to the range of temperature represented by 4 to 20mA.
Email: support@triplc.com
Tel: 1-877-TRI-PLCS

#### EDGAR ##### Re:4-20ma Calculation with 249ohms Res
« Reply #5 on: February 03, 2005, 08:16:33 PM »
Hey thanks for the reply

i check the FAQ and is good but i did it the way it shows in the FAQ tread and i did it the same way i was doing it and i'm comparing it with a Gage at the same location and there is no difference the only difference i came across was on one of the sensor that by the company specify that is 4-20ma. it will output 4 ma when there is no pressure on the sensor but this sensor when is no pressure it output 3.5ma ensted of the 4ma but is fixed. that's the beauty of this plc that you can make any changed of any calculation and any process at any time i tell you i love it... Thanks guy... THIS PLC IS USER SUPER FRIENDLY BIG TIME...

1 more question what is the minimum clock speed that wont hert the cpu for the pidcompute function for the A.O.
and do you guys know a company where the make costume LCD with Keypad i need to get a quote on that if you know where...
Thanks guys..
Low cost Modbus OPC DA Server, supporting Modbus RTU, ASCII, and TCP. Download your demo today! Go to www.kinemics.com/modbus.

#### support

• Global Moderator
• Hero Member
•     • • Posts: 3090 ##### Re:4-20ma Calculation with 249ohms Res
« Reply #6 on: February 08, 2005, 05:49:18 AM »
You probably should use the 0.1s, 0.2, 0.5s or 1.0s clock. There is no point executing the PID function more often than necessary. It depend on the dynamic response of process variable (i.e. how fast the process respond to a change of input) . The integrator accumulates the error every time the PIDcompute is called, so if you execute the PIDcompute using the shortest clock pulse period then you will have to be careful with the value of I term to prevent the integrator from saturation.
Email: support@triplc.com
Tel: 1-877-TRI-PLCS