Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(SNSHLI-57): refactor getters, fix dryBulbTemperatureIX to use X … #4

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 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.2</version>
<version>1.1.0</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,17 +38,17 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!-- Synerset library versions -->
<brent-solver.version>1.1.4</brent-solver.version>
<unitility.version>2.1.1</unitility.version>
<unitility.version>2.2.0</unitility.version>
<!-- Dependency versions -->
<assertJ.version>3.25.0</assertJ.version>
<assertJ.version>3.25.2</assertJ.version>
<junit-jupiter-api.version>5.10.1</junit-jupiter-api.version>
<!-- Plugins versions -->
<jacoco.version>0.8.9</jacoco.version>
<jacoco.version>0.8.11</jacoco.version>
<maven-surefire-plugin.version>3.0.0</maven-surefire-plugin.version>
<nexus-staging-maven-plugin.version>1.6.13</nexus-staging-maven-plugin.version>
<maven-source-plugin.version>3.3.0</maven-source-plugin.version>
<maven-javadoc-plugin.version>3.6.3</maven-javadoc-plugin.version>
<flatten-maven-plugin.version>1.5.0</flatten-maven-plugin.version>
<flatten-maven-plugin.version>1.6.0</flatten-maven-plugin.version>
<!-- Sonar Cloud Properties-->
<sonar.organization>synerset</sonar.organization>
<sonar.projectKey>pjazdzyk_hvac-engine</sonar.projectKey>
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/com/synerset/hvacengine/common/Validators.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ public static void requireNotEmpty(Collection<?> collection) {

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

public static <K extends Unit> void requireBelowUpperBound(PhysicalQuantity<K> quantityToCheck, PhysicalQuantity<K> upperBoundLimit) {
if (quantityToCheck.equalsOrGreaterThan(upperBoundLimit)) {
throw new InvalidArgumentException(String.format("Upper bound limit exceeded: Quantity: %s, Limit: %s", quantityToCheck, upperBoundLimit));
throw new InvalidArgumentException(String.format("Upper bound limit exceeded. Actual: %s, limit: %s", quantityToCheck, upperBoundLimit));
}
}

Expand All @@ -46,13 +46,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.isLowerThan(lowerBoundLimit)) {
throw new InvalidArgumentException(String.format("Lower bound limit reached or exceeded: Quantity: %s, Limit: %s", quantityToCheck, lowerBoundLimit));
throw new InvalidArgumentException(String.format("Lower bound limit reached or exceeded. Actual: %s, limit: %s", quantityToCheck, lowerBoundLimit));
}
}

public static <K extends Unit> void requireBelowUpperBoundInclusive(PhysicalQuantity<K> quantityToCheck, PhysicalQuantity<K> upperBoundLimit) {
if (quantityToCheck.isGreaterThan(upperBoundLimit)) {
throw new InvalidArgumentException(String.format("Upper bound limit reached or exceeded: Quantity: %s, Limit: %s", quantityToCheck, upperBoundLimit));
throw new InvalidArgumentException(String.format("Upper bound limit reached or exceeded: Actual: %s, limit: %s", quantityToCheck, upperBoundLimit));
}
}

Expand Down
16 changes: 8 additions & 8 deletions src/main/java/com/synerset/hvacengine/fluids/Flow.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,49 +23,49 @@ public interface Flow<F extends Fluid> {
*
* @return The mass flow rate in appropriate units.
*/
MassFlow massFlow();
MassFlow getMassFlow();

/**
* Get the volumetric flow rate of the fluid flow.
*
* @return The volumetric flow rate in appropriate units.
*/
VolumetricFlow volumetricFlow();
VolumetricFlow getVolumetricFlow();

/**
* Get the temperature of the fluid flow.
*
* @return The temperature in appropriate units.
*/
Temperature temperature();
Temperature getTemperature();

/**
* Get the pressure of the fluid flow.
*
* @return The pressure in appropriate units.
*/
Pressure pressure();
Pressure getPressure();

/**
* Get the density of the fluid flow.
*
* @return The density in appropriate units.
*/
Density density();
Density getDensity();

/**
* Get the specific heat capacity of the fluid flow.
*
* @return The specific heat capacity in appropriate units.
*/
SpecificHeat specificHeat();
SpecificHeat getSpecificHeat();

/**
* Get the specific enthalpy of the fluid flow.
*
* @return The specific enthalpy in appropriate units.
*/
SpecificEnthalpy specificEnthalpy();
SpecificEnthalpy getSpecificEnthalpy();

/**
* Convert the flow properties to a formatted string.
Expand All @@ -88,6 +88,6 @@ default <K extends Fluid> boolean isEqualsWithPrecision(Flow<K> flowOfFluid, dou
if (this.getClass() != flowOfFluid.getClass()) return false;

return fluid().isEqualsWithPrecision(flowOfFluid.fluid(), epsilon)
&& massFlow().equalsWithPrecision(flowOfFluid.massFlow(), epsilon);
&& getMassFlow().equalsWithPrecision(flowOfFluid.getMassFlow(), epsilon);
}
}
14 changes: 7 additions & 7 deletions src/main/java/com/synerset/hvacengine/fluids/Fluid.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,35 +12,35 @@ public interface Fluid {
*
* @return The temperature in appropriate units.
*/
Temperature temperature();
Temperature getTemperature();

/**
* Get the pressure of the fluid.
*
* @return The pressure in appropriate units.
*/
Pressure pressure();
Pressure getPressure();

/**
* Get the density of the fluid.
*
* @return The density in appropriate units.
*/
Density density();
Density getDensity();

/**
* Get the specific heat capacity of the fluid.
*
* @return The specific heat capacity in appropriate units.
*/
SpecificHeat specificHeat();
SpecificHeat getSpecificHeat();

/**
* Get the specific enthalpy of the fluid.
*
* @return The specific enthalpy in appropriate units.
*/
SpecificEnthalpy specificEnthalpy();
SpecificEnthalpy getSpecificEnthalpy();

/**
* Convert the fluid properties to a formatted string.
Expand All @@ -62,7 +62,7 @@ default <K extends Fluid> boolean isEqualsWithPrecision(K fluid, double epsilon)
if (fluid == null) return false;
if (this.getClass() != fluid.getClass()) return false;

return pressure().equalsWithPrecision(fluid.pressure(), epsilon)
&& temperature().equalsWithPrecision(fluid.temperature(), epsilon);
return getPressure().equalsWithPrecision(fluid.getPressure(), epsilon)
&& getTemperature().equalsWithPrecision(fluid.getTemperature(), epsilon);
}
}
18 changes: 9 additions & 9 deletions src/main/java/com/synerset/hvacengine/fluids/dryair/DryAir.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,39 +50,39 @@ public DryAir(Pressure pressure, Temperature temperature) {
this.prandtlNumber = SharedEquations.prandtlNumber(dynamicViscosity, thermalConductivity, specificHeat);
}

public Temperature temperature() {
public Temperature getTemperature() {
return temperature;
}

public Pressure pressure() {
public Pressure getPressure() {
return pressure;
}

public Density density() {
public Density getDensity() {
return density;
}

public SpecificHeat specificHeat() {
public SpecificHeat getSpecificHeat() {
return specificHeat;
}

public SpecificEnthalpy specificEnthalpy() {
public SpecificEnthalpy getSpecificEnthalpy() {
return specificEnthalpy;
}

public DynamicViscosity dynamicViscosity() {
public DynamicViscosity getDynamicViscosity() {
return dynamicViscosity;
}

public KinematicViscosity kinematicViscosity() {
public KinematicViscosity getKinematicViscosity() {
return kinematicViscosity;
}

public ThermalConductivity thermalConductivity() {
public ThermalConductivity getThermalConductivity() {
return thermalConductivity;
}

public PrandtlNumber prandtlNumber() {
public PrandtlNumber getPrandtlNumber() {
return prandtlNumber;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public FlowOfDryAir(DryAir dryAir, MassFlow massFlow) {
Validators.requireBetweenBoundsInclusive(massFlow, MASS_FLOW_MIN_LIMIT, MASS_FLOW_MAX_LIMIT);
this.dryAir = dryAir;
this.massFlow = massFlow;
this.volFlow = FlowEquations.massFlowToVolFlow(dryAir.density(), massFlow);
this.volFlow = FlowEquations.massFlowToVolFlow(dryAir.getDensity(), massFlow);
}

@Override
Expand All @@ -42,38 +42,38 @@ public DryAir fluid() {
}

@Override
public MassFlow massFlow() {
public MassFlow getMassFlow() {
return massFlow;
}

@Override
public VolumetricFlow volumetricFlow() {
public VolumetricFlow getVolumetricFlow() {
return volFlow;
}

@Override
public Temperature temperature() {
return dryAir.temperature();
public Temperature getTemperature() {
return dryAir.getTemperature();
}

@Override
public Pressure pressure() {
return dryAir.pressure();
public Pressure getPressure() {
return dryAir.getPressure();
}

@Override
public Density density() {
return dryAir.density();
public Density getDensity() {
return dryAir.getDensity();
}

@Override
public SpecificHeat specificHeat() {
return dryAir.specificHeat();
public SpecificHeat getSpecificHeat() {
return dryAir.getSpecificHeat();
}

@Override
public SpecificEnthalpy specificEnthalpy() {
return dryAir.specificEnthalpy();
public SpecificEnthalpy getSpecificEnthalpy() {
return dryAir.getSpecificEnthalpy();
}

@Override
Expand Down Expand Up @@ -166,7 +166,7 @@ public static FlowOfDryAir of(DryAir dryAir, MassFlow massFlow) {
*/
public static FlowOfDryAir of(DryAir dryAir, VolumetricFlow volFlow) {
Validators.requireNotNull(volFlow);
MassFlow massFlow = FlowEquations.volFlowToMassFlow(dryAir.density(), volFlow);
MassFlow massFlow = FlowEquations.volFlowToMassFlow(dryAir.getDensity(), volFlow);
return new FlowOfDryAir(dryAir, massFlow);
}

Expand Down
Loading
Loading