コード例 #1
0
ファイル: GravityAlorithms.cs プロジェクト: rmcarlsson/wbc
        public static int GetGrainWeight(double somePoints, double aPotential, double aMashEfficiency)
        {
            var gfc = new GrainfatherCalculator();

            var ppg = (aPotential - 1) * 1000 * aMashEfficiency;
            return Weight.ConvertPoundsToGrams(somePoints / ppg);

        }
コード例 #2
0
ファイル: GravityAlorithms.cs プロジェクト: rmcarlsson/wbc
        public static double GetGravityByPart(
            double aVolume,
            List<GristPart> aFermentableList,
            int aGrainbillWeight,
            double aMashEfficiency)
        {
            if (aVolume == 0 || (aFermentableList.Count == 0) || aFermentableList == null)
                return 1;

            var lbs = Weight.ConvertToPounds(aGrainbillWeight);

            double ppgLbMashEffComp = 0;
            foreach (var f in aFermentableList)
            {
                double eff = 1;
                switch (f.Stage)
                {
                    case FermentableStage.Mash:
                        var gfc = new GrainfatherCalculator();
                        eff = aMashEfficiency;
                        break;
                    case FermentableStage.ColdSteep:
                        eff = ColdSteep.COLDSTEEP_EFFICIENCY * aMashEfficiency;
                        break;
                    default:
                        eff = 1;
                        break;
                }
                ppgLbMashEffComp += eff * ((f.FermentableAdjunct.Potential - 1) * 1000) * lbs * ((double)(f.Amount) / 100d);

            }
            var g = ppgLbMashEffComp / Volume.ConvertLitersToGallons(aVolume);

            return (1 + (g / 1000));
        }
コード例 #3
0
ファイル: MainWindow.xaml.cs プロジェクト: rmcarlsson/wbc
        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;

        }