Beispiel #1
0
 /// <summary>
 /// Creates a new instance of this class.
 /// </summary>
 public ReactionDefinitionException(Reaction reaction) : base(string.Format("{0} is not valid.", reaction.ToString()))
 {
     m_reaction = reaction;
 }
Beispiel #2
0
 /// <summary>
 /// Creates a new instance of this class with a specific message.
 /// </summary>
 /// <param name="message">The exception message.</param>
 /// <param name="reaction">The reaction.</param>
 public ReactionDefinitionException(string message, Reaction reaction) : base(message)
 {
     m_reaction = reaction;
 }
Beispiel #3
0
        private void Initialize(BasicReactionSupporter brs)
        {
            MaterialCatalog   mcat = brs.MyMaterialCatalog;
            ReactionProcessor rp   = brs.MyReactionProcessor;

            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));
            mcat.Add(new MaterialType(null, "Palladium", Guid.NewGuid(), 3.1200, 4.1800, MaterialState.Liquid));
            mcat.Add(new MaterialType(null, "Hydrogen", Guid.NewGuid(), 3.1200, 4.1800, MaterialState.Liquid));
            mcat.Add(new MaterialType(null, "Oil", Guid.NewGuid(), 3.1200, 4.1800, MaterialState.Liquid));
            mcat.Add(new MaterialType(null, "Hydrogenated Oil", 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);

            Reaction r5 = new Reaction(null, "Reaction 5", Guid.NewGuid());

            r5.AddReactant(mcat["Palladium"], 1);
            r5.AddReactant(mcat["Hydrogen"], 1);
            r5.AddReactant(mcat["Oil"], 1);
            r5.AddProduct(mcat["Hydrogenated Oil"], 2);
            r5.AddProduct(mcat["Palladium"], 1);
            rp.AddReaction(r5);
        }