All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.synerset.hvacengine.process.heating.HeatingFromRH Maven / Gradle / Ivy

Go to download

HVAC|Engine is a comprehensive library for calculating moist air properties, including crucial thermodynamic processes such as heating, dry cooling, real cooling with condensate discharge, mixing single or multiple air streams, and more. Immutable, thread-safe, very accurate.

The newest version!
package com.synerset.hvacengine.process.heating;

import com.synerset.hvacengine.fluids.humidair.FlowOfHumidAir;
import com.synerset.hvacengine.fluids.humidair.HumidAir;
import com.synerset.hvacengine.fluids.humidair.HumidAirEquations;
import com.synerset.unitility.unitsystem.flow.MassFlow;
import com.synerset.unitility.unitsystem.humidity.RelativeHumidity;
import com.synerset.unitility.unitsystem.thermodynamic.Power;
import com.synerset.unitility.unitsystem.thermodynamic.Temperature;

/**
 * Calculates outlet temperature and heat of process for heating case based on target relative humidity (RH).
 * This method can be used only for heating, outRH must be equals or smaller than initial value
 *
 * @param inletAir               initial {@link FlowOfHumidAir}
 * @param targetRelativeHumidity target {@link RelativeHumidity}
 */
record HeatingFromRH(FlowOfHumidAir inletAir,
                     RelativeHumidity targetRelativeHumidity) implements HeatingStrategy {

    @Override
    public AirHeatingResult applyHeating() {

        if (inletAir.getRelativeHumidity().equals(targetRelativeHumidity) || inletAir.getMassFlow().isEqualZero()) {
            return new AirHeatingResult(inletAir, Power.ofWatts(0));
        }

        HumidAir inletHumidAir = inletAir.getFluid();
        double rhOut = targetRelativeHumidity.getInPercent();
        double xIn = inletHumidAir.getHumidityRatio().getInKilogramPerKilogram();
        double mdaIn = inletAir.getDryAirMassFlow().getInKilogramsPerSecond();
        double pIn = inletHumidAir.getPressure().getInPascals();
        double iIn = inletHumidAir.getSpecificEnthalpy().getInKiloJoulesPerKiloGram();
        double tOut = HumidAirEquations.dryBulbTemperatureXRH(xIn, rhOut, pIn);
        double iOut = HumidAirEquations.specificEnthalpy(tOut, xIn, pIn);
        double qHeat = (mdaIn * iOut - mdaIn * iIn) * 1000d;
        Power requiredHeat = Power.ofWatts(qHeat);

        HumidAir outletHumidAir = HumidAir.of(inletAir.getPressure(), Temperature.ofCelsius(tOut), inletAir.getHumidityRatio());
        FlowOfHumidAir outletFlow = FlowOfHumidAir.ofDryAirMassFlow(outletHumidAir, MassFlow.ofKilogramsPerSecond(mdaIn));

        return new AirHeatingResult(outletFlow, requiredHeat);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy