Example #1
0
        /// <summary>
        /// Retrieve the temperature dependent function for a given property id
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public PropertyFunction GetFunction(EvaluatedProperties id)
        {
            var function = Functions.FirstOrDefault(c => c.Property == id);

            if (function != null)
            {
                return(function);
            }
            else
            {
                throw new ArgumentException("Property function ID not found");
            }
        }
Example #2
0
        public string GetVariableNameForProperty(EvaluatedProperties id)
        {
            switch (id)
            {
            case EvaluatedProperties.HeatOfVaporization:
                return("HVAP");

            case EvaluatedProperties.IdealGasHeatCapacity:
                return("CPID");

            case EvaluatedProperties.LiquidDensity:
                return("DENL");

            case EvaluatedProperties.LiquidHeatCapacity:
                return("CL");

            case EvaluatedProperties.LiquidHeatConductivity:
                return("KLIQ");

            case EvaluatedProperties.SurfaceTension:
                return("ST");

            case EvaluatedProperties.VaporHeatConductivity:
                return("KVAP");

            case EvaluatedProperties.VaporViscosity:
                return("VISV");

            case EvaluatedProperties.LiquidViscosity:
                return("VISL");

            case EvaluatedProperties.VaporPressure:
                return("VP");

            default:
                throw new InvalidOperationException("Unknown property type");
            }
        }
Example #3
0
        PropertyFunction GetFunction(XElement xElement, EvaluatedProperties prop)
        {
            if (xElement == null)
            {
                throw new ArgumentException("xElement was null");
            }
            var uom   = ParseUOM((string)xElement.Attribute("units"));
            var tfunc = new PropertyFunction()
            {
                Type     = GetFunctionType((int)xElement.Element("eqno").Attribute("value")),
                Property = prop,
                MinimumX = GetVariable(xElement.Element("Tmin"), "Tmin"),
                MaximumX = GetVariable(xElement.Element("Tmax"), "Tmax"),
                XUnit    = GetVariable(xElement.Element("Tmax"), "Tmax").InternalUnit,
                YUnit    = uom
            };

            var a = xElement.Element("A");

            if (a != null)
            {
                tfunc.Coefficients.Add(new Variable("A", (double)a.Attribute("value"))
                {
                    IsConstant = true, IsFixed = true
                });
            }
            var b = xElement.Element("B");

            if (b != null)
            {
                tfunc.Coefficients.Add(new Variable("B", (double)b.Attribute("value"))
                {
                    IsConstant = true, IsFixed = true
                });
            }
            var c = xElement.Element("C");

            if (c != null)
            {
                tfunc.Coefficients.Add(new Variable("C", (double)c.Attribute("value"))
                {
                    IsConstant = true, IsFixed = true
                });
            }
            var d = xElement.Element("D");

            if (d != null)
            {
                tfunc.Coefficients.Add(new Variable("D", (double)d.Attribute("value"))
                {
                    IsConstant = true, IsFixed = true
                });
            }
            var e = xElement.Element("E");

            if (e != null)
            {
                tfunc.Coefficients.Add(new Variable("E", (double)e.Attribute("value"))
                {
                    IsConstant = true, IsFixed = true
                });
            }

            return(tfunc);
        }