PDA

View Full Version : Mead Calculator - V1.0



JamesP
01-13-2010, 06:14 PM
Vicky/Pete,

I finally got around to doing the next version.

Changes:



Method of calculation now uses a third degree polynomial to determine Brix from SG, rather than assuming 8 gravity points per gallon of honey in 5 gallons. (thenew value is between 6 and 7 gravity points)
Switched layout location of Target SG & Vol with Current SG & Vol (as suggested by Angus)
Potential Alcohol Conversion utility added
Conversion of quarts/pints/cups/... to Gallons fixed
Blending utility selects the volume when you click the associated text entry box
Blending utility added radio buttons to change the headings (eye candy!)
Batch Util calculations now use 3rd degree polynomials to convert SG to Plato/Brix/Balling
Blending Utility now has buttons to select which value to calculate
Changing the Gravity type or PA type on the Batch Utility changes the selection on the Potential Alc utility (but not vice versa)
Added reset and clear buttons to the Blending Util


Note, the change in layout (2nd dot point) may confuse people for a bit, since the results are at the top, not the bottom now.

An obvious addition is dot point 3, the Potential Alcohol Conversion (I've forgotten who suggested this, but thanks!)

[Note: the attached doc files contain html. I had to save it as a doc file to attach them. Attaching as a zip file didn't work]

Medsen Fey
01-13-2010, 06:27 PM
Ooooooh....This sounds great! When do we get to see this beauty?

Smarrikåka
01-13-2010, 08:00 PM
Hello James. Looking forward to it. I see you changed some volume conversions, but did you fix the liter conversion too?

JamesP
01-13-2010, 11:19 PM
. . . did you fix the liter conversion too?

There were issues with the quantity conversion to cups (in the additional Sugars section). What was the issue with Litres ?

Smarrikåka
01-14-2010, 01:33 AM
Well, when going from 1kg of honey to liters, it will say that this will be equal to 1.333 liters

If this were true the density of honey would be around 0,75 kg/liter, which isn't right.

The density of water should be around 1 kg/liter
The density of honey should be around 1.36 kg/liter

So I think you may have gotten the relationship inversed somehow.

JamesP
01-14-2010, 03:38 AM
It is fixed in V1.0 (1kg honey <-> 0.6955 Litre)

However, weight to volume conversion is not fully accurate without including the density of the "material". I haven't added that much complexity to the calculator (yet).

So weight measures are assuming that "sugars" plus water contributes fully to the density, which of course is not true, but is close enough for honey.

If you puree fruit, then weight/volume conversion should be close enough also.

webmaster
02-03-2010, 06:19 PM
James, I uploaded the new code, and created the new help page. The help window is a bit narrow, suggestions on how to change the code so it opens up wider?

Looks *fab*. Thanks *so* much for doing this. You are a true friend, and I can't tell you how much I appreciate your work on this.

Medsen Fey
02-03-2010, 06:29 PM
It looks great, but it doesn't seem to be calculating. Is is turned on yet?

webmaster
02-03-2010, 07:04 PM
The code is in, and it should work.

James, when I put in code like that, I can only use what's between the body tags. Does this affect the code's ability to work?

ZachR
02-03-2010, 07:13 PM
Looks good, but it isn't calculating for me either. This message popped up when I clicked on the link: "overLIB 4.10 or later is required for the HideForm Plugin."

BTW, I am using Firefox 3.5.7

webmaster
02-03-2010, 08:38 PM
Workin on it guys. I'll get with James and we'll get it fixed.

webmaster
02-04-2010, 12:14 AM
Looks like it won't calc because the <body onclick> function is missing. However, I can't put that in a php generated page, so I'll get James to give me a function to put in, that should fix it.

Sorry about the problems, folks, we'll get 'er done.

JamesP
02-04-2010, 04:43 AM
Vicky,

looks like not all the javascript code got copied in. Maybe it exceeded the amount of data allowed. (Also check that the data I sent you wasn't somehow truncated).

Either way, he scripts won't run because there will be javascript errors - hence why the calculate button didn't work.

How do we proceed from here?

PS - did you check out the SG table generator ?

James

webmaster
02-04-2010, 10:58 AM
OK, I re-inserted the code, by hand using the sql tables, and I'm showing all the code in the source when I open the page, but the buttons still don't work...

Thoughts?

JamesP
02-04-2010, 07:08 PM
Vicky,

Yes, all the code is there now.

The only thing I can think of, is to remove the tags that hide the script from HTML,
so change

<SCRIPT LANGUAGE="Javascript">
<!--
//

to


<SCRIPT LANGUAGE="Javascript">
//



and remove at the end of the javascript section the corresponding


// -->


===============================================

There is another error:

onClick="window.open(‘index.php?option=
should be

onClick="window.open('index.php?option=

webmaster
02-04-2010, 07:40 PM
OK, did this, and help button is working now. But the rest seems to be having issues.

OK, next idea? LOL...

JamesP
02-04-2010, 08:38 PM
Vicky,

The forum is too smart. It converted & into &amp; in the javascript which stopped the scripts working.

Starting from


<SCRIPT type="text/javascript" LANGUAGE="JavaScript">

//
// Residual Sugar at SG=1.000
//


search for &amp; in an if statement, and replace with just the ampersand symbol

as in


if ( (vMask &amp; 12) == 8) { // do **Target Gravity** (targVol checked, targGrav uncheched)


becomes


if ( (vMask & 12) == 8) { // do **Target Gravity** (targVol checked, targGrav uncheched)


There should be about seven of these to change.

====================================

Also, I left a degugging statement in there. Can this alert() statement be removed by changing


vTVol = (vSugar*1000 + (SGToSugarConc(vCSg) * vCVol)) / SGToSugarConc(vTSg); // convert g/L to kg/L
//alert(vCSg+' '+vCVol+' '+vTSg+' '+vTVol);
theForm.vol_valt.value = Number(vTVol / Number(theForm.targvol_s.options[theForm.targvol_s.selectedIndex].value));



to


vTVol = (vSugar*1000 + (SGToSugarConc(vCSg) * vCVol)) / SGToSugarConc(vTSg); // convert g/L to kg/L
theForm.vol_valt.value = Number(vTVol / Number(theForm.targvol_s.options[theForm.targvol_s.selectedIndex].value));


====================================

Also, if you can, change the body tag to be


<BODY onClick="i_updateStats()">


(the forum software might not let you do this)



Thanks, heaps!!!

webmaster
02-04-2010, 11:49 PM
::grumble:: I have been working on this directly in the DB, and it doesn't *have* the & signs converted there, which means it's converting them when the page renders, and I'll have to figure that out. I'll surf the joomla support and figure it out.

The only alert statment I"m turning up is:

var vCD = Number(theForm.blend_totvol.value);
//alert(vA+'!'+vB+'!'+vC+'!'+vD+'!'+vM+'!'+vCD);

// ensure blen value is BETWEEN value#1 and value#2


I can't use body tags in a content management system, it creates its own body tags, so I can only use what's between the body tags. I did a bit of googling, and found a couple pages where they discuss creating a bit of code to deal with that when you can't do it in the body tag. I closed the page tho and can't seem to turn them back up. But the code looked pretty straightforward (if you're good with javascript, which I'm not, LOL).

webmaster
02-05-2010, 12:10 AM
OK, by hacking the core code of the site, I think its working ok now. Test it folks, and make sure it comes back with stuff that looks right.

James, get back to me on the other items, we'll get 'em working...

ZachR
02-05-2010, 12:15 AM
Looks like it's working now. Thanks Vicky and James!

JamesP
02-05-2010, 12:48 AM
Vicky,

a work-around to allow clicking on the screen to update the calculations:

Change the form tag for the calculator to include the onClick event handler


<FORM NAME="util" onClick="i_updateStats();">



I can do an alternative for the ampersands if required (although you got these working ;) ).

webmaster
02-05-2010, 01:09 AM
OK, I added that new form tag.

Yeah, I hacked the core code to get that to work. Apparently the ampersand bug is known in Joomla (though not yet fixed....::sigh::)

akueck
02-05-2010, 01:25 AM
Huh. I tried it and got a popup window that told me:

1 0 1.12 13.612479051443316

Which is pretty much gibberish to me. :(

Although I did input 1.12 as a target gravity. Not sure what the other numbers are supposed to be.

JamesP
02-05-2010, 02:28 AM
Vicky,

you must be frustrated by now, with all the back and forth to get this working.

I've attached the updated code.

-Avoiding the single ampersand bit comparison
- form onclick handling
- removal of debugging message mentioned by Akuek

Hopefully this works as it should.

JamesP
02-05-2010, 02:34 AM
Vicky,

I forgot to mention,

With the new data file, the window.open() and the help file url will need to be modified as before.

Medsen Fey
02-07-2010, 05:43 PM
I see that the calculator is calculating now - Thanks James and Vicky!

I noticed one apparent conversion error. When you input honey in pounds and convert to cups (or vice versa) the numbers aren't quite right.

Medsen

JamesP
02-07-2010, 08:16 PM
Good pickup, Medsen.


There was also an error in conversion to Imp Cups for the Target/Current Volume settings. (And I thought I was thorough in checking the code :confused: )

I've fixed that up, but before annoying Vicky again to get the updates loaded, .....


Question

Do I need to also add Table Spoons, Dessert Spoons and Teaspoons, or are they too small to worry about ?

Medsen Fey
02-07-2010, 10:58 PM
Question

Do I need to also add Table Spoons, Dessert Spoons and Teaspoons, or are they too small to worry about ?

I wouldn't.

wayneb
02-08-2010, 01:16 AM
I concur - leave them out. It is better to weigh small amounts of dry ingredients rather than measure them by volume, anyway.

JamesP
02-08-2010, 01:44 AM
Vicky,

Sorry about the re-work. Here is V1.1.
It should point to the correct Help File URL.


Medsen & Wayneb,

Thanks. They are left out, as you suggest.

Medsen Fey
03-19-2010, 01:33 PM
Vicky/James,

I run into an error message with the calculator when I attempt to put in a target gravity and an amount of honey in pounds and try to let it solve for the volume. It brings up a little box with an error and a long string of numbers.

I hope it's an easy fix.

JamesP
03-20-2010, 05:23 PM
Vicky/James,
It brings up a little box with an error and a long string of numbers.

I hope it's an easy fix.

V1.1 removes this debugging message, that slipped thru the cracks of the release process (doesn't that sound fancy :p )

Medsen Fey
05-13-2010, 05:51 PM
I found what appears to be another conversion error in the calculator. When you enter a value in the weight of honey and covert to cups, it gives an erroneously high number. The same problem occurs if you enter 1 gallon of honey and covert to cups - it gives 30.6226 rather than 16.

I hope that is an easy fix.

JamesP
05-18-2010, 07:10 PM
Medsen,

fixed already in V1.1 :cool:

JamesP
05-18-2010, 07:13 PM
I found what appears to be another conversion error in the calculator.

I hope that is an easy fix.

Medsen, Already fixed in V1.1 :cool:

JamesP
05-18-2010, 07:24 PM
Medsen,

It is already fixed in V1.1 :cool:

PAMeadMaker
05-19-2010, 09:17 AM
I noticed something in the Mead Calculator but I'm not sure if it's a problem or just SUE (stupid user error). I'm doing the calculations for a 1 gallon batch. I want to have 18% ABV and a FG of 1.06. According to the calculations given in the Recipe Calculations I should use 77.7oz of honey (3oz * 18 = 54 and 3oz * 7.9 = 23.7), which yields 4.85625# of honey. If I check the Target Volume box and enter 1 US Gallon, check the Additional Sugars #1 box and enter 4.85625 Pounds and hit Calculate, I get a SG of 1.174 and an ABV of 21.49. In the Potential Alcohol Conversion box, if I enter the SG of 1.174 and the FG of 1.06, I get a 14.84% ABV result. In order to get close to 18% on the Potential Alcohol Conversion, the OG would have to be 1.2. Entering 1.2 in the Target Gravity box up top and then unchecking the Additional Sugars 1 box would then change the amount of honey needed to 5.566#. I think I'm probably doing something wrong but I'm not sure what it is. Can you please help? I want to get the honey amount right for this recipe and I'm getting 2 very different amounts.

MrMooCow
07-07-2010, 11:41 AM
So.... the blending calculator. I have never been able to get this to work. Never, ever, ever. I enter the known ABVs (17, 0), I enter the known volume of #1 (5), I enter the desired ABV (12), and click on Volume #2..... and nothing happens. Even changing ABV 2 to a non-zero number has no affect.

Is there a bug or am I stupid? Is there something obvious I am doing wrong here? I've tried it in both firefox and IE.

Thanks to everyone who put this together and got it up and working!

oldwhiskers
01-23-2011, 12:27 PM
Is V1.1 of the mead calculator with the cup conversion correction available or is it a patron only thing?

I started my first mead last night and was planning on using the cups measurement until I noticed a problem as I measured out the honey from a 5# container. I actually measured a little over 6-1/2 cups for the 5# of honey instead of the 12-3/4 the calculator said. I went back and measured and refilled the container afterwards to cross check. This would give a smidgen over 3/4# per cup.

mmclean
01-23-2011, 12:48 PM
Hi there oldwhiskers,

Welcome to "Gotmead?"

I'm not sure about the mead calculator. Most recipes use pounds just to get within range. Your best bet is to go by your S.G or a Brix Reading. All honey vary due to different water content.

Glad to see a fellow Tennessean Meadcrafter, we seem to be a rare breed around here.

webmaster
01-23-2011, 01:04 PM
The version of the calculator that is up is the latest I have. We don't restrict it to patrons....

JamesP
02-09-2011, 05:11 PM
So.... the blending calculator. I have never been able to get this to work. Never, ever, ever. I enter the known ABVs (17, 0), I enter the known volume of #1 (5), I enter the desired ABV (12), and click on Volume #2..... and nothing happens. Even changing ABV 2 to a non-zero number has no affect.


You need 4 bits of info to find the 5th.

eg,

So if you have 5 gals of 17 ABV and are blending it with a known volume of say 2 gals of 12 ABV and want to know the resultant abv,
then
enter value1=17, Value2=12, Volume1=5 and volume2=2 and click the button for blended value (15.571 ABV is the resultant ABV)

Or,

If you have 5 gals of 17 ABV and are blending it with a 12 ABV quantity to achieve 13 ABV and want to know how much 12ABV volume to add,
then
enter value1=17, Value2=12, Volume1=5 and BlendedValue=13 and click the button for Volume2, which tells you you need 20 gallons of 12 ABV to blend

JamesP
02-10-2011, 12:59 AM
The version of the calculator that is up is the latest I have. We don't restrict it to patrons....

Vicky,

I posted v1.1 earlier in this post, but I think things were busy at the time, and so the Mead Calculator didn't get around to being updated to v1.1 (ain't that life).

I HAVE ATTACHED V1.1 for updating the calculator (as a text file this time. It is actually html)

webmaster
02-10-2011, 01:15 AM
Yeah, it's been up. I just looked, and it says 1.1.....