Пример #1
0
        /// <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();
            Console.WriteLine("---------------------------------------------");


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

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

            FluentPlant pd = new FluentPlant();

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


            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()
            .AddControlLoop("TempControl122", "TempController")
            .SetSetPoint(678)
            .HasType("Valve");    //// WHAT IS THIS?
            //.Final();

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

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

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

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

            pd.ForPlant("Big Jakes")
            .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("---------------------------------------------");
            Console.WriteLine("-------adding units--------------------------------------");


            FluentUnit fu = new FluentUnit();


            Report.reportUnits();

            //fu.AddUnit("test unit 1","Big Jakes");

            pd.ForPlant("Big Jakes").HasUnits().AddUnit("test unit 1");

            Report.reportUnits();
            pd.ForPlant("Little Jakes").HasUnits().AddUnit("test unit 1");
            Report.reportUnits();
            pd.ForPlant("Big Jakes").HasUnits().AddUnit("test unit 1");
            Report.reportUnits();
            //pd.ForPlant("Little Jakes").HasLoopsInUnit("test unit 1").AddControlLoop("ValveXV1321");

            //fu.ForUnit("test unit 1").HasLoops().AddControlLoop("ValveXV1321");

            pd.ForPlant("Little Jakes").HasUnits().AddUnit("asdfasdf").HasLoops().AddControlLoop("ValveXV1321");

            pd.ForPlant("Big Jakes").HasUnits().AddUnit("asdfaddsdf").HasLoops().AddControlLoop("ValveXV1321x", "Valve");

            pd.ForPlant("Big Jakes").HasUnits().AddUnit("again").HasLoops().AddControlLoop("ValveXV1321xxx", "Valve");
            //Console.WriteLine(pd.ForPlant("Big Jakes").HasLoops("ValveXV1321").GetSetPoint());

            //Console.WriteLine(pd.ForPlant("Big Jakes").HasLoops("ValveXV1321").GetSetPoint());
            Report.reportUnits();
            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)
            //.HasRecOperations()
            .AddOperation("Heat Phase 3")
            .SetSetPoint(34)
            .AddOperation("test chain 3")
            .SetSetPoint(55);

            //.Final()
            //.Final();

            rec.ForRecipe("So Smooth")
            .HasRecOperations()
            .AddOperation("cool phase 3")
            .SetSetPoint(123)
            //.HasRecOperations()
            .AddOperation("cool phase 4")
            .SetSetPoint(155);
            //.Final().Final();
            Console.WriteLine("-------------------");
            Report.reportMasterRecipes();
            rec.ForRecipe("So Smooth").HasRecOperations().AddAllowedUnits("again");

            Console.WriteLine("-------------------");
            Report.reportMasterRecipes();
            rec.ForRecipe("So Smooth").HasRecOperations("cool phase 3").AddAllowedUnits("asdfasdf").AddAllowedUnits("asdfaddsdf");

            pd.ForPlant("Big Jakes").HasUnits().AddUnit("test2ss3Unit");
            rec.ForRecipe("So Smooth").HasRecOperations("cool phase 3").AddAllowedUnits("test2ss3Unit");

            rec.ForRecipe("So Smooth").HasRecOperations("cool phase 3").AddAllowedUnits("test unit 1").AddAllowedUnits("asdfaddsdf");
            Console.WriteLine("-------------------");
            Report.reportMasterRecipes();
            rec.ForRecipe("So Smooth").HasRecOperations().AddAllowedUnits("test unit 1");


            rec.ForRecipe("Big Eddy")
            .HasRecOperations()
            .AddOperation("Heat 33")
            .SetSetPoint(33);
            Console.WriteLine("-------------------");
            Report.reportMasterRecipes();
            Console.WriteLine("-------------------");

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

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


            Report.reportit();


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

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

            Console.WriteLine("-------------------");
            Report.reportMasterRecipes();
            Console.WriteLine("hit key");
            var name = Console.ReadLine();
        }
Пример #2
0
        private void ReadFile(String fname)
        {
            FluentEQType  types = new FluentEQType();
            Plant         p     = new Plant();
            BrewDBContext db    = new BrewDBContext();
            BrewML        b     = new BrewML();
            FluentPlant   pd    = new FluentPlant();
            FluentRecipe  rec   = new FluentRecipe();


            string[] lines = System.IO.File.ReadAllLines(@fname);
            for (int i = 0; i < lines.Length; i++)
            {
                String   input = lines[i];
                String[] words = input.Split(' ');
                for (int ii = 1; ii < words.Length; ii++)
                {
                    words[ii] = words[ii].Replace('_', ' ');
                }



                if (words[0] == "Add_EQType")
                {
                    types.AddEQType(words[1]);
                }
                else if (words[0] == "Add_Plant")
                {
                    pd.AddPlant(words[1]);
                    this.CreateNewPlant(words[1]);
                }
                else if (words[0] == "Add_Recipe")
                {
                    rec.AddRecipe(words[1]);
                }
                else if (words[0] == "Plant")
                {
                    FluentPlant fp = (FluentPlant)pd.ForPlant(words[1]);
                    do
                    {
                        i++;
                        String   tempinput = lines[i];
                        String[] tempWords = tempinput.Split(' ');
                        for (int ii = 1; ii < tempWords.Length; ii++)
                        {
                            tempWords[ii] = tempWords[ii].Replace('_', ' ');
                        }

                        if (tempWords[0] == "Add_ControlLoop")
                        {
                            fp.HasLoops().AddControlLoop(tempWords[1], tempWords[2]).SetSetPoint(Convert.ToInt32(tempWords[3]));
                        }
                        else if (tempWords[0] == "Update_ControlLoop")
                        {
                            fp.HasLoops(tempWords[1]).SetSetPoint(Convert.ToInt32(tempWords[2]));
                        }
                        else if (tempWords[0] == "Add_Unit")
                        {
                            fp.HasUnits().AddUnit(tempWords[1]);
                        }
                    } while (lines[i] != "--------------------------------------------");
                }
                else if (words[0] == "Recipe")
                {
                    FluentRecipe fr = (FluentRecipe)rec.ForRecipe(words[1]);
                    do
                    {
                        i++;
                        String   tempinput = lines[i];
                        String[] tempWords = tempinput.Split(' ');
                        for (int ii = 1; ii < tempWords.Length; ii++)
                        {
                            tempWords[ii] = tempWords[ii].Replace('_', ' ');
                        }

                        if (tempWords[0] == "SetBrandDescription")
                        {
                            rec.SetBrandDescription(tempWords[1]);
                        }
                        else if (tempWords[0] == "SetQualityTarget")
                        {
                            rec.SetQualityTarget(tempWords[1]);
                        }
                        else if (tempWords[0] == "Add_Operation")
                        {
                            rec.HasRecOperations().AddOperation(tempWords[1]).SetSetPoint(Convert.ToInt32(tempWords[2]));
                        }
                    } while (lines[i] != "--------------------------------------------");
                }
            }
        }