internal override double GetGasThermalConductivity(double temperature) { DryingMaterialComponents dmc = MaterialComponents; ArrayList compList = new ArrayList(); compList.Add(dmc.Moisture); return(materialPropCalculator.GetGasThermalConductivity(compList, temperature)); }
internal override double GetLiquidViscosity(double temperature) { DryingMaterialComponents dmc = MaterialComponents; ArrayList compList = new ArrayList(); compList.Add(dmc.Moisture); return(MaterialPropCalculator.GetLiquidViscosity(compList, temperature)); }
internal override double GetLiquidDensity(double temperature) { DryingMaterialComponents dmc = MaterialComponents; Substance s = dmc.Moisture.Substance; double molarWt = s.MolarWeight; double densityValue = Constants.NO_VALUE; if (density.IsSpecifiedAndHasValue) { densityValue = density.Value; } else if (massConcentration.Value <= TOLERANCE && pressure.HasValue) { densityValue = MoistureProperties.GetDensity(pressure.Value, temperature); } return(densityValue); }
//protected override bool IsSolveReady() { // if (HasSolvedAlready) { // return false; // } // bool retValue = false; // if ((moistureContentDryBase.HasValue && !moistureContentWetBase.IsSpecifiedAndHasValue) // || (moistureContentWetBase.HasValue && !moistureContentDryBase.IsSpecifiedAndHasValue) // || concentration.HasValue && (!moistureContentDryBase.IsSpecifiedAndHasValue || !moistureContentWetBase.IsSpecifiedAndHasValue)) { // retValue = true; // } // if (moistureContentDryBase.HasValue || moistureContentWetBase.HasValue || concentration.HasValue) { // if ((specificHeatDryBase.HasValue && !specificHeat.IsSpecifiedAndHasValue) // || (specificHeat.HasValue && !specificHeatDryBase.IsSpecifiedAndHasValue)) { // retValue = true; // } // if ((massFlowRateDryBase.HasValue && !massFlowRate.IsSpecifiedAndHasValue) // || (massFlowRate.HasValue && !massFlowRateDryBase.IsSpecifiedAndHasValue)) { // retValue = true; // } // if ((massFlowRateDryBase.HasValue || massFlowRate.HasValue) // && (density.HasValue && !volumeFlowRate.IsSpecifiedAndHasValue)) { // retValue = true; // } // } // return retValue; //} public override void Execute(bool propagate) { if (HasSolvedAlready) { return; } if (moistureContentDryBase.HasValue && !moistureContentWetBase.IsSpecifiedAndHasValue) { Calculate(moistureContentWetBase, moistureContentDryBase.Value / (1.0 + moistureContentDryBase.Value)); } else if (moistureContentWetBase.HasValue && !moistureContentDryBase.IsSpecifiedAndHasValue) { if (moistureContentWetBase.Value != 1.0) { Calculate(moistureContentDryBase, moistureContentWetBase.Value / (1.0 - moistureContentWetBase.Value)); } else { Calculate(moistureContentDryBase, Constants.NO_VALUE); } } if (volumeFlowRate.IsSpecifiedAndHasValue && density.IsSpecifiedAndHasValue) { Calculate(massFlowRate, volumeFlowRate.Value * density.Value); } if (materialStateType == MaterialStateType.Liquid) { if (massConcentration.HasValue && massConcentration.Value > TOLERANCE) { if (!moistureContentDryBase.IsSpecifiedAndHasValue) { Calculate(moistureContentDryBase, (1.0 - massConcentration.Value) / massConcentration.Value); } if (!moistureContentWetBase.IsSpecifiedAndHasValue) { Calculate(moistureContentWetBase, 1.0 - massConcentration.Value); } } else if (massConcentration.HasValue && massConcentration.Value <= TOLERANCE) { Calculate(moistureContentDryBase, Constants.NO_VALUE); Calculate(moistureContentWetBase, 1.0); Calculate(massFlowRateDryBase, Constants.NO_VALUE); } else if (moistureContentDryBase.HasValue && !massConcentration.IsSpecifiedAndHasValue) { Calculate(massConcentration, 1.0 / (1.0 + moistureContentDryBase.Value)); } else if (moistureContentWetBase.HasValue && !massConcentration.IsSpecifiedAndHasValue) { Calculate(massConcentration, 1.0 - moistureContentWetBase.Value); } } if (moistureContentWetBase.HasValue) { DryingMaterialComponents dmc = MaterialComponents; dmc.Moisture.SetMassFractionValue(moistureContentWetBase.Value); dmc.AbsoluteDryMaterial.SetMassFractionValue(1.0 - moistureContentWetBase.Value); dmc.ComponentsFractionsChanged(); } //if it is a known meterial in the material database, specific heat can be calculated double moistureLiquidCp = MoistureProperties.GetSpecificHeatOfLiquid(); if (temperature.HasValue) { moistureLiquidCp = MoistureProperties.GetSpecificHeatOfLiquid(temperature.Value); } double cs = GetCpOfAbsoluteDryMaterial(); if (temperature.HasValue && moistureContentWetBase.HasValue) { double cp = CalculateCp(temperature.Value); if (cp != Constants.NO_VALUE) { Calculate(specificHeat, cp); if (moistureContentDryBase.HasValue) { Calculate(specificHeatDryBase, cp * (1.0 + moistureContentDryBase.Value)); } } else if (specificHeat.HasValue && moistureContentDryBase.HasValue) { Calculate(specificHeatDryBase, specificHeat.Value * (1.0 + moistureContentDryBase.Value)); } } //need this when temperature is not not known //else if (cs != Constants.NO_VALUE && moistureContentDryBase.HasValue && !specificHeat.IsSpecifiedAndHasValue) { else if (specificEnthalpy.HasValue && cs != Constants.NO_VALUE && moistureContentDryBase.HasValue && !specificHeat.IsSpecifiedAndHasValue) { double cpMaterialDryBase = cs + moistureContentDryBase.Value * moistureLiquidCp; Calculate(specificHeatDryBase, cpMaterialDryBase); Calculate(specificHeat, cpMaterialDryBase / (1.0 + moistureContentDryBase.Value)); } //else if (moistureContentWetBase.Value == 1.0 && !specificHeat.IsSpecifiedAndHasValue) { // Calculate(specificHeatDryBase, Constants.NO_VALUE); // if (temperature.HasValue && moistureContentWetBase.HasValue) { // moistureLiquidCp = CalculateCp(temperature.Value); // Calculate(specificHeat, moistureLiquidCp); // } //} if (materialStateType == MaterialStateType.Solid && specificHeat.HasValue) { if (temperature.HasValue) { //Calculate(specificEnthalpy, specificHeat.Value * (temperature.Value - 273.15)); CalculateEnthalpyFromTemperature(Constants.ONE_ATM, temperature.Value, moistureContentWetBase.Value); } else if (specificEnthalpy.HasValue && !temperature.IsSpecifiedAndHasValue) { //Calculate(temperature, specificEnthalpy.Value / specificHeat.Value + 273.15); double tValue = CalculateTemperatureFromEnthalpyForSolid(specificEnthalpy.Value, moistureContentWetBase.Value); Calculate(temperature, tValue); } } else if (materialStateType == MaterialStateType.Liquid && pressure.HasValue && moistureContentWetBase.HasValue) { if (massConcentration.Value > TOLERANCE) { if (specificEnthalpy.HasValue && !temperature.IsSpecifiedAndHasValue) { CalculateTemperatureFromEnthalpy(pressure.Value, specificEnthalpy.Value, moistureContentWetBase.Value); } else if (temperature.HasValue) { CalculateEnthalpyFromTemperature(pressure.Value, temperature.Value, moistureContentWetBase.Value); } else if (vaporFraction.HasValue) { CalculateEnthalpyFromVaporFraction(pressure.Value, vaporFraction.Value, moistureContentWetBase.Value); } } else { double h = Constants.NO_VALUE; if (specificEnthalpy.HasValue && !temperature.IsSpecifiedAndHasValue) { double t = MoistureProperties.GetTemperatureFromPressureAndEnthalpy(pressure.Value, specificEnthalpy.Value); Calculate(temperature, t); CalculateVaporFractionIfNeeded(); } else if (temperature.HasValue) { h = MoistureProperties.GetEnthalpyFromPressureAndTemperature(pressure.Value, temperature.Value); Calculate(specificEnthalpy, h); CalculateVaporFractionIfNeeded(); } else if (vaporFraction.HasValue) { double boilingPoint = MoistureProperties.GetSaturationTemperature(pressure.Value); h = MoistureProperties.GetEnthalpyFromPressureAndVaporFraction(pressure.Value, vaporFraction.Value); Calculate(temperature, boilingPoint); Calculate(specificEnthalpy, h); } //CalculateCpOfPureMoisture(); if (specificEnthalpy.HasValue) { CalculateCpOfPureMoisture(); } } } if (massFlowRateDryBase.HasValue && moistureContentDryBase.HasValue && !massFlowRate.IsSpecifiedAndHasValue) { Calculate(massFlowRate, massFlowRateDryBase.Value * (1.0 + moistureContentDryBase.Value)); } else if (massFlowRate.HasValue && moistureContentDryBase.HasValue && !massFlowRateDryBase.IsSpecifiedAndHasValue) { Calculate(massFlowRateDryBase, massFlowRate.Value / (1.0 + moistureContentDryBase.Value)); } if (temperature.HasValue && massConcentration.HasValue) { CalculateDensity(); } if (!volumeFlowRate.IsSpecifiedAndHasValue && massFlowRate.HasValue && density.HasValue) { Calculate(volumeFlowRate, massFlowRate.Value / density.Value); } if (materialStateType == MaterialStateType.Solid && temperature.HasValue && massFlowRate.HasValue && moistureContentWetBase.HasValue && specificHeat.HasValue && specificEnthalpy.HasValue) { solveState = SolveState.Solved; } else if (materialStateType == MaterialStateType.Liquid && pressure.HasValue && temperature.HasValue && massFlowRate.HasValue && moistureContentWetBase.HasValue && specificEnthalpy.HasValue && vaporFraction.HasValue) { solveState = SolveState.Solved; } AdjustVarsStates(); //if (HasSolvedAlready) { // DryingMaterialComponents dmc = MaterialComponents; // dmc.Moisture.SetMassFractionValue(moistureContentWetBase.Value); // dmc.AbsoluteDryMaterial.SetMassFractionValue(1.0 - moistureContentWetBase.Value); // dmc.ComponentsFractionsChanged(); //} OnSolveComplete(); }
//protected override bool IsSolveReady() { // if (HasSolvedAlready) { // return false; // } // bool retValue = false; // if ((moistureContentDryBase.HasValue && !moistureContentWetBase.IsSpecifiedAndHasValue) // || (moistureContentWetBase.HasValue && !moistureContentDryBase.IsSpecifiedAndHasValue) // || concentration.HasValue && (!moistureContentDryBase.IsSpecifiedAndHasValue || !moistureContentWetBase.IsSpecifiedAndHasValue)) { // retValue = true; // } // if (moistureContentDryBase.HasValue || moistureContentWetBase.HasValue || concentration.HasValue) { // if ((specificHeatDryBase.HasValue && !specificHeat.IsSpecifiedAndHasValue) // || (specificHeatAbsDry.HasValue && !specificHeat.IsSpecifiedAndHasValue) // || (specificHeat.HasValue && !specificHeatDryBase.IsSpecifiedAndHasValue)) { // retValue = true; // } // if ((massFlowRateDryBase.HasValue && !massFlowRate.IsSpecifiedAndHasValue) // || (massFlowRate.HasValue && !massFlowRateDryBase.IsSpecifiedAndHasValue)) { // retValue = true; // } // if ((massFlowRateDryBase.HasValue || massFlowRate.HasValue) // && (density.HasValue && !volumeFlowRate.IsSpecifiedAndHasValue)) { // retValue = true; // } // } // return retValue; //} public override void Execute(bool propagate) { if (HasSolvedAlready) { return; } if (moistureContentDryBase.HasValue && !moistureContentWetBase.IsSpecifiedAndHasValue) { Calculate(moistureContentWetBase, moistureContentDryBase.Value / (1.0 + moistureContentDryBase.Value)); } else if (moistureContentWetBase.HasValue && !moistureContentDryBase.IsSpecifiedAndHasValue) { if (moistureContentWetBase.Value != 1.0) { Calculate(moistureContentDryBase, moistureContentWetBase.Value / (1.0 - moistureContentWetBase.Value)); } else { Calculate(moistureContentDryBase, Constants.NO_VALUE); } } if (materialStateType == MaterialStateType.Liquid) { if (massConcentration.HasValue && massConcentration.Value > 1.0e-6) { if (!moistureContentDryBase.IsSpecifiedAndHasValue) { Calculate(moistureContentDryBase, (1.0 - massConcentration.Value) / massConcentration.Value); } if (!moistureContentWetBase.IsSpecifiedAndHasValue) { Calculate(moistureContentWetBase, 1.0 - massConcentration.Value); } } else if (massConcentration.HasValue && massConcentration.Value <= 1.0e-6) { Calculate(moistureContentDryBase, Constants.NO_VALUE); Calculate(moistureContentWetBase, 1.0); Calculate(massFlowRateDryBase, Constants.NO_VALUE); } else if (moistureContentDryBase.HasValue && !massConcentration.IsSpecifiedAndHasValue) { Calculate(massConcentration, 1.0 / (1.0 + moistureContentDryBase.Value)); } else if (moistureContentWetBase.HasValue && !massConcentration.IsSpecifiedAndHasValue) { Calculate(massConcentration, 1.0 - moistureContentWetBase.Value); } } if (moistureContentWetBase.HasValue) { DryingMaterialComponents dmc = MaterialComponents; dmc.Moisture.SetMassFractionValue(moistureContentWetBase.Value); dmc.AbsoluteDryMaterial.SetMassFractionValue(1.0 - moistureContentWetBase.Value); dmc.ComponentsFractionsChanged(); } //if it is a known meterial in the material database, specific heat can be calculated double moistureLiquidCp = MoistureProperties.GetSpecificHeatOfLiquid(); if (temperature.HasValue) { moistureLiquidCp = MoistureProperties.GetSpecificHeatOfLiquid(temperature.Value); } double cs = GetCpOfAbsoluteDryMaterial(); if (temperature.HasValue && moistureContentWetBase.HasValue) { double cp = CalculateCp(temperature.Value); if (cp != Constants.NO_VALUE) { Calculate(specificHeat, cp); if (moistureContentDryBase.HasValue) { Calculate(specificHeatDryBase, cp * (1.0 + moistureContentDryBase.Value)); } } else if (specificHeat.HasValue && moistureContentDryBase.HasValue) { Calculate(specificHeatDryBase, specificHeat.Value * (1.0 + moistureContentDryBase.Value)); } } //need this when temperature is not not known //else if (cs != Constants.NO_VALUE && moistureContentDryBase.HasValue && !specificHeat.IsSpecifiedAndHasValue) { else if (specificEnthalpy.HasValue && cs != Constants.NO_VALUE && moistureContentDryBase.HasValue && !specificHeat.IsSpecifiedAndHasValue) { double cpMaterialDryBase = cs + moistureContentDryBase.Value * moistureLiquidCp; Calculate(specificHeatDryBase, cpMaterialDryBase); Calculate(specificHeat, cpMaterialDryBase / (1.0 + moistureContentDryBase.Value)); } //else if (moistureContentWetBase.Value == 1.0 && !specificHeat.IsSpecifiedAndHasValue) { // Calculate(specificHeatDryBase, Constants.NO_VALUE); // if (temperature.HasValue && moistureContentWetBase.HasValue) { // moistureLiquidCp = CalculateCp(temperature.Value); // Calculate(specificHeat, moistureLiquidCp); // } //} if (materialStateType == MaterialStateType.Solid && specificHeat.HasValue) { if (temperature.HasValue) { //Calculate(specificEnthalpy, specificHeat.Value * (temperature.Value - 273.15)); CalculateEnthalpyFromTemperature(Constants.ONE_ATM, temperature.Value, moistureContentWetBase.Value); } else if (specificEnthalpy.HasValue && !temperature.IsSpecifiedAndHasValue) { //Calculate(temperature, specificEnthalpy.Value / specificHeat.Value + 273.15); double tValue = CalculateTemperatureFromEnthalpyForSolid(specificEnthalpy.Value, moistureContentWetBase.Value); Calculate(temperature, tValue); } } else if (materialStateType == MaterialStateType.Liquid && pressure.HasValue && moistureContentWetBase.HasValue) { if (massConcentration.Value > 1.0e-6) { if (specificEnthalpy.HasValue && !temperature.IsSpecifiedAndHasValue) { CalculateTemperatureFromEnthalpy(pressure.Value, specificEnthalpy.Value, moistureContentWetBase.Value); } else if (temperature.HasValue) { CalculateEnthalpyFromTemperature(pressure.Value, temperature.Value, moistureContentWetBase.Value); } else if (vaporFraction.HasValue) { CalculateEnthalpyFromVaporFraction(pressure.Value, vaporFraction.Value, moistureContentWetBase.Value); } } else { SteamTable steamTable = SteamTable.GetInstance(); SubstanceStatesAndProperties props; if (specificEnthalpy.HasValue && !temperature.IsSpecifiedAndHasValue) { try { props = steamTable.GetPropertiesFromPressureAndEnthalpy(pressure.Value, specificEnthalpy.Value); } catch (CalculationFailedException) { throw new CalculationFailedException("Calculation of temperature from pressure and enthalpy failed in " + this.name + "."); } Calculate(temperature, props.temperature); Calculate(vaporFraction, props.vaporFraction); } else if (temperature.HasValue) { try { props = steamTable.GetPropertiesFromPressureAndTemperature(pressure.Value, temperature.Value); } catch (CalculationFailedException) { throw new CalculationFailedException("Calculation of enthalpy from pressure and temperature failed in " + this.name + "."); } Calculate(specificEnthalpy, props.enthalpy); Calculate(vaporFraction, props.vaporFraction); } else if (vaporFraction.HasValue) { try { props = steamTable.GetPropertiesFromPressureAndVaporFraction(pressure.Value, vaporFraction.Value); } catch (CalculationFailedException) { throw new CalculationFailedException("Calculation of enthalpy from pressure and vapor fraction failed in " + this.name + "."); } Calculate(temperature, props.temperature); Calculate(specificEnthalpy, props.enthalpy); } CalculateCpOfPureMoisture(); } } if (massFlowRateDryBase.HasValue && moistureContentDryBase.HasValue && !massFlowRate.IsSpecifiedAndHasValue) { Calculate(massFlowRate, massFlowRateDryBase.Value * (1.0 + moistureContentDryBase.Value)); } else if (massFlowRate.HasValue && moistureContentDryBase.HasValue && !massFlowRateDryBase.IsSpecifiedAndHasValue) { Calculate(massFlowRateDryBase, massFlowRate.Value / (1.0 + moistureContentDryBase.Value)); } if (temperature.HasValue && massConcentration.HasValue) { CalculateDensity(); } if (massFlowRate.HasValue && density.HasValue) { Calculate(volumeFlowRate, massFlowRate.Value / density.Value); } if (materialStateType == MaterialStateType.Solid && temperature.HasValue && massFlowRate.HasValue && moistureContentWetBase.HasValue && specificHeat.HasValue && specificEnthalpy.HasValue) { currentSolveState = SolveState.Solved; } else if (materialStateType == MaterialStateType.Liquid && pressure.HasValue && temperature.HasValue && massFlowRate.HasValue && moistureContentWetBase.HasValue && specificEnthalpy.HasValue && vaporFraction.HasValue) { currentSolveState = SolveState.Solved; } AdjustVarsStates(); //if (HasSolvedAlready) { // DryingMaterialComponents dmc = MaterialComponents; // dmc.Moisture.SetMassFractionValue(moistureContentWetBase.Value); // dmc.AbsoluteDryMaterial.SetMassFractionValue(1.0 - moistureContentWetBase.Value); // dmc.ComponentsFractionsChanged(); //} OnSolveComplete(currentSolveState); }
// protected override bool IsSolveReady() { // if (HasSolvedAlready) { // return false; // } // // bool retValue = false; // // if ((moistureContentDryBase.HasValue && !moistureContentWetBase.IsSpecifiedAndHasValue) // || (moistureContentWetBase.HasValue && !moistureContentDryBase.IsSpecifiedAndHasValue) // || concentration.HasValue && (!moistureContentDryBase.IsSpecifiedAndHasValue || !moistureContentWetBase.IsSpecifiedAndHasValue)) { // retValue = true; // } // // if (moistureContentDryBase.HasValue || moistureContentWetBase.HasValue || concentration.HasValue) { // if ((specificHeatDryBase.HasValue && !specificHeat.IsSpecifiedAndHasValue) // || (specificHeatAbsDry.HasValue && !specificHeat.IsSpecifiedAndHasValue) // || (specificHeat.HasValue && !specificHeatDryBase.IsSpecifiedAndHasValue)) { // retValue = true; // } // // if((massFlowRateDryBase.HasValue && !massFlowRate.IsSpecifiedAndHasValue) // || (massFlowRate.HasValue && !massFlowRateDryBase.IsSpecifiedAndHasValue)) { // retValue = true; // } // // if((massFlowRateDryBase.HasValue || massFlowRate.HasValue) // && (density.HasValue && !volumeFlowRate.IsSpecifiedAndHasValue)) { // retValue = true; // } // } // // return retValue; // } public override void Execute(bool propagate) { if (HasSolvedAlready) { return; } if (moistureContentDryBase.HasValue && !moistureContentWetBase.IsSpecifiedAndHasValue) { Calculate(moistureContentWetBase, moistureContentDryBase.Value / (1.0 + moistureContentDryBase.Value)); } else if (moistureContentWetBase.HasValue && !moistureContentDryBase.IsSpecifiedAndHasValue) { if (moistureContentWetBase.Value != 1.0) { Calculate(moistureContentDryBase, moistureContentWetBase.Value / (1.0 - moistureContentWetBase.Value)); } else { Calculate(moistureContentDryBase, Constants.NO_VALUE); } } if (materialStateType == MaterialStateType.Liquid) { if (massConcentration.HasValue && massConcentration.Value > 1.0e-6) { if (!moistureContentDryBase.IsSpecifiedAndHasValue) { Calculate(moistureContentDryBase, (1.0 - massConcentration.Value) / massConcentration.Value); } if (!moistureContentWetBase.IsSpecifiedAndHasValue) { Calculate(moistureContentWetBase, 1.0 - massConcentration.Value); } } else if (massConcentration.HasValue && massConcentration.Value <= 1.0e-6) { Calculate(moistureContentDryBase, Constants.NO_VALUE); Calculate(moistureContentWetBase, 1.0); Calculate(massFlowRateDryBase, Constants.NO_VALUE); } else if (moistureContentDryBase.HasValue && !massConcentration.IsSpecifiedAndHasValue) { Calculate(massConcentration, 1.0 / (1.0 + moistureContentDryBase.Value)); } else if (moistureContentWetBase.HasValue && !massConcentration.IsSpecifiedAndHasValue) { Calculate(massConcentration, 1.0 - moistureContentWetBase.Value); } } //if it is a known meterial in the material database, specific heat can be calculated double moistureLiquidCp = Constants.NO_VALUE; if (temperature.HasValue && moistureContentWetBase.HasValue) { double cp = CalculateCp(temperature.Value); moistureLiquidCp = MoistureProperties.GetSpecificHeatOfLiquid(temperature.Value); if (cp != Constants.NO_VALUE) { Calculate(specificHeat, cp); if (moistureContentDryBase.HasValue) { Calculate(specificHeatDryBase, cp * (1.0 + moistureContentDryBase.Value)); double cpAbsDry = specificHeatDryBase.Value - moistureContentDryBase.Value * moistureLiquidCp; Calculate(specificHeatAbsDry, cpAbsDry); } } else if (specificHeatAbsDry.HasValue && !specificHeat.IsSpecifiedAndHasValue) { double cpMaterialDryBase = specificHeatAbsDry.Value + moistureContentDryBase.Value * moistureLiquidCp; Calculate(specificHeatDryBase, cpMaterialDryBase); Calculate(specificHeat, cpMaterialDryBase / (1.0 + moistureContentDryBase.Value)); } else if (specificHeat.HasValue && moistureContentDryBase.HasValue && temperature.HasValue && !specificHeatAbsDry.IsSpecifiedAndHasValue) { Calculate(specificHeatDryBase, specificHeat.Value / (1.0 - moistureContentWetBase.Value)); Calculate(specificHeatAbsDry, specificHeatDryBase.Value - moistureContentDryBase.Value * moistureLiquidCp); } } else if (moistureContentWetBase.Value == 1.0 && !specificHeat.IsSpecifiedAndHasValue) { Calculate(specificHeatDryBase, Constants.NO_VALUE); Calculate(specificHeatAbsDry, Constants.NO_VALUE); if (temperature.HasValue && moistureContentWetBase.HasValue) { moistureLiquidCp = CalculateCp(temperature.Value); Calculate(specificHeat, moistureLiquidCp); } } if (materialStateType == MaterialStateType.Solid && specificHeat.HasValue) { if (temperature.HasValue) { Calculate(specificEnthalpy, specificHeat.Value * (temperature.Value - 273.15)); } else if (specificEnthalpy.HasValue && !temperature.IsSpecifiedAndHasValue) { Calculate(temperature, specificEnthalpy.Value / specificHeat.Value + 273.15); } } else if (materialStateType == MaterialStateType.Liquid && pressure.HasValue) { if (specificEnthalpy.HasValue && !temperature.IsSpecifiedAndHasValue) { CalculateTemperatureFromEnthalpy(); } else if (temperature.HasValue && massConcentration.HasValue) { double tBoilingPoint = GetBoilingPoint(pressure.Value); if (temperature.Value < tBoilingPoint) { Calculate(vaporFraction, 0.0); if (specificHeat.HasValue) { Calculate(specificEnthalpy, specificHeat.Value * (temperature.Value - 273.15)); } } else if (temperature.Value > tBoilingPoint) { Calculate(vaporFraction, 1.0); if (specificHeat.HasValue) { double evapHeat = GetEvaporationHeat(tBoilingPoint); double gasCp = GetLiquidCp(tBoilingPoint); double h = moistureLiquidCp * (tBoilingPoint - 273.15) + evapHeat + gasCp * (temperature.Value - tBoilingPoint); Calculate(specificEnthalpy, h); } } else if (vaporFraction.HasValue) { double liquidCp = specificHeat.Value; if (!specificHeat.HasValue) { liquidCp = CalculateCp(tBoilingPoint); } double evapHeat = GetEvaporationHeat(tBoilingPoint); double h = liquidCp * (tBoilingPoint - 273.15) + vaporFraction.Value * evapHeat; Calculate(specificEnthalpy, h); } } else if (vaporFraction.HasValue && massConcentration.HasValue) { double tBoilingPoint = GetBoilingPoint(pressure.Value); Calculate(temperature, tBoilingPoint); double liquidCp = specificHeat.Value; if (!specificHeat.HasValue) { liquidCp = CalculateCp(tBoilingPoint); } double evapHeat = GetEvaporationHeat(tBoilingPoint); double h = liquidCp * (tBoilingPoint - 273.15) + vaporFraction.Value * evapHeat; Calculate(specificEnthalpy, h); if (Math.Abs(vaporFraction.Value - 1.0) < 1.0e-5) { Calculate(specificHeat, GetGasCp(tBoilingPoint)); } else if (Math.Abs(vaporFraction.Value - 0.0) < 1.0e-5) { Calculate(specificHeat, liquidCp); } } } if (massFlowRateDryBase.HasValue && moistureContentDryBase.HasValue && !massFlowRate.IsSpecifiedAndHasValue) { Calculate(massFlowRate, massFlowRateDryBase.Value * (1.0 + moistureContentDryBase.Value)); } else if (massFlowRate.HasValue && moistureContentDryBase.HasValue && !massFlowRateDryBase.IsSpecifiedAndHasValue) { Calculate(massFlowRateDryBase, massFlowRate.Value / (1.0 + moistureContentDryBase.Value)); } if (temperature.HasValue && massConcentration.HasValue) { CalculateDensity(); } if (massFlowRate.HasValue && density.HasValue) { Calculate(volumeFlowRate, massFlowRate.Value / density.Value); } if (materialStateType == MaterialStateType.Solid && temperature.HasValue && massFlowRate.HasValue && moistureContentWetBase.HasValue && specificHeat.HasValue && specificEnthalpy.HasValue) { solveState = SolveState.Solved; } else if (materialStateType == MaterialStateType.Liquid && pressure.HasValue && temperature.HasValue && massFlowRate.HasValue && moistureContentWetBase.HasValue && specificEnthalpy.HasValue && vaporFraction.HasValue) { solveState = SolveState.Solved; } else if ((!massFlowRate.IsSpecified && massFlowRate.HasValue) || (!massFlowRateDryBase.IsSpecified && massFlowRateDryBase.HasValue) || (!moistureContentWetBase.IsSpecified && moistureContentWetBase.HasValue) || (!moistureContentDryBase.IsSpecified && moistureContentDryBase.HasValue) || (!massConcentration.IsSpecified && massConcentration.HasValue) || (!specificHeat.IsSpecified && specificHeat.HasValue) || (!specificHeatAbsDry.IsSpecified && specificHeatAbsDry.HasValue) || (!specificEnthalpy.IsSpecified && specificEnthalpy.HasValue)) { solveState = SolveState.PartiallySolved; } AdjustVarsStates(); if (HasSolvedAlready) { DryingMaterialComponents dmc = MaterialComponents; dmc.Moisture.SetMassFractionValue(moistureContentWetBase.Value); dmc.AbsoluteDryMaterial.SetMassFractionValue(1.0 - moistureContentWetBase.Value); dmc.ComponentsFractionsChanged(); } OnSolveComplete(solveState); }