Skip to content

Commit

Permalink
Refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
portyanikhin committed Oct 3, 2024
1 parent 21a50ba commit 8fcdc0e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
6 changes: 6 additions & 0 deletions src/VCRC/Fluids/IRefrigerant.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,12 @@ public interface IRefrigerant : IFluid
/// <exception cref="ArgumentException">Invalid superheat!</exception>
IRefrigerant Superheated(Pressure pressure, TemperatureDelta superheat);

/// <inheritdoc cref="IFluid.SpecifyPhase"/>
new IRefrigerant SpecifyPhase(Phases phase);

/// <inheritdoc cref="IFluid.UnspecifyPhase"/>
new IRefrigerant UnspecifyPhase();

/// <inheritdoc cref="IFluid.WithState"/>
new IRefrigerant WithState(
IKeyedInput<Parameters> firstInput,
Expand Down
7 changes: 4 additions & 3 deletions src/VCRC/Fluids/Refrigerant.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,8 @@ public Refrigerant(FluidsList name)
.ToUnit(TemperatureDeltaUnit.Kelvin);

public bool HasGlide => Glide > 0.01.Kelvins();

public bool IsSingleComponent => !IsAzeotropicBlend && !IsZeotropicBlend;

public bool IsAzeotropicBlend => BlendRegex(false).IsMatch(Name.ToString());

public bool IsZeotropicBlend => BlendRegex(true).IsMatch(Name.ToString());

public IRefrigerant Subcooled(
Expand Down Expand Up @@ -64,6 +61,10 @@ public IRefrigerant Superheated(Pressure pressure, TemperatureDelta superheat) =
: superheat.Equals(TemperatureDelta.Zero, Tolerance.Kelvins()) ? DewPointAt(pressure)
: DewPointAt(pressure).HeatingTo(DewPointAt(pressure).Temperature + superheat);

public new IRefrigerant SpecifyPhase(Phases phase) => (Refrigerant)base.SpecifyPhase(phase);

public new IRefrigerant UnspecifyPhase() => (Refrigerant)base.UnspecifyPhase();

public new IRefrigerant WithState(
IKeyedInput<Parameters> firstInput,
IKeyedInput<Parameters> secondInput
Expand Down
1 change: 1 addition & 0 deletions tests/VCRC.Tests/Fluids/RefrigerantTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ public void Methods_New_ReturnsInstancesOfTheRefrigerantType()
{
_sut.Clone().Should().BeOfType<Refrigerant>();
_sut.Factory().Should().BeOfType<Refrigerant>();
_sut.SpecifyPhase(Phases.Gas).UnspecifyPhase().Should().BeOfType<Refrigerant>();
_sut.IsentropicCompressionTo(HighPressure).Should().BeOfType<Refrigerant>();
_sut.CompressionTo(HighPressure, _isentropicEfficiency).Should().BeOfType<Refrigerant>();
_sut.IsenthalpicExpansionTo(LowPressure).Should().BeOfType<Refrigerant>();
Expand Down

0 comments on commit 8fcdc0e

Please sign in to comment.