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

com.synerset.hvacengine.process.cooling.CoolingFromPower 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.cooling;

import com.synerset.brentsolver.BrentSolver;
import com.synerset.hvacengine.fluids.humidair.FlowOfHumidAir;
import com.synerset.hvacengine.fluids.liquidwater.FlowOfLiquidWater;
import com.synerset.hvacengine.fluids.liquidwater.LiquidWater;
import com.synerset.hvacengine.process.drycooling.DryCooling;
import com.synerset.hvacengine.process.drycooling.DryCoolingStrategy;
import com.synerset.unitility.unitsystem.flow.MassFlow;
import com.synerset.unitility.unitsystem.thermodynamic.Power;
import com.synerset.unitility.unitsystem.thermodynamic.Temperature;

/**
 * Real cooling coil process result as a double array, for provided cooling power. Results in the array are organized as following:
 * result: [heat in (W), outlet air temperature (oC), outlet humidity ratio x (kgWv/kgDa), condensate temperature (oC), condensate mass flow (kg/s)]
 * REFERENCE SOURCE: [1] [Q, W] (-) [37]
 *
 * @param inletAir    initial {@link FlowOfHumidAir}
 * @param coolantData coolant data {@link CoolantData}
 * @param inputPower  cooling {@link Power}
 */
record CoolingFromPower(FlowOfHumidAir inletAir,
                        CoolantData coolantData,
                        Power inputPower) implements CoolingStrategy {

    @Override
    public AirCoolingResult applyCooling() {

        if (inputPower.isEqualZero() || inletAir.getMassFlow().isEqualZero()) {
            LiquidWater liquidWater = LiquidWater.of(inletAir.getTemperature());
            FlowOfLiquidWater flowOfLiquidWater = FlowOfLiquidWater.of(liquidWater, MassFlow.ofKilogramsPerSecond(0.0));
            new AirCoolingResult(inletAir, inputPower, flowOfLiquidWater,
                    CoolingHelpers.coilBypassFactor(coolantData.getAverageTemperature(), inletAir.getTemperature(), inletAir.getTemperature()));
        }

        // For the provided inputHeat, maximum possible cooling will occur for completely dry air, where no energy will be used for condensate discharge
        DryCooling dryCooling = DryCooling.of(DryCoolingStrategy.of(inletAir, inputPower));
        double tmin = inletAir.getTemperature().getInCelsius();
        double tmax = dryCooling.getOutLetTemperature().getInCelsius();
        BrentSolver solver = new BrentSolver("[CoolingFromPower]");
        solver.setCounterpartPoints(tmin, tmax);
        AirCoolingResult[] coolingResults = new AirCoolingResult[1];
        solver.calcForFunction(outTemp -> {
            AirCoolingResult airCoolingResult = CoolingStrategy.of(inletAir, coolantData, Temperature.ofCelsius(outTemp)).applyCooling();
            coolingResults[0] = airCoolingResult;
            Power calculatedQ = airCoolingResult.heatOfProcess();
            return calculatedQ.getInWatts() - inputPower.getInWatts();
        });

        return coolingResults[0];
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy