diff -r e37b9c571a56 -r 99c47a8a61cb mash/beerxml.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mash/beerxml.h Sat Jul 12 21:59:19 2014 +0200 @@ -0,0 +1,262 @@ +#ifndef _BEERXML_H +#define _BEERXML_H + + +/* + * See http://www.beerxml.com/beerxml.htm for more information. + * This standard isn't perfect, but it works. Note that some + * fields are not well defined. Some precentages are safe if you + * declare them as float instead of intergers. + * + * The function parseBeerXML() reads the file and puts the + * contents in the following tree: + * + * recipes recipe hops hop + * hop + * fermentables fermentable + * fermentable + * yeasts yeast + * yeast + * miscs misc + * misc + * waters water + * water + * style + * mash mash_step + * mash_step + * equipment + * recipe hops hop + * and so on. + */ + +typedef struct _hop_rec { + struct _hop_rec *next; + char *name; /* Name of the hops */ + int version; /* Should be 1 for this version of the standard */ + float alpha; /* Percent alpha of hops */ + float amount; /* Weight in Kilograms of the hops used. */ + char *use; /* "Boil", "Dry Hop", "Mash", "First Wort" or "Aroma" */ + float time; /* The time as measured in minutes. */ + char *notes; /* Textual notes about the hops. */ + char *type; /* "Bittering", "Aroma" or "Both" */ + char *form; /* "Pellet", "Plug" or "Leaf" */ + float beta; /* Hop beta percentage. */ + float hsi; /* Hop Stability Index */ + char *origin; /* Place of origin for the hops */ + char *substitutes; /* Substitutes that can be used for this hops */ + float humulene; /* Humulene level in percent. */ + float caryophyllene; /* Caryophyllene level in percent. */ + float cohumulone; /* Cohumulone level in percent */ + float myrcene; /* Myrcene level in percent */ +} hop_rec; + +typedef struct _fermentable_rec { + struct _fermentable_rec *next; + char *name; /* Name */ + int version; /* Record version */ + char *type; /* "Grain", "Sugar", "Extract", "Dry Extract" or "Adjunct" */ + char *notes; /* Notes */ + float amount; /* Weight in KG */ + float yield; /* Percent dry yield (fine grain) */ + float color; /* The color of the item in Lovibond */ + bool add_after_boil; /* May be TRUE. */ + char *origin; /* Country or place of origin */ + char *supplier; /* Supplier of the grain/extract/sugar */ + float coarse_fine_diff; /* Percent difference between the coarse grain yield and fine grain yield. */ + float moisture; /* Percent moisture in the grain. */ + float diastatic_power; /* The diastatic power of the grain */ + float protein; /* The percent protein in the grain. */ + float max_in_batch; /* The recommended maximum percentage */ + bool recommend_mash; /* TRUE if it is recommended to mash */ +} fermentable_rec; + +typedef struct _equipment_rec { + char *name; /* Name of the equipment profile */ + int version; /* Version of the equipment record. */ + float boil_size; /* The pre-boil volume used. */ + float batch_size; /* The target volume of the batch. */ + float tun_volume; /* Volume of the mash tun in liters. */ + float tun_weight; /* Weight of the mash tun in kilograms. */ + float tun_specific_heat; /* The specific heat of the mash tun. */ + float top_up_water; /* The amount of top up water normally added. */ + float trub_chiller_loss; /* The amount of wort normally lost. */ + float evap_rate; /* Perc of wort lost to evaporation per hour. */ + float boil_time; /* The normal amount of time one boils */ + bool calc_boil_volume; /* Flag denoting to calculate the boil size. */ + float lauter_deadspace; /* Amount lost to the lauter tun. */ + float top_up_kettle; /* Amount normally added to the boil */ + float hop_utilization; /* Large batch hop utilization. */ + char *notes; /* Notes associated with the equipment. */ +} equipment_rec; + +typedef struct _yeast_rec { + struct _yeast_rec *next; + char *name; /* Name of the yeast. */ + int version; /* Version of the standard. */ + char *type; /* “Ale”, “Lager”, “Wheat”, “Wine”, “Champagne” */ + char *form; /* “Liquid”, “Dry”, “Slant” or “Culture” */ + float amount; /* The amount of yeast, measured in liters. */ + bool amount_is_weight; /* TRUE if the amount measurement is a weight */ + char *laboratory; /* The laboratory that produced the yeast. */ + char *product_id; /* The manufacturer’s product ID label */ + float min_temperature; /* The minimum recommended temperature */ + float max_temperature; /* The maximum recommended temperature */ + char *flocculation; /* “Low”, “Medium”, “High” or “Very High” */ + float attenuation; /* Average attenuation for this yeast strain. */ + char *notes; /* Notes on this yeast strain. */ + char *best_for; /* Beerstyle this yeast is best suited for. */ + int times_cultured; /* Number of times this yeast has been reused */ + int max_reuse; /* Recommended maximum reuse times */ + bool add_to_secondary; /* Flag this yeast was added for a secondary */ +} yeast_rec; + +typedef struct _misc_rec { + struct _misc_rec *next; + char *name; /* Name of the misc item. */ + int version; /* Version number of this element. */ + char *type; /* “Spice”, “Fining”, “Water Agent”, “Herb”, “Flavor”, “Other” */ + char *use; /* “Boil”, “Mash”, “Primary”, “Secondary”, “Bottling” */ + float time; /* Time the misc was boiled, steeped, mashed, etc in minutes. */ + float amount; /* Amount of item used. Liters or Weight */ + bool amount_is_weight; /* TRUE if amount is weight */ + char *use_for; /* Desc. of what the ingredient is used for */ + char *notes; /* Detailed notes on the item including usage. */ +} misc_rec; + +typedef struct _water_rec { + struct _water_rec *next; + char *name; /* Name of the water profile */ + int version; /* Version of the water record. */ + float amount; /* Volume of water to use in a recipe in liters */ + float calcium; /* The amount of calcium (Ca) in ppm */ + float bicarbonate; /* The amount of bicarbonate (HCO3) in ppm. */ + float sulfate; /* The amount of Sulfate (SO4) in ppm. */ + float chloride; /* The amount of Chloride (Cl) in ppm. */ + float sodium; /* The amount of Sodium (Na) in ppm. */ + float magnesium; /* The amount of Magnesium (Mg) in ppm. */ + float ph; /* The PH of the water. */ + char *notes; /* Notes about the water profile. */ +} water_rec; + +typedef struct _style_rec { + char *name; /* Name of the style profile */ + char *category; /* Category that this style belongs to */ + int version; /* Version of the style record. */ + char *category_number; /* Number or identifier for this style category */ + char *style_letter; /* The specific style number or subcategory */ + char *style_guide; /* The name of the style guide */ + char *type; /* “Lager”, “Ale”, “Mead”, “Wheat”, “Mixed” or “Cider” */ + float og_min; /* Original gracity */ + float og_max; + float fg_min; /* Final gravity */ + float fg_max; + float ibu_min; /* Bitterness for this style as measured */ + float ibu_max; /* in International Bitterness Units (IBUs) */ + float color_min; /* The recommended color in SRM */ + float color_max; + float carb_min; /* The recommended carbonation for this style */ + float carb_max; /* in volumes of CO2 */ + float abv_min; /* Alcohol by volume as a percentage. */ + float abv_max; + char *notes; /* Description of the style, history */ + char *profile; /* Flavor and aroma profile for this style */ + char *ingredients; /* Suggested ingredients for this style */ + char *examples; /* Example beers of this style. */ +} style_rec; + +typedef struct _mash_step { + struct _mash_step *next; + char *name; /* Name of this step */ + int version; /* Record version */ + char *type; /* “Infusion”, “Temperature” or “Decoction” */ + float infuse_amount; /* Wateri vol. in liters to infuse in this step */ + float infuse_temp; /* niet officieel - berekenen */ + float step_temp; /* The target temperature for this step */ + float end_temp; /* The final temperature you can expect */ + float step_time; /* The number of minutes to spend */ + float ramp_time; /* Time to achieve the desired step temperature */ + float water_grain_ratio; /* niet officieel - berekenen */ + float decotion_amt; /* niet officieel */ +} mash_step; + +typedef struct _mash_profile { + char *name; /* Name of mash method */ + int version; /* Record version */ + char *notes; /* Additional notes */ + float grain_temp; /* The temperature of the grain */ + mash_step *mash_steps; /* List of mash steps */ + float tun_temp; /* Grain tun temperature */ + float sparge_temp; /* Temperature of the sparge water */ + float ph; /* PH of the sparge. */ + float tun_weight; /* Weight of the mash tun in kilograms */ + float tun_specific_heat; /* Specific heat of the tun material */ + bool equip_adjust; /* Adjust for tun heat loss */ +} mash_profile; + +typedef struct _brew_equipment { + char *name; /* Name of the equipment profile */ + float boil_size; /* The pre-boil volume for this equipment setup */ + float batch_size; /* The target volume of the batch */ + float tun_volume; /* Volume of the mash tun in liters. */ + float tun_weight; /* Weight of the mash tun in kilograms. */ + float tun_specific_heat; /* The specific heat of the mash tun. */ + float top_up_water; /* The amount of top up water b4 fermenting */ + float trub_chiller_loss; /* Amount of wort lost during cooling */ + float evap_rate; /* Perc of wort lost to evaporation per hour. */ + float boil_time; /* The normal amount of boil time for this eq. */ + bool calc_boil_volume; /* Should the program calculate the boil size. */ + float lauter_dead_space; /* Amount lost to the lauter tun. */ + float top_up_kettle; /* Amount added to the boil kettle b4 the boil. */ + float hop_utilization; /* Large batch hop utilization. */ + char *notes; /* Notes for this equipment. */ +} brew_equipment; + +typedef struct _recipe_rec { + struct _recipe_rec *next; + int version; /* Current version is 1 */ + char *name; /* Name of the recipe */ + char *type; /* “Extract”, “Partial Mash” or “All Grain” */ + style_rec *style; /* style record */ + equipment_rec *equipment; /* equipemnt record */ + char *brewer; /* Name of the brewer */ + char *asst_brewer; /* Name of the assistent brewer */ + float batch_size; /* Target size of the finished batch in liters. */ + float boil_size; /* Starting size for the main boil in liters */ + float boil_time; /* The total time to boil the wort in minutes. */ + float efficiency; /* The percent brewhouse efficiency */ + hop_rec *hops; /* hops */ + fermentable_rec *fermentables; /* Fermentables list */ + misc_rec *miscs; /* Misc ingredients */ + yeast_rec *yeasts; /* Yeasts */ + water_rec *waters; /* Water profiles */ + mash_profile *mash; /* Mash profile */ + char *notes; /* Notes associated with this recipe */ + char *taste_notes; /* Tasting notes – may be multiline. */ + float taste_rating; /* Number between zero and 50.0 (BJCP system) */ + float og; /* The measured original specific gravity. */ + float fg; /* The measured final gravity of the beer. */ + int fermentation_stages; /* The number of fermentation stages used */ + int primary_age; /* Time spent in the primary in days */ + float primary_temp; /* Temp in Celsius for the primary fermentation */ + int secondary_age; /* Time spent in the secondary in days. */ + float secondary_temp; /* Temp in C for the secondary fermentation. */ + int tertiary_age; /* Time spent in the third fermenter in days. */ + float tertiary_temp; /* Temperature in the tertiary fermenter. */ + int age; /* Time to age the beer in days after bottling. */ + float age_temp; /* Temperature for aging after bottling. */ + char *date; /* Date brewed in a easily recognizable format. */ + float carbonation; /* Volume of CO2 used to carbonate this beer. */ + bool forced_carbonation; /* TRUE if forced carbonated using CO2 pressure */ + char *priming_sugar_name; /* Text describing the priming agent. */ + float carbonation_temp; /* Temp for either bottling/forced carbonation. */ + float priming_sugar_equiv; /* Factor used to convert this priming agent */ + float keg_priming_factor; /* Used 2 factor amount of sugar for containers */ +} recipe_rec; + + +int parseBeerXML(char *); +void printBeerXML(void); + + +#endif +