Beispiel #1
0
        /// <summary>
        /// Loads the material catalog in the model with sample materials.
        /// </summary>
        /// <param name="mcat">the Material Catalog to be initialized.</param>
        private static MaterialCatalog LoadSampleCatalog()
        {
            MaterialCatalog mcat = new MaterialCatalog();

            //Console.WriteLine("Warning: Specification is creating a MaterialType without propagating its molecular weight, emissions classifications or VaporPressure constants.");
            mcat.Add(new MaterialType(null, "Ethyl Acetate", Guid.NewGuid(), 0.9020, 1.9230, MaterialState.Liquid));
            mcat.Add(new MaterialType(null, "Hydrochloric Acid", Guid.NewGuid(), 1.1890, 2.5500, MaterialState.Liquid));
            mcat.Add(new MaterialType(null, "Ethanol", Guid.NewGuid(), 0.8110, 3.0000, MaterialState.Liquid));
            mcat.Add(new MaterialType(null, "Hexane", Guid.NewGuid(), 0.6700, 4.1800, MaterialState.Liquid));
            mcat.Add(new MaterialType(null, "Triethylamine", Guid.NewGuid(), 0.7290, 4.1800, MaterialState.Liquid));
            mcat.Add(new MaterialType(null, "MTBE", Guid.NewGuid(), 0.7400, 4.1800, MaterialState.Liquid));
            mcat.Add(new MaterialType(null, "Isopropyl Alcohol", Guid.NewGuid(), 0.7860, 4.1800, MaterialState.Liquid));
            mcat.Add(new MaterialType(null, "Acetone", Guid.NewGuid(), 0.7899, 4.1800, MaterialState.Liquid));
            mcat.Add(new MaterialType(null, "Propyl Alcohol", Guid.NewGuid(), 0.8035, 4.1800, MaterialState.Liquid));
            mcat.Add(new MaterialType(null, "Butanol", Guid.NewGuid(), 0.8100, 4.1800, MaterialState.Liquid));
            mcat.Add(new MaterialType(null, "Aluminum Hydroxide", Guid.NewGuid(), 1.0000, 4.1800, MaterialState.Liquid));
            mcat.Add(new MaterialType(null, "Ammonia", Guid.NewGuid(), 1.0000, 4.1800, MaterialState.Liquid));
            mcat.Add(new MaterialType(null, "Ammonium Hydroxide", Guid.NewGuid(), 1.0000, 4.1800, MaterialState.Liquid));
            mcat.Add(new MaterialType(null, "Carbon Dioxide", Guid.NewGuid(), 1.0000, 4.1800, MaterialState.Liquid));
            mcat.Add(new MaterialType(null, "Manganese Sulfate", Guid.NewGuid(), 1.0000, 4.1800, MaterialState.Liquid));
            mcat.Add(new MaterialType(null, "Nitrous Acid", Guid.NewGuid(), 1.0000, 4.1800, MaterialState.Liquid));
            mcat.Add(new MaterialType(null, "Potassium Phosphate", Guid.NewGuid(), 1.0000, 4.1800, MaterialState.Liquid));
            mcat.Add(new MaterialType(null, "Potassium Sulfate", Guid.NewGuid(), 1.0000, 4.1800, MaterialState.Liquid));
            mcat.Add(new MaterialType(null, "Sodium Sulfate", Guid.NewGuid(), 1.0000, 4.1800, MaterialState.Liquid));
            mcat.Add(new MaterialType(null, "Manganese Dioxide", Guid.NewGuid(), 1.3000, 4.1800, MaterialState.Liquid));
            mcat.Add(new MaterialType(null, "Potassium Hydroxide", Guid.NewGuid(), 1.3000, 4.1800, MaterialState.Liquid));
            mcat.Add(new MaterialType(null, "Sodium Bromide", Guid.NewGuid(), 1.3000, 4.1800, MaterialState.Liquid));
            mcat.Add(new MaterialType(null, "Sodium Bisulfite", Guid.NewGuid(), 1.4800, 4.1800, MaterialState.Liquid));
            mcat.Add(new MaterialType(null, "Titanium Dioxide", Guid.NewGuid(), 1.5000, 4.1800, MaterialState.Liquid));
            mcat.Add(new MaterialType(null, "Titanium Tetrachloride", Guid.NewGuid(), 1.5000, 4.1800, MaterialState.Liquid));
            mcat.Add(new MaterialType(null, "Sodium Nitrate", Guid.NewGuid(), 1.6000, 4.1800, MaterialState.Liquid));
            mcat.Add(new MaterialType(null, "Phosphoric Acid", Guid.NewGuid(), 1.6850, 4.1800, MaterialState.Liquid));
            mcat.Add(new MaterialType(null, "Sodium Sulfide", Guid.NewGuid(), 1.8580, 4.1800, MaterialState.Liquid));
            mcat.Add(new MaterialType(null, "Caustic Soda", Guid.NewGuid(), 2.0000, 4.1800, MaterialState.Liquid));
            mcat.Add(new MaterialType(null, "Sodium Chloride", Guid.NewGuid(), 2.1650, 4.1800, MaterialState.Liquid));
            mcat.Add(new MaterialType(null, "Sodium Bicarbonate", Guid.NewGuid(), 2.2000, 4.1800, MaterialState.Liquid));
            mcat.Add(new MaterialType(null, "Sodium Nitrite", Guid.NewGuid(), 2.3800, 4.1800, MaterialState.Liquid));
            mcat.Add(new MaterialType(null, "Potassium Nitrite", Guid.NewGuid(), 1.9150, 4.1800, MaterialState.Liquid));
            mcat.Add(new MaterialType(null, "Sodium Carbonate", Guid.NewGuid(), 2.5330, 4.1800, MaterialState.Liquid));
            mcat.Add(new MaterialType(null, "Pot. Permanganate", Guid.NewGuid(), 2.7000, 4.1800, MaterialState.Liquid));
            mcat.Add(new MaterialType(null, "Bromine", Guid.NewGuid(), 3.1200, 4.1800, MaterialState.Liquid));
            mcat.Add(new MaterialType(null, "Sulfuric Acid", Guid.NewGuid(), 1.8420, 4.1800, MaterialState.Liquid));

            mcat.Add(new MaterialType(null, "Methanol", Guid.NewGuid(), 0.7920, 4.1800, MaterialState.Liquid, 32));
            mcat.Add(new MaterialType(null, "Methylene Chloride", Guid.NewGuid(), 2.15, 4.1800, MaterialState.Liquid, 85));
            mcat.Add(new MaterialType(null, "Water", Guid.NewGuid(), 1.0000, 4.1800, MaterialState.Liquid));

            mcat["Methanol"].SetAntoinesCoefficients3(7.879, 1473.1, 230, PressureUnits.mmHg, TemperatureUnits.Celsius);
            mcat["Methylene Chloride"].SetAntoinesCoefficients3(7.263, 1222.7, 238.4, PressureUnits.mmHg, TemperatureUnits.Celsius);
            mcat["Water"].SetAntoinesCoefficients3(8.040, 1715.1, 232.4, PressureUnits.mmHg, TemperatureUnits.Celsius);

            Debug.WriteLine(" ... sample substances loaded.");
            return(mcat);
        }
            private void Initialize(BasicReactionSupporter brs)
            {
                MaterialCatalog   mcat = brs.MyMaterialCatalog;
                ReactionProcessor rp   = brs.MyReactionProcessor;

                //                        Model  Name    Guid           SpecGrav SpecHeat
                mcat.Add(new MaterialType(null, "Water", Guid.NewGuid(), 1.0000, 4.1800, MaterialState.Liquid));
                mcat.Add(new MaterialType(null, "Hydrochloric Acid", Guid.NewGuid(), 1.1890, 2.5500, MaterialState.Liquid));
                mcat.Add(new MaterialType(null, "Caustic Soda", Guid.NewGuid(), 2.0000, 4.1800, MaterialState.Liquid));
                mcat.Add(new MaterialType(null, "Sodium Chloride", Guid.NewGuid(), 2.1650, 4.1800, MaterialState.Liquid));
                mcat.Add(new MaterialType(null, "Sulfuric Acid 98%", Guid.NewGuid(), 1.8420, 4.1800, MaterialState.Liquid));
                mcat.Add(new MaterialType(null, "Potassium Hydroxide", Guid.NewGuid(), 1.3000, 4.1800, MaterialState.Liquid));
                mcat.Add(new MaterialType(null, "Potassium Sulfate", Guid.NewGuid(), 1.0000, 4.1800, MaterialState.Liquid));
                mcat.Add(new MaterialType(null, "Nitrous Acid", Guid.NewGuid(), 1.0000, 4.1800, MaterialState.Liquid));
                mcat.Add(new MaterialType(null, "Sodium Nitrite", Guid.NewGuid(), 2.3800, 4.1800, MaterialState.Liquid));
                mcat.Add(new MaterialType(null, "Potassium Nitrite", Guid.NewGuid(), 1.9150, 4.1800, MaterialState.Liquid));
                mcat.Add(new MaterialType(null, "Aluminum Hydroxide", Guid.NewGuid(), 1.0000, 4.1800, MaterialState.Liquid));
                mcat.Add(new MaterialType(null, "Ammonia", Guid.NewGuid(), 1.0000, 4.1800, MaterialState.Liquid));
                mcat.Add(new MaterialType(null, "Ammonium Hydroxide", Guid.NewGuid(), 1.0000, 4.1800, MaterialState.Liquid));
                mcat.Add(new MaterialType(null, "Bromine", Guid.NewGuid(), 3.1200, 4.1800, MaterialState.Liquid));

                Reaction r1 = new Reaction(null, "Reaction 1", Guid.NewGuid());

                r1.AddReactant(mcat["Caustic Soda"], 0.5231);
                r1.AddReactant(mcat["Hydrochloric Acid"], 0.4769);
                r1.AddProduct(mcat["Water"], 0.2356);
                r1.AddProduct(mcat["Sodium Chloride"], 0.7644);
                rp.AddReaction(r1);

                Reaction r2 = new Reaction(null, "Reaction 2", Guid.NewGuid());

                r2.AddReactant(mcat["Sulfuric Acid 98%"], 0.533622);
                r2.AddReactant(mcat["Potassium Hydroxide"], 0.466378);
                r2.AddProduct(mcat["Water"], 0.171333);
                r2.AddProduct(mcat["Potassium Sulfate"], 0.828667);
                rp.AddReaction(r2);

                Reaction r3 = new Reaction(null, "Reaction 3", Guid.NewGuid());

                r3.AddReactant(mcat["Caustic Soda"], 0.459681368);
                r3.AddReactant(mcat["Nitrous Acid"], 0.540318632);
                r3.AddProduct(mcat["Water"], 0.207047552);
                r3.AddProduct(mcat["Sodium Nitrite"], 0.792952448);
                rp.AddReaction(r3);

                Reaction r4 = new Reaction(null, "Reaction 4", Guid.NewGuid());

                r4.AddReactant(mcat["Potassium Hydroxide"], 0.544102);
                r4.AddReactant(mcat["Nitrous Acid"], 0.455898);
                r4.AddProduct(mcat["Water"], 0.174698);
                r4.AddProduct(mcat["Potassium Nitrite"], 0.825302);
                rp.AddReaction(r4);
            }
Beispiel #3
0
    void Awake()
    {
        if (instance == null)
        {
            instance = this;
            //DontDestroyOnLoad(gameObject);
        }
        else
        {
            Debug.LogWarning("[MaterialCatalog.cs] - Multiple MaterialCatalog(s) found!");
            Destroy(gameObject);
        }

        materials = Resources.LoadAll <Material>("Materials").OfType <Material>().ToList();
        // Debug.Log("[MaterialCatalog.cs] - " + materials);
    }
        /// <summary>
        /// Loads the material catalog in the model with sample materials.
        /// </summary>
        /// <param name="mcat">the Material Catalog to be initialized.</param>
        private static void LoadSampleCatalog(MaterialCatalog mcat)
        {
            mcat.Add(new MaterialType(null, "Ethyl Acetate", Guid.NewGuid(), 0.9020, 1.9230, MaterialState.Liquid));
            mcat.Add(new MaterialType(null, "Hydrochloric Acid", Guid.NewGuid(), 1.1890, 2.5500, MaterialState.Liquid));
            mcat.Add(new MaterialType(null, "Ethanol", Guid.NewGuid(), 0.8110, 3.0000, MaterialState.Liquid));
            mcat.Add(new MaterialType(null, "Hexane", Guid.NewGuid(), 0.6700, 4.1800, MaterialState.Liquid));
            mcat.Add(new MaterialType(null, "Triethylamine", Guid.NewGuid(), 0.7290, 4.1800, MaterialState.Liquid));
            mcat.Add(new MaterialType(null, "MTBE", Guid.NewGuid(), 0.7400, 4.1800, MaterialState.Liquid));
            mcat.Add(new MaterialType(null, "Isopropyl Alcohol", Guid.NewGuid(), 0.7860, 4.1800, MaterialState.Liquid));
            mcat.Add(new MaterialType(null, "Acetone", Guid.NewGuid(), 0.7899, 4.1800, MaterialState.Liquid));
            mcat.Add(new MaterialType(null, "Methanol", Guid.NewGuid(), 0.7920, 4.1800, MaterialState.Liquid));
            mcat.Add(new MaterialType(null, "Propyl Alcohol", Guid.NewGuid(), 0.8035, 4.1800, MaterialState.Liquid));
            mcat.Add(new MaterialType(null, "Butanol", Guid.NewGuid(), 0.8100, 4.1800, MaterialState.Liquid));
            mcat.Add(new MaterialType(null, "Aluminum Hydroxide", Guid.NewGuid(), 1.0000, 4.1800, MaterialState.Liquid));
            mcat.Add(new MaterialType(null, "Ammonia", Guid.NewGuid(), 1.0000, 4.1800, MaterialState.Liquid));
            mcat.Add(new MaterialType(null, "Ammonium Hydroxide", Guid.NewGuid(), 1.0000, 4.1800, MaterialState.Liquid));
            mcat.Add(new MaterialType(null, "Carbon Dioxide", Guid.NewGuid(), 1.0000, 4.1800, MaterialState.Liquid));
            mcat.Add(new MaterialType(null, "Manganese Sulfate", Guid.NewGuid(), 1.0000, 4.1800, MaterialState.Liquid));
            mcat.Add(new MaterialType(null, "Nitrous Acid", Guid.NewGuid(), 1.0000, 4.1800, MaterialState.Liquid));
            mcat.Add(new MaterialType(null, "Potassium Phosphate", Guid.NewGuid(), 1.0000, 4.1800, MaterialState.Liquid));
            mcat.Add(new MaterialType(null, "Potassium Sulfate", Guid.NewGuid(), 1.0000, 4.1800, MaterialState.Liquid));
            mcat.Add(new MaterialType(null, "Sodium Sulfate", Guid.NewGuid(), 1.0000, 4.1800, MaterialState.Liquid));
            mcat.Add(new MaterialType(null, "Water", Guid.NewGuid(), 1.0000, 4.1800, MaterialState.Liquid));
            mcat.Add(new MaterialType(null, "Manganese Dioxide", Guid.NewGuid(), 1.3000, 4.1800, MaterialState.Liquid));
            mcat.Add(new MaterialType(null, "Potassium Hydroxide", Guid.NewGuid(), 1.3000, 4.1800, MaterialState.Liquid));
            mcat.Add(new MaterialType(null, "Sodium Bromide", Guid.NewGuid(), 1.3000, 4.1800, MaterialState.Liquid));
            mcat.Add(new MaterialType(null, "Sodium Bisulfite", Guid.NewGuid(), 1.4800, 4.1800, MaterialState.Liquid));
            mcat.Add(new MaterialType(null, "Titanium Dioxide", Guid.NewGuid(), 1.5000, 4.1800, MaterialState.Liquid));
            mcat.Add(new MaterialType(null, "Titanium Tetrachloride", Guid.NewGuid(), 1.5000, 4.1800, MaterialState.Liquid));
            mcat.Add(new MaterialType(null, "Sodium Nitrate", Guid.NewGuid(), 1.6000, 4.1800, MaterialState.Liquid));
            mcat.Add(new MaterialType(null, "Phosphoric Acid", Guid.NewGuid(), 1.6850, 4.1800, MaterialState.Liquid));
            mcat.Add(new MaterialType(null, "Sodium Sulfide", Guid.NewGuid(), 1.8580, 4.1800, MaterialState.Liquid));
            mcat.Add(new MaterialType(null, "Caustic Soda", Guid.NewGuid(), 2.0000, 4.1800, MaterialState.Liquid));
            mcat.Add(new MaterialType(null, "Sodium Chloride", Guid.NewGuid(), 2.1650, 4.1800, MaterialState.Liquid));
            mcat.Add(new MaterialType(null, "Sodium Bicarbonate", Guid.NewGuid(), 2.2000, 4.1800, MaterialState.Liquid));
            mcat.Add(new MaterialType(null, "Sodium Nitrite", Guid.NewGuid(), 2.3800, 4.1800, MaterialState.Liquid));
            mcat.Add(new MaterialType(null, "Potassium Nitrite", Guid.NewGuid(), 1.9150, 4.1800, MaterialState.Liquid));
            mcat.Add(new MaterialType(null, "Sodium Carbonate", Guid.NewGuid(), 2.5330, 4.1800, MaterialState.Liquid));
            mcat.Add(new MaterialType(null, "Pot. Permanganate", Guid.NewGuid(), 2.7000, 4.1800, MaterialState.Liquid));
            mcat.Add(new MaterialType(null, "Bromine", Guid.NewGuid(), 3.1200, 4.1800, MaterialState.Liquid));
            mcat.Add(new MaterialType(null, "Sulfuric Acid", Guid.NewGuid(), 1.8420, 4.1800, MaterialState.Liquid));

            _Debug.WriteLine(" ... sample substances loaded.");
        }
Beispiel #5
0
        public void TestChargeWithSufficientSupply()
        {
            Model model = new Model("Test Model", Guid.NewGuid());

            MaterialCatalog mcat = LoadSampleCatalog();

            MaterialService source = new MaterialService(model, "Sorc", Guid.NewGuid(), 3, 100, mcat, 37.0);

            source.AddCompartment(model, mcat["Ammonia"].Guid, 1500, 17, 2000, Guid.NewGuid());

            MaterialService sink = new MaterialService(model, "Sink", Guid.NewGuid(), 3, 100, mcat, 37.0);

            sink.AutocreateMaterialCompartments = true;

            TestClient tc = new TestClient(model, source, sink, mcat["Ammonia"], 1000, mcat["Ammonia"], 750);

            model.Executive.RequestEvent(
                new ExecEventReceiver(tc.Run),
                new DateTime(2009, 2, 16, 12, 59, 28), 0.0, new Hashtable(), ExecEventType.Detachable);

            model.Start();
        }