Shop OBEX P1 Docs P2 Docs Learn Events
Need help solving for a formula — Parallax Forums

Need help solving for a formula

ArchiverArchiver Posts: 46,084
edited 2002-11-05 13:58 in General Discussion
I am trying to solve for a variable within this formula.

The formula solves for the amount of dissolved CO2 within pressurized liquids
(pop & beer).
I have the temperature and pressure, and I need to solve for V (Volumes of CO2)



P = -16.6999 - 0.0101059 T + 0.00116512 T^2 + 0.173354 T V + 4.24267 V -
0.0684226 V^2


T = temp in degrees F (typically from 32 to 50F)
P = PSI of CO2 (Typically from 0 to 30 PSI)
V = volumes of CO2 (Typically from 0 to 4 units)

Can this be done on a BS2? Would a lookup table be better? I don't need
extreme accuracy or resolution either (0.1 volume unit resolution). Is there an
easier way?

Thanks
Allan

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2002-11-04 22:02
    Hi Alan,

    It looks like you might be able to disregard the term in V^2, which
    looks like it will be much less than the V and the T*V terms.

    That would help some, because you can then solve for V, and V would
    be directly proportional to P. It is still a tough problem for the
    Stamp due to the temperature dependence. A lookup table could do it,
    but you would probably end up with a need for double interpolation.
    I would be inclined to try for a formula, but it would probably be a
    few hours of work to get it scaled right.

    -- Tracy Allen


    >I am trying to solve for a variable within this formula.
    >
    >The formula solves for the amount of dissolved CO2 within
    >pressurized liquids (pop & beer).
    >I have the temperature and pressure, and I need to solve for V
    >(Volumes of CO2)
    >
    >
    >
    >P = -16.6999 - 0.0101059 T + 0.00116512 T^2 + 0.173354 T V + 4.24267
    >V - 0.0684226 V^2
    >
    >
    >T = temp in degrees F (typically from 32 to 50F)
    >P = PSI of CO2 (Typically from 0 to 30 PSI)
    >V = volumes of CO2 (Typically from 0 to 4 units)
    >
    >Can this be done on a BS2? Would a lookup table be better? I don't
    >need extreme accuracy or resolution either (0.1 volume unit
    >resolution). Is there an easier way?
    >
    >Thanks
    >Allan
  • ArchiverArchiver Posts: 46,084
    edited 2002-11-04 22:49
    alan,
    stamp math is definetly not my strong suit, but this
    is how id approach it (unless i grossly overlooked
    something???). i "think" you can boil your problem
    down to several managable chunks. reference
    http://www.emesystems.com/BS2math3.htm for math
    related stuff (a higher precesion squareroot):

    basically it is just a quadratic equation, so we
    actually only need to solve the coefficients and then
    the quad formula. after doing some algabrae, i get:
    -.068V^2+V(.1734T+4.24)+(P+16.7+.01T-.0011T^2) = 0
    A B C
    Quad Eqn. = (B +- ((B^2-4AC)^0.5)/2A

    coefficients in terms of all knowns then approximatley
    equal:
    A=-.068
    B=.1734 (T) + 4.24
    C = P+16.7+.01T-.0011T^2

    with A=-.068, that simplifies expression:
    Quad Eqn. = (B +- ((B^2+.272*C)^0.5)/-.136
    so now, given P and T, solve B & C and put into proper
    stamp math, something "like":

    Volume = B + SQR((B*B) + ((34/125)*C)) / (-17/125)
    use 34/125 = .272 and 17/125=.136 for integer math

    of course you only need 1 solution since the other
    will be negative. accuracy??? the link above for the
    SQR should improve it. seems workable to me, unless i
    missed something?
    ross



    --- Tracy Allen <tracy@e...> wrote:
    > Hi Alan,
    >
    > It looks like you might be able to disregard the
    > term in V^2, which
    > looks like it will be much less than the V and the
    > T*V terms.
    >
    > That would help some, because you can then solve for
    > V, and V would
    > be directly proportional to P. It is still a tough
    > problem for the
    > Stamp due to the temperature dependence. A lookup
    > table could do it,
    > but you would probably end up with a need for double
    > interpolation.
    > I would be inclined to try for a formula, but it
    > would probably be a
    > few hours of work to get it scaled right.
    >
    > -- Tracy Allen
    >
    >
    > >I am trying to solve for a variable within this
    > formula.
    > >
    > >The formula solves for the amount of dissolved CO2
    > within
    > >pressurized liquids (pop & beer).
    > >I have the temperature and pressure, and I need to
    > solve for V
    > >(Volumes of CO2)
    > >
    > >
    > >
    > >P = -16.6999 - 0.0101059 T + 0.00116512 T^2 +
    > 0.173354 T V + 4.24267
    > >V - 0.0684226 V^2
    > >
    > >
    > >T = temp in degrees F (typically from 32 to 50F)
    > >P = PSI of CO2 (Typically from 0 to 30 PSI)
    > >V = volumes of CO2 (Typically from 0 to 4 units)
    > >
    > >Can this be done on a BS2? Would a lookup table be
    > better? I don't
    > >need extreme accuracy or resolution either (0.1
    > volume unit
    > >resolution). Is there an easier way?
    > >
    > >Thanks
    > >Allan
    >
    > To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    > from the same email address that you subscribed.
    > Text in the Subject and Body of the message will be
    > ignored.
    >
    >
    > Your use of Yahoo! Groups is subject to
    > http://docs.yahoo.com/info/terms/
    >
    >


    __________________________________________________
    Do you Yahoo!?
    Y! Web Hosting - Let the expert host your web site
    http://webhosting.yahoo.com/
  • ArchiverArchiver Posts: 46,084
    edited 2002-11-05 02:19
    Thanks Ross and Tracy. I'll need a few days to work my way through all the good
    information you guys have posted. I'll probably be back with more questions
    though, as it has been a few years since I was in college. [noparse]:([/noparse]

    Allan Dobler

    Klutch wrote:
    >
    > alan,
    > stamp math is definetly not my strong suit, but this
    > is how id approach it (unless i grossly overlooked
    > something???). i "think" you can boil your problem
    > down to several managable chunks. reference
    > http://www.emesystems.com/BS2math3.htm for math
    > related stuff (a higher precesion squareroot):
  • ArchiverArchiver Posts: 46,084
    edited 2002-11-05 13:58
    I'm in this thread a little late, but I wanted to point out that while
    you can probably work out an integer way to do this, another alternative
    would be to add a PAK-I, II, or IX to your project. See
    http://www.al-williams.com/pak1.htm

    I'm behind this month as you can tell since the Stamp project of the
    month is late. Pretty sure it will be done today and it should be worth
    the wait.

    Al Williams
    AWC
    * Easy RS-232 Prototyping
    http://www.al-williams.com/awce/rs1.htm

    > >
    > >
    > > >I am trying to solve for a variable within this
    > > formula.
    > > >
    > > >The formula solves for the amount of dissolved CO2
    > > within
    > > >pressurized liquids (pop & beer).
    > > >I have the temperature and pressure, and I need to
    > > solve for V
    > > >(Volumes of CO2)
    > > >
    > > >
    > > >
    > > >P = -16.6999 - 0.0101059 T + 0.00116512 T^2 +
    > > 0.173354 T V + 4.24267
    > > >V - 0.0684226 V^2
    > > >
    > > >
    > > >T = temp in degrees F (typically from 32 to 50F)
    > > >P = PSI of CO2 (Typically from 0 to 30 PSI)
    > > >V = volumes of CO2 (Typically from 0 to 4 units)
    > > >
    > > >Can this be done on a BS2? Would a lookup table be
    > > better? I don't
    > > >need extreme accuracy or resolution either (0.1
    > > volume unit
    > > >resolution). Is there an easier way?
    > > >
    > > >Thanks
    > > >Allan
    > >
    > > To UNSUBSCRIBE, just send mail to:
    > > basicstamps-unsubscribe@yahoogroups.com
    > > from the same email address that you subscribed.
    > > Text in the Subject and Body of the message will be ignored.
    > >
    > >
    > > Your use of Yahoo! Groups is subject to
    > > http://docs.yahoo.com/info/terms/
    > >
    > >
    >
    >
    > __________________________________________________
    > Do you Yahoo!?
    > Y! Web Hosting - Let the expert host your web site
    http://webhosting.yahoo.com/

    To UNSUBSCRIBE, just send mail to:
    basicstamps-unsubscribe@yahoogroups.com
    from the same email address that you subscribed. Text in the Subject
    and Body of the message will be ignored.


    Your use of Yahoo! Groups is subject to
    http://docs.yahoo.com/info/terms/
Sign In or Register to comment.