Skip to content

Commit

Permalink
Merge pull request #324 from portyanikhin/fix-humid-air-mixing
Browse files Browse the repository at this point in the history
Fixed `HumidAir.Mixing` method
  • Loading branch information
portyanikhin authored Dec 18, 2024
2 parents 11d2a66 + 8f77a9b commit 5e5e0d9
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 5e5e0d9

Please sign in to comment.