Skip to content

Commit

Permalink
Fix HumidAir.Mixing method
Browse files Browse the repository at this point in the history
  • Loading branch information
portyanikhin committed Dec 18, 2024
1 parent 11d2a66 commit 8f77a9b
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 5 deletions.
20 changes: 16 additions & 4 deletions src/SharpProp/HumidAir/HumidAirProcesses.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,22 @@ IHumidAir second
) / (firstSpecificMassFlow + secondSpecificMassFlow).DecimalFractions
),
InputHumidAir.Humidity(
(
firstSpecificMassFlow.DecimalFractions * first.Humidity
+ secondSpecificMassFlow.DecimalFractions * second.Humidity
) / (firstSpecificMassFlow + secondSpecificMassFlow).DecimalFractions
Ratio.FromDecimalFractions(
(
firstSpecificMassFlow.DecimalFractions
* first.Humidity.DecimalFractions
* (1 + second.Humidity.DecimalFractions)
+ secondSpecificMassFlow.DecimalFractions
* second.Humidity.DecimalFractions
* (1 + first.Humidity.DecimalFractions)
)
/ (
firstSpecificMassFlow.DecimalFractions
* (1 + second.Humidity.DecimalFractions)
+ secondSpecificMassFlow.DecimalFractions
* (1 + first.Humidity.DecimalFractions)
)
)
)
)
: throw new ArgumentException(
Expand Down
17 changes: 16 additions & 1 deletion tests/SharpProp.Tests/HumidAir/HumidAirProcessesTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,22 @@ public void Mixing_SamePressures_ReturnsMixPoint()
_humidAir.WithState(
InputHumidAir.Pressure(_humidAir.Pressure),
InputHumidAir.Enthalpy((1 * first.Enthalpy + 2 * second.Enthalpy) / 3.0),
InputHumidAir.Humidity((1 * first.Humidity + 2 * second.Humidity) / 3.0)
InputHumidAir.Humidity(
Ratio.FromDecimalFractions(
(
1
* first.Humidity.DecimalFractions
* (1 + second.Humidity.DecimalFractions)
+ 2
* second.Humidity.DecimalFractions
* (1 + first.Humidity.DecimalFractions)
)
/ (
1 * (1 + second.Humidity.DecimalFractions)
+ 2 * (1 + first.Humidity.DecimalFractions)
)
)
)
)
);
}
Expand Down

0 comments on commit 8f77a9b

Please sign in to comment.