BeerXML Community
September 09, 2010, 07:53:18 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Nov 2008 - Cleaned out the spam - BeerXML 2.0 is still in draft, but being worked on.
 
   Home   Help Search Calendar Login Register  
Pages: [1]
  Print  
Author Topic: Units in BeerXML 2.0  (Read 3292 times)
GregR
Newbie
*
Posts: 26


View Profile WWW
« on: March 25, 2008, 01:49:03 PM »

I haven't been following the progress of BeerXML 2.0 for a while, but just regained an interest as I'm currently working on related things...so forgive me if this seems like a belated comment...

Looking through the BeerXML v2.01 document, I notice that units seem to be dealt with a bit inconsistently....  For example, looking at how styles are stored:

     
Code:
      <final_gravity>
        <minimum density="sg">1.013</minimum>
        <maximum density="sg">1.017</maximum>
      </final_gravity>
      <international_bitterness_units>
        <minimum>35.0</minimum>
        <maximum>45.0</maximum>
      </international_bitterness_units>
      <color>
        <minimum scale="SRM">3.0</minimum>
        <maximum scale="SRM">5.0</maximum>
      </color>

It seems that it would make more sense to just designate a "units" attribute for each tag, instead of using "density" and "scale".  And then for bitterness, the units value is implicit in the element and not an attribute.  Wouldn't it be more consistent to use:

 
Code:
      <final_gravity>
        <minimum unit="sg">1.013</minimum>
        <maximum unit="sg">1.017</maximum>
      </final_gravity>
      <bitterness>
        <minimum unit="ibu">35.0</minimum>
        <maximum unit="ibu">45.0</maximum>
      </bitterness>
      <color>
        <minimum unit="srm">3.0</minimum>
        <maximum unit="srm">5.0</maximum>
      </color>

This way, units are dealt with in a very consistent way, bitterness can now be stored as ibu, or ebu, etc (yes, I know ibu == ebu, but flexibility is always good) and srm is not needlessly capitalized.

Is there an advantage to not using the same attribute name (i.e. "unit") across several elements?  I'm not an XML whiz, so...

« Last Edit: March 25, 2008, 09:09:06 PM by GregR » Logged

AntonW
Global Moderator
Full Member
*****
Posts: 105



View Profile
« Reply #1 on: March 25, 2008, 11:27:33 PM »

Hi Greg,

That's a great catch for the styles IBU unit type!  Currently within a recipe the bitterness is specified as something like:

<ibu_estimate method="Tinseth">blah</ibu_estimate>

As bitterness is generally estimated for recipes instead of measured by laboratory method in the finished beer quantitatively.  We could definitely mark up the bitterness data to be something like:

<bitterness>
   <minimum unit="ibu">35.0</minimum>
   <maximum unit="ibu">35.0</maximum>
</bitterness>

where unit can be either 'ibu' or 'ebu'.  The reason why some general term was not used across several elements stems from minimizing the available choices for the attribute of a given element.  In the example of fg you've provided:

<final_gravity>
   <minimum density="sg">1.013</minimum>
   <maximum density="sg">1.017</maximum>
</final_gravity>

Every valid BeerXML 2.0x file exchanged can only have 'sg' or 'plato' density units associated with them.  If we created a single term containing all units, then you could potentially set fg <minimum unit="SRM">3.14159</minimum> and have to check for those errors in a later step programmatically (instead of catching it earlier at validation with XSDs).

Also, SRM can be easily changed to lowercase if that is the convention.


-Anton


Logged
D.Neelm
Newbie
*
Posts: 1

http://tierussianwoman.w-ru.com/ - dating men


View Profile WWW
« Reply #2 on: October 07, 2009, 10:51:08 PM »

I dont know if this has been discussed already, but can we agree that we should use the International System of Units SI for everything that matters?
Logged

AntonW
Global Moderator
Full Member
*****
Posts: 105



View Profile
« Reply #3 on: October 09, 2009, 08:46:14 AM »

Hi D.Neelm,

I believe the documentation states that the International System of Units is the preferred set of units for BeerXML, but this should be more of a configurable setting in your specific brewing program.  The best approach is to record the value to BeerXML in the units of the device performing the measurement (as this will allow for the greatest amount of accuracy in further computations).

Within the brewing program, the user should be able to change configuration settings so the units are displayed in ISU-based units (even if they were recorded in US units) or vice versa.  And within the program, any type of units that you like may be used to perform the internal calculations required.  The only requirement is to convert those internal units to units supported by BeerXML when saving BeerXML output files (if they are not already supported).

Does that sound reasonable?

-Anton

Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!