Example #1
0
        public static double CalculateColor(List <GristPart> aMashFermentList, BrewVolumes aSetOfBrewVolumes)
        {
            // MCU = (Weight of grain in lbs) *(Color of grain in degrees lovibond) / (volume in gallons)
            double mcu = 0;

            foreach (GristPart g in aMashFermentList)
            {
                double w = g.AmountGrams;
                if (g.Stage == FermentableStage.Mash)
                {
                    double tapOffComp = (aSetOfBrewVolumes.PreBoilTapOff / (aSetOfBrewVolumes.PreBoilVolume + aSetOfBrewVolumes.PreBoilTapOff));
                    w = (1 - tapOffComp) * g.AmountGrams;
                }
                if (g.Stage == FermentableStage.Fermentor)
                {
                    double boilToFerComp = GrainfatherCalculator.GRAINFATHER_BOILER_TO_FERMENTOR_LOSS / (aSetOfBrewVolumes.PostBoilVolume);
                    w = (1 + boilToFerComp) * g.AmountGrams;
                }

                mcu += (Weight.ConvertToPounds(w) * g.FermentableAdjunct.Color) / Volume.ConvertLitersToGallons(aSetOfBrewVolumes.PostBoilVolume);
            }
            double srm = 1.4922 * Math.Pow(mcu, 0.6859d);

            return(srm * SRM_TO_EBC);
        }
Example #2
0
        public static double CalculateColor(List<GristPart> aMashFermentList, BrewVolumes aSetOfBrewVolumes)
        {
            // MCU = (Weight of grain in lbs) *(Color of grain in degrees lovibond) / (volume in gallons)
            double mcu = 0;
            foreach (GristPart g in aMashFermentList)
            {
                int w = 0;
                if (g.Stage == FermentableStage.Mash)
                    w = (int)(Math.Round(g.AmountGrams * (1 - (aSetOfBrewVolumes.PreBoilTapOff / aSetOfBrewVolumes.PreBoilVolume))));
                else
                    w = g.AmountGrams;

                mcu += (Weight.ConvertToPounds(w) * g.FermentableAdjunct.Color) / Volume.ConvertLitersToGallons(aSetOfBrewVolumes.PostBoilVolume);
            }
            double srm = 1.4922 * Math.Pow(mcu, 0.6859d);
            return (srm * SRM_TO_EBC);
        }
Example #3
0
        public MainWindow()
        {
            InitializeComponent();

            var assembly = Assembly.GetExecutingAssembly();
            var path = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
            var fullpath = String.Format("{0}\\{1}", path, assembly.GetName().Name);
            try {
                if (!Directory.Exists(fullpath))
                    Directory.CreateDirectory(fullpath);
            }
            catch (Exception e)
            {
                MessageBox.Show(String.Format("Unable to create {0}. Exception {1}", fullpath, e));

            }
            HopsRepo = new HopsRepository();
            MaltRepo = new FermentableRepository();

            Grist = new ObservableCollection<GristPart>();
            MaltsListView.ItemsSource = Grist;
            BoilHops = new ObservableCollection<HopAddition>();
            HopsListView.ItemsSource = BoilHops;

            MashProfileList = new ObservableCollection<Domain.MashProfileStep>();
            MashStepListView.ItemsSource = MashProfileList;

            OtherIngredientsList = new ObservableCollection<OtherIngredient>();
            OtherIngredientsListView.ItemsSource = OtherIngredientsList;

            OriginalGravity = 1.05;
            BoilTime = 60;

            Volumes = new BrewVolumes();
            Volumes.BoilOffLoss = GrainfatherCalculator.CalcBoilOffVolume(BoilTime);
            Volumes.FinalBatchVolume = 25;
            Volumes.BoilerToFermentorLoss = GrainfatherCalculator.GRAINFATHER_BOILER_TO_FERMENTOR_LOSS;
            Volumes.PreBoilTapOff = 0;

            TopUpMashWater = 0;

            gfc = new GrainfatherCalculator();
            gfc.MashEfficiency = (double)WpfApplication1.Properties.Settings.Default["MashEfficiency"];

            updateGuiTextboxes();

            GrainBrainMenuItem.IsEnabled = false;

            dispatcherTimer = new DispatcherTimer();
            dispatcherTimer.Tick += new EventHandler(dispatcherTimer_Tick);
            dispatcherTimer.Interval = new TimeSpan(0, 0, 5);
            dispatcherTimer.Start();

            MashProfileList.CollectionChanged += this.OnCollectionChanged;

        }