Skip to content

Commit

Permalink
feat(SNSHLI-56): Update Unitility version to 2.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
pjazdzyk committed Jan 3, 2024
1 parent 1e5b51c commit c41cb2e
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 18 deletions.
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>com.synerset</groupId>
<artifactId>hvac-engine</artifactId>
<version>1.0.1</version>
<version>1.0.2</version>
<name>hvac-engine</name>
<description>
HVAC|Engine is a comprehensive library for calculating moist air properties, including crucial thermodynamic
Expand Down Expand Up @@ -38,9 +38,9 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!-- Synerset library versions -->
<brent-solver.version>1.1.4</brent-solver.version>
<unitility.version>2.0.0</unitility.version>
<unitility.version>2.1.1</unitility.version>
<!-- Dependency versions -->
<assertJ.version>3.24.2</assertJ.version>
<assertJ.version>3.25.0</assertJ.version>
<junit-jupiter-api.version>5.10.1</junit-jupiter-api.version>
<!-- Plugins versions -->
<jacoco.version>0.8.9</jacoco.version>
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/synerset/hvacengine/common/Validators.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ public static <K extends Unit> void requireBetweenBounds(PhysicalQuantity<K> qua
}

public static <K extends Unit> void requireAboveLowerBoundInclusive(PhysicalQuantity<K> quantityToCheck, PhysicalQuantity<K> lowerBoundLimit) {
if (quantityToCheck.lowerThan(lowerBoundLimit)) {
if (quantityToCheck.isLowerThan(lowerBoundLimit)) {
throw new InvalidArgumentException(String.format("Lower bound limit reached or exceeded: Quantity: %s, Limit: %s", quantityToCheck, lowerBoundLimit));
}
}

public static <K extends Unit> void requireBelowUpperBoundInclusive(PhysicalQuantity<K> quantityToCheck, PhysicalQuantity<K> upperBoundLimit) {
if (quantityToCheck.greaterThan(upperBoundLimit)) {
if (quantityToCheck.isGreaterThan(upperBoundLimit)) {
throw new InvalidArgumentException(String.format("Upper bound limit reached or exceeded: Quantity: %s, Limit: %s", quantityToCheck, upperBoundLimit));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,9 +237,9 @@ public <K extends Fluid> boolean isEqualsWithPrecision(K fluid, double epsilon)
private static VapourState determineVapourState(Temperature dryBulbTemperature, HumidityRatio humidityRatio, HumidityRatio maxHumidityRatio) {
if (humidityRatio == maxHumidityRatio) {
return VapourState.SATURATED;
} else if ((humidityRatio.greaterThan(maxHumidityRatio)) && dryBulbTemperature.positive()) {
} else if ((humidityRatio.isGreaterThan(maxHumidityRatio)) && dryBulbTemperature.isPositive()) {
return VapourState.WATER_MIST;
} else if ((humidityRatio.greaterThan(maxHumidityRatio)) && dryBulbTemperature.negativeOrZero()) {
} else if ((humidityRatio.isGreaterThan(maxHumidityRatio)) && dryBulbTemperature.isNegativeOrZero()) {
return VapourState.ICE_FOG;
} else {
return VapourState.UNSATURATED;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@ static CoolingStrategy of(FlowOfHumidAir inletAirFlow, CoolantData inletCoolantD
Validators.requireNotNull(inletAirFlow);
Validators.requireNotNull(inletCoolantData);
Validators.requireNotNull(inputPower);
if (inputPower.positive()) {
if (inputPower.isPositive()) {
throw new InvalidArgumentException("Cooling power must be negative value. Q_in = " + inputPower);
}
// Mox cooling power quick estimate to reach 0 degrees Qcool.max= G * (i_0 - i_in)
double estimatedMaxPowerKw = inletAirFlow.specificEnthalpy().toKiloJoulePerKiloGram()
.minusFromValue(0)
.multiply(inletAirFlow.massFlow().toKilogramsPerSecond());
Power estimatedPowerLimit = Power.ofKiloWatts(estimatedMaxPowerKw);
if (inputPower.lowerThan(estimatedPowerLimit)) {
if (inputPower.isLowerThan(estimatedPowerLimit)) {
throw new InvalidArgumentException("To large cooling power for provided flow. "
+ "Q_in = " + inputPower + " Q_limit = " + estimatedPowerLimit);
}
Expand All @@ -77,7 +77,7 @@ static CoolingStrategy of(FlowOfHumidAir inletAirFlow, CoolantData inletCoolantD
Validators.requireNotNull(inletCoolantData);
Validators.requireNotNull(targetRelativeHumidity);
Validators.requireBetweenBoundsInclusive(targetRelativeHumidity, RelativeHumidity.RH_MIN_LIMIT, RelativeHumidity.ofPercentage(98));
if (targetRelativeHumidity.lowerThan(inletAirFlow.relativeHumidity())) {
if (targetRelativeHumidity.isLowerThan(inletAirFlow.relativeHumidity())) {
throw new InvalidArgumentException("Cooling process cannot decrease relative humidity. "
+ "RH_in = " + inletAirFlow.relativeHumidity() + " RH_target = " + targetRelativeHumidity);
}
Expand All @@ -98,7 +98,7 @@ static CoolingStrategy of(FlowOfHumidAir inletAirFlow, CoolantData inletCoolantD
Validators.requireNotNull(inletCoolantData);
Validators.requireNotNull(targetTemperature);
Validators.requireAboveLowerBound(targetTemperature, Temperature.ofCelsius(0));
if (targetTemperature.greaterThan(inletAirFlow.temperature())) {
if (targetTemperature.isGreaterThan(inletAirFlow.temperature())) {
throw new InvalidArgumentException("Expected outlet temperature must be lower than inlet for cooling process. "
+ "DBT_in = " + inletAirFlow.relativeHumidity() + " DBT_target = " + inletAirFlow.temperature());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public DryAirCoolingResult applyDryCooling() {
}

// If the target temperature is below dew point temperature, it is certain that this is no longer dry cooling
if (outletTemperature.lowerThan(inletAir.fluid().dewPointTemperature())) {
if (outletTemperature.isLowerThan(inletAir.fluid().dewPointTemperature())) {
return new DryAirCoolingResult(inletAir, Power.ofWatts(0));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ static DryCoolingStrategy of(FlowOfHumidAir inletAirFlow, Power inputPower) {
Validators.requireNotNull(inletAirFlow);
Validators.requireNotNull(inputPower);

if (inputPower.positive()) {
if (inputPower.isPositive()) {
throw new InvalidArgumentException("Cooling power must be negative value. Q_in = " + inputPower);
}

Expand All @@ -58,7 +58,7 @@ static DryCoolingStrategy of(FlowOfHumidAir inletAirFlow, Temperature targetTemp
Validators.requireNotNull(inletAirFlow);
Validators.requireNotNull(targetTemperature);

if (targetTemperature.greaterThan(inletAirFlow.temperature())) {
if (targetTemperature.isGreaterThan(inletAirFlow.temperature())) {
throw new InvalidArgumentException("Expected outlet temperature must be lower than inlet for cooling process. "
+ "DBT_in = " + inletAirFlow.relativeHumidity() + " DBT_target = " + inletAirFlow.temperature());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ static HeatingStrategy of(FlowOfHumidAir inletAirFlow, Power inputPower) {
Validators.requireNotNull(inletAirFlow);
Validators.requireNotNull(inputPower);

if (inputPower.negative()) {
if (inputPower.isNegative()) {
throw new InvalidArgumentException("Heating power must be positive value. Q_in = " + inputPower);
}

Expand All @@ -54,7 +54,7 @@ static HeatingStrategy of(FlowOfHumidAir inletAirFlow, Power inputPower) {
double qMax = iMax.minus(inletAirFlow.specificEnthalpy())
.multiply(inletAirFlow.massFlow().toKilogramsPerSecond());
Power estimatedPowerLimit = Power.ofKiloWatts(qMax);
if (inputPower.greaterThan(estimatedPowerLimit)) {
if (inputPower.isGreaterThan(estimatedPowerLimit)) {
throw new InvalidArgumentException("To large heating power for provided flow. "
+ "Q_in = " + inputPower + " Q_limit = " + estimatedPowerLimit);
}
Expand All @@ -73,7 +73,7 @@ static HeatingStrategy of(FlowOfHumidAir inletAirFlow, RelativeHumidity targetRe
Validators.requireNotNull(inletAirFlow);
Validators.requireNotNull(targetRelativeHumidity);
Validators.requireBetweenBoundsInclusive(targetRelativeHumidity, RelativeHumidity.RH_MIN_LIMIT, RelativeHumidity.ofPercentage(98));
if (targetRelativeHumidity.greaterThan(inletAirFlow.relativeHumidity())) {
if (targetRelativeHumidity.isGreaterThan(inletAirFlow.relativeHumidity())) {
throw new InvalidArgumentException("Heating process cannot increase relative humidity. "
+ "RH_in = " + inletAirFlow.relativeHumidity() + " RH_target = " + targetRelativeHumidity);
}
Expand All @@ -92,7 +92,7 @@ static HeatingStrategy of(FlowOfHumidAir inletAirFlow, Temperature targetTempera
Validators.requireNotNull(inletAirFlow);
Validators.requireNotNull(targetTemperature);
Validators.requireBelowUpperBoundInclusive(targetTemperature, HumidAir.TEMPERATURE_MAX_LIMIT);
if (targetTemperature.lowerThan(inletAirFlow.temperature())) {
if (targetTemperature.isLowerThan(inletAirFlow.temperature())) {
throw new InvalidArgumentException("Expected outlet temperature must be greater than inlet for cooling process. "
+ "DBT_in = " + inletAirFlow.relativeHumidity() + " DBT_target = " + inletAirFlow.temperature());
}
Expand Down

0 comments on commit c41cb2e

Please sign in to comment.