Ejemplo n.º 1
0
        public override void SetObjectData()
        {
            base.SetObjectData();
            int persistedClassVersion = info.GetInt32("ClassPersistenceVersionSubstance");

            this.name          = info.GetString("Name");
            this.molarWeight   = info.GetDouble("MolarWeight");
            this.isUserDefined = info.GetBoolean("IsUserDefined");
            this.type          = (SubstanceType)info.GetValue("Type", typeof(SubstanceType));
            //this.casRegistryNo = (int)info.GetValue("CasRegistryNo", typeof(int));
            //this.formula = (string)info.GetValue("Formula", typeof(string));
            //this.propsAndCoeffs = info.GetValue("PropsAndCoeffs", typeof(ThermalPropsAndCoeffs)) as ThermalPropsAndCoeffs;
            //this.criticalProps = info.GetValue("CriticalProps", typeof(CriticalProperties)) as CriticalProperties;
            if (persistedClassVersion == 1)
            {
                int casNo = info.GetInt32("CasRegistryNo");
                this.casRegistryNo = casNo.ToString();
            }

            if (persistedClassVersion >= 2)
            {
                this.casRegistryNo = info.GetString("CasRegistryNo");
                //this.htmlTaggedName = info.GetString("HtmlTaggedName");
                this.formula = (SubstanceFormula)RecallStorableObject("Formula", typeof(SubstanceFormula));
                this.criticalPropsAndAcentricFactor = (CriticalPropsAndAcentricFactor)RecallStorableObject("CriticalPropsAndAcentricFactor", typeof(CriticalPropsAndAcentricFactor));
            }
        }
Ejemplo n.º 2
0
 public Substance(string name, SubstanceType type, string casNo, SubstanceFormula formula, double molWt,
       CriticalPropsAndAcentricFactor criticalPropsAndAcentricFactor) {
    this.name = name;
    //htmlTaggedName = null;
    this.type = type;
    this.casRegistryNo = casNo;
    this.formula = formula;
    this.molarWeight = molWt;
    this.IsUserDefined = false;
    this.criticalPropsAndAcentricFactor = criticalPropsAndAcentricFactor;
 }
Ejemplo n.º 3
0
        private void InitializeCatalog()
        {
            SubstanceFormula formula = new SubstanceFormula();

            formula.AddElement(Substance.AIR, 1);
            //from Perry
            CriticalPropsAndAcentricFactor criticalProps = new CriticalPropsAndAcentricFactor(132.45, 3.79e6, 0.092, 0.318, 0.0);
            Substance substanceAir = new Substance(Substance.AIR, SubstanceType.Inorganic, "132259-10-0", formula, 28.951, criticalProps);

            allSubstanceList.Add(substanceAir);

            foreach (Substance s in recalledSubstanceList)
            {
                allSubstanceList.Add(s);
            }
            //Air-xxx systems
            //gasSubstanceList.Add(substanceAir);

            moistureSubstanceListForAir = new List <Substance>();

            CreateAirMoistureSubstanceList();

            //NItrogne-xxx systems
            //Substance substanceNitrogen = sc.GetSubstance("nitrogen");
            //gasSubstanceList.Add(substanceNitrogen);

            CreateNitrogenMoistureSubstanceList();

            //CreateGenericFoodSubstance("Dry Material", SubstanceType.Unknown);
            genericSubstance = new Substance("Generic Substance", SubstanceType.Unknown, false);
            allSubstanceList.Add(genericSubstance);

            CreateGenericFoodSubstanceList();

            CreateGenericFuelSubstanceList();

            CreateFuelSubstanceList();
        }
Ejemplo n.º 4
0
        private void InitializeCatalog()
        {
            SubstanceFormula formula = new SubstanceFormula();

            formula.AddElement("Air", 1);
            //from Perry
            CriticalPropsAndAcentricFactor criticalProps = new CriticalPropsAndAcentricFactor(132.45, 3.79e6, 0.092, 0.318, 0.0);
            Substance substanceAir = new Substance("Air", SubstanceType.Inorganic, "132259-10-0", formula, 28.951, criticalProps);

            allSubstanceList.Add(substanceAir);

            foreach (Substance s in recalledSubstanceList)
            {
                allSubstanceList.Add(s);
            }
            //Air-xxx systems
            //gasSubstanceList.Add(substanceAir);

            moistureSubstanceListForAir = new List <Substance>();

            moistureSubstanceListForAir.Add(GetSubstance("water"));
            moistureSubstanceListForAir.Add(GetSubstance("carbon tetrachloride"));
            //moistureSubstanceListForAir.Add(GetSubstance("tetrachloromethane"));
            moistureSubstanceListForAir.Add(GetSubstance("benzene"));
            moistureSubstanceListForAir.Add(GetSubstance("toluene"));
            moistureSubstanceListForAir.Add(GetSubstance("ethanol"));

            //NItrogne-xxx systems
            //Substance substanceNitrogen = sc.GetSubstance("nitrogen");
            //gasSubstanceList.Add(substanceNitrogen);

            moistureSubstanceListForNitrogen = new List <Substance>();;
            moistureSubstanceListForNitrogen.Add(GetSubstance("acetone"));
            moistureSubstanceListForNitrogen.Add(GetSubstance("methanol"));
            moistureSubstanceListForNitrogen.Add(GetSubstance("ethanol"));
            moistureSubstanceListForNitrogen.Add(GetSubstance("n-propanol"));
            moistureSubstanceListForNitrogen.Add(GetSubstance("isopropanol"));
            moistureSubstanceListForNitrogen.Add(GetSubstance("n-butanol"));
            moistureSubstanceListForNitrogen.Add(GetSubstance("isobutanol"));

            //CreateGenericFoodSubstance("Dry Material", SubstanceType.Unknown);
            genericSubstance = new Substance("Generic Substance", SubstanceType.Unknown, false);
            allSubstanceList.Add(genericSubstance);

            CreateGenericFoodSubstance("Carbohydrate", SubstanceType.Organic);
            CreateGenericFoodSubstance("Ash", SubstanceType.Organic);
            CreateGenericFoodSubstance("Fiber", SubstanceType.Organic);
            CreateGenericFoodSubstance("Fat", SubstanceType.Organic);
            CreateGenericFoodSubstance("Protein", SubstanceType.Organic);

            genericFuelSubstanceList.Add(GetSubstance("carbon"));
            genericFuelSubstanceList.Add(GetSubstance("hydrogen"));
            genericFuelSubstanceList.Add(GetSubstance("oxygen"));
            genericFuelSubstanceList.Add(GetSubstance("sulfur"));

            naturalGasSubstanceList.Add(GetSubstance("methane"));
            naturalGasSubstanceList.Add(GetSubstance("ethane"));
            naturalGasSubstanceList.Add(GetSubstance("propane"));
            naturalGasSubstanceList.Add(GetSubstance("n-butane"));
            naturalGasSubstanceList.Add(GetSubstance("carbon dioxide"));
            naturalGasSubstanceList.Add(GetSubstance("oxygen"));
            naturalGasSubstanceList.Add(GetSubstance("nitrogen"));
            naturalGasSubstanceList.Add(GetSubstance("hydrogen sulfide"));
            naturalGasSubstanceList.Add(GetSubstance("n-pentane"));
            naturalGasSubstanceList.Add(GetSubstance("n-hexane"));
        }
Ejemplo n.º 5
0
        private static void InitializeCatalog()
        {
            SubstanceFormula formula = new SubstanceFormula();

            formula.AddElement(Substance.AIR, 1);
            //from Perry
            CriticalPropsAndAcentricFactor criticalProps = new CriticalPropsAndAcentricFactor(132.45, 3.79e6, 0.092, 0.318, 0.0);
            Substance substanceAir = new Substance(Substance.AIR, SubstanceType.Inorganic, "132259-10-0", formula, 28.951, criticalProps);

            allSubstanceList.Add(substanceAir);

            foreach (Substance s in recalledSubstanceList)
            {
                allSubstanceList.Add(s);
            }
            //Air-xxx systems
            //gasSubstanceList.Add(substanceAir);

            moistureSubstanceListForAir = new List <Substance>();

            moistureSubstanceListForAir.Add(GetSubstance(Substance.WATER));
            moistureSubstanceListForAir.Add(GetSubstance(Substance.CARBON_TETRACHLORIDE));
            //moistureSubstanceListForAir.Add(GetSubstance("tetrachloromethane"));
            moistureSubstanceListForAir.Add(GetSubstance(Substance.BENZENE));
            moistureSubstanceListForAir.Add(GetSubstance(Substance.TOLUENE));
            moistureSubstanceListForAir.Add(GetSubstance(Substance.ETHANOL));
            moistureSubstanceListForAir.Add(GetSubstance(Substance.ACETIC_ACID));

            //NItrogne-xxx systems
            //Substance substanceNitrogen = sc.GetSubstance("nitrogen");
            //gasSubstanceList.Add(substanceNitrogen);

            moistureSubstanceListForNitrogen = new List <Substance>();;
            moistureSubstanceListForNitrogen.Add(GetSubstance(Substance.ACETONE));
            moistureSubstanceListForNitrogen.Add(GetSubstance(Substance.METHANOL));
            moistureSubstanceListForNitrogen.Add(GetSubstance(Substance.ETHANOL));
            moistureSubstanceListForNitrogen.Add(GetSubstance(Substance.N_PROPANOL));
            moistureSubstanceListForNitrogen.Add(GetSubstance(Substance.ISO_PROPANOL));
            moistureSubstanceListForNitrogen.Add(GetSubstance(Substance.N_BUTANOL));
            moistureSubstanceListForNitrogen.Add(GetSubstance(Substance.ISO_BUTANOL));
            moistureSubstanceListForNitrogen.Add(GetSubstance(Substance.ACETIC_ACID));

            //CreateGenericFoodSubstance("Dry Material", SubstanceType.Unknown);
            genericSubstance = new Substance("Generic Substance", SubstanceType.Unknown, false);
            allSubstanceList.Add(genericSubstance);

            CreateGenericFoodSubstance("Carbohydrate", SubstanceType.Organic);
            CreateGenericFoodSubstance("Ash", SubstanceType.Organic);
            CreateGenericFoodSubstance("Fiber", SubstanceType.Organic);
            CreateGenericFoodSubstance("Fat", SubstanceType.Organic);
            CreateGenericFoodSubstance("Protein", SubstanceType.Organic);

            genericFuelSubstanceList.Add(GetSubstance(Substance.CARBON));
            genericFuelSubstanceList.Add(GetSubstance(Substance.HYDROGEN));
            genericFuelSubstanceList.Add(GetSubstance(Substance.OXYGEN));
            genericFuelSubstanceList.Add(GetSubstance(Substance.SULFUR));

            naturalGasSubstanceList.Add(GetSubstance("methane"));
            naturalGasSubstanceList.Add(GetSubstance("ethane"));
            naturalGasSubstanceList.Add(GetSubstance("propane"));
            naturalGasSubstanceList.Add(GetSubstance("n-butane"));
            naturalGasSubstanceList.Add(GetSubstance(Substance.CARBON_DIOXIDE));
            naturalGasSubstanceList.Add(GetSubstance(Substance.OXYGEN));
            naturalGasSubstanceList.Add(GetSubstance(Substance.NITROGEN));
            naturalGasSubstanceList.Add(GetSubstance("hydrogen sulfide"));
            naturalGasSubstanceList.Add(GetSubstance("n-pentane"));
            naturalGasSubstanceList.Add(GetSubstance("n-hexane"));
        }