adccommunitymod (AutomationDirect) asked a question.

Converting BAR to PSI

Created Date: September 15,2000

Created By: piscis

**** This post has been imported from our legacy forum. Information in this post may be outdated and links contained in the post may no longer work.****

Thank you all for your kind answer to my problem, I later realized that the Transmitter output its values in BARS instead of PSI hence the pressure diference I was experiencing. Now the problem becomes this; How do I convert BAR to PSI,the instructions I'm using are not given me the correct results; LD V3000 counts from analog module MUL K1000 DIV K4095 OUT (V3010) LDR ( 14.503 ) formula for converting BAR to PSI OUT (V3005) MULR OUT (V3010) There must be something wrong with this? right, I'm not getting the correct results. Also I noticed that when pressure is manually lowered (to imitate low PSI conditions) Optimate does not show a steady lowering of the pressure readings, instead it jumps all over, skipping numbers. Could you please tell me what I'm doing wrong. Thanks you all Andy


  • adccommunitymod (AutomationDirect)

    Created Date: September 15,2000

    Created by: piscis

    Thank you all for your kind answer to my problem, I later realized that the Transmitter output its values in BARS instead of PSI hence the pressure diference I was experiencing.

    Now the problem becomes this; How do I convert BAR to PSI,the instructions I'm using are not given me the correct results;

    LD V3000 counts from analog module

    MUL K1000

    DIV K4095

    OUT (V3010)

    LDR ( 14.503 ) formula for converting BAR to PSI

    OUT (V3005)

    MULR

    OUT (V3010)

    There must be something wrong with this? right, I'm not getting the correct results.

    Also I noticed that when pressure is manually lowered (to imitate low PSI conditions) Optimate does not show a steady lowering of the pressure readings, instead it jumps all over, skipping numbers.

    Could you please tell me what I'm doing wrong.

    Thanks you all

    Andy

    Expand Post
  • adccommunitymod (AutomationDirect)

    Created Date: September 15,2000

    Created by: Mark Troutner

    This may not work because you might be exceeding the BCD upper limit. You probably should be using real numbers instead of BCD.

  • adccommunitymod (AutomationDirect)

    Created Date: September 15,2000

    Created by: Tom Jenkins

    I think you have two problems. First, you are mixing real (floating point) instructions like LDR and MULR with BCD instructions like OUT - Should be OUTD. Second, in any math operation you have to follow the sequence of load a value, define an operation and second value, and then send the result out to a storage register. You have too many OUT's.

    For simplicity sake, I suggest staying with standard math functions and BCD results. (I'm not sure if the Optomate can handle real numbers.) By running a calculation manually at the extremes of the range you can make sure you don't overflow 4 digits with the final result - I believe intermediate results are handled as double words in the stack. You probably also want to use a single operation to maintain maximum accuracy.

    Try this:

    Transmitter range = 0 bars @ 4 mA, 100 bars @ 20 mA (verify this: 100 bar is a lot of pressure!)

    Full scale = 100 bar x 14.5 psi/bar = 1450 psi @ 20 mA

    Then write your code using standard math and a single operation:

    SP1

    -| |--+-----|LD

    | |V3000

    |

    +-----|MUL

    | |K1450

    |

    +-----|DIV

    | |K4095

    |

    +-----|OUT

    |V3010

    Always check this kind of calculation by hand to make sure it's right. If your signal is 12 mA (50%) V3000 = 2048

    2048 x 1450 / 4095 = 724.65

    The out command truncates so V3010 = 724

    At 50% your 0-100 bar transmitter is indeed reading 724 psi. (Well OK, 725 actually, but don't quibble for 0.1% - it isn't that good a transmitter!)

    Expand Post
  • adccommunitymod (AutomationDirect)

    Created Date: September 15,2000

    Created by: piscis

    Dear TOM:

    Thank you so much for the help you gave me and for making me see things a lot more simple in terms of programming.

    I used the MUL x 1450 and the application worked beautifully. Now I'm reading in PSI and the Optimate 620 is showing this value strong and steady, even when the pressure lowers considerably.

    Thank you once again.

    Andy

    Puerto Rico

    Expand Post
  • adccommunitymod (AutomationDirect)

    Created Date: September 15,2000

    Created by: franji1

    There are issues dealing with 4 digit BCD math and 8 digit BCD math. I believe the following should work. Also, can the result be stored in 4 BCD digits? If not, you 're going to have to store it in 2 successive V locations (V3010 and V3011) to utilize 8 BCD digits. I'm not sure of any implied decimal point, but you will need to tweak the logic (i.e. multiply by another factor of 10 or divide by another factor of 10) to get the desired affect.

    First, load the following 2 constants into 2 DOUBLE V locations (hence 4 V memory locations will be occupied) at the first scan. I'm going to use V2000 and V2002 in this example...

    _FirstScan

    SP0

    --]

    |

    +-

    |

    +- // 1000 * 14.503

    |

    +-

    Now, whenever you want to convert your anlog to PSI, just do the following

    LD V3000

    MULD V2002

    DIVD V2000

    OUTD V3010 // result is DOUBLE BCD - 32 BITS, 8 BCD DIGITS

    If you need to increase the precision and change the position of the implied decimal point (if any), change the DOUBLE values in V2002. For example, if you wanted to INCREASE the number if implied decimal digits by 2 digits, (a factor of 100), you would need to change the LDD K14503 in the first network to LD K1450300.

    If you wanted to DECREASE the precision by 1 decimal position, it's best to add 5 and do a SHFR 4 to simulate dividing by 10 and rounding. If this is the case, change the last network to the following:

    LD V3000

    MULD V2002

    DIVD V2000

    ADDD K5 // for rounding purposes - you want 126 at this point to be 13 in V3010

    SHFR 4 // shifting right 4 bits is the same as dividing by 10 BCD, just a lot quicker

    OUTD V3010 // result is DOUBLE BCD - 32 BITS, 8 BCD DIGITS

    I hope this works!

    Expand Post