Ejemplo n.º 1
0
        public Variable GetLiquidDensityExpression(ThermodynamicSystem system, MolecularComponent comp, Variable T, Variable p)
        {
            var func       = comp.GetFunction(EvaluatedProperties.LiquidDensity);
            var TC         = comp.GetConstant(ConstantProperties.CriticalTemperature);
            var expression = system.CorrelationFactory.CreateExpression(func.Type, func, T, TC, null);

            expression *= Unit.GetConversionFactor(func.YUnit, system.VariableFactory.Internal.UnitDictionary[PhysicalDimension.MolarDensity]);

            var expresssionDENV = GetVaporDensityExpression(system, comp, T, p);

            Variable prop = new Variable(system.CorrelationFactory.GetVariableNameForProperty(func.Property) + "(" + T.FullName + ")", 1);

            prop.LowerBound = 1e-6;
            prop.UpperBound = 1e8;
            prop.Subscript  = comp.ID;
            prop.BindTo(new SafeLiquidDensity(expression, expresssionDENV));
            //prop.BindTo(expression);
            return(prop);
        }
Ejemplo n.º 2
0
        public Expression GetLiquidHeatCapacityExpression(ThermodynamicSystem system, MolecularComponent comp, Variable T)
        {
            var func = comp.GetFunction(EvaluatedProperties.LiquidHeatCapacity);

            var expr = system.CorrelationFactory.CreateExpression(func.Type, func, T, comp.GetConstant(ConstantProperties.CriticalTemperature), comp.GetConstant(ConstantProperties.CriticalPressure));

            expr *= Unit.GetConversionFactor(func.YUnit, system.VariableFactory.Internal.UnitDictionary[PhysicalDimension.HeatCapacity]);

            Variable prop = new Variable(system.CorrelationFactory.GetVariableNameForProperty(func.Property) + "(" + T.FullName + ")", 1);

            prop.Subscript = comp.ID;
            prop.BindTo(expr);
            return(prop);
        }
Ejemplo n.º 3
0
        public Variable GetVaporPressure(ThermodynamicSystem system, MolecularComponent comp, Variable T)
        {
            var func = comp.GetFunction(EvaluatedProperties.VaporPressure);

            var expr = system.CorrelationFactory.CreateExpression(func.Type, func, T, comp.GetConstant(ConstantProperties.CriticalTemperature), comp.GetConstant(ConstantProperties.CriticalPressure));

            expr *= Unit.GetConversionFactor(func.YUnit, system.VariableFactory.Internal.UnitDictionary[PhysicalDimension.Pressure]);

            //var exprmax = system.CorrelationFactory.CreateExpression(func.Type, func, comp.GetConstant(ConstantProperties.CriticalTemperature), comp.GetConstant(ConstantProperties.CriticalTemperature), comp.GetConstant(ConstantProperties.CriticalPressure));
            //var maxVal = exprmax.Eval(new Evaluator());


            Variable prop = new Variable(system.CorrelationFactory.GetVariableNameForProperty(func.Property) + "(" + T.FullName + ")", 1);

            prop.Subscript = comp.ID;
            // prop.UpperBound = 1e9;
            prop.BindTo(expr);
            return(prop);
        }