コード例 #1
0
ファイル: FluentPlant.cs プロジェクト: JamesClark99/BrewMLLib
        public IFluentPlant ForPlant(string name)
        {
            try
            {

                _isnew = false;
                _plant = contx.Plants.FirstOrDefault(p => p.PlantName == name);

                //if (_plant == null)
                //{
                //    AddPlant(name);

                //}

            }
            catch (Exception ex)
            {
                _message = _message + ex.ToString();
            }

            return this;
        }
コード例 #2
0
ファイル: FluentPlant.cs プロジェクト: JamesClark99/BrewMLLib
 public FluentControlLoop(IFluentPlant parent)
 {
     _plant = parent.GetPlant();
     _parent = parent;
     _isnew = false;
 }
コード例 #3
0
ファイル: FluentPlant.cs プロジェクト: JamesClark99/BrewMLLib
        public IFluentPlant AddPlant(string name)
        {
            _isnew = false;
            _plant = contx.Plants.FirstOrDefault(p => p.PlantName == name);
            if (_plant == null)
            {
                try
                {
                    _isnew = true;
                    _plant = new Plant();
                    _plant.PlantName = name;
                    _plant.BrewPubMenu = "default";
                    _plant.PlantAddress = "default";
                    _plant.PlantAux = new List<EQAuxilary>();
                    _plant.PlantLoops = new List<EQControlLoop>();
                    _plant.PlantVessels = new List<EQVessel>();

                    _plant.Units = new List<Unit>();
                }
                catch (Exception ex)
                {
                    _message = _message + ex.ToString();
                }
            }

            return this;
        }
コード例 #4
0
ファイル: BrewDBDAL.cs プロジェクト: JamesClark99/BrewMLLib
        public Plant GetPlantByPlantID(int plantID)
        {
            BrewDBContext cont = new BrewDBContext();

            Plant p = new Plant();
            p = cont.Plants.FirstOrDefault(g => g.PlantID == plantID);
            return p;
        }
コード例 #5
0
ファイル: BrewDBDAL.cs プロジェクト: JamesClark99/BrewMLLib
        public List<EQControlLoop> GetEQControlLoopsByPlant(Plant plant)
        {
            BrewDBContext cont = new BrewDBContext();

            List<EQControlLoop> loops = cont.EQControlLoops.SelectMany(g=>EQControlLoops).Where(g=>g.Plant == plant).ToList();

            return loops;
        }
コード例 #6
0
ファイル: BrewDBDAL.cs プロジェクト: JamesClark99/BrewMLLib
        //----------------------------------------------------------------------------------------------------
        //----------------------------------------------------------------------------------------------------
        //----------------------------------------------------------------------------------------------------
        //          Equipment
        //----------------------------------------------------------------------------------------------------
        //----------------------------------------------------------------------------------------------------
        public Plant EQAddPlant(Plant newplant)
        {
            BrewDBContext cont = new BrewDBContext();

            Plant plant = new Plant();
            plant.PlantLoops = new List<EQControlLoop>();
            plant.PlantAux = new List<EQAuxilary>();
            plant.PlantVessels = new List<EQVessel>();
            plant.BrewPubMenu = newplant.BrewPubMenu;
            plant.PlantAddress = newplant.PlantAddress;
            plant.PlantLocation = newplant.PlantLocation;
            plant.PlantName = newplant.PlantName;
            plant.Units = new List<Unit>();

            cont.Plants.Add(plant);
            cont.SaveChanges();

            Plant plantreturn = cont.Plants.FirstOrDefault(e => e.PlantID == plant.PlantID);

            return plantreturn;
        }
コード例 #7
0
ファイル: Program.cs プロジェクト: JamesClark99/BrewMLLib
        /// <summary>
        /// Test
        /// </summary>
        /// <param name="args"></param>
        static void Main(string[] args)
        {
            BrewML b = new BrewML();

            BrewDBContext db = new BrewDBContext();

            WriteDb Report = new WriteDb();

            Plant p = new Plant();

            FluentEQType types = new FluentEQType();

            types.AddEQType("Pump").Final();
            types.AddEQType("Valve").Final();
            types.AddEQType("TempController").Final();

            Report.reportit();

            FluentPlant pd = new FluentPlant();

            pd.AddPlant("Little Jakes").Final();

            pd.ForPlant("Little Jakes")
                .HasLoops()
                .AddControlLoop("WaterPump","Pump")
                .SetSetPoint(215)
                .Final();

            //Console.WriteLine(pd.GetMessage());
            //Console.WriteLine(pd.ForPlant("Little Jakes").HasLoops("WaterInfeed").GetSetPoint());

            pd.ForPlant("Little Jakes")
                .HasLoops()
                .AddControlLoop("TempControl1", "TempController")
                .SetSetPoint(222)
                .Final();

            Report.reportit();

            //Console.WriteLine(pd.ForPlant("Little Jakes").HasLoops("TempControl1").GetSetPoint());

            pd.ForPlant("Little Jakes")
                .HasLoops("TempControl1")
                .SetSetPoint(678)
                .HasType("Valve")
                .Final();

            pd.ForPlant("Little Jakes").HasLoops().ForControlLoop("TempControl1").SetSetPoint(33).Final();

            //Console.WriteLine(pd.ForPlant("Little Jakes").HasLoops("TempControl1").GetSetPoint());

            pd.AddPlant("Big Jakes").Final();

            pd.ForPlant("Big Jakes")
                .HasLoops()
                .AddControlLoop("ValveXV1321", "Valve")
                .SetSetPoint(33)
                .Final()
                .HasLoops()
                .AddControlLoop("DumpValve12", "Valve")
                .SetSetPoint(123)
                .Final()
                .Final();

            //Console.WriteLine("-------------------");

            pd.ForPlant("Big Jakes")
                .HasLoops("ValveXV1321")
                .SetSetPoint(678)
                .HasType("Valve")
                .SetSetPoint(99)
                .Final();

            //Console.WriteLine(pd.ForPlant("Big Jakes").HasLoops("ValveXV1321").GetSetPoint());

            //Console.WriteLine(pd.ForPlant("Big Jakes").HasLoops("ValveXV1321").GetSetPoint());

            Console.WriteLine("-------------------");
            Console.WriteLine("Recipe Test ");

            FluentRecipe rec = new FluentRecipe();

            rec.AddRecipe("Big Eddy")
                .SetBrandDescription("hey this is big stuff")
                .SetQualityTarget("always high quality")
                .Final();

            rec.ForRecipe("Big Eddy")
                .HasRecOperations()
                .AddOperation("Heat 12")
                .SetSetPoint(33)
                .Final()
                .Final();

            rec.AddRecipe("So Smooth")
                .SetQualityTarget("top notch")
                .HasRecOperations()
                .AddOperation("Heat Phase 1")
                .SetSetPoint(170)
                .Final()
                .Final();

            rec.ForRecipe("So Smooth")
                .HasRecOperations()
                .AddOperation("heat phase 2")
                .SetSetPoint(33)
                .Final()
                .HasRecOperations()
                .AddOperation("Heat Phase 3")
                .SetSetPoint(34)
                .Final()
                .Final();

            rec.ForRecipe("So Smooth")
                .HasRecOperations()
                .AddOperation("cool phase 3")
                .SetSetPoint(123)
                .Final()
                .HasRecOperations()
                .AddOperation("cool phase 4")
                .SetSetPoint(155).Final().Final();

            Console.WriteLine("-------------------");

            Console.WriteLine("-------------------");

            Console.WriteLine("-------------------");

            Report.reportit();

            Console.WriteLine("hit key");
            var name = Console.ReadLine();
        }