From 24f63473b6322dc5bdf867c0db3cc566686aca69 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 23 Aug 2024 17:20:08 +0000 Subject: [PATCH 1/2] Bump csharpier from 0.28.2 to 0.29.1 Bumps [csharpier](https://github.com/belav/csharpier) from 0.28.2 to 0.29.1. - [Release notes](https://github.com/belav/csharpier/releases) - [Changelog](https://github.com/belav/csharpier/blob/main/CHANGELOG.md) - [Commits](https://github.com/belav/csharpier/compare/0.28.2...0.29.1) --- updated-dependencies: - dependency-name: csharpier dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .config/dotnet-tools.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index a271784..33e923c 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -3,7 +3,7 @@ "isRoot": true, "tools": { "csharpier": { - "version": "0.28.2", + "version": "0.29.1", "commands": [ "dotnet-csharpier" ] From cba375306746a114fcd6c11c40a1b3b14b4d8577 Mon Sep 17 00:00:00 2001 From: Vladimir Portyanikhin <86243191+portyanikhin@users.noreply.github.com> Date: Thu, 29 Aug 2024 22:31:35 +0300 Subject: [PATCH 2/2] Updated formatting --- .csharpierrc.json | 10 - src/VCRC/Abstract/AbstractTwoStageVCRC.cs | 21 +-- src/VCRC/Abstract/AbstractVCRC.cs | 24 +-- src/VCRC/Abstract/IVCRC.cs | 6 +- src/VCRC/Abstract/Validators/VCRCValidator.cs | 7 +- src/VCRC/Components/Condenser.cs | 7 +- src/VCRC/Components/Economizer.cs | 12 +- src/VCRC/Components/EconomizerWithTPI.cs | 11 +- src/VCRC/Components/Ejector.cs | 26 +-- src/VCRC/Components/EjectorFlows.cs | 48 ++--- src/VCRC/Components/Evaporator.cs | 7 +- src/VCRC/Components/GasCooler.cs | 41 ++--- .../Components/IAuxiliaryHeatExchanger.cs | 3 +- src/VCRC/Components/IEjector.cs | 12 +- src/VCRC/Components/IHaveEconomizerWithTPI.cs | 3 +- src/VCRC/Components/IMainHeatExchanger.cs | 3 +- src/VCRC/Components/Recuperator.cs | 11 +- .../Validators/CompressorValidator.cs | 7 +- .../Validators/CondenserValidator.cs | 7 +- .../Validators/EconomizerValidator.cs | 2 +- .../Validators/EconomizerWithTPIValidator.cs | 6 +- .../Validators/EjectorFlowsValidator.cs | 5 +- .../Components/Validators/EjectorValidator.cs | 15 +- .../Validators/EvaporatorValidator.cs | 7 +- .../Validators/GasCoolerValidator.cs | 2 +- .../Validators/RecuperatorValidator.cs | 5 +- .../EntropyAnalysisExtensions.cs | 83 ++------- .../EntropyAnalysis/EntropyAnalysisResult.cs | 38 ++-- src/VCRC/EntropyAnalysis/EntropyAnalyzer.cs | 40 ++-- .../EntropyAnalysis/IEntropyAnalysable.cs | 8 +- .../EntropyAnalysis/IEntropyAnalysisResult.cs | 31 ++-- src/VCRC/EntropyAnalysis/IEntropyAnalyzer.cs | 5 +- src/VCRC/EntropyAnalysis/Nodes/EVNode.cs | 10 +- .../EntropyAnalysis/Nodes/EconomizerNode.cs | 8 +- src/VCRC/EntropyAnalysis/Nodes/EjectorNode.cs | 12 +- .../EntropyAnalysis/Nodes/EvaporatorNode.cs | 10 +- .../EntropyAnalysis/Nodes/HeatReleaserNode.cs | 6 +- .../EntropyAnalysis/Nodes/IEvaporatorNode.cs | 5 +- .../Nodes/IHeatReleaserNode.cs | 4 +- src/VCRC/EntropyAnalysis/Nodes/MixingNode.cs | 6 +- .../EntropyAnalysis/Nodes/RecuperatorNode.cs | 8 +- src/VCRC/Fluids/IRefrigerant.cs | 51 ++---- src/VCRC/Fluids/Refrigerant.cs | 126 ++++--------- .../Validators/RefrigerantTypeValidator.cs | 11 +- .../Fluids/Validators/RefrigerantValidator.cs | 5 +- src/VCRC/ISimpleVCRC.cs | 8 +- src/VCRC/IVCRCMitsubishiZubadan.cs | 17 +- src/VCRC/IVCRCWithCIC.cs | 9 +- src/VCRC/IVCRCWithEconomizer.cs | 15 +- src/VCRC/IVCRCWithEconomizerAndPC.cs | 12 +- src/VCRC/IVCRCWithEconomizerAndTPI.cs | 19 +- src/VCRC/IVCRCWithEjector.cs | 8 +- src/VCRC/IVCRCWithEjectorAndEconomizer.cs | 20 +- src/VCRC/IVCRCWithEjectorEconomizerAndPC.cs | 20 +- src/VCRC/IVCRCWithEjectorEconomizerAndTPI.cs | 12 +- src/VCRC/IVCRCWithIIC.cs | 12 +- src/VCRC/IVCRCWithPC.cs | 6 +- src/VCRC/IVCRCWithRecuperator.cs | 8 +- src/VCRC/SimpleVCRC.cs | 27 +-- src/VCRC/VCRCMitsubishiZubadan.cs | 76 ++------ src/VCRC/VCRCWithCIC.cs | 53 +----- src/VCRC/VCRCWithEconomizer.cs | 59 ++---- src/VCRC/VCRCWithEconomizerAndPC.cs | 68 ++----- src/VCRC/VCRCWithEconomizerAndTPI.cs | 68 ++----- src/VCRC/VCRCWithEjector.cs | 35 +--- src/VCRC/VCRCWithEjectorAndEconomizer.cs | 85 ++------- src/VCRC/VCRCWithEjectorEconomizerAndPC.cs | 94 ++-------- src/VCRC/VCRCWithEjectorEconomizerAndTPI.cs | 80 ++------ src/VCRC/VCRCWithIIC.cs | 52 +----- src/VCRC/VCRCWithPC.cs | 57 ++---- src/VCRC/VCRCWithRecuperator.cs | 32 +--- .../VCRCMitsubishiZubadanValidator.cs | 20 +- .../VCRCWithEconomizerAndPCValidator.cs | 15 +- .../VCRCWithEconomizerAndTPIValidator.cs | 10 +- .../Validators/VCRCWithEconomizerValidator.cs | 15 +- .../VCRCWithEjectorAndEconomizerValidator.cs | 14 +- ...VCRCWithEjectorEconomizerAndPCValidator.cs | 14 +- ...CRCWithEjectorEconomizerAndTPIValidator.cs | 10 +- .../VCRCWithRecuperatorValidator.cs | 11 +- .../VCRC.Tests/Components/CompressorTests.cs | 15 +- tests/VCRC.Tests/Components/CondenserTests.cs | 43 +---- .../VCRC.Tests/Components/EconomizerTests.cs | 17 +- .../Components/EconomizerWithTPITests.cs | 16 +- .../Components/EjectorFlowsTests.cs | 51 ++---- tests/VCRC.Tests/Components/EjectorTests.cs | 60 ++---- .../VCRC.Tests/Components/EvaporatorTests.cs | 38 +--- tests/VCRC.Tests/Components/GasCoolerTests.cs | 36 +--- .../VCRC.Tests/Components/RecuperatorTests.cs | 18 +- .../EntropyAnalysisExtensionsTests.cs | 30 +-- tests/VCRC.Tests/Fixtures/VCRCFixture.cs | 150 +++++++-------- tests/VCRC.Tests/Fluids/RefrigerantTests.cs | 173 ++++-------------- tests/VCRC.Tests/GlobalUsings.cs | 3 +- .../Subcritical/SimpleVCRCSubcriticalTests.cs | 69 ++----- .../Subcritical/VCRCMitsubishiZubadanTests.cs | 111 +++-------- .../VCRCWithCICSubcriticalTests.cs | 105 +++-------- ...VCRCWithEconomizerAndPCSubcriticalTests.cs | 92 ++-------- ...CRCWithEconomizerAndTPISubcriticalTests.cs | 112 +++--------- .../VCRCWithEconomizerSubcriticalTests.cs | 95 +++------- ...ithEjectorAndEconomizerSubcriticalTests.cs | 148 +++------------ ...hEjectorEconomizerAndPCSubcriticalTests.cs | 154 +++------------- ...EjectorEconomizerAndTPISubcriticalTests.cs | 172 ++++------------- .../VCRCWithEjectorSubcriticalTests.cs | 97 ++-------- .../VCRCWithIICSubcriticalTests.cs | 95 ++-------- .../Subcritical/VCRCWithPCSubcriticalTests.cs | 103 ++--------- .../VCRCWithRecuperatorSubcriticalTests.cs | 67 ++----- .../SimpleVCRCTranscriticalTests.cs | 55 ++---- .../VCRCWithCICTranscriticalTests.cs | 100 ++-------- ...RCWithEconomizerAndPCTranscriticalTests.cs | 78 ++------ ...CWithEconomizerAndTPITranscriticalTests.cs | 107 +++-------- .../VCRCWithEconomizerTranscriticalTests.cs | 81 ++------ ...hEjectorAndEconomizerTranscriticalTests.cs | 129 +++---------- ...jectorEconomizerAndPCTranscriticalTests.cs | 135 +++----------- ...ectorEconomizerAndTPITranscriticalTests.cs | 166 ++++------------- .../VCRCWithEjectorTranscriticalTests.cs | 92 ++-------- .../VCRCWithIICTranscriticalTests.cs | 90 ++------- .../VCRCWithPCTranscriticalTests.cs | 98 ++-------- .../VCRCWithRecuperatorTranscriticalTests.cs | 62 ++----- 117 files changed, 1190 insertions(+), 3909 deletions(-) delete mode 100644 .csharpierrc.json diff --git a/.csharpierrc.json b/.csharpierrc.json deleted file mode 100644 index eb1b692..0000000 --- a/.csharpierrc.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "printWidth": 80, - "useTabs": false, - "tabWidth": 4, - "preprocessorSymbolSets": [ - "", - "DEBUG", - "DEBUG,CODE_STYLE" - ] -} diff --git a/src/VCRC/Abstract/AbstractTwoStageVCRC.cs b/src/VCRC/Abstract/AbstractTwoStageVCRC.cs index 49b53ee..32609f0 100644 --- a/src/VCRC/Abstract/AbstractTwoStageVCRC.cs +++ b/src/VCRC/Abstract/AbstractTwoStageVCRC.cs @@ -7,12 +7,9 @@ public abstract class AbstractTwoStageVCRC : AbstractVCRC, ITwoStageVCRC /// Evaporator. /// Compressor. /// Condenser or gas cooler. + /// Only one refrigerant should be selected! /// - /// Only one refrigerant should be selected! - /// - /// - /// Condensing temperature - /// should be greater than evaporating temperature! + /// Condensing temperature should be greater than evaporating temperature! /// protected AbstractTwoStageVCRC( IEvaporator evaporator, @@ -22,18 +19,12 @@ IHeatReleaser heatReleaser : base(evaporator, compressor, heatReleaser) { } public virtual Pressure IntermediatePressure => - CalculateIntermediatePressure( - Evaporator.Pressure, - HeatReleaser.Pressure - ); + CalculateIntermediatePressure(Evaporator.Pressure, HeatReleaser.Pressure); public virtual Ratio IntermediateSpecificMassFlow => HeatReleaserSpecificMassFlow - EvaporatorSpecificMassFlow; - protected Pressure CalculateIntermediatePressure( - Pressure low, - Pressure high - ) + protected Pressure CalculateIntermediatePressure(Pressure low, Pressure high) { var result = GeometricMean(low, high); return result < Refrigerant.CriticalPressure @@ -42,7 +33,5 @@ Pressure high } private static Pressure GeometricMean(Pressure low, Pressure high) => - Math.Sqrt(low.Pascals * high.Pascals) - .Pascals() - .ToUnit(PressureUnit.Kilopascal); + Math.Sqrt(low.Pascals * high.Pascals).Pascals().ToUnit(PressureUnit.Kilopascal); } diff --git a/src/VCRC/Abstract/AbstractVCRC.cs b/src/VCRC/Abstract/AbstractVCRC.cs index 0c173fa..c97bc75 100644 --- a/src/VCRC/Abstract/AbstractVCRC.cs +++ b/src/VCRC/Abstract/AbstractVCRC.cs @@ -7,12 +7,9 @@ public abstract class AbstractVCRC : IVCRC /// Evaporator. /// Compressor. /// Condenser or gas cooler. + /// Only one refrigerant should be selected! /// - /// Only one refrigerant should be selected! - /// - /// - /// Condensing temperature - /// should be greater than evaporating temperature! + /// Condensing temperature should be greater than evaporating temperature! /// protected AbstractVCRC( IEvaporator evaporator, @@ -28,38 +25,23 @@ IHeatReleaser heatReleaser } protected IRefrigerant Refrigerant { get; } - public IEvaporator Evaporator { get; } - public ICompressor Compressor { get; } - public IHeatReleaser HeatReleaser { get; } - public ICondenser? Condenser => HeatReleaser as Condenser; - public IHeatReleaser? GasCooler => HeatReleaser as GasCooler; - public bool IsTranscritical => GasCooler is not null; - public Ratio EvaporatorSpecificMassFlow => 100.Percent(); - public abstract Ratio HeatReleaserSpecificMassFlow { get; } - public abstract SpecificEnergy IsentropicSpecificWork { get; } public SpecificEnergy SpecificWork => IsentropicSpecificWork / Compressor.Efficiency.DecimalFractions; public abstract SpecificEnergy SpecificCoolingCapacity { get; } - public abstract SpecificEnergy SpecificHeatingCapacity { get; } - public double EER => SpecificCoolingCapacity / SpecificWork; - public double COP => SpecificHeatingCapacity / SpecificWork; - public abstract IEntropyAnalysisResult EntropyAnalysis( - Temperature indoor, - Temperature outdoor - ); + public abstract IEntropyAnalysisResult EntropyAnalysis(Temperature indoor, Temperature outdoor); } diff --git a/src/VCRC/Abstract/IVCRC.cs b/src/VCRC/Abstract/IVCRC.cs index c7a7210..3678022 100644 --- a/src/VCRC/Abstract/IVCRC.cs +++ b/src/VCRC/Abstract/IVCRC.cs @@ -16,8 +16,7 @@ public interface IVCRC : IEntropyAnalysable public ICompressor Compressor { get; } /// - /// Heat releaser (condenser for subcritical VCRC or - /// gas cooler for transcritical VCRC). + /// Heat releaser (condenser for subcritical VCRC or gas cooler for transcritical VCRC). /// public IHeatReleaser HeatReleaser { get; } @@ -32,8 +31,7 @@ public interface IVCRC : IEntropyAnalysable public IHeatReleaser? GasCooler { get; } /// - /// true if VCRC is transcritical, - /// false if VCRC is subcritical. + /// true if VCRC is transcritical, false if VCRC is subcritical. /// public bool IsTranscritical { get; } diff --git a/src/VCRC/Abstract/Validators/VCRCValidator.cs b/src/VCRC/Abstract/Validators/VCRCValidator.cs index bc6ddb2..8561765 100644 --- a/src/VCRC/Abstract/Validators/VCRCValidator.cs +++ b/src/VCRC/Abstract/Validators/VCRCValidator.cs @@ -1,6 +1,6 @@ namespace VCRC; -internal class VCRCValidator : AbstractValidator +internal sealed class VCRCValidator : AbstractValidator { public VCRCValidator() { @@ -10,9 +10,6 @@ public VCRCValidator() RuleFor(vcrc => vcrc.HeatReleaser.Temperature) .GreaterThan(vcrc => vcrc.Evaporator.Temperature) .When(vcrc => vcrc.HeatReleaser is Condenser) - .WithMessage( - "Condensing temperature should be " - + "greater than evaporating temperature!" - ); + .WithMessage("Condensing temperature should be greater than evaporating temperature!"); } } diff --git a/src/VCRC/Components/Condenser.cs b/src/VCRC/Components/Condenser.cs index 929498d..2ee23e5 100644 --- a/src/VCRC/Components/Condenser.cs +++ b/src/VCRC/Components/Condenser.cs @@ -23,17 +23,12 @@ TemperatureDelta subcooling RefrigerantName = refrigerantName; Temperature = temperature.ToUnit(TemperatureUnit.DegreeCelsius); Subcooling = subcooling.ToUnit(TemperatureDeltaUnit.Kelvin); - new CondenserValidator( - new Refrigerant(RefrigerantName) - ).ValidateAndThrow(this); + new CondenserValidator(new Refrigerant(RefrigerantName)).ValidateAndThrow(this); } public TemperatureDelta Subcooling { get; } - public FluidsList RefrigerantName { get; } - public Temperature Temperature { get; } - public Pressure Pressure => Outlet.Pressure; public IRefrigerant Outlet => diff --git a/src/VCRC/Components/Economizer.cs b/src/VCRC/Components/Economizer.cs index c837fda..fb91f44 100644 --- a/src/VCRC/Components/Economizer.cs +++ b/src/VCRC/Components/Economizer.cs @@ -4,21 +4,15 @@ public record Economizer : EconomizerWithTPI, IEconomizer { /// - /// - /// Temperature difference at the "cold" side. - /// + /// Temperature difference at the "cold" side. /// Superheat. /// - /// Temperature difference at the economizer 'cold' side - /// should be in (0;50) K! + /// Temperature difference at the economizer 'cold' side should be in (0;50) K! /// /// /// Superheat in the economizer should be in [0;50] K! /// - public Economizer( - TemperatureDelta temperatureDifference, - TemperatureDelta superheat - ) + public Economizer(TemperatureDelta temperatureDifference, TemperatureDelta superheat) : base(temperatureDifference) { Superheat = superheat.ToUnit(TemperatureDeltaUnit.Kelvin); diff --git a/src/VCRC/Components/EconomizerWithTPI.cs b/src/VCRC/Components/EconomizerWithTPI.cs index 435896b..b32983e 100644 --- a/src/VCRC/Components/EconomizerWithTPI.cs +++ b/src/VCRC/Components/EconomizerWithTPI.cs @@ -6,18 +6,13 @@ public record EconomizerWithTPI : IAuxiliaryHeatExchanger { /// - /// - /// Temperature difference at the "cold" side. - /// + /// Temperature difference at the "cold" side. /// - /// Temperature difference at the economizer 'cold' side - /// should be in (0;50) K! + /// Temperature difference at the economizer 'cold' side should be in (0;50) K! /// public EconomizerWithTPI(TemperatureDelta temperatureDifference) { - TemperatureDifference = temperatureDifference.ToUnit( - TemperatureDeltaUnit.Kelvin - ); + TemperatureDifference = temperatureDifference.ToUnit(TemperatureDeltaUnit.Kelvin); new EconomizerWithTPIValidator().ValidateAndThrow(this); } diff --git a/src/VCRC/Components/Ejector.cs b/src/VCRC/Components/Ejector.cs index 55020dd..dbaf0e7 100644 --- a/src/VCRC/Components/Ejector.cs +++ b/src/VCRC/Components/Ejector.cs @@ -20,15 +20,9 @@ public Ejector(Ratio efficiency) : this(efficiency, efficiency, efficiency) { } /// - /// - /// Isentropic efficiency of the nozzle. - /// - /// - /// Isentropic efficiency of the suction section. - /// - /// - /// Isentropic efficiency of the diffuser. - /// + /// Isentropic efficiency of the nozzle. + /// Isentropic efficiency of the suction section. + /// Isentropic efficiency of the diffuser. /// /// Isentropic efficiency of the nozzle should be in (0;100) %! /// @@ -38,11 +32,7 @@ public Ejector(Ratio efficiency) /// /// Isentropic efficiency of the diffuser should be in (0;100) %! /// - public Ejector( - Ratio nozzleEfficiency, - Ratio suctionEfficiency, - Ratio diffuserEfficiency - ) + public Ejector(Ratio nozzleEfficiency, Ratio suctionEfficiency, Ratio diffuserEfficiency) { NozzleEfficiency = nozzleEfficiency.ToUnit(RatioUnit.Percent); SuctionEfficiency = suctionEfficiency.ToUnit(RatioUnit.Percent); @@ -51,13 +41,9 @@ Ratio diffuserEfficiency } public Ratio NozzleEfficiency { get; } - public Ratio SuctionEfficiency { get; } - public Ratio DiffuserEfficiency { get; } - public IEjectorFlows CalculateFlows( - IRefrigerant nozzleInlet, - IRefrigerant suctionInlet - ) => new EjectorFlows(this, nozzleInlet, suctionInlet); + public IEjectorFlows CalculateFlows(IRefrigerant nozzleInlet, IRefrigerant suctionInlet) => + new EjectorFlows(this, nozzleInlet, suctionInlet); } diff --git a/src/VCRC/Components/EjectorFlows.cs b/src/VCRC/Components/EjectorFlows.cs index ee15f67..9613892 100644 --- a/src/VCRC/Components/EjectorFlows.cs +++ b/src/VCRC/Components/EjectorFlows.cs @@ -7,32 +7,19 @@ public class EjectorFlows : IEjectorFlows /// Ejector. /// Nozzle inlet. /// Suction section inlet. + /// Only one refrigerant should be selected! /// - /// Only one refrigerant should be selected! + /// Ejector nozzle inlet pressure should be greater than suction inlet pressure! /// - /// - /// Ejector nozzle inlet pressure - /// should be greater than suction inlet pressure! - /// - public EjectorFlows( - IEjector ejector, - IRefrigerant nozzleInlet, - IRefrigerant suctionInlet - ) + public EjectorFlows(IEjector ejector, IRefrigerant nozzleInlet, IRefrigerant suctionInlet) { Refrigerant = new Refrigerant(nozzleInlet.Name); Ejector = ejector; NozzleInlet = nozzleInlet; SuctionInlet = suctionInlet; new EjectorFlowsValidator().ValidateAndThrow(this); - NozzleOutlet = NozzleInlet.ExpansionTo( - MixingPressure, - Ejector.NozzleEfficiency - ); - SuctionOutlet = SuctionInlet.ExpansionTo( - MixingPressure, - Ejector.SuctionEfficiency - ); + NozzleOutlet = NozzleInlet.ExpansionTo(MixingPressure, Ejector.NozzleEfficiency); + SuctionOutlet = SuctionInlet.ExpansionTo(MixingPressure, Ejector.SuctionEfficiency); CalculateFlowRatio(); } @@ -43,15 +30,11 @@ IRefrigerant suctionInlet private Pressure MixingPressure => 0.9 * SuctionInlet.Pressure; private Speed MixingInletSpeed => - FlowRatio.DecimalFractions - * CalculateOutletSpeed(NozzleInlet, NozzleOutlet) - + (1 - FlowRatio.DecimalFractions) - * CalculateOutletSpeed(SuctionInlet, SuctionOutlet); + FlowRatio.DecimalFractions * CalculateOutletSpeed(NozzleInlet, NozzleOutlet) + + (1 - FlowRatio.DecimalFractions) * CalculateOutletSpeed(SuctionInlet, SuctionOutlet); private SpecificEnergy MixingInletKineticEnergy => - ( - Math.Pow(MixingInletSpeed.MetersPerSecond, 2) / 2.0 - ).JoulesPerKilogram(); + (Math.Pow(MixingInletSpeed.MetersPerSecond, 2) / 2.0).JoulesPerKilogram(); public IRefrigerant NozzleInlet { get; } @@ -86,8 +69,7 @@ double ToSolve(double flowRatio) Input.Pressure(MixingPressure), Input.Enthalpy( FlowRatio.DecimalFractions * NozzleInlet.Enthalpy - + (1 - FlowRatio.DecimalFractions) - * SuctionInlet.Enthalpy + + (1 - FlowRatio.DecimalFractions) * SuctionInlet.Enthalpy - MixingInletKineticEnergy ) ); @@ -98,9 +80,7 @@ double ToSolve(double flowRatio) Input.Entropy(MixingInlet.Entropy), Input.Enthalpy( MixingInlet.Enthalpy - + Ejector - .DiffuserEfficiency - .DecimalFractions + + Ejector.DiffuserEfficiency.DecimalFractions * MixingInletKineticEnergy ) ) @@ -112,10 +92,6 @@ double ToSolve(double flowRatio) } } - private static Speed CalculateOutletSpeed( - IFluidState inlet, - IFluidState outlet - ) => - Math.Sqrt(2 * (inlet.Enthalpy - outlet.Enthalpy).JoulesPerKilogram) - .MetersPerSecond(); + private static Speed CalculateOutletSpeed(IFluidState inlet, IFluidState outlet) => + Math.Sqrt(2 * (inlet.Enthalpy - outlet.Enthalpy).JoulesPerKilogram).MetersPerSecond(); } diff --git a/src/VCRC/Components/Evaporator.cs b/src/VCRC/Components/Evaporator.cs index 0d7d2c2..8e37b48 100644 --- a/src/VCRC/Components/Evaporator.cs +++ b/src/VCRC/Components/Evaporator.cs @@ -23,17 +23,12 @@ TemperatureDelta superheat RefrigerantName = refrigerantName; Temperature = temperature.ToUnit(TemperatureUnit.DegreeCelsius); Superheat = superheat.ToUnit(TemperatureDeltaUnit.Kelvin); - new EvaporatorValidator( - new Refrigerant(RefrigerantName) - ).ValidateAndThrow(this); + new EvaporatorValidator(new Refrigerant(RefrigerantName)).ValidateAndThrow(this); } public FluidsList RefrigerantName { get; } - public Temperature Temperature { get; } - public TemperatureDelta Superheat { get; } - public Pressure Pressure => Outlet.Pressure; public IRefrigerant Outlet => diff --git a/src/VCRC/Components/GasCooler.cs b/src/VCRC/Components/GasCooler.cs index adc9b25..52b7e5f 100644 --- a/src/VCRC/Components/GasCooler.cs +++ b/src/VCRC/Components/GasCooler.cs @@ -9,30 +9,27 @@ public record GasCooler : IHeatReleaser { /// /// - /// For R744, the absolute pressure in the gas cooler is optional. - /// If it is not specified, then the optimal pressure - /// will be calculated automatically in accordance + /// For R744, the absolute pressure in the gas cooler is optional. If it is not specified, + /// then the optimal pressure ill be calculated automatically in accordance /// with this literary source: - /// Yang L. et al. Minimizing COP loss from optional high pressure - /// correlation for transcritical CO2 cycle // - /// Applied Thermal Engineering. – 2015. – V. 89. – P. 656-662. + /// + /// Yang L. et al. Minimizing COP loss from optional + /// high pressure correlation for transcritical CO2 cycle // + /// Applied Thermal Engineering. – 2015. – V. 89. – P. 656-662. + /// /// /// Selected refrigerant name. /// Gas cooler outlet temperature. - /// - /// Gas cooler absolute pressure (optional for R744). - /// + /// Gas cooler absolute pressure (optional for R744). /// - /// It is impossible to automatically calculate the absolute pressure - /// in the gas cooler! It is necessary to define it. + /// It is impossible to automatically calculate the absolute pressure in the gas cooler! + /// It is necessary to define it. /// /// - /// Gas cooler outlet temperature - /// should be greater than {CriticalTemperature} °C! + /// Gas cooler outlet temperature should be greater than {CriticalTemperature} °C! /// /// - /// Gas cooler absolute pressure - /// should be greater than {CriticalPressure} MPa! + /// Gas cooler absolute pressure should be greater than {CriticalPressure} MPa! /// public GasCooler( FluidsList refrigerantName, @@ -46,10 +43,7 @@ public GasCooler( { Pressure = pressure.Value.ToUnit(PressureUnit.Kilopascal); } - else if ( - RefrigerantName is FluidsList.R744 - && Temperature <= 60.DegreesCelsius() - ) + else if (RefrigerantName is FluidsList.R744 && Temperature <= 60.DegreesCelsius()) { Pressure = (2.759 * Temperature.DegreesCelsius - 9.912) .Bars() @@ -59,20 +53,15 @@ RefrigerantName is FluidsList.R744 { throw new ArgumentException( "It is impossible to automatically calculate " - + "the absolute pressure in the gas cooler! " - + "It is necessary to define it." + + "the absolute pressure in the gas cooler! It is necessary to define it." ); } - new GasCoolerValidator( - new Refrigerant(RefrigerantName) - ).ValidateAndThrow(this); + new GasCoolerValidator(new Refrigerant(RefrigerantName)).ValidateAndThrow(this); } public FluidsList RefrigerantName { get; } - public Temperature Temperature { get; } - public Pressure Pressure { get; } public IRefrigerant Outlet => diff --git a/src/VCRC/Components/IAuxiliaryHeatExchanger.cs b/src/VCRC/Components/IAuxiliaryHeatExchanger.cs index 2920fc7..350da70 100644 --- a/src/VCRC/Components/IAuxiliaryHeatExchanger.cs +++ b/src/VCRC/Components/IAuxiliaryHeatExchanger.cs @@ -7,8 +7,7 @@ public interface IAuxiliaryHeatExchanger { /// /// Characteristic temperature difference - /// (at the "cold" side for the economizer; - /// at the "hot" side for the recuperator). + /// (at the "cold" side for the economizer; at the "hot" side for the recuperator). /// TemperatureDelta TemperatureDifference { get; } } diff --git a/src/VCRC/Components/IEjector.cs b/src/VCRC/Components/IEjector.cs index e31beac..7dd8791 100644 --- a/src/VCRC/Components/IEjector.cs +++ b/src/VCRC/Components/IEjector.cs @@ -26,15 +26,9 @@ public interface IEjector /// Nozzle inlet. /// Suction section inlet. /// Ejector flows. + /// Only one refrigerant should be selected! /// - /// Only one refrigerant should be selected! + /// Ejector nozzle inlet pressure should be greater than suction inlet pressure! /// - /// - /// Ejector nozzle inlet pressure - /// should be greater than suction inlet pressure! - /// - IEjectorFlows CalculateFlows( - IRefrigerant nozzleInlet, - IRefrigerant suctionInlet - ); + IEjectorFlows CalculateFlows(IRefrigerant nozzleInlet, IRefrigerant suctionInlet); } diff --git a/src/VCRC/Components/IHaveEconomizerWithTPI.cs b/src/VCRC/Components/IHaveEconomizerWithTPI.cs index f9d37d3..28bd9f2 100644 --- a/src/VCRC/Components/IHaveEconomizerWithTPI.cs +++ b/src/VCRC/Components/IHaveEconomizerWithTPI.cs @@ -1,8 +1,7 @@ namespace VCRC; /// -/// VCRC, which includes an economizer -/// with two-phase injection into the compressor. +/// VCRC, which includes an economizer with two-phase injection into the compressor. /// public interface IHaveEconomizerWithTPI { diff --git a/src/VCRC/Components/IMainHeatExchanger.cs b/src/VCRC/Components/IMainHeatExchanger.cs index 2dfa79d..79921f1 100644 --- a/src/VCRC/Components/IMainHeatExchanger.cs +++ b/src/VCRC/Components/IMainHeatExchanger.cs @@ -11,8 +11,7 @@ public interface IMainHeatExchanger FluidsList RefrigerantName { get; } /// - /// Characteristic temperature - /// (evaporating temperature (dew point) for the evaporator; + /// Characteristic temperature (evaporating temperature (dew point) for the evaporator; /// condensing temperature (bubble point) for the condenser; /// outlet temperature for the gas cooler). /// diff --git a/src/VCRC/Components/Recuperator.cs b/src/VCRC/Components/Recuperator.cs index 86dccd3..155ef9b 100644 --- a/src/VCRC/Components/Recuperator.cs +++ b/src/VCRC/Components/Recuperator.cs @@ -6,18 +6,13 @@ public record Recuperator : IAuxiliaryHeatExchanger { /// - /// - /// Temperature difference at the "hot" side. - /// + /// Temperature difference at the "hot" side. /// - /// Temperature difference at the recuperator 'hot' side - /// should be in (0;50) K! + /// Temperature difference at the recuperator 'hot' side should be in (0;50) K! /// public Recuperator(TemperatureDelta temperatureDifference) { - TemperatureDifference = temperatureDifference.ToUnit( - TemperatureDeltaUnit.Kelvin - ); + TemperatureDifference = temperatureDifference.ToUnit(TemperatureDeltaUnit.Kelvin); new RecuperatorValidator().ValidateAndThrow(this); } diff --git a/src/VCRC/Components/Validators/CompressorValidator.cs b/src/VCRC/Components/Validators/CompressorValidator.cs index e44c92f..d36d4d7 100644 --- a/src/VCRC/Components/Validators/CompressorValidator.cs +++ b/src/VCRC/Components/Validators/CompressorValidator.cs @@ -1,12 +1,9 @@ namespace VCRC; -internal class CompressorValidator : AbstractValidator +internal sealed class CompressorValidator : AbstractValidator { public CompressorValidator() => RuleFor(compressor => compressor.Efficiency) .ExclusiveBetween(Ratio.Zero, 100.Percent()) - .WithMessage( - "Isentropic efficiency of the compressor " - + "should be in (0;100) %!" - ); + .WithMessage("Isentropic efficiency of the compressor should be in (0;100) %!"); } diff --git a/src/VCRC/Components/Validators/CondenserValidator.cs b/src/VCRC/Components/Validators/CondenserValidator.cs index 2704c04..79e1f39 100644 --- a/src/VCRC/Components/Validators/CondenserValidator.cs +++ b/src/VCRC/Components/Validators/CondenserValidator.cs @@ -2,15 +2,12 @@ namespace VCRC; -internal class CondenserValidator : AbstractValidator +internal sealed class CondenserValidator : AbstractValidator { public CondenserValidator(IRefrigerant refrigerant) { RuleFor(condenser => condenser.Temperature) - .ExclusiveBetween( - refrigerant.TripleTemperature, - refrigerant.CriticalTemperature - ) + .ExclusiveBetween(refrigerant.TripleTemperature, refrigerant.CriticalTemperature) .WithMessage( "Condensing temperature should be in " + $"({Math.Round(refrigerant.TripleTemperature.DegreesCelsius, 2)};" diff --git a/src/VCRC/Components/Validators/EconomizerValidator.cs b/src/VCRC/Components/Validators/EconomizerValidator.cs index f4d0b7d..26d979e 100644 --- a/src/VCRC/Components/Validators/EconomizerValidator.cs +++ b/src/VCRC/Components/Validators/EconomizerValidator.cs @@ -2,7 +2,7 @@ namespace VCRC; -internal class EconomizerValidator : AbstractValidator +internal sealed class EconomizerValidator : AbstractValidator { public EconomizerValidator() => RuleFor(economizer => economizer.Superheat) diff --git a/src/VCRC/Components/Validators/EconomizerWithTPIValidator.cs b/src/VCRC/Components/Validators/EconomizerWithTPIValidator.cs index ea4cb62..4b3d10e 100644 --- a/src/VCRC/Components/Validators/EconomizerWithTPIValidator.cs +++ b/src/VCRC/Components/Validators/EconomizerWithTPIValidator.cs @@ -2,14 +2,12 @@ namespace VCRC; -internal class EconomizerWithTPIValidator - : AbstractValidator +internal sealed class EconomizerWithTPIValidator : AbstractValidator { public EconomizerWithTPIValidator() => RuleFor(economizer => economizer.TemperatureDifference) .ExclusiveBetween(TemperatureDelta.Zero, 50.Kelvins()) .WithMessage( - "Temperature difference at the economizer 'cold' side " - + "should be in (0;50) K!" + "Temperature difference at the economizer 'cold' side should be in (0;50) K!" ); } diff --git a/src/VCRC/Components/Validators/EjectorFlowsValidator.cs b/src/VCRC/Components/Validators/EjectorFlowsValidator.cs index f366780..99eb77f 100644 --- a/src/VCRC/Components/Validators/EjectorFlowsValidator.cs +++ b/src/VCRC/Components/Validators/EjectorFlowsValidator.cs @@ -1,6 +1,6 @@ namespace VCRC; -internal class EjectorFlowsValidator : AbstractValidator +internal sealed class EjectorFlowsValidator : AbstractValidator { public EjectorFlowsValidator() { @@ -10,8 +10,7 @@ public EjectorFlowsValidator() RuleFor(flows => flows.NozzleInlet.Pressure) .GreaterThan(flows => flows.SuctionInlet.Pressure) .WithMessage( - "Ejector nozzle inlet pressure " - + "should be greater than suction inlet pressure!" + "Ejector nozzle inlet pressure should be greater than suction inlet pressure!" ); } } diff --git a/src/VCRC/Components/Validators/EjectorValidator.cs b/src/VCRC/Components/Validators/EjectorValidator.cs index ada7eb4..99525fc 100644 --- a/src/VCRC/Components/Validators/EjectorValidator.cs +++ b/src/VCRC/Components/Validators/EjectorValidator.cs @@ -1,24 +1,17 @@ namespace VCRC; -internal class EjectorValidator : AbstractValidator +internal sealed class EjectorValidator : AbstractValidator { public EjectorValidator() { RuleFor(ejector => ejector.NozzleEfficiency) .ExclusiveBetween(Ratio.Zero, 100.Percent()) - .WithMessage( - "Isentropic efficiency of the nozzle should be in (0;100) %!" - ); + .WithMessage("Isentropic efficiency of the nozzle should be in (0;100) %!"); RuleFor(ejector => ejector.SuctionEfficiency) .ExclusiveBetween(Ratio.Zero, 100.Percent()) - .WithMessage( - "Isentropic efficiency of the suction section " - + "should be in (0;100) %!" - ); + .WithMessage("Isentropic efficiency of the suction section should be in (0;100) %!"); RuleFor(ejector => ejector.DiffuserEfficiency) .ExclusiveBetween(Ratio.Zero, 100.Percent()) - .WithMessage( - "Isentropic efficiency of the diffuser should be in (0;100) %!" - ); + .WithMessage("Isentropic efficiency of the diffuser should be in (0;100) %!"); } } diff --git a/src/VCRC/Components/Validators/EvaporatorValidator.cs b/src/VCRC/Components/Validators/EvaporatorValidator.cs index cc466c3..ed80301 100644 --- a/src/VCRC/Components/Validators/EvaporatorValidator.cs +++ b/src/VCRC/Components/Validators/EvaporatorValidator.cs @@ -2,15 +2,12 @@ namespace VCRC; -internal class EvaporatorValidator : AbstractValidator +internal sealed class EvaporatorValidator : AbstractValidator { public EvaporatorValidator(IRefrigerant refrigerant) { RuleFor(evaporator => evaporator.Temperature) - .ExclusiveBetween( - refrigerant.TripleTemperature, - refrigerant.CriticalTemperature - ) + .ExclusiveBetween(refrigerant.TripleTemperature, refrigerant.CriticalTemperature) .WithMessage( "Evaporating temperature should be in " + $"({Math.Round(refrigerant.TripleTemperature.DegreesCelsius, 2)};" diff --git a/src/VCRC/Components/Validators/GasCoolerValidator.cs b/src/VCRC/Components/Validators/GasCoolerValidator.cs index 5d1ddbc..a37c108 100644 --- a/src/VCRC/Components/Validators/GasCoolerValidator.cs +++ b/src/VCRC/Components/Validators/GasCoolerValidator.cs @@ -1,6 +1,6 @@ namespace VCRC; -internal class GasCoolerValidator : AbstractValidator +internal sealed class GasCoolerValidator : AbstractValidator { public GasCoolerValidator(IRefrigerant refrigerant) { diff --git a/src/VCRC/Components/Validators/RecuperatorValidator.cs b/src/VCRC/Components/Validators/RecuperatorValidator.cs index b2958e6..483dbf6 100644 --- a/src/VCRC/Components/Validators/RecuperatorValidator.cs +++ b/src/VCRC/Components/Validators/RecuperatorValidator.cs @@ -2,13 +2,12 @@ namespace VCRC; -internal class RecuperatorValidator : AbstractValidator +internal sealed class RecuperatorValidator : AbstractValidator { public RecuperatorValidator() => RuleFor(recuperator => recuperator.TemperatureDifference) .ExclusiveBetween(TemperatureDelta.Zero, 50.Kelvins()) .WithMessage( - "Temperature difference at the recuperator 'hot' side " - + "should be in (0;50) K!" + "Temperature difference at the recuperator 'hot' side should be in (0;50) K!" ); } diff --git a/src/VCRC/EntropyAnalysis/EntropyAnalysisExtensions.cs b/src/VCRC/EntropyAnalysis/EntropyAnalysisExtensions.cs index ff9e8bf..7cb3cc9 100644 --- a/src/VCRC/EntropyAnalysis/EntropyAnalysisExtensions.cs +++ b/src/VCRC/EntropyAnalysis/EntropyAnalysisExtensions.cs @@ -6,18 +6,13 @@ public static class EntropyAnalysisExtensions { /// - /// Performs VCRC entropy analysis over a range - /// of indoor and outdoor temperatures. + /// Performs VCRC entropy analysis over a range of indoor and outdoor temperatures. /// /// List of VCRCs. /// List of indoor temperatures. /// List of outdoor temperatures. - /// - /// Result of the VCRC entropy analysis in range of temperatures. - /// - /// - /// The lists should have the same length! - /// + /// Result of the VCRC entropy analysis in range of temperatures. + /// The lists should have the same length! public static IEntropyAnalysisResult EntropyAnalysis( this IList cycles, IList indoor, @@ -25,71 +20,29 @@ IList outdoor ) => cycles.Count == indoor.Count && indoor.Count == outdoor.Count ? cycles - .Select( - (cycle, i) => cycle.EntropyAnalysis(indoor[i], outdoor[i]) - ) + .Select((cycle, i) => cycle.EntropyAnalysis(indoor[i], outdoor[i])) .ToList() .Average() - : throw new ArgumentException( - "The lists should have the same length!" - ); + : throw new ArgumentException("The lists should have the same length!"); /// /// Computes the average of a list of the entropy analysis results. /// /// List of the entropy analysis results. /// The average. - public static IEntropyAnalysisResult Average( - this IList results - ) => + public static IEntropyAnalysisResult Average(this IList results) => new EntropyAnalysisResult( - results - .Select(i => i.ThermodynamicPerfection.Percent) - .Average() - .Percent(), - results - .Select(i => i.MinSpecificWorkRatio.Percent) - .Average() - .Percent(), - results - .Select(i => i.CompressorEnergyLossRatio.Percent) - .Average() - .Percent(), - results - .Select(i => i.CondenserEnergyLossRatio.Percent) - .Average() - .Percent(), - results - .Select(i => i.GasCoolerEnergyLossRatio.Percent) - .Average() - .Percent(), - results - .Select(i => i.ExpansionValvesEnergyLossRatio.Percent) - .Average() - .Percent(), - results - .Select(i => i.EjectorEnergyLossRatio.Percent) - .Average() - .Percent(), - results - .Select(i => i.EvaporatorEnergyLossRatio.Percent) - .Average() - .Percent(), - results - .Select(i => i.RecuperatorEnergyLossRatio.Percent) - .Average() - .Percent(), - results - .Select(i => i.EconomizerEnergyLossRatio.Percent) - .Average() - .Percent(), - results - .Select(i => i.MixingEnergyLossRatio.Percent) - .Average() - .Percent(), - results - .Select(i => i.AnalysisRelativeError.Percent) - .Average() - .Percent() + results.Select(i => i.ThermodynamicPerfection.Percent).Average().Percent(), + results.Select(i => i.MinSpecificWorkRatio.Percent).Average().Percent(), + results.Select(i => i.CompressorEnergyLossRatio.Percent).Average().Percent(), + results.Select(i => i.CondenserEnergyLossRatio.Percent).Average().Percent(), + results.Select(i => i.GasCoolerEnergyLossRatio.Percent).Average().Percent(), + results.Select(i => i.ExpansionValvesEnergyLossRatio.Percent).Average().Percent(), + results.Select(i => i.EjectorEnergyLossRatio.Percent).Average().Percent(), + results.Select(i => i.EvaporatorEnergyLossRatio.Percent).Average().Percent(), + results.Select(i => i.RecuperatorEnergyLossRatio.Percent).Average().Percent(), + results.Select(i => i.EconomizerEnergyLossRatio.Percent).Average().Percent(), + results.Select(i => i.MixingEnergyLossRatio.Percent).Average().Percent(), + results.Select(i => i.AnalysisRelativeError.Percent).Average().Percent() ); } diff --git a/src/VCRC/EntropyAnalysis/EntropyAnalysisResult.cs b/src/VCRC/EntropyAnalysis/EntropyAnalysisResult.cs index 8d5734b..3685ea4 100644 --- a/src/VCRC/EntropyAnalysis/EntropyAnalysisResult.cs +++ b/src/VCRC/EntropyAnalysis/EntropyAnalysisResult.cs @@ -5,52 +5,42 @@ /// Degree of thermodynamic perfection of the cycle (by default, %). /// /// -/// Minimum specific work -/// (its percentage of the total specific work) (by default, %). +/// Minimum specific work (its percentage of the total specific work) (by default, %). /// /// -/// Energy losses in the compressor -/// (its percentage of the total specific work) (by default, %). +/// Energy losses in the compressor (its percentage of the total specific work) (by default, %). /// /// -/// Minimum required specific work -/// to compensate for entropy production in the condenser +/// Minimum required specific work to compensate for entropy production in the condenser /// (its percentage of the total specific work) (by default, %). /// /// -/// Minimum required specific work -/// to compensate for entropy production in the gas cooler +/// Minimum required specific work to compensate for entropy production in the gas cooler /// (its percentage of the total specific work) (by default, %). /// /// -/// Minimum required specific work -/// to compensate for entropy production in the expansion valves +/// Minimum required specific work to compensate for entropy production in the expansion valves /// (its percentage of the total specific work) (by default, %). /// /// -/// Minimum required specific work -/// to compensate for entropy production in the ejector +/// Minimum required specific work to compensate for entropy production in the ejector /// (its percentage of the total specific work) (by default, %). /// /// -/// Minimum required specific work -/// to compensate for entropy production in the evaporator +/// Minimum required specific work to compensate for entropy production in the evaporator /// (its percentage of the total specific work) (by default, %). /// /// -/// Minimum required specific work -/// to compensate for entropy production in the recuperator +/// Minimum required specific work to compensate for entropy production in the recuperator /// (its percentage of the total specific work) (by default, %). /// /// -/// Minimum required specific work -/// to compensate for entropy production in the economizer +/// Minimum required specific work to compensate for entropy production in the economizer /// (its percentage of the total specific work) (by default, %). /// /// -/// Minimum required specific work -/// to compensate for entropy production during the mixing of flows -/// (its percentage of the total specific work) (by default, %). +/// Minimum required specific work to compensate for entropy production during +/// the mixing of flows (its percentage of the total specific work) (by default, %). /// /// /// Entropy analysis relative error (by default, %). @@ -76,14 +66,12 @@ Ratio AnalysisRelativeError public Ratio CondenserEnergyLossRatio { get; } = CondenserEnergyLossRatio; public Ratio GasCoolerEnergyLossRatio { get; } = GasCoolerEnergyLossRatio; - public Ratio ExpansionValvesEnergyLossRatio { get; } = - ExpansionValvesEnergyLossRatio; + public Ratio ExpansionValvesEnergyLossRatio { get; } = ExpansionValvesEnergyLossRatio; public Ratio EjectorEnergyLossRatio { get; } = EjectorEnergyLossRatio; public Ratio EvaporatorEnergyLossRatio { get; } = EvaporatorEnergyLossRatio; - public Ratio RecuperatorEnergyLossRatio { get; } = - RecuperatorEnergyLossRatio; + public Ratio RecuperatorEnergyLossRatio { get; } = RecuperatorEnergyLossRatio; public Ratio EconomizerEnergyLossRatio { get; } = EconomizerEnergyLossRatio; public Ratio MixingEnergyLossRatio { get; } = MixingEnergyLossRatio; diff --git a/src/VCRC/EntropyAnalysis/EntropyAnalyzer.cs b/src/VCRC/EntropyAnalysis/EntropyAnalyzer.cs index beb143b..d53b166 100644 --- a/src/VCRC/EntropyAnalysis/EntropyAnalyzer.cs +++ b/src/VCRC/EntropyAnalysis/EntropyAnalyzer.cs @@ -2,7 +2,7 @@ namespace VCRC; -internal class EntropyAnalyzer( +internal sealed class EntropyAnalyzer( IVCRC cycle, IEvaporatorNode evaporatorNode, IHeatReleaserNode heatReleaserNode, @@ -19,14 +19,10 @@ internal class EntropyAnalyzer( private Temperature _hotSource; private Ratio ThermodynamicPerfection => - Ratio - .FromDecimalFractions(MinSpecificWork / cycle.SpecificWork) - .ToUnit(RatioUnit.Percent); + Ratio.FromDecimalFractions(MinSpecificWork / cycle.SpecificWork).ToUnit(RatioUnit.Percent); private SpecificEnergy MinSpecificWork => - cycle.SpecificCoolingCapacity - * (_hotSource - _coldSource).Kelvins - / _coldSource.Kelvins; + cycle.SpecificCoolingCapacity * (_hotSource - _coldSource).Kelvins / _coldSource.Kelvins; private SpecificEnergy HeatReleaserEnergyLoss => heatReleaserNode.CalculateEnergyLoss(_hotSource); @@ -62,8 +58,7 @@ internal class EntropyAnalyzer( + MixingEnergyLoss; private SpecificEnergy CompressorEnergyLoss => - CalculatedIsentropicSpecificWork - * (1.0 / cycle.Compressor.Efficiency.DecimalFractions - 1); + CalculatedIsentropicSpecificWork * (1.0 / cycle.Compressor.Efficiency.DecimalFractions - 1); private SpecificEnergy CalculatedSpecificWork => CalculatedIsentropicSpecificWork + CompressorEnergyLoss; @@ -71,25 +66,18 @@ internal class EntropyAnalyzer( private Ratio AnalysisRelativeError => Ratio .FromDecimalFractions( - ( - CalculatedIsentropicSpecificWork - - cycle.IsentropicSpecificWork - ).Abs() / cycle.IsentropicSpecificWork + (CalculatedIsentropicSpecificWork - cycle.IsentropicSpecificWork).Abs() + / cycle.IsentropicSpecificWork ) .ToUnit(RatioUnit.Percent); - public IEntropyAnalysisResult PerformAnalysis( - Temperature indoor, - Temperature outdoor - ) + public IEntropyAnalysisResult PerformAnalysis(Temperature indoor, Temperature outdoor) { _coldSource = UnitMath.Min(indoor, outdoor); _hotSource = UnitMath.Max(indoor, outdoor); if (_coldSource.Equals(_hotSource, 1e-3.DegreesCelsius())) { - throw new ArgumentException( - "Indoor and outdoor temperatures should not be equal!" - ); + throw new ArgumentException("Indoor and outdoor temperatures should not be equal!"); } if (_coldSource <= evaporatorNode.Outlet.Temperature) @@ -112,12 +100,8 @@ Temperature outdoor ThermodynamicPerfection, EnergyLossRatio(MinSpecificWork), EnergyLossRatio(CompressorEnergyLoss), - cycle.HeatReleaser is Condenser - ? EnergyLossRatio(HeatReleaserEnergyLoss) - : Ratio.Zero, - cycle.HeatReleaser is GasCooler - ? EnergyLossRatio(HeatReleaserEnergyLoss) - : Ratio.Zero, + cycle.HeatReleaser is Condenser ? EnergyLossRatio(HeatReleaserEnergyLoss) : Ratio.Zero, + cycle.HeatReleaser is GasCooler ? EnergyLossRatio(HeatReleaserEnergyLoss) : Ratio.Zero, EnergyLossRatio(ExpansionValvesEnergyLoss), EnergyLossRatio(EjectorEnergyLoss), EnergyLossRatio(EvaporatorEnergyLoss), @@ -129,7 +113,5 @@ cycle.HeatReleaser is GasCooler } private Ratio EnergyLossRatio(SpecificEnergy energyLoss) => - Ratio - .FromDecimalFractions(energyLoss / CalculatedSpecificWork) - .ToUnit(RatioUnit.Percent); + Ratio.FromDecimalFractions(energyLoss / CalculatedSpecificWork).ToUnit(RatioUnit.Percent); } diff --git a/src/VCRC/EntropyAnalysis/IEntropyAnalysable.cs b/src/VCRC/EntropyAnalysis/IEntropyAnalysable.cs index 1056b7f..9abe3ec 100644 --- a/src/VCRC/EntropyAnalysis/IEntropyAnalysable.cs +++ b/src/VCRC/EntropyAnalysis/IEntropyAnalysable.cs @@ -15,15 +15,11 @@ public interface IEntropyAnalysable /// Indoor and outdoor temperatures should not be equal! /// /// - /// Wrong temperature difference in the evaporator! - /// Increase 'cold' source temperature. + /// Wrong temperature difference in the evaporator! Increase 'cold' source temperature. /// /// /// Wrong temperature difference in the condenser or gas cooler! /// Decrease 'hot' source temperature. /// - IEntropyAnalysisResult EntropyAnalysis( - Temperature indoor, - Temperature outdoor - ); + IEntropyAnalysisResult EntropyAnalysis(Temperature indoor, Temperature outdoor); } diff --git a/src/VCRC/EntropyAnalysis/IEntropyAnalysisResult.cs b/src/VCRC/EntropyAnalysis/IEntropyAnalysisResult.cs index da1dec5..77dcf22 100644 --- a/src/VCRC/EntropyAnalysis/IEntropyAnalysisResult.cs +++ b/src/VCRC/EntropyAnalysis/IEntropyAnalysisResult.cs @@ -11,8 +11,7 @@ public interface IEntropyAnalysisResult Ratio ThermodynamicPerfection { get; } /// - /// Minimum specific work - /// (its percentage of the total specific work) (by default, %). + /// Minimum specific work (its percentage of the total specific work) (by default, %). /// Ratio MinSpecificWorkRatio { get; } @@ -23,58 +22,50 @@ public interface IEntropyAnalysisResult Ratio CompressorEnergyLossRatio { get; } /// - /// Minimum required specific work - /// to compensate for entropy production in the condenser + /// Minimum required specific work to compensate for entropy production in the condenser /// (its percentage of the total specific work) (by default, %). /// Ratio CondenserEnergyLossRatio { get; } /// - /// Minimum required specific work - /// to compensate for entropy production in the gas cooler + /// Minimum required specific work to compensate for entropy production in the gas cooler /// (its percentage of the total specific work) (by default, %). /// Ratio GasCoolerEnergyLossRatio { get; } /// - /// Minimum required specific work - /// to compensate for entropy production in the expansion valves - /// (its percentage of the total specific work) (by default, %). + /// Minimum required specific work to compensate for entropy production + /// in the expansion valves (its percentage of the total specific work) (by default, %). /// Ratio ExpansionValvesEnergyLossRatio { get; } /// - /// Minimum required specific work - /// to compensate for entropy production in the ejector + /// Minimum required specific work to compensate for entropy production in the ejector /// (its percentage of the total specific work) (by default, %). /// Ratio EjectorEnergyLossRatio { get; } /// - /// Minimum required specific work - /// to compensate for entropy production in the evaporator + /// Minimum required specific work to compensate for entropy production in the evaporator /// (its percentage of the total specific work) (by default, %). /// Ratio EvaporatorEnergyLossRatio { get; } /// - /// Minimum required specific work - /// to compensate for entropy production in the recuperator + /// Minimum required specific work to compensate for entropy production in the recuperator /// (its percentage of the total specific work) (by default, %). /// Ratio RecuperatorEnergyLossRatio { get; } /// - /// Minimum required specific work - /// to compensate for entropy production in the economizer + /// Minimum required specific work to compensate for entropy production in the economizer /// (its percentage of the total specific work) (by default, %). /// Ratio EconomizerEnergyLossRatio { get; } /// - /// Minimum required specific work - /// to compensate for entropy production during the mixing of flows - /// (its percentage of the total specific work) (by default, %). + /// Minimum required specific work to compensate for entropy production during + /// the mixing of flows (its percentage of the total specific work) (by default, %). /// Ratio MixingEnergyLossRatio { get; } diff --git a/src/VCRC/EntropyAnalysis/IEntropyAnalyzer.cs b/src/VCRC/EntropyAnalysis/IEntropyAnalyzer.cs index e401b3b..6f4a3f5 100644 --- a/src/VCRC/EntropyAnalysis/IEntropyAnalyzer.cs +++ b/src/VCRC/EntropyAnalysis/IEntropyAnalyzer.cs @@ -2,8 +2,5 @@ internal interface IEntropyAnalyzer { - IEntropyAnalysisResult PerformAnalysis( - Temperature indoor, - Temperature outdoor - ); + IEntropyAnalysisResult PerformAnalysis(Temperature indoor, Temperature outdoor); } diff --git a/src/VCRC/EntropyAnalysis/Nodes/EVNode.cs b/src/VCRC/EntropyAnalysis/Nodes/EVNode.cs index a9fc79d..17384f2 100644 --- a/src/VCRC/EntropyAnalysis/Nodes/EVNode.cs +++ b/src/VCRC/EntropyAnalysis/Nodes/EVNode.cs @@ -1,17 +1,13 @@ namespace VCRC; -internal class EVNode( - Ratio specificMassFlow, - IRefrigerant inlet, - IRefrigerant outlet -) : IEntropyAnalysisNode +internal sealed class EVNode(Ratio specificMassFlow, IRefrigerant inlet, IRefrigerant outlet) + : IEntropyAnalysisNode { public SpecificEnergy CalculateEnergyLoss(Temperature hotSource) => ( hotSource.Kelvins * ( - specificMassFlow.DecimalFractions - * (outlet.Entropy - inlet.Entropy) + specificMassFlow.DecimalFractions * (outlet.Entropy - inlet.Entropy) ).JoulesPerKilogramKelvin ).JoulesPerKilogram(); } diff --git a/src/VCRC/EntropyAnalysis/Nodes/EconomizerNode.cs b/src/VCRC/EntropyAnalysis/Nodes/EconomizerNode.cs index 75e15fc..ebcb2ec 100644 --- a/src/VCRC/EntropyAnalysis/Nodes/EconomizerNode.cs +++ b/src/VCRC/EntropyAnalysis/Nodes/EconomizerNode.cs @@ -1,6 +1,6 @@ namespace VCRC; -internal class EconomizerNode( +internal sealed class EconomizerNode( Ratio coldSideSpecificMassFlow, IRefrigerant coldInlet, IRefrigerant coldOutlet, @@ -13,10 +13,8 @@ public SpecificEnergy CalculateEnergyLoss(Temperature hotSource) => ( hotSource.Kelvins * ( - coldSideSpecificMassFlow.DecimalFractions - * (coldOutlet.Entropy - coldInlet.Entropy) - - hotSideSpecificMassFlow.DecimalFractions - * (hotInlet.Entropy - hotOutlet.Entropy) + coldSideSpecificMassFlow.DecimalFractions * (coldOutlet.Entropy - coldInlet.Entropy) + - hotSideSpecificMassFlow.DecimalFractions * (hotInlet.Entropy - hotOutlet.Entropy) ).JoulesPerKilogramKelvin ).JoulesPerKilogram(); } diff --git a/src/VCRC/EntropyAnalysis/Nodes/EjectorNode.cs b/src/VCRC/EntropyAnalysis/Nodes/EjectorNode.cs index ca21bd9..a4384ac 100644 --- a/src/VCRC/EntropyAnalysis/Nodes/EjectorNode.cs +++ b/src/VCRC/EntropyAnalysis/Nodes/EjectorNode.cs @@ -1,6 +1,6 @@ namespace VCRC; -internal class EjectorNode( +internal sealed class EjectorNode( IRefrigerant outlet, Ratio nozzleSpecificMassFlow, IRefrigerant nozzleInlet, @@ -12,14 +12,10 @@ public SpecificEnergy CalculateEnergyLoss(Temperature hotSource) => ( hotSource.Kelvins * ( - ( - nozzleSpecificMassFlow + suctionSpecificMassFlow - ).DecimalFractions * outlet.Entropy + (nozzleSpecificMassFlow + suctionSpecificMassFlow).DecimalFractions * outlet.Entropy - ( - nozzleSpecificMassFlow.DecimalFractions - * nozzleInlet.Entropy - + suctionSpecificMassFlow.DecimalFractions - * suctionInlet.Entropy + nozzleSpecificMassFlow.DecimalFractions * nozzleInlet.Entropy + + suctionSpecificMassFlow.DecimalFractions * suctionInlet.Entropy ) ).JoulesPerKilogramKelvin ).JoulesPerKilogram(); diff --git a/src/VCRC/EntropyAnalysis/Nodes/EvaporatorNode.cs b/src/VCRC/EntropyAnalysis/Nodes/EvaporatorNode.cs index ce60c23..df6d6a1 100644 --- a/src/VCRC/EntropyAnalysis/Nodes/EvaporatorNode.cs +++ b/src/VCRC/EntropyAnalysis/Nodes/EvaporatorNode.cs @@ -1,6 +1,6 @@ namespace VCRC; -internal class EvaporatorNode( +internal sealed class EvaporatorNode( Ratio specificMassFlow, IRefrigerant inlet, IRefrigerant outlet @@ -8,17 +8,13 @@ IRefrigerant outlet { public IRefrigerant Outlet { get; } = outlet; - public SpecificEnergy CalculateEnergyLoss( - Temperature coldSource, - Temperature hotSource - ) => + public SpecificEnergy CalculateEnergyLoss(Temperature coldSource, Temperature hotSource) => ( specificMassFlow.DecimalFractions * hotSource.Kelvins * ( (Outlet.Entropy - inlet.Entropy).JoulesPerKilogramKelvin - - (Outlet.Enthalpy - inlet.Enthalpy).JoulesPerKilogram - / coldSource.Kelvins + - (Outlet.Enthalpy - inlet.Enthalpy).JoulesPerKilogram / coldSource.Kelvins ) ).JoulesPerKilogram(); } diff --git a/src/VCRC/EntropyAnalysis/Nodes/HeatReleaserNode.cs b/src/VCRC/EntropyAnalysis/Nodes/HeatReleaserNode.cs index d0aa32a..9f3810d 100644 --- a/src/VCRC/EntropyAnalysis/Nodes/HeatReleaserNode.cs +++ b/src/VCRC/EntropyAnalysis/Nodes/HeatReleaserNode.cs @@ -1,6 +1,6 @@ namespace VCRC; -internal class HeatReleaserNode( +internal sealed class HeatReleaserNode( Ratio specificMassFlow, IRefrigerant isentropicInlet, IRefrigerant outlet @@ -15,9 +15,7 @@ public SpecificEnergy CalculateEnergyLoss(Temperature hotSource) => - Outlet.Enthalpy - ( hotSource.Kelvins - * ( - isentropicInlet.Entropy - Outlet.Entropy - ).JoulesPerKilogramKelvin + * (isentropicInlet.Entropy - Outlet.Entropy).JoulesPerKilogramKelvin ).JoulesPerKilogram() ); } diff --git a/src/VCRC/EntropyAnalysis/Nodes/IEvaporatorNode.cs b/src/VCRC/EntropyAnalysis/Nodes/IEvaporatorNode.cs index ed67f6c..7e0e108 100644 --- a/src/VCRC/EntropyAnalysis/Nodes/IEvaporatorNode.cs +++ b/src/VCRC/EntropyAnalysis/Nodes/IEvaporatorNode.cs @@ -2,8 +2,5 @@ internal interface IEvaporatorNode : IMainHeatExchangerNode { - SpecificEnergy CalculateEnergyLoss( - Temperature coldSource, - Temperature hotSource - ); + SpecificEnergy CalculateEnergyLoss(Temperature coldSource, Temperature hotSource); } diff --git a/src/VCRC/EntropyAnalysis/Nodes/IHeatReleaserNode.cs b/src/VCRC/EntropyAnalysis/Nodes/IHeatReleaserNode.cs index 4f38b28..c23684e 100644 --- a/src/VCRC/EntropyAnalysis/Nodes/IHeatReleaserNode.cs +++ b/src/VCRC/EntropyAnalysis/Nodes/IHeatReleaserNode.cs @@ -1,5 +1,3 @@ namespace VCRC; -internal interface IHeatReleaserNode - : IMainHeatExchangerNode, - IEntropyAnalysisNode; +internal interface IHeatReleaserNode : IMainHeatExchangerNode, IEntropyAnalysisNode; diff --git a/src/VCRC/EntropyAnalysis/Nodes/MixingNode.cs b/src/VCRC/EntropyAnalysis/Nodes/MixingNode.cs index fe911a6..6c18c46 100644 --- a/src/VCRC/EntropyAnalysis/Nodes/MixingNode.cs +++ b/src/VCRC/EntropyAnalysis/Nodes/MixingNode.cs @@ -1,6 +1,6 @@ namespace VCRC; -internal class MixingNode( +internal sealed class MixingNode( IRefrigerant outlet, Ratio firstSpecificMassFlow, IRefrigerant first, @@ -12,9 +12,7 @@ public SpecificEnergy CalculateEnergyLoss(Temperature hotSource) => ( hotSource.Kelvins * ( - ( - firstSpecificMassFlow + secondSpecificMassFlow - ).DecimalFractions * outlet.Entropy + (firstSpecificMassFlow + secondSpecificMassFlow).DecimalFractions * outlet.Entropy - ( firstSpecificMassFlow.DecimalFractions * first.Entropy + secondSpecificMassFlow.DecimalFractions * second.Entropy diff --git a/src/VCRC/EntropyAnalysis/Nodes/RecuperatorNode.cs b/src/VCRC/EntropyAnalysis/Nodes/RecuperatorNode.cs index 227c7e2..a839618 100644 --- a/src/VCRC/EntropyAnalysis/Nodes/RecuperatorNode.cs +++ b/src/VCRC/EntropyAnalysis/Nodes/RecuperatorNode.cs @@ -1,6 +1,6 @@ namespace VCRC; -internal class RecuperatorNode( +internal sealed class RecuperatorNode( Ratio coldSideSpecificMassFlow, IRefrigerant coldInlet, IRefrigerant coldOutlet, @@ -13,10 +13,8 @@ public SpecificEnergy CalculateEnergyLoss(Temperature hotSource) => ( hotSource.Kelvins * ( - coldSideSpecificMassFlow.DecimalFractions - * (coldOutlet.Entropy - coldInlet.Entropy) - - hotSideSpecificMassFlow.DecimalFractions - * (hotInlet.Entropy - hotOutlet.Entropy) + coldSideSpecificMassFlow.DecimalFractions * (coldOutlet.Entropy - coldInlet.Entropy) + - hotSideSpecificMassFlow.DecimalFractions * (hotInlet.Entropy - hotOutlet.Entropy) ).JoulesPerKilogramKelvin ).JoulesPerKilogram(); } diff --git a/src/VCRC/Fluids/IRefrigerant.cs b/src/VCRC/Fluids/IRefrigerant.cs index be316fc..e96f6c1 100644 --- a/src/VCRC/Fluids/IRefrigerant.cs +++ b/src/VCRC/Fluids/IRefrigerant.cs @@ -8,33 +8,25 @@ public interface IRefrigerant : IFluid /// /// Absolute pressure at the critical point (by default, kPa). /// - /// - /// Invalid critical pressure! - /// + /// Invalid critical pressure! new Pressure CriticalPressure { get; } /// /// Temperature at the critical point (by default, °C). /// - /// - /// Invalid critical temperature! - /// + /// Invalid critical temperature! new Temperature CriticalTemperature { get; } /// /// Absolute pressure at the triple point (by default, kPa). /// - /// - /// Invalid triple pressure! - /// + /// Invalid triple pressure! new Pressure TriplePressure { get; } /// /// Temperature at the triple point (by default, °C). /// - /// - /// Invalid triple temperature! - /// + /// Invalid triple temperature! new Temperature TripleTemperature { get; } /// @@ -69,10 +61,7 @@ public interface IRefrigerant : IFluid /// Subcooling. /// Subcooled refrigerant. /// Invalid subcooling! - IRefrigerant Subcooled( - Temperature bubblePointTemperature, - TemperatureDelta subcooling - ); + IRefrigerant Subcooled(Temperature bubblePointTemperature, TemperatureDelta subcooling); /// /// Subcooled refrigerant. @@ -90,10 +79,7 @@ TemperatureDelta subcooling /// Superheat. /// Superheated refrigerant. /// Invalid superheat! - IRefrigerant Superheated( - Temperature dewPointTemperature, - TemperatureDelta superheat - ); + IRefrigerant Superheated(Temperature dewPointTemperature, TemperatureDelta superheat); /// /// Superheated refrigerant. @@ -114,10 +100,7 @@ IKeyedInput secondInput new IRefrigerant IsentropicCompressionTo(Pressure pressure); /// - new IRefrigerant CompressionTo( - Pressure pressure, - Ratio isentropicEfficiency - ); + new IRefrigerant CompressionTo(Pressure pressure, Ratio isentropicEfficiency); /// new IRefrigerant IsenthalpicExpansionTo(Pressure pressure); @@ -129,28 +112,16 @@ Ratio isentropicEfficiency new IRefrigerant ExpansionTo(Pressure pressure, Ratio isentropicEfficiency); /// - new IRefrigerant CoolingTo( - Temperature temperature, - Pressure? pressureDrop = null - ); + new IRefrigerant CoolingTo(Temperature temperature, Pressure? pressureDrop = null); /// - new IRefrigerant CoolingTo( - SpecificEnergy enthalpy, - Pressure? pressureDrop = null - ); + new IRefrigerant CoolingTo(SpecificEnergy enthalpy, Pressure? pressureDrop = null); /// - new IRefrigerant HeatingTo( - Temperature temperature, - Pressure? pressureDrop = null - ); + new IRefrigerant HeatingTo(Temperature temperature, Pressure? pressureDrop = null); /// - new IRefrigerant HeatingTo( - SpecificEnergy enthalpy, - Pressure? pressureDrop = null - ); + new IRefrigerant HeatingTo(SpecificEnergy enthalpy, Pressure? pressureDrop = null); /// new IRefrigerant BubblePointAt(Pressure pressure); diff --git a/src/VCRC/Fluids/Refrigerant.cs b/src/VCRC/Fluids/Refrigerant.cs index 72c857c..615df9a 100644 --- a/src/VCRC/Fluids/Refrigerant.cs +++ b/src/VCRC/Fluids/Refrigerant.cs @@ -8,33 +8,26 @@ public class Refrigerant : Fluid, IRefrigerant /// /// Selected refrigerant name. /// - /// The selected fluid is not a refrigerant - /// (its name should start with 'R')! + /// The selected fluid is not a refrigerant (its name should start with 'R')! /// public Refrigerant(FluidsList name) : base(name) => new RefrigerantValidator().ValidateAndThrow(this); public new Pressure CriticalPressure => - base.CriticalPressure - ?? throw new NullReferenceException("Invalid critical pressure!"); + base.CriticalPressure ?? throw new NullReferenceException("Invalid critical pressure!"); public new Temperature CriticalTemperature => base.CriticalTemperature ?? throw new NullReferenceException("Invalid critical temperature!"); public new Pressure TriplePressure => - base.TriplePressure - ?? throw new NullReferenceException("Invalid triple pressure!"); + base.TriplePressure ?? throw new NullReferenceException("Invalid triple pressure!"); public new Temperature TripleTemperature => - base.TripleTemperature - ?? throw new NullReferenceException("Invalid triple temperature!"); + base.TripleTemperature ?? throw new NullReferenceException("Invalid triple temperature!"); public TemperatureDelta Glide => - ( - DewPointAt(1.Atmospheres()).Temperature - - BubblePointAt(1.Atmospheres()).Temperature - ) + (DewPointAt(1.Atmospheres()).Temperature - BubblePointAt(1.Atmospheres()).Temperature) .Abs() .ToUnit(TemperatureDeltaUnit.Kelvin); @@ -50,47 +43,26 @@ public IRefrigerant Subcooled( Temperature bubblePointTemperature, TemperatureDelta subcooling ) => - subcooling < TemperatureDelta.Zero - ? throw new ArgumentException("Invalid subcooling!") - : subcooling.Equals(TemperatureDelta.Zero, Tolerance.Kelvins()) - ? BubblePointAt(bubblePointTemperature) - : BubblePointAt(bubblePointTemperature) - .CoolingTo(bubblePointTemperature - subcooling); - - public IRefrigerant Subcooled( - Pressure pressure, - TemperatureDelta subcooling - ) => - subcooling < TemperatureDelta.Zero - ? throw new ArgumentException("Invalid subcooling!") - : subcooling.Equals(TemperatureDelta.Zero, Tolerance.Kelvins()) - ? BubblePointAt(pressure) - : BubblePointAt(pressure) - .CoolingTo( - BubblePointAt(pressure).Temperature - subcooling - ); - - public IRefrigerant Superheated( - Temperature dewPointTemperature, - TemperatureDelta superheat - ) => - superheat < TemperatureDelta.Zero - ? throw new ArgumentException("Invalid superheat!") - : superheat.Equals(TemperatureDelta.Zero, Tolerance.Kelvins()) - ? DewPointAt(dewPointTemperature) - : DewPointAt(dewPointTemperature) - .HeatingTo(dewPointTemperature + superheat); - - public IRefrigerant Superheated( - Pressure pressure, - TemperatureDelta superheat - ) => - superheat < TemperatureDelta.Zero - ? throw new ArgumentException("Invalid superheat!") - : superheat.Equals(TemperatureDelta.Zero, Tolerance.Kelvins()) - ? DewPointAt(pressure) - : DewPointAt(pressure) - .HeatingTo(DewPointAt(pressure).Temperature + superheat); + subcooling < TemperatureDelta.Zero ? throw new ArgumentException("Invalid subcooling!") + : subcooling.Equals(TemperatureDelta.Zero, Tolerance.Kelvins()) + ? BubblePointAt(bubblePointTemperature) + : BubblePointAt(bubblePointTemperature).CoolingTo(bubblePointTemperature - subcooling); + + public IRefrigerant Subcooled(Pressure pressure, TemperatureDelta subcooling) => + subcooling < TemperatureDelta.Zero ? throw new ArgumentException("Invalid subcooling!") + : subcooling.Equals(TemperatureDelta.Zero, Tolerance.Kelvins()) ? BubblePointAt(pressure) + : BubblePointAt(pressure).CoolingTo(BubblePointAt(pressure).Temperature - subcooling); + + public IRefrigerant Superheated(Temperature dewPointTemperature, TemperatureDelta superheat) => + superheat < TemperatureDelta.Zero ? throw new ArgumentException("Invalid superheat!") + : superheat.Equals(TemperatureDelta.Zero, Tolerance.Kelvins()) + ? DewPointAt(dewPointTemperature) + : DewPointAt(dewPointTemperature).HeatingTo(dewPointTemperature + superheat); + + public IRefrigerant Superheated(Pressure pressure, TemperatureDelta superheat) => + superheat < TemperatureDelta.Zero ? throw new ArgumentException("Invalid superheat!") + : superheat.Equals(TemperatureDelta.Zero, Tolerance.Kelvins()) ? DewPointAt(pressure) + : DewPointAt(pressure).HeatingTo(DewPointAt(pressure).Temperature + superheat); public new IRefrigerant WithState( IKeyedInput firstInput, @@ -100,10 +72,8 @@ IKeyedInput secondInput public new IRefrigerant IsentropicCompressionTo(Pressure pressure) => (Refrigerant)base.IsentropicCompressionTo(pressure); - public new IRefrigerant CompressionTo( - Pressure pressure, - Ratio isentropicEfficiency - ) => (Refrigerant)base.CompressionTo(pressure, isentropicEfficiency); + public new IRefrigerant CompressionTo(Pressure pressure, Ratio isentropicEfficiency) => + (Refrigerant)base.CompressionTo(pressure, isentropicEfficiency); public new IRefrigerant IsenthalpicExpansionTo(Pressure pressure) => (Refrigerant)base.IsenthalpicExpansionTo(pressure); @@ -111,30 +81,20 @@ Ratio isentropicEfficiency public new IRefrigerant IsentropicExpansionTo(Pressure pressure) => (Refrigerant)base.IsentropicExpansionTo(pressure); - public new IRefrigerant ExpansionTo( - Pressure pressure, - Ratio isentropicEfficiency - ) => (Refrigerant)base.ExpansionTo(pressure, isentropicEfficiency); + public new IRefrigerant ExpansionTo(Pressure pressure, Ratio isentropicEfficiency) => + (Refrigerant)base.ExpansionTo(pressure, isentropicEfficiency); - public new IRefrigerant CoolingTo( - Temperature temperature, - Pressure? pressureDrop = null - ) => (Refrigerant)base.CoolingTo(temperature, pressureDrop); + public new IRefrigerant CoolingTo(Temperature temperature, Pressure? pressureDrop = null) => + (Refrigerant)base.CoolingTo(temperature, pressureDrop); - public new IRefrigerant CoolingTo( - SpecificEnergy enthalpy, - Pressure? pressureDrop = null - ) => (Refrigerant)base.CoolingTo(enthalpy, pressureDrop); + public new IRefrigerant CoolingTo(SpecificEnergy enthalpy, Pressure? pressureDrop = null) => + (Refrigerant)base.CoolingTo(enthalpy, pressureDrop); - public new IRefrigerant HeatingTo( - Temperature temperature, - Pressure? pressureDrop = null - ) => (Refrigerant)base.HeatingTo(temperature, pressureDrop); + public new IRefrigerant HeatingTo(Temperature temperature, Pressure? pressureDrop = null) => + (Refrigerant)base.HeatingTo(temperature, pressureDrop); - public new IRefrigerant HeatingTo( - SpecificEnergy enthalpy, - Pressure? pressureDrop = null - ) => (Refrigerant)base.HeatingTo(enthalpy, pressureDrop); + public new IRefrigerant HeatingTo(SpecificEnergy enthalpy, Pressure? pressureDrop = null) => + (Refrigerant)base.HeatingTo(enthalpy, pressureDrop); public new IRefrigerant BubblePointAt(Pressure pressure) => (Refrigerant)base.BubblePointAt(pressure); @@ -142,8 +102,7 @@ Ratio isentropicEfficiency public new IRefrigerant BubblePointAt(Temperature temperature) => (Refrigerant)base.BubblePointAt(temperature); - public new IRefrigerant DewPointAt(Pressure pressure) => - (Refrigerant)base.DewPointAt(pressure); + public new IRefrigerant DewPointAt(Pressure pressure) => (Refrigerant)base.DewPointAt(pressure); public new IRefrigerant DewPointAt(Temperature temperature) => (Refrigerant)base.DewPointAt(temperature); @@ -156,14 +115,7 @@ public IRefrigerant Mixing( IRefrigerant first, Ratio secondSpecificMassFlow, IRefrigerant second - ) => - (Refrigerant) - base.Mixing( - firstSpecificMassFlow, - first, - secondSpecificMassFlow, - second - ); + ) => (Refrigerant)base.Mixing(firstSpecificMassFlow, first, secondSpecificMassFlow, second); public new IRefrigerant Clone() => (Refrigerant)base.Clone(); diff --git a/src/VCRC/Fluids/Validators/RefrigerantTypeValidator.cs b/src/VCRC/Fluids/Validators/RefrigerantTypeValidator.cs index 85feb2a..3b041d1 100644 --- a/src/VCRC/Fluids/Validators/RefrigerantTypeValidator.cs +++ b/src/VCRC/Fluids/Validators/RefrigerantTypeValidator.cs @@ -1,14 +1,9 @@ namespace VCRC; -internal class RefrigerantTypeValidator : AbstractValidator +internal sealed class RefrigerantTypeValidator : AbstractValidator { public RefrigerantTypeValidator() => RuleFor(refrigerant => refrigerant) - .Must(refrigerant => - refrigerant.IsSingleComponent || refrigerant.IsAzeotropicBlend - ) - .WithMessage( - "Refrigerant should be " - + "a single component or an azeotropic blend!" - ); + .Must(refrigerant => refrigerant.IsSingleComponent || refrigerant.IsAzeotropicBlend) + .WithMessage("Refrigerant should be a single component or an azeotropic blend!"); } diff --git a/src/VCRC/Fluids/Validators/RefrigerantValidator.cs b/src/VCRC/Fluids/Validators/RefrigerantValidator.cs index 42b4ea5..acabfb4 100644 --- a/src/VCRC/Fluids/Validators/RefrigerantValidator.cs +++ b/src/VCRC/Fluids/Validators/RefrigerantValidator.cs @@ -1,14 +1,13 @@ namespace VCRC; #pragma warning disable CA1866 -internal class RefrigerantValidator : AbstractValidator +internal sealed class RefrigerantValidator : AbstractValidator { public RefrigerantValidator() => RuleFor(refrigerant => refrigerant.Name) .Must(name => name.ToString().StartsWith("R")) .WithMessage( - "The selected fluid is not a refrigerant " - + "(its name should start with 'R')!" + "The selected fluid is not a refrigerant (its name should start with 'R')!" ); } #pragma warning restore CA1866 diff --git a/src/VCRC/ISimpleVCRC.cs b/src/VCRC/ISimpleVCRC.cs index bfeb303..5658e55 100644 --- a/src/VCRC/ISimpleVCRC.cs +++ b/src/VCRC/ISimpleVCRC.cs @@ -1,4 +1,6 @@ -namespace VCRC; +// ReSharper disable InconsistentNaming + +namespace VCRC; /// /// Simple single-stage VCRC. @@ -13,12 +15,10 @@ public interface ISimpleVCRC : IVCRC /// /// Point 2s – isentropic compression stage discharge. /// - [SuppressMessage("ReSharper", "InconsistentNaming")] IRefrigerant Point2s { get; } /// - /// Point 2 – compression stage discharge / - /// condenser or gas cooler inlet. + /// Point 2 – compression stage discharge / condenser or gas cooler inlet. /// IRefrigerant Point2 { get; } diff --git a/src/VCRC/IVCRCMitsubishiZubadan.cs b/src/VCRC/IVCRCMitsubishiZubadan.cs index bcc8f70..7388d4f 100644 --- a/src/VCRC/IVCRCMitsubishiZubadan.cs +++ b/src/VCRC/IVCRCMitsubishiZubadan.cs @@ -1,4 +1,6 @@ -namespace VCRC; +// ReSharper disable InconsistentNaming + +namespace VCRC; /// /// Mitsubishi Zubadan VCRC (subcritical only). @@ -7,10 +9,7 @@ /// Two-stage subcritical VCRC with economizer, /// recuperator and two-phase injection into the compressor. /// -public interface IVCRCMitsubishiZubadan - : ITwoStageVCRC, - IHaveRecuperator, - IHaveEconomizerWithTPI +public interface IVCRCMitsubishiZubadan : ITwoStageVCRC, IHaveRecuperator, IHaveEconomizerWithTPI { /// /// Condenser. @@ -28,15 +27,13 @@ public interface IVCRCMitsubishiZubadan IRefrigerant Point1 { get; } /// - /// Point 2 – recuperator "cold" outlet / - /// first compression stage suction. + /// Point 2 – recuperator "cold" outlet / first compression stage suction. /// IRefrigerant Point2 { get; } /// /// Point 3s – first isentropic compression stage discharge. /// - [SuppressMessage("ReSharper", "InconsistentNaming")] IRefrigerant Point3s { get; } /// @@ -52,7 +49,6 @@ public interface IVCRCMitsubishiZubadan /// /// Point 5s – second isentropic compression stage discharge. /// - [SuppressMessage("ReSharper", "InconsistentNaming")] IRefrigerant Point5s { get; } /// @@ -71,8 +67,7 @@ public interface IVCRCMitsubishiZubadan IRefrigerant Point7 { get; } /// - /// Point 8 – recuperator "hot" outlet / - /// second EV inlet / economizer "hot" inlet. + /// Point 8 – recuperator "hot" outlet / second EV inlet / economizer "hot" inlet. /// IRefrigerant Point8 { get; } diff --git a/src/VCRC/IVCRCWithCIC.cs b/src/VCRC/IVCRCWithCIC.cs index 3cad532..caa54cb 100644 --- a/src/VCRC/IVCRCWithCIC.cs +++ b/src/VCRC/IVCRCWithCIC.cs @@ -1,4 +1,6 @@ -namespace VCRC; +// ReSharper disable InconsistentNaming + +namespace VCRC; /// /// Two-stage VCRC with complete intercooling. @@ -13,7 +15,6 @@ public interface IVCRCWithCIC : ITwoStageVCRC /// /// Point 2s – first isentropic compression stage discharge. /// - [SuppressMessage("ReSharper", "InconsistentNaming")] IRefrigerant Point2s { get; } /// @@ -29,12 +30,10 @@ public interface IVCRCWithCIC : ITwoStageVCRC /// /// Point 4s – second isentropic compression stage discharge. /// - [SuppressMessage("ReSharper", "InconsistentNaming")] IRefrigerant Point4s { get; } /// - /// Point 4 – second compression stage discharge / - /// condenser or gas cooler inlet. + /// Point 4 – second compression stage discharge / condenser or gas cooler inlet. /// IRefrigerant Point4 { get; } diff --git a/src/VCRC/IVCRCWithEconomizer.cs b/src/VCRC/IVCRCWithEconomizer.cs index 531fa8c..9b0433a 100644 --- a/src/VCRC/IVCRCWithEconomizer.cs +++ b/src/VCRC/IVCRCWithEconomizer.cs @@ -1,4 +1,6 @@ -namespace VCRC; +// ReSharper disable InconsistentNaming + +namespace VCRC; /// /// Two-stage VCRC with economizer. @@ -13,7 +15,6 @@ public interface IVCRCWithEconomizer : ITwoStageVCRC, IHaveEconomizer /// /// Point 2s – first isentropic compression stage discharge. /// - [SuppressMessage("ReSharper", "InconsistentNaming")] IRefrigerant Point2s { get; } /// @@ -29,18 +30,15 @@ public interface IVCRCWithEconomizer : ITwoStageVCRC, IHaveEconomizer /// /// Point 4s – second isentropic compression stage discharge. /// - [SuppressMessage("ReSharper", "InconsistentNaming")] IRefrigerant Point4s { get; } /// - /// Point 4 – second compression stage discharge / - /// condenser or gas cooler inlet. + /// Point 4 – second compression stage discharge / condenser or gas cooler inlet. /// IRefrigerant Point4 { get; } /// - /// Point 5 – condenser or gas cooler outlet / - /// first EV inlet / economizer "hot" inlet. + /// Point 5 – condenser or gas cooler outlet / first EV inlet / economizer "hot" inlet. /// IRefrigerant Point5 { get; } @@ -50,8 +48,7 @@ public interface IVCRCWithEconomizer : ITwoStageVCRC, IHaveEconomizer IRefrigerant Point6 { get; } /// - /// Point 7 – economizer "cold" outlet / - /// injection of cooled vapor into the compressor. + /// Point 7 – economizer "cold" outlet / injection of cooled vapor into the compressor. /// IRefrigerant Point7 { get; } diff --git a/src/VCRC/IVCRCWithEconomizerAndPC.cs b/src/VCRC/IVCRCWithEconomizerAndPC.cs index ac6739b..4c310cc 100644 --- a/src/VCRC/IVCRCWithEconomizerAndPC.cs +++ b/src/VCRC/IVCRCWithEconomizerAndPC.cs @@ -1,4 +1,6 @@ -namespace VCRC; +// ReSharper disable InconsistentNaming + +namespace VCRC; /// /// Two-stage VCRC with economizer and parallel compression. @@ -13,7 +15,6 @@ public interface IVCRCWithEconomizerAndPC : ITwoStageVCRC, IHaveEconomizer /// /// Point 2s – first isentropic compression stage discharge. /// - [SuppressMessage("ReSharper", "InconsistentNaming")] IRefrigerant Point2s { get; } /// @@ -22,15 +23,13 @@ public interface IVCRCWithEconomizerAndPC : ITwoStageVCRC, IHaveEconomizer IRefrigerant Point2 { get; } /// - /// Point 3 – economizer "cold" outlet / - /// second compression stage suction. + /// Point 3 – economizer "cold" outlet / second compression stage suction. /// IRefrigerant Point3 { get; } /// /// Point 4s – second isentropic compression stage discharge. /// - [SuppressMessage("ReSharper", "InconsistentNaming")] IRefrigerant Point4s { get; } /// @@ -44,8 +43,7 @@ public interface IVCRCWithEconomizerAndPC : ITwoStageVCRC, IHaveEconomizer IRefrigerant Point5 { get; } /// - /// Point 6 – condenser or gas cooler outlet / - /// first EV inlet / economizer "hot" inlet. + /// Point 6 – condenser or gas cooler outlet / first EV inlet / economizer "hot" inlet. /// IRefrigerant Point6 { get; } diff --git a/src/VCRC/IVCRCWithEconomizerAndTPI.cs b/src/VCRC/IVCRCWithEconomizerAndTPI.cs index 928e36a..8dbee11 100644 --- a/src/VCRC/IVCRCWithEconomizerAndTPI.cs +++ b/src/VCRC/IVCRCWithEconomizerAndTPI.cs @@ -1,12 +1,11 @@ -namespace VCRC; +// ReSharper disable InconsistentNaming + +namespace VCRC; /// -/// Two-stage VCRC with economizer -/// and two-phase injection into the compressor. +/// Two-stage VCRC with economizer and two-phase injection into the compressor. /// -public interface IVCRCWithEconomizerAndTPI - : ITwoStageVCRC, - IHaveEconomizerWithTPI +public interface IVCRCWithEconomizerAndTPI : ITwoStageVCRC, IHaveEconomizerWithTPI { /// /// Point 1 – evaporator outlet / first compression stage suction. @@ -16,7 +15,6 @@ public interface IVCRCWithEconomizerAndTPI /// /// Point 2s – first isentropic compression stage discharge. /// - [SuppressMessage("ReSharper", "InconsistentNaming")] IRefrigerant Point2s { get; } /// @@ -32,18 +30,15 @@ public interface IVCRCWithEconomizerAndTPI /// /// Point 4s – second isentropic compression stage discharge. /// - [SuppressMessage("ReSharper", "InconsistentNaming")] IRefrigerant Point4s { get; } /// - /// Point 4 – second compression stage discharge / - /// condenser or gas cooler inlet. + /// Point 4 – second compression stage discharge / condenser or gas cooler inlet. /// IRefrigerant Point4 { get; } /// - /// Point 5 – condenser or gas cooler outlet / - /// first EV inlet / economizer "hot" inlet. + /// Point 5 – condenser or gas cooler outlet / first EV inlet / economizer "hot" inlet. /// IRefrigerant Point5 { get; } diff --git a/src/VCRC/IVCRCWithEjector.cs b/src/VCRC/IVCRCWithEjector.cs index bc6cc2c..2b2e813 100644 --- a/src/VCRC/IVCRCWithEjector.cs +++ b/src/VCRC/IVCRCWithEjector.cs @@ -1,4 +1,6 @@ -namespace VCRC; +// ReSharper disable InconsistentNaming + +namespace VCRC; /// /// Single-stage VCRC with an ejector as an expansion device. @@ -13,12 +15,10 @@ public interface IVCRCWithEjector : IVCRC, IHaveEjector /// /// Point 2s – isentropic compression stage discharge. /// - [SuppressMessage("ReSharper", "InconsistentNaming")] IRefrigerant Point2s { get; } /// - /// Point 2 – compression stage discharge / - /// condenser or gas cooler inlet. + /// Point 2 – compression stage discharge / condenser or gas cooler inlet. /// IRefrigerant Point2 { get; } diff --git a/src/VCRC/IVCRCWithEjectorAndEconomizer.cs b/src/VCRC/IVCRCWithEjectorAndEconomizer.cs index 6442955..8c49170 100644 --- a/src/VCRC/IVCRCWithEjectorAndEconomizer.cs +++ b/src/VCRC/IVCRCWithEjectorAndEconomizer.cs @@ -1,12 +1,11 @@ -namespace VCRC; +// ReSharper disable InconsistentNaming + +namespace VCRC; /// /// Two-stage VCRC with an ejector as an expansion device and economizer. /// -public interface IVCRCWithEjectorAndEconomizer - : ITwoStageVCRC, - IHaveEjector, - IHaveEconomizer +public interface IVCRCWithEjectorAndEconomizer : ITwoStageVCRC, IHaveEjector, IHaveEconomizer { /// /// Point 1 - separator vapor outlet / first compression stage suction. @@ -16,7 +15,6 @@ public interface IVCRCWithEjectorAndEconomizer /// /// Point 2s – first isentropic compression stage discharge. /// - [SuppressMessage("ReSharper", "InconsistentNaming")] IRefrigerant Point2s { get; } /// @@ -32,18 +30,15 @@ public interface IVCRCWithEjectorAndEconomizer /// /// Point 4s – second isentropic compression stage discharge. /// - [SuppressMessage("ReSharper", "InconsistentNaming")] IRefrigerant Point4s { get; } /// - /// Point 4 – second compression stage discharge / - /// condenser or gas cooler inlet. + /// Point 4 – second compression stage discharge / condenser or gas cooler inlet. /// IRefrigerant Point4 { get; } /// - /// Point 5 – condenser or gas cooler outlet / - /// first EV inlet / economizer "hot" inlet. + /// Point 5 – condenser or gas cooler outlet / first EV inlet / economizer "hot" inlet. /// IRefrigerant Point5 { get; } @@ -53,8 +48,7 @@ public interface IVCRCWithEjectorAndEconomizer IRefrigerant Point6 { get; } /// - /// Point 7 – economizer "cold" outlet / - /// injection of cooled vapor into the compressor. + /// Point 7 – economizer "cold" outlet / injection of cooled vapor into the compressor. /// IRefrigerant Point7 { get; } diff --git a/src/VCRC/IVCRCWithEjectorEconomizerAndPC.cs b/src/VCRC/IVCRCWithEjectorEconomizerAndPC.cs index 4758cf8..f8df15d 100644 --- a/src/VCRC/IVCRCWithEjectorEconomizerAndPC.cs +++ b/src/VCRC/IVCRCWithEjectorEconomizerAndPC.cs @@ -1,13 +1,11 @@ -namespace VCRC; +// ReSharper disable InconsistentNaming + +namespace VCRC; /// -/// Two-stage VCRC with an ejector as an expansion device, -/// economizer and parallel compression. +/// Two-stage VCRC with an ejector as an expansion device, economizer and parallel compression. /// -public interface IVCRCWithEjectorEconomizerAndPC - : ITwoStageVCRC, - IHaveEjector, - IHaveEconomizer +public interface IVCRCWithEjectorEconomizerAndPC : ITwoStageVCRC, IHaveEjector, IHaveEconomizer { /// /// Point 1 – separator vapor outlet / first compression stage suction. @@ -17,7 +15,6 @@ public interface IVCRCWithEjectorEconomizerAndPC /// /// Point 2s – first isentropic compression stage discharge. /// - [SuppressMessage("ReSharper", "InconsistentNaming")] IRefrigerant Point2s { get; } /// @@ -26,15 +23,13 @@ public interface IVCRCWithEjectorEconomizerAndPC IRefrigerant Point2 { get; } /// - /// Point 3 – economizer "cold" outlet / - /// second compression stage suction. + /// Point 3 – economizer "cold" outlet / second compression stage suction. /// IRefrigerant Point3 { get; } /// /// Point 4s – second isentropic compression stage discharge. /// - [SuppressMessage("ReSharper", "InconsistentNaming")] IRefrigerant Point4s { get; } /// @@ -48,8 +43,7 @@ public interface IVCRCWithEjectorEconomizerAndPC IRefrigerant Point5 { get; } /// - /// Point 6 – condenser or gas cooler outlet / - /// first EV inlet / economizer "hot" inlet. + /// Point 6 – condenser or gas cooler outlet / first EV inlet / economizer "hot" inlet. /// IRefrigerant Point6 { get; } diff --git a/src/VCRC/IVCRCWithEjectorEconomizerAndTPI.cs b/src/VCRC/IVCRCWithEjectorEconomizerAndTPI.cs index 9087019..d3809f6 100644 --- a/src/VCRC/IVCRCWithEjectorEconomizerAndTPI.cs +++ b/src/VCRC/IVCRCWithEjectorEconomizerAndTPI.cs @@ -1,4 +1,6 @@ -namespace VCRC; +// ReSharper disable InconsistentNaming + +namespace VCRC; /// /// Two-stage VCRC with an ejector as an expansion device, @@ -17,7 +19,6 @@ public interface IVCRCWithEjectorEconomizerAndTPI /// /// Point 2s – first isentropic compression stage discharge. /// - [SuppressMessage("ReSharper", "InconsistentNaming")] IRefrigerant Point2s { get; } /// @@ -33,18 +34,15 @@ public interface IVCRCWithEjectorEconomizerAndTPI /// /// Point 4s – second isentropic compression stage discharge. /// - [SuppressMessage("ReSharper", "InconsistentNaming")] IRefrigerant Point4s { get; } /// - /// Point 4 – second compression stage discharge / - /// condenser or gas cooler inlet. + /// Point 4 – second compression stage discharge / condenser or gas cooler inlet. /// IRefrigerant Point4 { get; } /// - /// Point 5 – condenser or gas cooler outlet / - /// first EV inlet / economizer "hot" inlet. + /// Point 5 – condenser or gas cooler outlet / first EV inlet / economizer "hot" inlet. /// IRefrigerant Point5 { get; } diff --git a/src/VCRC/IVCRCWithIIC.cs b/src/VCRC/IVCRCWithIIC.cs index ca18fac..f8bbc44 100644 --- a/src/VCRC/IVCRCWithIIC.cs +++ b/src/VCRC/IVCRCWithIIC.cs @@ -1,4 +1,6 @@ -namespace VCRC; +// ReSharper disable InconsistentNaming + +namespace VCRC; /// /// Two-stage VCRC with incomplete intercooling. @@ -13,7 +15,6 @@ public interface IVCRCWithIIC : ITwoStageVCRC /// /// Point 2s – first isentropic compression stage discharge. /// - [SuppressMessage("ReSharper", "InconsistentNaming")] IRefrigerant Point2s { get; } /// @@ -29,12 +30,10 @@ public interface IVCRCWithIIC : ITwoStageVCRC /// /// Point 4s – second isentropic compression stage discharge. /// - [SuppressMessage("ReSharper", "InconsistentNaming")] IRefrigerant Point4s { get; } /// - /// Point 4 – second compression stage discharge / - /// condenser or gas cooler inlet. + /// Point 4 – second compression stage discharge / condenser or gas cooler inlet. /// IRefrigerant Point4 { get; } @@ -49,8 +48,7 @@ public interface IVCRCWithIIC : ITwoStageVCRC IRefrigerant Point6 { get; } /// - /// Point 7 – separator vapor outlet / - /// injection of cooled vapor into the compressor. + /// Point 7 – separator vapor outlet / injection of cooled vapor into the compressor. /// IRefrigerant Point7 { get; } diff --git a/src/VCRC/IVCRCWithPC.cs b/src/VCRC/IVCRCWithPC.cs index f153c0c..7311924 100644 --- a/src/VCRC/IVCRCWithPC.cs +++ b/src/VCRC/IVCRCWithPC.cs @@ -1,4 +1,6 @@ -namespace VCRC; +// ReSharper disable InconsistentNaming + +namespace VCRC; /// /// Two-stage VCRC with parallel compression. @@ -13,7 +15,6 @@ public interface IVCRCWithPC : ITwoStageVCRC /// /// Point 2s – first isentropic compression stage discharge. /// - [SuppressMessage("ReSharper", "InconsistentNaming")] IRefrigerant Point2s { get; } /// @@ -29,7 +30,6 @@ public interface IVCRCWithPC : ITwoStageVCRC /// /// Point 4s – second isentropic compression stage discharge. /// - [SuppressMessage("ReSharper", "InconsistentNaming")] IRefrigerant Point4s { get; } /// diff --git a/src/VCRC/IVCRCWithRecuperator.cs b/src/VCRC/IVCRCWithRecuperator.cs index a2e4756..9cb9493 100644 --- a/src/VCRC/IVCRCWithRecuperator.cs +++ b/src/VCRC/IVCRCWithRecuperator.cs @@ -1,4 +1,6 @@ -namespace VCRC; +// ReSharper disable InconsistentNaming + +namespace VCRC; /// /// Single-stage VCRC with recuperator. @@ -18,12 +20,10 @@ public interface IVCRCWithRecuperator : IVCRC, IHaveRecuperator /// /// Point 3s – isentropic compression stage discharge. /// - [SuppressMessage("ReSharper", "InconsistentNaming")] IRefrigerant Point3s { get; } /// - /// Point 3 – compression stage discharge / - /// condenser or gas cooler inlet. + /// Point 3 – compression stage discharge / condenser or gas cooler inlet. /// IRefrigerant Point3 { get; } diff --git a/src/VCRC/SimpleVCRC.cs b/src/VCRC/SimpleVCRC.cs index 5eaab75..e36f84c 100644 --- a/src/VCRC/SimpleVCRC.cs +++ b/src/VCRC/SimpleVCRC.cs @@ -7,25 +7,15 @@ public class SimpleVCRC : AbstractVCRC, ISimpleVCRC /// Evaporator. /// Compressor. /// Condenser or gas cooler. + /// Only one refrigerant should be selected! /// - /// Only one refrigerant should be selected! + /// Condensing temperature should be greater than evaporating temperature! /// - /// - /// Condensing temperature - /// should be greater than evaporating temperature! - /// - public SimpleVCRC( - IEvaporator evaporator, - ICompressor compressor, - IHeatReleaser heatReleaser - ) + public SimpleVCRC(IEvaporator evaporator, ICompressor compressor, IHeatReleaser heatReleaser) : base(evaporator, compressor, heatReleaser) { Point2s = Point1.IsentropicCompressionTo(HeatReleaser.Pressure); - Point2 = Point1.CompressionTo( - HeatReleaser.Pressure, - Compressor.Efficiency - ); + Point2 = Point1.CompressionTo(HeatReleaser.Pressure, Compressor.Efficiency); Point4 = Point3.IsenthalpicExpansionTo(Evaporator.Pressure); } @@ -38,18 +28,11 @@ IHeatReleaser heatReleaser ); public IRefrigerant Point1 => Evaporator.Outlet; - - [SuppressMessage("ReSharper", "InconsistentNaming")] public IRefrigerant Point2s { get; } - public IRefrigerant Point2 { get; } - public IRefrigerant Point3 => HeatReleaser.Outlet; - public IRefrigerant Point4 { get; } - - public sealed override Ratio HeatReleaserSpecificMassFlow { get; } = - 100.Percent(); + public sealed override Ratio HeatReleaserSpecificMassFlow { get; } = 100.Percent(); public sealed override SpecificEnergy IsentropicSpecificWork => Point2s.Enthalpy - Point1.Enthalpy; diff --git a/src/VCRC/VCRCMitsubishiZubadan.cs b/src/VCRC/VCRCMitsubishiZubadan.cs index c6d0d92..a4efb87 100644 --- a/src/VCRC/VCRCMitsubishiZubadan.cs +++ b/src/VCRC/VCRCMitsubishiZubadan.cs @@ -1,9 +1,7 @@ namespace VCRC; /// -public class VCRCMitsubishiZubadan - : AbstractTwoStageVCRC, - IVCRCMitsubishiZubadan +public class VCRCMitsubishiZubadan : AbstractTwoStageVCRC, IVCRCMitsubishiZubadan { /// /// Evaporator. @@ -11,16 +9,12 @@ public class VCRCMitsubishiZubadan /// Condenser. /// Economizer. /// Solution not found! + /// Only one refrigerant should be selected! /// - /// Only one refrigerant should be selected! + /// Condensing temperature should be greater than evaporating temperature! /// /// - /// Condensing temperature - /// should be greater than evaporating temperature! - /// - /// - /// There should be a two-phase refrigerant - /// at the recuperator 'hot' inlet! + /// There should be a two-phase refrigerant at the recuperator 'hot' inlet! /// /// /// Wrong temperature difference at the recuperator 'hot' side! @@ -44,13 +38,8 @@ IAuxiliaryHeatExchanger economizer CalculateInjectionQuality(); new VCRCMitsubishiZubadanValidator().ValidateAndThrow(this); Point5s = Point4!.IsentropicCompressionTo(Condenser.Pressure); - Point5 = Point4.CompressionTo( - Condenser.Pressure, - Compressor.Efficiency - ); - Recuperator = new Recuperator( - Point7!.Temperature - Point2!.Temperature - ); + Point5 = Point4.CompressionTo(Condenser.Pressure, Compressor.Efficiency); + Recuperator = new Recuperator(Point7!.Temperature - Point2!.Temperature); } private IEntropyAnalyzer Analyzer => @@ -88,69 +77,40 @@ IAuxiliaryHeatExchanger economizer ); public new ICondenser Condenser { get; } - public IAuxiliaryHeatExchanger Recuperator { get; } - public IAuxiliaryHeatExchanger Economizer { get; } - public Pressure RecuperatorHighPressure { get; private set; } - public IRefrigerant Point1 => Evaporator.Outlet; - public IRefrigerant Point2 { get; private set; } - - [SuppressMessage("ReSharper", "InconsistentNaming")] public IRefrigerant Point3s { get; private set; } = default!; - public IRefrigerant Point3 { get; private set; } = default!; - public IRefrigerant Point4 { get; private set; } - - [SuppressMessage("ReSharper", "InconsistentNaming")] public IRefrigerant Point5s { get; } - public IRefrigerant Point5 { get; } - public IRefrigerant Point6 => HeatReleaser.Outlet; - public IRefrigerant Point7 { get; private set; } - public IRefrigerant Point8 { get; private set; } = default!; - public IRefrigerant Point9 { get; private set; } = default!; - public IRefrigerant Point10 { get; private set; } = default!; - public IRefrigerant Point11 { get; private set; } = default!; - public IRefrigerant Point12 { get; private set; } = default!; - - public sealed override Pressure IntermediatePressure => - base.IntermediatePressure; - - public sealed override Ratio IntermediateSpecificMassFlow => - base.IntermediateSpecificMassFlow; + public sealed override Pressure IntermediatePressure => base.IntermediatePressure; + public sealed override Ratio IntermediateSpecificMassFlow => base.IntermediateSpecificMassFlow; public sealed override Ratio HeatReleaserSpecificMassFlow => EvaporatorSpecificMassFlow - * ( - 1 - + (Point8.Enthalpy - Point11.Enthalpy) - / (Point10.Enthalpy - Point9.Enthalpy) - ); + * (1 + (Point8.Enthalpy - Point11.Enthalpy) / (Point10.Enthalpy - Point9.Enthalpy)); public sealed override SpecificEnergy IsentropicSpecificWork => Point3s.Enthalpy - Point2.Enthalpy - + HeatReleaserSpecificMassFlow.DecimalFractions - * (Point5s.Enthalpy - Point4.Enthalpy); + + HeatReleaserSpecificMassFlow.DecimalFractions * (Point5s.Enthalpy - Point4.Enthalpy); public sealed override SpecificEnergy SpecificCoolingCapacity => Point1.Enthalpy - Point12.Enthalpy; public sealed override SpecificEnergy SpecificHeatingCapacity => - HeatReleaserSpecificMassFlow.DecimalFractions - * (Point5.Enthalpy - Point6.Enthalpy); + HeatReleaserSpecificMassFlow.DecimalFractions * (Point5.Enthalpy - Point6.Enthalpy); public override IEntropyAnalysisResult EntropyAnalysis( Temperature indoor, @@ -170,9 +130,7 @@ private void CalculateInjectionQuality() Point7 = Point6.IsenthalpicExpansionTo(RecuperatorHighPressure); Point8 = Refrigerant.BubblePointAt(RecuperatorHighPressure); Point9 = Point8.IsenthalpicExpansionTo(IntermediatePressure); - Point11 = Point8.CoolingTo( - Point9.Temperature + Economizer.TemperatureDifference - ); + Point11 = Point8.CoolingTo(Point9.Temperature + Economizer.TemperatureDifference); Point12 = Point11.IsenthalpicExpansionTo(Evaporator.Pressure); try { @@ -203,10 +161,7 @@ private void CalculateInjectionQuality() double ToSolve(double injectionQuality) { - Point10 = Refrigerant.TwoPhasePointAt( - IntermediatePressure, - injectionQuality.Percent() - ); + Point10 = Refrigerant.TwoPhasePointAt(IntermediatePressure, injectionQuality.Percent()); Point2 = Point1.HeatingTo( Point1.Enthalpy + HeatReleaserSpecificMassFlow @@ -214,10 +169,7 @@ double ToSolve(double injectionQuality) * (Point7.Enthalpy - Point8.Enthalpy) ); Point3s = Point2.IsentropicCompressionTo(IntermediatePressure); - Point3 = Point2.CompressionTo( - IntermediatePressure, - Compressor.Efficiency - ); + Point3 = Point2.CompressionTo(IntermediatePressure, Compressor.Efficiency); return ( Point10.Enthalpy - ( diff --git a/src/VCRC/VCRCWithCIC.cs b/src/VCRC/VCRCWithCIC.cs index 1cb1798..8c72754 100644 --- a/src/VCRC/VCRCWithCIC.cs +++ b/src/VCRC/VCRCWithCIC.cs @@ -7,46 +7,30 @@ public class VCRCWithCIC : AbstractTwoStageVCRC, IVCRCWithCIC /// Evaporator. /// Compressor. /// Condenser or gas cooler. + /// Only one refrigerant should be selected! /// - /// Only one refrigerant should be selected! - /// - /// - /// Condensing temperature - /// should be greater than evaporating temperature! + /// Condensing temperature should be greater than evaporating temperature! /// /// /// Refrigerant should be a single component or an azeotropic blend! /// - public VCRCWithCIC( - IEvaporator evaporator, - ICompressor compressor, - IHeatReleaser heatReleaser - ) + public VCRCWithCIC(IEvaporator evaporator, ICompressor compressor, IHeatReleaser heatReleaser) : base(evaporator, compressor, heatReleaser) { new RefrigerantTypeValidator().ValidateAndThrow(Refrigerant); Point2s = Point1.IsentropicCompressionTo(IntermediatePressure); - Point2 = Point1.CompressionTo( - IntermediatePressure, - Compressor.Efficiency - ); + Point2 = Point1.CompressionTo(IntermediatePressure, Compressor.Efficiency); Point3 = Refrigerant.DewPointAt(IntermediatePressure); Point4s = Point3.IsentropicCompressionTo(HeatReleaser.Pressure); Point6 = Point5.IsenthalpicExpansionTo(IntermediatePressure); Point7 = Refrigerant.BubblePointAt(IntermediatePressure); Point8 = Point7.IsenthalpicExpansionTo(Evaporator.Pressure); - Point4 = Point3.CompressionTo( - HeatReleaser.Pressure, - Compressor.Efficiency - ); + Point4 = Point3.CompressionTo(HeatReleaser.Pressure, Compressor.Efficiency); } private Ratio BarbotageSpecificMassFlow => EvaporatorSpecificMassFlow - * ( - (Point2.Enthalpy - Point3.Enthalpy) - / (Point3.Enthalpy - Point7.Enthalpy) - ); + * ((Point2.Enthalpy - Point3.Enthalpy) / (Point3.Enthalpy - Point7.Enthalpy)); private IEntropyAnalyzer Analyzer => new EntropyAnalyzer( @@ -69,32 +53,17 @@ IHeatReleaser heatReleaser ); public IRefrigerant Point1 => Evaporator.Outlet; - - [SuppressMessage("ReSharper", "InconsistentNaming")] public IRefrigerant Point2s { get; } - public IRefrigerant Point2 { get; } - public IRefrigerant Point3 { get; } - - [SuppressMessage("ReSharper", "InconsistentNaming")] public IRefrigerant Point4s { get; } - public IRefrigerant Point4 { get; } - public IRefrigerant Point5 => HeatReleaser.Outlet; - public IRefrigerant Point6 { get; } - public IRefrigerant Point7 { get; } - public IRefrigerant Point8 { get; } - - public sealed override Pressure IntermediatePressure => - base.IntermediatePressure; - - public sealed override Ratio IntermediateSpecificMassFlow => - HeatReleaserSpecificMassFlow; + public sealed override Pressure IntermediatePressure => base.IntermediatePressure; + public sealed override Ratio IntermediateSpecificMassFlow => HeatReleaserSpecificMassFlow; public sealed override Ratio HeatReleaserSpecificMassFlow => (EvaporatorSpecificMassFlow + BarbotageSpecificMassFlow) @@ -103,15 +72,13 @@ IHeatReleaser heatReleaser public sealed override SpecificEnergy IsentropicSpecificWork => Point2s.Enthalpy - Point1.Enthalpy - + HeatReleaserSpecificMassFlow.DecimalFractions - * (Point4s.Enthalpy - Point3.Enthalpy); + + HeatReleaserSpecificMassFlow.DecimalFractions * (Point4s.Enthalpy - Point3.Enthalpy); public sealed override SpecificEnergy SpecificCoolingCapacity => Point1.Enthalpy - Point8.Enthalpy; public sealed override SpecificEnergy SpecificHeatingCapacity => - HeatReleaserSpecificMassFlow.DecimalFractions - * (Point4.Enthalpy - Point5.Enthalpy); + HeatReleaserSpecificMassFlow.DecimalFractions * (Point4.Enthalpy - Point5.Enthalpy); public override IEntropyAnalysisResult EntropyAnalysis( Temperature indoor, diff --git a/src/VCRC/VCRCWithEconomizer.cs b/src/VCRC/VCRCWithEconomizer.cs index 1e629ac..a238693 100644 --- a/src/VCRC/VCRCWithEconomizer.cs +++ b/src/VCRC/VCRCWithEconomizer.cs @@ -8,12 +8,9 @@ public class VCRCWithEconomizer : AbstractTwoStageVCRC, IVCRCWithEconomizer /// Compressor. /// Condenser or gas cooler. /// Economizer. + /// Only one refrigerant should be selected! /// - /// Only one refrigerant should be selected! - /// - /// - /// Condensing temperature - /// should be greater than evaporating temperature! + /// Condensing temperature should be greater than evaporating temperature! /// /// /// Wrong temperature difference at the economizer 'hot' side! @@ -31,19 +28,11 @@ IEconomizer economizer { Economizer = economizer; Point2s = Point1.IsentropicCompressionTo(IntermediatePressure); - Point2 = Point1.CompressionTo( - IntermediatePressure, - Compressor.Efficiency - ); + Point2 = Point1.CompressionTo(IntermediatePressure, Compressor.Efficiency); Point6 = Point5.IsenthalpicExpansionTo(IntermediatePressure); - Point7 = Refrigerant.Superheated( - IntermediatePressure, - Economizer.Superheat - ); + Point7 = Refrigerant.Superheated(IntermediatePressure, Economizer.Superheat); new VCRCWithEconomizerValidator().ValidateAndThrow(this); - Point8 = Point5.CoolingTo( - Point6.Temperature + Economizer.TemperatureDifference - ); + Point8 = Point5.CoolingTo(Point6.Temperature + Economizer.TemperatureDifference); Point9 = Point8.IsenthalpicExpansionTo(Evaporator.Pressure); Point3 = Refrigerant.Mixing( EvaporatorSpecificMassFlow, @@ -52,10 +41,7 @@ IEconomizer economizer Point7 ); Point4s = Point3.IsentropicCompressionTo(HeatReleaser.Pressure); - Point4 = Point3.CompressionTo( - HeatReleaser.Pressure, - Compressor.Efficiency - ); + Point4 = Point3.CompressionTo(HeatReleaser.Pressure, Compressor.Efficiency); } private IEntropyAnalyzer Analyzer => @@ -86,57 +72,34 @@ IEconomizer economizer ); public IEconomizer Economizer { get; } - public IRefrigerant Point1 => Evaporator.Outlet; - - [SuppressMessage("ReSharper", "InconsistentNaming")] public IRefrigerant Point2s { get; } - public IRefrigerant Point2 { get; } - public IRefrigerant Point3 { get; } - - [SuppressMessage("ReSharper", "InconsistentNaming")] public IRefrigerant Point4s { get; } - public IRefrigerant Point4 { get; } - public IRefrigerant Point5 => HeatReleaser.Outlet; - public IRefrigerant Point6 { get; } - public IRefrigerant Point7 { get; } - public IRefrigerant Point8 { get; } - public IRefrigerant Point9 { get; } - - public sealed override Pressure IntermediatePressure => - base.IntermediatePressure; - - public sealed override Ratio IntermediateSpecificMassFlow => - base.IntermediateSpecificMassFlow; + public sealed override Pressure IntermediatePressure => base.IntermediatePressure; + public sealed override Ratio IntermediateSpecificMassFlow => base.IntermediateSpecificMassFlow; public sealed override Ratio HeatReleaserSpecificMassFlow => EvaporatorSpecificMassFlow - * ( - 1 - + (Point5.Enthalpy - Point8.Enthalpy) - / (Point7.Enthalpy - Point6.Enthalpy) - ); + * (1 + (Point5.Enthalpy - Point8.Enthalpy) / (Point7.Enthalpy - Point6.Enthalpy)); public sealed override SpecificEnergy IsentropicSpecificWork => Point2s.Enthalpy - Point1.Enthalpy - + HeatReleaserSpecificMassFlow.DecimalFractions - * (Point4s.Enthalpy - Point3.Enthalpy); + + HeatReleaserSpecificMassFlow.DecimalFractions * (Point4s.Enthalpy - Point3.Enthalpy); public sealed override SpecificEnergy SpecificCoolingCapacity => Point1.Enthalpy - Point9.Enthalpy; public sealed override SpecificEnergy SpecificHeatingCapacity => - HeatReleaserSpecificMassFlow.DecimalFractions - * (Point4.Enthalpy - Point5.Enthalpy); + HeatReleaserSpecificMassFlow.DecimalFractions * (Point4.Enthalpy - Point5.Enthalpy); public override IEntropyAnalysisResult EntropyAnalysis( Temperature indoor, diff --git a/src/VCRC/VCRCWithEconomizerAndPC.cs b/src/VCRC/VCRCWithEconomizerAndPC.cs index 47c3988..6cb5298 100644 --- a/src/VCRC/VCRCWithEconomizerAndPC.cs +++ b/src/VCRC/VCRCWithEconomizerAndPC.cs @@ -1,21 +1,18 @@ -namespace VCRC; +// ReSharper disable InconsistentNaming + +namespace VCRC; /// -public class VCRCWithEconomizerAndPC - : AbstractTwoStageVCRC, - IVCRCWithEconomizerAndPC +public class VCRCWithEconomizerAndPC : AbstractTwoStageVCRC, IVCRCWithEconomizerAndPC { /// /// Evaporator. /// Compressor. /// Condenser or gas cooler. /// Economizer. + /// Only one refrigerant should be selected! /// - /// Only one refrigerant should be selected! - /// - /// - /// Condensing temperature - /// should be greater than evaporating temperature! + /// Condensing temperature should be greater than evaporating temperature! /// /// /// Wrong temperature difference at the economizer 'hot' side! @@ -33,24 +30,13 @@ IEconomizer economizer { Economizer = economizer; Point2s = Point1.IsentropicCompressionTo(HeatReleaser.Pressure); - Point2 = Point1.CompressionTo( - HeatReleaser.Pressure, - Compressor.Efficiency - ); + Point2 = Point1.CompressionTo(HeatReleaser.Pressure, Compressor.Efficiency); Point7 = Point6.IsenthalpicExpansionTo(IntermediatePressure); - Point3 = Refrigerant.Superheated( - IntermediatePressure, - Economizer.Superheat - ); + Point3 = Refrigerant.Superheated(IntermediatePressure, Economizer.Superheat); new VCRCWithEconomizerAndPCValidator().ValidateAndThrow(this); Point4s = Point3.IsentropicCompressionTo(HeatReleaser.Pressure); - Point4 = Point3.CompressionTo( - HeatReleaser.Pressure, - Compressor.Efficiency - ); - Point8 = Point6.CoolingTo( - Point7.Temperature + Economizer.TemperatureDifference - ); + Point4 = Point3.CompressionTo(HeatReleaser.Pressure, Compressor.Efficiency); + Point8 = Point6.CoolingTo(Point7.Temperature + Economizer.TemperatureDifference); Point9 = Point8.IsenthalpicExpansionTo(Evaporator.Pressure); Point5s = Refrigerant.Mixing( EvaporatorSpecificMassFlow, @@ -66,7 +52,6 @@ IEconomizer economizer ); } - [SuppressMessage("ReSharper", "InconsistentNaming")] private IRefrigerant Point5s { get; } private IEntropyAnalyzer Analyzer => @@ -97,57 +82,34 @@ IEconomizer economizer ); public IEconomizer Economizer { get; } - public IRefrigerant Point1 => Evaporator.Outlet; - - [SuppressMessage("ReSharper", "InconsistentNaming")] public IRefrigerant Point2s { get; } - public IRefrigerant Point2 { get; } - public IRefrigerant Point3 { get; } - - [SuppressMessage("ReSharper", "InconsistentNaming")] public IRefrigerant Point4s { get; } - public IRefrigerant Point4 { get; } - public IRefrigerant Point5 { get; } - public IRefrigerant Point6 => HeatReleaser.Outlet; - public IRefrigerant Point7 { get; } - public IRefrigerant Point8 { get; } - public IRefrigerant Point9 { get; } - - public sealed override Pressure IntermediatePressure => - base.IntermediatePressure; - - public sealed override Ratio IntermediateSpecificMassFlow => - base.IntermediateSpecificMassFlow; + public sealed override Pressure IntermediatePressure => base.IntermediatePressure; + public sealed override Ratio IntermediateSpecificMassFlow => base.IntermediateSpecificMassFlow; public sealed override Ratio HeatReleaserSpecificMassFlow => EvaporatorSpecificMassFlow - * ( - 1 - + (Point6.Enthalpy - Point8.Enthalpy) - / (Point3.Enthalpy - Point7.Enthalpy) - ); + * (1 + (Point6.Enthalpy - Point8.Enthalpy) / (Point3.Enthalpy - Point7.Enthalpy)); public sealed override SpecificEnergy IsentropicSpecificWork => Point2s.Enthalpy - Point1.Enthalpy - + IntermediateSpecificMassFlow.DecimalFractions - * (Point4s.Enthalpy - Point3.Enthalpy); + + IntermediateSpecificMassFlow.DecimalFractions * (Point4s.Enthalpy - Point3.Enthalpy); public sealed override SpecificEnergy SpecificCoolingCapacity => Point1.Enthalpy - Point9.Enthalpy; public sealed override SpecificEnergy SpecificHeatingCapacity => - HeatReleaserSpecificMassFlow.DecimalFractions - * (Point5.Enthalpy - Point6.Enthalpy); + HeatReleaserSpecificMassFlow.DecimalFractions * (Point5.Enthalpy - Point6.Enthalpy); public override IEntropyAnalysisResult EntropyAnalysis( Temperature indoor, diff --git a/src/VCRC/VCRCWithEconomizerAndTPI.cs b/src/VCRC/VCRCWithEconomizerAndTPI.cs index 33e0c96..a177a13 100644 --- a/src/VCRC/VCRCWithEconomizerAndTPI.cs +++ b/src/VCRC/VCRCWithEconomizerAndTPI.cs @@ -1,21 +1,16 @@ namespace VCRC; /// -public class VCRCWithEconomizerAndTPI - : AbstractTwoStageVCRC, - IVCRCWithEconomizerAndTPI +public class VCRCWithEconomizerAndTPI : AbstractTwoStageVCRC, IVCRCWithEconomizerAndTPI { /// /// Evaporator. /// Compressor. /// Condenser or gas cooler. /// Economizer. + /// Only one refrigerant should be selected! /// - /// Only one refrigerant should be selected! - /// - /// - /// Condensing temperature - /// should be greater than evaporating temperature! + /// Condensing temperature should be greater than evaporating temperature! /// /// /// Too high temperature difference at the economizer 'cold' side! @@ -30,34 +25,20 @@ IAuxiliaryHeatExchanger economizer { Economizer = economizer; Point2s = Point1.IsentropicCompressionTo(IntermediatePressure); - Point2 = Point1.CompressionTo( - IntermediatePressure, - Compressor.Efficiency - ); + Point2 = Point1.CompressionTo(IntermediatePressure, Compressor.Efficiency); Point3 = Refrigerant.DewPointAt(IntermediatePressure); Point4s = Point3.IsentropicCompressionTo(HeatReleaser.Pressure); - Point4 = Point3.CompressionTo( - HeatReleaser.Pressure, - Compressor.Efficiency - ); + Point4 = Point3.CompressionTo(HeatReleaser.Pressure, Compressor.Efficiency); Point6 = Point5.IsenthalpicExpansionTo(IntermediatePressure); new VCRCWithEconomizerAndTPIValidator().ValidateAndThrow(this); - Point8 = Point5.CoolingTo( - Point6.Temperature + Economizer.TemperatureDifference - ); + Point8 = Point5.CoolingTo(Point6.Temperature + Economizer.TemperatureDifference); Point7 = Point6.HeatingTo( ( ( Point6.Enthalpy.JoulesPerKilogram - * ( - Point2.Enthalpy.JoulesPerKilogram - - Point3.Enthalpy.JoulesPerKilogram - ) + * (Point2.Enthalpy.JoulesPerKilogram - Point3.Enthalpy.JoulesPerKilogram) + Point3.Enthalpy.JoulesPerKilogram - * ( - Point5.Enthalpy.JoulesPerKilogram - - Point8.Enthalpy.JoulesPerKilogram - ) + * (Point5.Enthalpy.JoulesPerKilogram - Point8.Enthalpy.JoulesPerKilogram) ) / ( Point2.Enthalpy.JoulesPerKilogram @@ -98,57 +79,34 @@ IAuxiliaryHeatExchanger economizer ); public IAuxiliaryHeatExchanger Economizer { get; } - public IRefrigerant Point1 => Evaporator.Outlet; - - [SuppressMessage("ReSharper", "InconsistentNaming")] public IRefrigerant Point2s { get; } - public IRefrigerant Point2 { get; } - public IRefrigerant Point3 { get; } - - [SuppressMessage("ReSharper", "InconsistentNaming")] public IRefrigerant Point4s { get; } - public IRefrigerant Point4 { get; } - public IRefrigerant Point5 => HeatReleaser.Outlet; - public IRefrigerant Point6 { get; } - public IRefrigerant Point7 { get; } - public IRefrigerant Point8 { get; } - public IRefrigerant Point9 { get; } - - public sealed override Pressure IntermediatePressure => - base.IntermediatePressure; - - public sealed override Ratio IntermediateSpecificMassFlow => - base.IntermediateSpecificMassFlow; + public sealed override Pressure IntermediatePressure => base.IntermediatePressure; + public sealed override Ratio IntermediateSpecificMassFlow => base.IntermediateSpecificMassFlow; public sealed override Ratio HeatReleaserSpecificMassFlow => EvaporatorSpecificMassFlow - * ( - 1 - + (Point2.Enthalpy - Point3.Enthalpy) - / (Point3.Enthalpy - Point7.Enthalpy) - ); + * (1 + (Point2.Enthalpy - Point3.Enthalpy) / (Point3.Enthalpy - Point7.Enthalpy)); public sealed override SpecificEnergy IsentropicSpecificWork => Point2s.Enthalpy - Point1.Enthalpy - + HeatReleaserSpecificMassFlow.DecimalFractions - * (Point4s.Enthalpy - Point3.Enthalpy); + + HeatReleaserSpecificMassFlow.DecimalFractions * (Point4s.Enthalpy - Point3.Enthalpy); public sealed override SpecificEnergy SpecificCoolingCapacity => Point1.Enthalpy - Point9.Enthalpy; public sealed override SpecificEnergy SpecificHeatingCapacity => - HeatReleaserSpecificMassFlow.DecimalFractions - * (Point4.Enthalpy - Point5.Enthalpy); + HeatReleaserSpecificMassFlow.DecimalFractions * (Point4.Enthalpy - Point5.Enthalpy); public override IEntropyAnalysisResult EntropyAnalysis( Temperature indoor, diff --git a/src/VCRC/VCRCWithEjector.cs b/src/VCRC/VCRCWithEjector.cs index 7346bc8..a3eca23 100644 --- a/src/VCRC/VCRCWithEjector.cs +++ b/src/VCRC/VCRCWithEjector.cs @@ -10,12 +10,9 @@ public class VCRCWithEjector : AbstractVCRC, IVCRCWithEjector /// Compressor. /// Condenser or gas cooler. /// Ejector. + /// Only one refrigerant should be selected! /// - /// Only one refrigerant should be selected! - /// - /// - /// Condensing temperature - /// should be greater than evaporating temperature! + /// Condensing temperature should be greater than evaporating temperature! /// /// /// Refrigerant should be a single component or an azeotropic blend! @@ -33,10 +30,7 @@ IEjector ejector _ejectorFlows = Ejector.CalculateFlows(Point3, Point9); Point1 = Refrigerant.DewPointAt(Point6.Pressure); Point2s = Point1.IsentropicCompressionTo(HeatReleaser.Pressure); - Point2 = Point1.CompressionTo( - HeatReleaser.Pressure, - Compressor.Efficiency - ); + Point2 = Point1.CompressionTo(HeatReleaser.Pressure, Compressor.Efficiency); Point7 = Refrigerant.BubblePointAt(Point6.Pressure); Point8 = Point7.IsenthalpicExpansionTo(Evaporator.Pressure); } @@ -59,47 +53,30 @@ IEjector ejector ); public IEjector Ejector { get; } - public IRefrigerant Point1 { get; } - - [SuppressMessage("ReSharper", "InconsistentNaming")] public IRefrigerant Point2s { get; } - public IRefrigerant Point2 { get; } - public IRefrigerant Point3 => HeatReleaser.Outlet; - public IRefrigerant Point4 => _ejectorFlows.NozzleOutlet; - public IRefrigerant Point5 => _ejectorFlows.MixingInlet; - public IRefrigerant Point6 => _ejectorFlows.DiffuserOutlet; - public IRefrigerant Point7 { get; } - public IRefrigerant Point8 { get; } - public IRefrigerant Point9 => Evaporator.Outlet; - public IRefrigerant Point10 => _ejectorFlows.SuctionOutlet; public sealed override Ratio HeatReleaserSpecificMassFlow => EvaporatorSpecificMassFlow - * ( - Point6.Quality!.Value.DecimalFractions - / (1 - Point6.Quality!.Value.DecimalFractions) - ); + * (Point6.Quality!.Value.DecimalFractions / (1 - Point6.Quality!.Value.DecimalFractions)); public sealed override SpecificEnergy IsentropicSpecificWork => - HeatReleaserSpecificMassFlow.DecimalFractions - * (Point2s.Enthalpy - Point1.Enthalpy); + HeatReleaserSpecificMassFlow.DecimalFractions * (Point2s.Enthalpy - Point1.Enthalpy); public sealed override SpecificEnergy SpecificCoolingCapacity => Point9.Enthalpy - Point8.Enthalpy; public override SpecificEnergy SpecificHeatingCapacity => - HeatReleaserSpecificMassFlow.DecimalFractions - * (Point2.Enthalpy - Point3.Enthalpy); + HeatReleaserSpecificMassFlow.DecimalFractions * (Point2.Enthalpy - Point3.Enthalpy); public override IEntropyAnalysisResult EntropyAnalysis( Temperature indoor, diff --git a/src/VCRC/VCRCWithEjectorAndEconomizer.cs b/src/VCRC/VCRCWithEjectorAndEconomizer.cs index ca0b5dc..ba5078b 100644 --- a/src/VCRC/VCRCWithEjectorAndEconomizer.cs +++ b/src/VCRC/VCRCWithEjectorAndEconomizer.cs @@ -1,9 +1,7 @@ namespace VCRC; /// -public class VCRCWithEjectorAndEconomizer - : AbstractTwoStageVCRC, - IVCRCWithEjectorAndEconomizer +public class VCRCWithEjectorAndEconomizer : AbstractTwoStageVCRC, IVCRCWithEjectorAndEconomizer { private Pressure _diffuserOutletPressure; private IEjectorFlows _ejectorFlows = default!; @@ -14,12 +12,9 @@ public class VCRCWithEjectorAndEconomizer /// Condenser or gas cooler. /// Ejector. /// Economizer. + /// Only one refrigerant should be selected! /// - /// Only one refrigerant should be selected! - /// - /// - /// Condensing temperature - /// should be greater than evaporating temperature! + /// Condensing temperature should be greater than evaporating temperature! /// /// /// Refrigerant should be a single component or an azeotropic blend! @@ -45,10 +40,7 @@ IEconomizer economizer CalculateDiffuserOutletPressure(); Point1 = Refrigerant.DewPointAt(_ejectorFlows.DiffuserOutlet.Pressure); Point2s = Point1.IsentropicCompressionTo(IntermediatePressure); - Point2 = Point1.CompressionTo( - IntermediatePressure, - Compressor.Efficiency - ); + Point2 = Point1.CompressionTo(IntermediatePressure, Compressor.Efficiency); Point3 = Refrigerant.Mixing( HeatReleaserSpecificMassFlow - IntermediateSpecificMassFlow, Point2, @@ -56,13 +48,8 @@ IEconomizer economizer Point7 ); Point4s = Point3.IsentropicCompressionTo(HeatReleaser.Pressure); - Point4 = Point3.CompressionTo( - HeatReleaser.Pressure, - Compressor.Efficiency - ); - Point12 = Refrigerant.BubblePointAt( - _ejectorFlows.DiffuserOutlet.Pressure - ); + Point4 = Point3.CompressionTo(HeatReleaser.Pressure, Compressor.Efficiency); + Point12 = Refrigerant.BubblePointAt(_ejectorFlows.DiffuserOutlet.Pressure); Point13 = Point12.IsenthalpicExpansionTo(Evaporator.Pressure); } @@ -100,50 +87,27 @@ IEconomizer economizer ); public IEjector Ejector { get; } - public IEconomizer Economizer { get; } - public IRefrigerant Point1 { get; } - - [SuppressMessage("ReSharper", "InconsistentNaming")] public IRefrigerant Point2s { get; } - public IRefrigerant Point2 { get; } - public IRefrigerant Point3 { get; } - - [SuppressMessage("ReSharper", "InconsistentNaming")] public IRefrigerant Point4s { get; } - public IRefrigerant Point4 { get; } - public IRefrigerant Point5 => HeatReleaser.Outlet; - public IRefrigerant Point6 { get; private set; } = default!; - public IRefrigerant Point7 { get; private set; } = default!; - public IRefrigerant Point8 { get; private set; } = default!; - public IRefrigerant Point9 => _ejectorFlows.NozzleOutlet; - public IRefrigerant Point10 => _ejectorFlows.MixingInlet; - public IRefrigerant Point11 => _ejectorFlows.DiffuserOutlet; - public IRefrigerant Point12 { get; } - public IRefrigerant Point13 { get; } - public IRefrigerant Point14 => Evaporator.Outlet; - public IRefrigerant Point15 => _ejectorFlows.SuctionOutlet; public sealed override Pressure IntermediatePressure => - CalculateIntermediatePressure( - _diffuserOutletPressure, - HeatReleaser.Pressure - ); + CalculateIntermediatePressure(_diffuserOutletPressure, HeatReleaser.Pressure); public sealed override Ratio IntermediateSpecificMassFlow => HeatReleaserSpecificMassFlow @@ -155,29 +119,19 @@ IEconomizer economizer public sealed override Ratio HeatReleaserSpecificMassFlow => EvaporatorSpecificMassFlow - * ( - Point11.Quality!.Value.DecimalFractions - / (1 - Point11.Quality!.Value.DecimalFractions) - ) - * ( - 1 - + (Point5.Enthalpy - Point8.Enthalpy) - / (Point7.Enthalpy - Point6.Enthalpy) - ); + * (Point11.Quality!.Value.DecimalFractions / (1 - Point11.Quality!.Value.DecimalFractions)) + * (1 + (Point5.Enthalpy - Point8.Enthalpy) / (Point7.Enthalpy - Point6.Enthalpy)); public sealed override SpecificEnergy IsentropicSpecificWork => - ( - HeatReleaserSpecificMassFlow - IntermediateSpecificMassFlow - ).DecimalFractions * (Point2s.Enthalpy - Point1.Enthalpy) - + HeatReleaserSpecificMassFlow.DecimalFractions - * (Point4s.Enthalpy - Point3.Enthalpy); + (HeatReleaserSpecificMassFlow - IntermediateSpecificMassFlow).DecimalFractions + * (Point2s.Enthalpy - Point1.Enthalpy) + + HeatReleaserSpecificMassFlow.DecimalFractions * (Point4s.Enthalpy - Point3.Enthalpy); public sealed override SpecificEnergy SpecificCoolingCapacity => Point14.Enthalpy - Point13.Enthalpy; public sealed override SpecificEnergy SpecificHeatingCapacity => - HeatReleaserSpecificMassFlow.DecimalFractions - * (Point4.Enthalpy - Point5.Enthalpy); + HeatReleaserSpecificMassFlow.DecimalFractions * (Point4.Enthalpy - Point5.Enthalpy); public override IEntropyAnalysisResult EntropyAnalysis( Temperature indoor, @@ -200,18 +154,11 @@ double ToSolve(double diffuserOutletPressure) { _diffuserOutletPressure = diffuserOutletPressure.Pascals(); Point6 = Point5.IsenthalpicExpansionTo(IntermediatePressure); - Point7 = Refrigerant.Superheated( - IntermediatePressure, - Economizer.Superheat - ); + Point7 = Refrigerant.Superheated(IntermediatePressure, Economizer.Superheat); new VCRCWithEjectorAndEconomizerValidator().ValidateAndThrow(this); - Point8 = Point5.CoolingTo( - Point6.Temperature + Economizer.TemperatureDifference - ); + Point8 = Point5.CoolingTo(Point6.Temperature + Economizer.TemperatureDifference); _ejectorFlows = Ejector.CalculateFlows(Point8, Point14); - return ( - _ejectorFlows.DiffuserOutlet.Pressure - _diffuserOutletPressure - ).Pascals; + return (_ejectorFlows.DiffuserOutlet.Pressure - _diffuserOutletPressure).Pascals; } } } diff --git a/src/VCRC/VCRCWithEjectorEconomizerAndPC.cs b/src/VCRC/VCRCWithEjectorEconomizerAndPC.cs index 2cfbbc3..8d44609 100644 --- a/src/VCRC/VCRCWithEjectorEconomizerAndPC.cs +++ b/src/VCRC/VCRCWithEjectorEconomizerAndPC.cs @@ -1,9 +1,9 @@ -namespace VCRC; +// ReSharper disable InconsistentNaming + +namespace VCRC; /// -public class VCRCWithEjectorEconomizerAndPC - : AbstractTwoStageVCRC, - IVCRCWithEjectorEconomizerAndPC +public class VCRCWithEjectorEconomizerAndPC : AbstractTwoStageVCRC, IVCRCWithEjectorEconomizerAndPC { private Pressure _diffuserOutletPressure; private IEjectorFlows _ejectorFlows = default!; @@ -14,12 +14,9 @@ public class VCRCWithEjectorEconomizerAndPC /// Condenser or gas cooler. /// Ejector. /// Economizer. + /// Only one refrigerant should be selected! /// - /// Only one refrigerant should be selected! - /// - /// - /// Condensing temperature - /// should be greater than evaporating temperature! + /// Condensing temperature should be greater than evaporating temperature! /// /// /// Refrigerant should be a single component or an azeotropic blend! @@ -45,15 +42,9 @@ IEconomizer economizer CalculateDiffuserOutletPressure(); Point1 = Refrigerant.DewPointAt(_ejectorFlows.DiffuserOutlet.Pressure); Point2s = Point1.IsentropicCompressionTo(HeatReleaser.Pressure); - Point2 = Point1.CompressionTo( - HeatReleaser.Pressure, - Compressor.Efficiency - ); + Point2 = Point1.CompressionTo(HeatReleaser.Pressure, Compressor.Efficiency); Point4s = Point3.IsentropicCompressionTo(HeatReleaser.Pressure); - Point4 = Point3.CompressionTo( - HeatReleaser.Pressure, - Compressor.Efficiency - ); + Point4 = Point3.CompressionTo(HeatReleaser.Pressure, Compressor.Efficiency); Point5s = Refrigerant.Mixing( HeatReleaserSpecificMassFlow - IntermediateSpecificMassFlow, Point2s, @@ -66,13 +57,10 @@ IEconomizer economizer IntermediateSpecificMassFlow, Point4 ); - Point12 = Refrigerant.BubblePointAt( - _ejectorFlows.DiffuserOutlet.Pressure - ); + Point12 = Refrigerant.BubblePointAt(_ejectorFlows.DiffuserOutlet.Pressure); Point13 = Point12.IsenthalpicExpansionTo(Evaporator.Pressure); } - [SuppressMessage("ReSharper", "InconsistentNaming")] private IRefrigerant Point5s { get; } private IEntropyAnalyzer Analyzer => @@ -109,50 +97,27 @@ IEconomizer economizer ); public IEjector Ejector { get; } - public IEconomizer Economizer { get; } - public IRefrigerant Point1 { get; } - - [SuppressMessage("ReSharper", "InconsistentNaming")] public IRefrigerant Point2s { get; } - public IRefrigerant Point2 { get; } - public IRefrigerant Point3 { get; private set; } = default!; - - [SuppressMessage("ReSharper", "InconsistentNaming")] public IRefrigerant Point4s { get; } - public IRefrigerant Point4 { get; } - public IRefrigerant Point5 { get; } - public IRefrigerant Point6 => HeatReleaser.Outlet; - public IRefrigerant Point7 { get; private set; } = default!; - public IRefrigerant Point8 { get; private set; } = default!; - public IRefrigerant Point9 => _ejectorFlows.NozzleOutlet; - public IRefrigerant Point10 => _ejectorFlows.MixingInlet; - public IRefrigerant Point11 => _ejectorFlows.DiffuserOutlet; - public IRefrigerant Point12 { get; } - public IRefrigerant Point13 { get; } - public IRefrigerant Point14 => Evaporator.Outlet; - public IRefrigerant Point15 => _ejectorFlows.SuctionOutlet; public sealed override Pressure IntermediatePressure => - CalculateIntermediatePressure( - _diffuserOutletPressure, - HeatReleaser.Pressure - ); + CalculateIntermediatePressure(_diffuserOutletPressure, HeatReleaser.Pressure); public sealed override Ratio IntermediateSpecificMassFlow => HeatReleaserSpecificMassFlow @@ -164,29 +129,19 @@ IEconomizer economizer public sealed override Ratio HeatReleaserSpecificMassFlow => EvaporatorSpecificMassFlow - * ( - Point11.Quality!.Value.DecimalFractions - / (1 - Point11.Quality!.Value.DecimalFractions) - ) - * ( - 1 - + (Point6.Enthalpy - Point8.Enthalpy) - / (Point3.Enthalpy - Point7.Enthalpy) - ); + * (Point11.Quality!.Value.DecimalFractions / (1 - Point11.Quality!.Value.DecimalFractions)) + * (1 + (Point6.Enthalpy - Point8.Enthalpy) / (Point3.Enthalpy - Point7.Enthalpy)); public sealed override SpecificEnergy IsentropicSpecificWork => - ( - HeatReleaserSpecificMassFlow - IntermediateSpecificMassFlow - ).DecimalFractions * (Point2s.Enthalpy - Point1.Enthalpy) - + IntermediateSpecificMassFlow.DecimalFractions - * (Point4s.Enthalpy - Point3.Enthalpy); + (HeatReleaserSpecificMassFlow - IntermediateSpecificMassFlow).DecimalFractions + * (Point2s.Enthalpy - Point1.Enthalpy) + + IntermediateSpecificMassFlow.DecimalFractions * (Point4s.Enthalpy - Point3.Enthalpy); public sealed override SpecificEnergy SpecificCoolingCapacity => Point14.Enthalpy - Point13.Enthalpy; public sealed override SpecificEnergy SpecificHeatingCapacity => - HeatReleaserSpecificMassFlow.DecimalFractions - * (Point5.Enthalpy - Point6.Enthalpy); + HeatReleaserSpecificMassFlow.DecimalFractions * (Point5.Enthalpy - Point6.Enthalpy); public override IEntropyAnalysisResult EntropyAnalysis( Temperature indoor, @@ -209,20 +164,11 @@ double ToSolve(double diffuserOutletPressure) { _diffuserOutletPressure = diffuserOutletPressure.Pascals(); Point7 = Point6.IsenthalpicExpansionTo(IntermediatePressure); - Point3 = Refrigerant.Superheated( - IntermediatePressure, - Economizer.Superheat - ); - new VCRCWithEjectorEconomizerAndPCValidator().ValidateAndThrow( - this - ); - Point8 = Point6.CoolingTo( - Point7.Temperature + Economizer.TemperatureDifference - ); + Point3 = Refrigerant.Superheated(IntermediatePressure, Economizer.Superheat); + new VCRCWithEjectorEconomizerAndPCValidator().ValidateAndThrow(this); + Point8 = Point6.CoolingTo(Point7.Temperature + Economizer.TemperatureDifference); _ejectorFlows = Ejector.CalculateFlows(Point8, Point14); - return ( - _ejectorFlows.DiffuserOutlet.Pressure - _diffuserOutletPressure - ).Pascals; + return (_ejectorFlows.DiffuserOutlet.Pressure - _diffuserOutletPressure).Pascals; } } } diff --git a/src/VCRC/VCRCWithEjectorEconomizerAndTPI.cs b/src/VCRC/VCRCWithEjectorEconomizerAndTPI.cs index d77a01b..887f465 100644 --- a/src/VCRC/VCRCWithEjectorEconomizerAndTPI.cs +++ b/src/VCRC/VCRCWithEjectorEconomizerAndTPI.cs @@ -14,12 +14,9 @@ public class VCRCWithEjectorEconomizerAndTPI /// Condenser or gas cooler. /// Ejector. /// Economizer. + /// Only one refrigerant should be selected! /// - /// Only one refrigerant should be selected! - /// - /// - /// Condensing temperature - /// should be greater than evaporating temperature! + /// Condensing temperature should be greater than evaporating temperature! /// /// /// Refrigerant should be a single component or an azeotropic blend! @@ -41,13 +38,8 @@ IAuxiliaryHeatExchanger economizer Economizer = economizer; CalculateDiffuserOutletPressure(); Point4s = Point3.IsentropicCompressionTo(HeatReleaser.Pressure); - Point4 = Point3.CompressionTo( - HeatReleaser.Pressure, - Compressor.Efficiency - ); - Point12 = Refrigerant.BubblePointAt( - _ejectorFlows.DiffuserOutlet.Pressure - ); + Point4 = Point3.CompressionTo(HeatReleaser.Pressure, Compressor.Efficiency); + Point12 = Refrigerant.BubblePointAt(_ejectorFlows.DiffuserOutlet.Pressure); Point13 = Point12.IsenthalpicExpansionTo(Evaporator.Pressure); } @@ -85,50 +77,27 @@ IAuxiliaryHeatExchanger economizer ); public IEjector Ejector { get; } - public IAuxiliaryHeatExchanger Economizer { get; } - public IRefrigerant Point1 { get; private set; } = default!; - - [SuppressMessage("ReSharper", "InconsistentNaming")] public IRefrigerant Point2s { get; private set; } = default!; - public IRefrigerant Point2 { get; private set; } = default!; - public IRefrigerant Point3 { get; private set; } = default!; - - [SuppressMessage("ReSharper", "InconsistentNaming")] public IRefrigerant Point4s { get; } - public IRefrigerant Point4 { get; } - public IRefrigerant Point5 => HeatReleaser.Outlet; - public IRefrigerant Point6 { get; private set; } = default!; - public IRefrigerant Point7 { get; private set; } = default!; - public IRefrigerant Point8 { get; private set; } = default!; - public IRefrigerant Point9 => _ejectorFlows.NozzleOutlet; - public IRefrigerant Point10 => _ejectorFlows.MixingInlet; - public IRefrigerant Point11 => _ejectorFlows.DiffuserOutlet; - public IRefrigerant Point12 { get; } - public IRefrigerant Point13 { get; } - public IRefrigerant Point14 => Evaporator.Outlet; - public IRefrigerant Point15 => _ejectorFlows.SuctionOutlet; public sealed override Pressure IntermediatePressure => - CalculateIntermediatePressure( - _diffuserOutletPressure, - HeatReleaser.Pressure - ); + CalculateIntermediatePressure(_diffuserOutletPressure, HeatReleaser.Pressure); public sealed override Ratio IntermediateSpecificMassFlow => HeatReleaserSpecificMassFlow @@ -140,29 +109,19 @@ IAuxiliaryHeatExchanger economizer public sealed override Ratio HeatReleaserSpecificMassFlow => EvaporatorSpecificMassFlow - * ( - Point11.Quality!.Value.DecimalFractions - / (1 - Point11.Quality!.Value.DecimalFractions) - ) - * ( - 1 - + (Point2.Enthalpy - Point3.Enthalpy) - / (Point3.Enthalpy - Point7.Enthalpy) - ); + * (Point11.Quality!.Value.DecimalFractions / (1 - Point11.Quality!.Value.DecimalFractions)) + * (1 + (Point2.Enthalpy - Point3.Enthalpy) / (Point3.Enthalpy - Point7.Enthalpy)); public sealed override SpecificEnergy IsentropicSpecificWork => - ( - HeatReleaserSpecificMassFlow - IntermediateSpecificMassFlow - ).DecimalFractions * (Point2s.Enthalpy - Point1.Enthalpy) - + HeatReleaserSpecificMassFlow.DecimalFractions - * (Point4s.Enthalpy - Point3.Enthalpy); + (HeatReleaserSpecificMassFlow - IntermediateSpecificMassFlow).DecimalFractions + * (Point2s.Enthalpy - Point1.Enthalpy) + + HeatReleaserSpecificMassFlow.DecimalFractions * (Point4s.Enthalpy - Point3.Enthalpy); public sealed override SpecificEnergy SpecificCoolingCapacity => Point14.Enthalpy - Point13.Enthalpy; public sealed override SpecificEnergy SpecificHeatingCapacity => - HeatReleaserSpecificMassFlow.DecimalFractions - * (Point4.Enthalpy - Point5.Enthalpy); + HeatReleaserSpecificMassFlow.DecimalFractions * (Point4.Enthalpy - Point5.Enthalpy); public override IEntropyAnalysisResult EntropyAnalysis( Temperature indoor, @@ -186,18 +145,11 @@ double ToSolve(double diffuserOutletPressure) _diffuserOutletPressure = diffuserOutletPressure.Pascals(); Point1 = Refrigerant.DewPointAt(_diffuserOutletPressure); Point2s = Point1.IsentropicCompressionTo(IntermediatePressure); - Point2 = Point1.CompressionTo( - IntermediatePressure, - Compressor.Efficiency - ); + Point2 = Point1.CompressionTo(IntermediatePressure, Compressor.Efficiency); Point3 = Refrigerant.DewPointAt(IntermediatePressure); Point6 = Point5.IsenthalpicExpansionTo(IntermediatePressure); - new VCRCWithEjectorEconomizerAndTPIValidator().ValidateAndThrow( - this - ); - Point8 = Point5.CoolingTo( - Point6.Temperature + Economizer.TemperatureDifference - ); + new VCRCWithEjectorEconomizerAndTPIValidator().ValidateAndThrow(this); + Point8 = Point5.CoolingTo(Point6.Temperature + Economizer.TemperatureDifference); Point7 = Point6.HeatingTo( ( ( @@ -221,9 +173,7 @@ double ToSolve(double diffuserOutletPressure) ).JoulesPerKilogram() ); _ejectorFlows = Ejector.CalculateFlows(Point8, Point14); - return ( - _ejectorFlows.DiffuserOutlet.Pressure - _diffuserOutletPressure - ).Pascals; + return (_ejectorFlows.DiffuserOutlet.Pressure - _diffuserOutletPressure).Pascals; } } } diff --git a/src/VCRC/VCRCWithIIC.cs b/src/VCRC/VCRCWithIIC.cs index e42d048..3861aa8 100644 --- a/src/VCRC/VCRCWithIIC.cs +++ b/src/VCRC/VCRCWithIIC.cs @@ -7,29 +7,19 @@ public class VCRCWithIIC : AbstractTwoStageVCRC, IVCRCWithIIC /// Evaporator. /// Compressor. /// Condenser or gas cooler. + /// Only one refrigerant should be selected! /// - /// Only one refrigerant should be selected! - /// - /// - /// Condensing temperature - /// should be greater than evaporating temperature! + /// Condensing temperature should be greater than evaporating temperature! /// /// /// Refrigerant should be a single component or an azeotropic blend! /// - public VCRCWithIIC( - IEvaporator evaporator, - ICompressor compressor, - IHeatReleaser heatReleaser - ) + public VCRCWithIIC(IEvaporator evaporator, ICompressor compressor, IHeatReleaser heatReleaser) : base(evaporator, compressor, heatReleaser) { new RefrigerantTypeValidator().ValidateAndThrow(Refrigerant); Point2s = Point1.IsentropicCompressionTo(IntermediatePressure); - Point2 = Point1.CompressionTo( - IntermediatePressure, - Compressor.Efficiency - ); + Point2 = Point1.CompressionTo(IntermediatePressure, Compressor.Efficiency); Point6 = Point5.IsenthalpicExpansionTo(IntermediatePressure); Point7 = Refrigerant.DewPointAt(IntermediatePressure); Point8 = Refrigerant.BubblePointAt(IntermediatePressure); @@ -41,10 +31,7 @@ IHeatReleaser heatReleaser Point7 ); Point4s = Point3.IsentropicCompressionTo(HeatReleaser.Pressure); - Point4 = Point3.CompressionTo( - HeatReleaser.Pressure, - Compressor.Efficiency - ); + Point4 = Point3.CompressionTo(HeatReleaser.Pressure, Compressor.Efficiency); } private IEntropyAnalyzer Analyzer => @@ -68,51 +55,32 @@ IHeatReleaser heatReleaser ); public IRefrigerant Point1 => Evaporator.Outlet; - - [SuppressMessage("ReSharper", "InconsistentNaming")] public IRefrigerant Point2s { get; } - public IRefrigerant Point2 { get; } - public IRefrigerant Point3 { get; } - - [SuppressMessage("ReSharper", "InconsistentNaming")] public IRefrigerant Point4s { get; } - public IRefrigerant Point4 { get; } - public IRefrigerant Point5 => HeatReleaser.Outlet; - public IRefrigerant Point6 { get; } - public IRefrigerant Point7 { get; } - public IRefrigerant Point8 { get; } - public IRefrigerant Point9 { get; } - - public sealed override Pressure IntermediatePressure => - base.IntermediatePressure; - - public sealed override Ratio IntermediateSpecificMassFlow => - base.IntermediateSpecificMassFlow; + public sealed override Pressure IntermediatePressure => base.IntermediatePressure; + public sealed override Ratio IntermediateSpecificMassFlow => base.IntermediateSpecificMassFlow; public sealed override Ratio HeatReleaserSpecificMassFlow => - EvaporatorSpecificMassFlow - / (1 - Point6.Quality!.Value.DecimalFractions); + EvaporatorSpecificMassFlow / (1 - Point6.Quality!.Value.DecimalFractions); public sealed override SpecificEnergy IsentropicSpecificWork => Point2s.Enthalpy - Point1.Enthalpy - + HeatReleaserSpecificMassFlow.DecimalFractions - * (Point4s.Enthalpy - Point3.Enthalpy); + + HeatReleaserSpecificMassFlow.DecimalFractions * (Point4s.Enthalpy - Point3.Enthalpy); public sealed override SpecificEnergy SpecificCoolingCapacity => Point1.Enthalpy - Point9.Enthalpy; public sealed override SpecificEnergy SpecificHeatingCapacity => - HeatReleaserSpecificMassFlow.DecimalFractions - * (Point4.Enthalpy - Point5.Enthalpy); + HeatReleaserSpecificMassFlow.DecimalFractions * (Point4.Enthalpy - Point5.Enthalpy); public override IEntropyAnalysisResult EntropyAnalysis( Temperature indoor, diff --git a/src/VCRC/VCRCWithPC.cs b/src/VCRC/VCRCWithPC.cs index 44c978d..02fd76a 100644 --- a/src/VCRC/VCRCWithPC.cs +++ b/src/VCRC/VCRCWithPC.cs @@ -1,4 +1,6 @@ -namespace VCRC; +// ReSharper disable InconsistentNaming + +namespace VCRC; /// public class VCRCWithPC : AbstractTwoStageVCRC, IVCRCWithPC @@ -7,36 +9,23 @@ public class VCRCWithPC : AbstractTwoStageVCRC, IVCRCWithPC /// Evaporator. /// Compressor. /// Condenser or gas cooler. + /// Only one refrigerant should be selected! /// - /// Only one refrigerant should be selected! - /// - /// - /// Condensing temperature - /// should be greater than evaporating temperature! + /// Condensing temperature should be greater than evaporating temperature! /// /// /// Refrigerant should be a single component or an azeotropic blend! /// - public VCRCWithPC( - IEvaporator evaporator, - ICompressor compressor, - IHeatReleaser heatReleaser - ) + public VCRCWithPC(IEvaporator evaporator, ICompressor compressor, IHeatReleaser heatReleaser) : base(evaporator, compressor, heatReleaser) { new RefrigerantTypeValidator().ValidateAndThrow(Refrigerant); Point2s = Point1.IsentropicCompressionTo(HeatReleaser.Pressure); - Point2 = Point1.CompressionTo( - HeatReleaser.Pressure, - Compressor.Efficiency - ); + Point2 = Point1.CompressionTo(HeatReleaser.Pressure, Compressor.Efficiency); Point3 = Refrigerant.DewPointAt(IntermediatePressure); Point7 = Point6.IsenthalpicExpansionTo(IntermediatePressure); Point4s = Point3.IsentropicCompressionTo(HeatReleaser.Pressure); - Point4 = Point3.CompressionTo( - HeatReleaser.Pressure, - Compressor.Efficiency - ); + Point4 = Point3.CompressionTo(HeatReleaser.Pressure, Compressor.Efficiency); Point5s = Refrigerant.Mixing( EvaporatorSpecificMassFlow, Point2s, @@ -53,7 +42,6 @@ IHeatReleaser heatReleaser Point9 = Point8.IsenthalpicExpansionTo(Evaporator.Pressure); } - [SuppressMessage("ReSharper", "InconsistentNaming")] private IRefrigerant Point5s { get; } private IEntropyAnalyzer Analyzer => @@ -77,55 +65,36 @@ IHeatReleaser heatReleaser ); public IRefrigerant Point1 => Evaporator.Outlet; - - [SuppressMessage("ReSharper", "InconsistentNaming")] public IRefrigerant Point2s { get; } - public IRefrigerant Point2 { get; } - public IRefrigerant Point3 { get; } - - [SuppressMessage("ReSharper", "InconsistentNaming")] public IRefrigerant Point4s { get; } - public IRefrigerant Point4 { get; } - public IRefrigerant Point5 { get; } - public IRefrigerant Point6 => HeatReleaser.Outlet; - public IRefrigerant Point7 { get; } - public IRefrigerant Point8 { get; } - public IRefrigerant Point9 { get; } - - public sealed override Pressure IntermediatePressure => - base.IntermediatePressure; - - public sealed override Ratio IntermediateSpecificMassFlow => - base.IntermediateSpecificMassFlow; + public sealed override Pressure IntermediatePressure => base.IntermediatePressure; + public sealed override Ratio IntermediateSpecificMassFlow => base.IntermediateSpecificMassFlow; public sealed override Ratio HeatReleaserSpecificMassFlow => EvaporatorSpecificMassFlow * ( 1 - + Point7.Quality!.Value.DecimalFractions - / (1 - Point7.Quality!.Value.DecimalFractions) + + Point7.Quality!.Value.DecimalFractions / (1 - Point7.Quality!.Value.DecimalFractions) ); public sealed override SpecificEnergy IsentropicSpecificWork => Point2s.Enthalpy - Point1.Enthalpy - + IntermediateSpecificMassFlow.DecimalFractions - * (Point4s.Enthalpy - Point3.Enthalpy); + + IntermediateSpecificMassFlow.DecimalFractions * (Point4s.Enthalpy - Point3.Enthalpy); public sealed override SpecificEnergy SpecificCoolingCapacity => Point1.Enthalpy - Point9.Enthalpy; public sealed override SpecificEnergy SpecificHeatingCapacity => - HeatReleaserSpecificMassFlow.DecimalFractions - * (Point5.Enthalpy - Point6.Enthalpy); + HeatReleaserSpecificMassFlow.DecimalFractions * (Point5.Enthalpy - Point6.Enthalpy); public override IEntropyAnalysisResult EntropyAnalysis( Temperature indoor, diff --git a/src/VCRC/VCRCWithRecuperator.cs b/src/VCRC/VCRCWithRecuperator.cs index a180790..5cd63be 100644 --- a/src/VCRC/VCRCWithRecuperator.cs +++ b/src/VCRC/VCRCWithRecuperator.cs @@ -8,12 +8,9 @@ public class VCRCWithRecuperator : AbstractVCRC, IVCRCWithRecuperator /// Recuperator. /// Compressor. /// Condenser or gas cooler. + /// Only one refrigerant should be selected! /// - /// Only one refrigerant should be selected! - /// - /// - /// Condensing temperature - /// should be greater than evaporating temperature! + /// Condensing temperature should be greater than evaporating temperature! /// /// /// Too high temperature difference at the recuperator 'hot' side! @@ -28,17 +25,10 @@ IHeatReleaser heatReleaser { Recuperator = recuperator; new VCRCWithRecuperatorValidator().ValidateAndThrow(this); - Point2 = Point1.HeatingTo( - Point4.Temperature - Recuperator.TemperatureDifference - ); + Point2 = Point1.HeatingTo(Point4.Temperature - Recuperator.TemperatureDifference); Point3s = Point2.IsentropicCompressionTo(HeatReleaser.Pressure); - Point3 = Point2.CompressionTo( - HeatReleaser.Pressure, - Compressor.Efficiency - ); - Point5 = Point4.CoolingTo( - Point4.Enthalpy - (Point2.Enthalpy - Point1.Enthalpy) - ); + Point3 = Point2.CompressionTo(HeatReleaser.Pressure, Compressor.Efficiency); + Point5 = Point4.CoolingTo(Point4.Enthalpy - (Point2.Enthalpy - Point1.Enthalpy)); Point6 = Point5.IsenthalpicExpansionTo(Evaporator.Pressure); } @@ -62,24 +52,14 @@ IHeatReleaser heatReleaser ); public IAuxiliaryHeatExchanger Recuperator { get; } - public IRefrigerant Point1 => Evaporator.Outlet; - public IRefrigerant Point2 { get; } - - [SuppressMessage("ReSharper", "InconsistentNaming")] public IRefrigerant Point3s { get; } - public IRefrigerant Point3 { get; } - public IRefrigerant Point4 => HeatReleaser.Outlet; - public IRefrigerant Point5 { get; } - public IRefrigerant Point6 { get; } - - public sealed override Ratio HeatReleaserSpecificMassFlow { get; } = - 100.Percent(); + public sealed override Ratio HeatReleaserSpecificMassFlow { get; } = 100.Percent(); public sealed override SpecificEnergy IsentropicSpecificWork => Point3s.Enthalpy - Point2.Enthalpy; diff --git a/src/VCRC/Validators/VCRCMitsubishiZubadanValidator.cs b/src/VCRC/Validators/VCRCMitsubishiZubadanValidator.cs index d0084f1..87367ad 100644 --- a/src/VCRC/Validators/VCRCMitsubishiZubadanValidator.cs +++ b/src/VCRC/Validators/VCRCMitsubishiZubadanValidator.cs @@ -1,30 +1,20 @@ namespace VCRC; -internal class VCRCMitsubishiZubadanValidator - : AbstractValidator +internal sealed class VCRCMitsubishiZubadanValidator : AbstractValidator { public VCRCMitsubishiZubadanValidator() { RuleFor(vcrc => vcrc.Point7.Quality) .Must(quality => quality?.DecimalFractions is > 0 and < 1) - .WithMessage( - "There should be a two-phase refrigerant " - + "at the recuperator 'hot' inlet!" - ); + .WithMessage("There should be a two-phase refrigerant at the recuperator 'hot' inlet!"); RuleFor(vcrc => vcrc.Point7.Temperature) .GreaterThan(vcrc => vcrc.Point2.Temperature) - .WithMessage( - "Wrong temperature difference at the recuperator 'hot' side!" - ); + .WithMessage("Wrong temperature difference at the recuperator 'hot' side!"); RuleFor(vcrc => vcrc.Point8.Temperature) .GreaterThan(vcrc => vcrc.Point1.Temperature) - .WithMessage( - "Wrong temperature difference at the recuperator 'cold' side!" - ); + .WithMessage("Wrong temperature difference at the recuperator 'cold' side!"); RuleFor(vcrc => vcrc.Point11.Temperature) .LessThan(vcrc => vcrc.Point8.Temperature) - .WithMessage( - "Too high temperature difference at the economizer 'cold' side!" - ); + .WithMessage("Too high temperature difference at the economizer 'cold' side!"); } } diff --git a/src/VCRC/Validators/VCRCWithEconomizerAndPCValidator.cs b/src/VCRC/Validators/VCRCWithEconomizerAndPCValidator.cs index 6cb826b..4b3fbe5 100644 --- a/src/VCRC/Validators/VCRCWithEconomizerAndPCValidator.cs +++ b/src/VCRC/Validators/VCRCWithEconomizerAndPCValidator.cs @@ -1,21 +1,14 @@ namespace VCRC; -internal class VCRCWithEconomizerAndPCValidator - : AbstractValidator +internal sealed class VCRCWithEconomizerAndPCValidator : AbstractValidator { public VCRCWithEconomizerAndPCValidator() { RuleFor(vcrc => vcrc.Point3.Temperature) .LessThan(vcrc => vcrc.Point6.Temperature) - .WithMessage( - "Wrong temperature difference at the economizer 'hot' side!" - ); - RuleFor(vcrc => - vcrc.Point7.Temperature + vcrc.Economizer.TemperatureDifference - ) + .WithMessage("Wrong temperature difference at the economizer 'hot' side!"); + RuleFor(vcrc => vcrc.Point7.Temperature + vcrc.Economizer.TemperatureDifference) .LessThan(vcrc => vcrc.Point6.Temperature) - .WithMessage( - "Too high temperature difference at the economizer 'cold' side!" - ); + .WithMessage("Too high temperature difference at the economizer 'cold' side!"); } } diff --git a/src/VCRC/Validators/VCRCWithEconomizerAndTPIValidator.cs b/src/VCRC/Validators/VCRCWithEconomizerAndTPIValidator.cs index c45ee06..42cdcc6 100644 --- a/src/VCRC/Validators/VCRCWithEconomizerAndTPIValidator.cs +++ b/src/VCRC/Validators/VCRCWithEconomizerAndTPIValidator.cs @@ -1,16 +1,12 @@ namespace VCRC; -internal class VCRCWithEconomizerAndTPIValidator +internal sealed class VCRCWithEconomizerAndTPIValidator : AbstractValidator { public VCRCWithEconomizerAndTPIValidator() { - RuleFor(vcrc => - vcrc.Point6.Temperature + vcrc.Economizer.TemperatureDifference - ) + RuleFor(vcrc => vcrc.Point6.Temperature + vcrc.Economizer.TemperatureDifference) .LessThan(vcrc => vcrc.Point5.Temperature) - .WithMessage( - "Too high temperature difference at the economizer 'cold' side!" - ); + .WithMessage("Too high temperature difference at the economizer 'cold' side!"); } } diff --git a/src/VCRC/Validators/VCRCWithEconomizerValidator.cs b/src/VCRC/Validators/VCRCWithEconomizerValidator.cs index 6536a04..a7c4c81 100644 --- a/src/VCRC/Validators/VCRCWithEconomizerValidator.cs +++ b/src/VCRC/Validators/VCRCWithEconomizerValidator.cs @@ -1,21 +1,14 @@ namespace VCRC; -internal class VCRCWithEconomizerValidator - : AbstractValidator +internal sealed class VCRCWithEconomizerValidator : AbstractValidator { public VCRCWithEconomizerValidator() { RuleFor(vcrc => vcrc.Point7.Temperature) .LessThan(vcrc => vcrc.Point5.Temperature) - .WithMessage( - "Wrong temperature difference at the economizer 'hot' side!" - ); - RuleFor(vcrc => - vcrc.Point6.Temperature + vcrc.Economizer.TemperatureDifference - ) + .WithMessage("Wrong temperature difference at the economizer 'hot' side!"); + RuleFor(vcrc => vcrc.Point6.Temperature + vcrc.Economizer.TemperatureDifference) .LessThan(vcrc => vcrc.Point5.Temperature) - .WithMessage( - "Too high temperature difference at the economizer 'cold' side!" - ); + .WithMessage("Too high temperature difference at the economizer 'cold' side!"); } } diff --git a/src/VCRC/Validators/VCRCWithEjectorAndEconomizerValidator.cs b/src/VCRC/Validators/VCRCWithEjectorAndEconomizerValidator.cs index 3bef4b3..99e32cd 100644 --- a/src/VCRC/Validators/VCRCWithEjectorAndEconomizerValidator.cs +++ b/src/VCRC/Validators/VCRCWithEjectorAndEconomizerValidator.cs @@ -1,21 +1,15 @@ namespace VCRC; -internal class VCRCWithEjectorAndEconomizerValidator +internal sealed class VCRCWithEjectorAndEconomizerValidator : AbstractValidator { public VCRCWithEjectorAndEconomizerValidator() { RuleFor(vcrc => vcrc.Point7.Temperature) .LessThan(vcrc => vcrc.Point5.Temperature) - .WithMessage( - "Wrong temperature difference at the economizer 'hot' side!" - ); - RuleFor(vcrc => - vcrc.Point6.Temperature + vcrc.Economizer.TemperatureDifference - ) + .WithMessage("Wrong temperature difference at the economizer 'hot' side!"); + RuleFor(vcrc => vcrc.Point6.Temperature + vcrc.Economizer.TemperatureDifference) .LessThan(vcrc => vcrc.Point5.Temperature) - .WithMessage( - "Too high temperature difference at the economizer 'cold' side!" - ); + .WithMessage("Too high temperature difference at the economizer 'cold' side!"); } } diff --git a/src/VCRC/Validators/VCRCWithEjectorEconomizerAndPCValidator.cs b/src/VCRC/Validators/VCRCWithEjectorEconomizerAndPCValidator.cs index f7e6897..66c4494 100644 --- a/src/VCRC/Validators/VCRCWithEjectorEconomizerAndPCValidator.cs +++ b/src/VCRC/Validators/VCRCWithEjectorEconomizerAndPCValidator.cs @@ -1,21 +1,15 @@ namespace VCRC; -internal class VCRCWithEjectorEconomizerAndPCValidator +internal sealed class VCRCWithEjectorEconomizerAndPCValidator : AbstractValidator { public VCRCWithEjectorEconomizerAndPCValidator() { RuleFor(vcrc => vcrc.Point3.Temperature) .LessThan(vcrc => vcrc.Point6.Temperature) - .WithMessage( - "Wrong temperature difference at the economizer 'hot' side!" - ); - RuleFor(vcrc => - vcrc.Point7.Temperature + vcrc.Economizer.TemperatureDifference - ) + .WithMessage("Wrong temperature difference at the economizer 'hot' side!"); + RuleFor(vcrc => vcrc.Point7.Temperature + vcrc.Economizer.TemperatureDifference) .LessThan(vcrc => vcrc.Point6.Temperature) - .WithMessage( - "Too high temperature difference at the economizer 'cold' side!" - ); + .WithMessage("Too high temperature difference at the economizer 'cold' side!"); } } diff --git a/src/VCRC/Validators/VCRCWithEjectorEconomizerAndTPIValidator.cs b/src/VCRC/Validators/VCRCWithEjectorEconomizerAndTPIValidator.cs index 955289f..0327bac 100644 --- a/src/VCRC/Validators/VCRCWithEjectorEconomizerAndTPIValidator.cs +++ b/src/VCRC/Validators/VCRCWithEjectorEconomizerAndTPIValidator.cs @@ -1,16 +1,12 @@ namespace VCRC; -internal class VCRCWithEjectorEconomizerAndTPIValidator +internal sealed class VCRCWithEjectorEconomizerAndTPIValidator : AbstractValidator { public VCRCWithEjectorEconomizerAndTPIValidator() { - RuleFor(vcrc => - vcrc.Point6.Temperature + vcrc.Economizer.TemperatureDifference - ) + RuleFor(vcrc => vcrc.Point6.Temperature + vcrc.Economizer.TemperatureDifference) .LessThan(vcrc => vcrc.Point5.Temperature) - .WithMessage( - "Too high temperature difference at the economizer 'cold' side!" - ); + .WithMessage("Too high temperature difference at the economizer 'cold' side!"); } } diff --git a/src/VCRC/Validators/VCRCWithRecuperatorValidator.cs b/src/VCRC/Validators/VCRCWithRecuperatorValidator.cs index 73f05c3..bc525c4 100644 --- a/src/VCRC/Validators/VCRCWithRecuperatorValidator.cs +++ b/src/VCRC/Validators/VCRCWithRecuperatorValidator.cs @@ -1,16 +1,11 @@ namespace VCRC; -internal class VCRCWithRecuperatorValidator - : AbstractValidator +internal sealed class VCRCWithRecuperatorValidator : AbstractValidator { public VCRCWithRecuperatorValidator() { - RuleFor(vcrc => - vcrc.Point4.Temperature - vcrc.Recuperator.TemperatureDifference - ) + RuleFor(vcrc => vcrc.Point4.Temperature - vcrc.Recuperator.TemperatureDifference) .GreaterThan(vcrc => vcrc.Point1.Temperature) - .WithMessage( - "Too high temperature difference at the recuperator 'hot' side!" - ); + .WithMessage("Too high temperature difference at the recuperator 'hot' side!"); } } diff --git a/tests/VCRC.Tests/Components/CompressorTests.cs b/tests/VCRC.Tests/Components/CompressorTests.cs index 20083f4..cae4612 100644 --- a/tests/VCRC.Tests/Components/CompressorTests.cs +++ b/tests/VCRC.Tests/Components/CompressorTests.cs @@ -1,6 +1,6 @@ namespace VCRC.Tests; -public class CompressorTests : IClassFixture +public sealed class CompressorTests : IClassFixture { private readonly ComparisonFixture _comparison; private readonly Ratio _efficiency; @@ -16,26 +16,19 @@ public CompressorTests(ComparisonFixture comparison) [Theory] [InlineData(0.0)] [InlineData(100.0)] - public static void Compressor_WrongEfficiency_ThrowsValidationException( - double efficiency - ) + public static void Compressor_WrongEfficiency_ThrowsValidationException(double efficiency) { Action action = () => _ = new Compressor(efficiency.Percent()); action .Should() .Throw() - .WithMessage( - "*Isentropic efficiency of the compressor " - + "should be in (0;100) %!*" - ); + .WithMessage("*Isentropic efficiency of the compressor should be in (0;100) %!*"); } [Fact] public void Efficiency_Always_ReturnsEnteredValueInPercents() { - _sut.Efficiency.Equals(_efficiency, _comparison.Tolerance.Percent()) - .Should() - .BeTrue(); + _sut.Efficiency.Equals(_efficiency, _comparison.Tolerance.Percent()).Should().BeTrue(); _sut.Efficiency.Unit.Should().Be(RatioUnit.Percent); } } diff --git a/tests/VCRC.Tests/Components/CondenserTests.cs b/tests/VCRC.Tests/Components/CondenserTests.cs index 9bed258..e0658ed 100644 --- a/tests/VCRC.Tests/Components/CondenserTests.cs +++ b/tests/VCRC.Tests/Components/CondenserTests.cs @@ -2,7 +2,7 @@ namespace VCRC.Tests; -public class CondenserTests : IClassFixture +public sealed class CondenserTests : IClassFixture { private readonly ComparisonFixture _comparison; private readonly IRefrigerant _refrigerant; @@ -22,31 +22,21 @@ public CondenserTests(ComparisonFixture comparison) [Theory] [InlineData(-74.0)] [InlineData(87.0)] - public void Condenser_WrongTemperature_ThrowsValidationException( - double temperature - ) + public void Condenser_WrongTemperature_ThrowsValidationException(double temperature) { CultureInfo.CurrentCulture = new CultureInfo("en-US"); Action action = () => - _ = new Condenser( - _refrigerant.Name, - temperature.DegreesCelsius(), - _subcooling - ); + _ = new Condenser(_refrigerant.Name, temperature.DegreesCelsius(), _subcooling); action .Should() .Throw() - .WithMessage( - "*Condensing temperature should be in (-73.15;86.2) °C!*" - ); + .WithMessage("*Condensing temperature should be in (-73.15;86.2) °C!*"); } [Theory] [InlineData(-1.0)] [InlineData(51.0)] - public void Condenser_WrongSubcooling_ThrowsValidationException( - double subcooling - ) + public void Condenser_WrongSubcooling_ThrowsValidationException(double subcooling) { Action action = () => _ = new Condenser( @@ -57,9 +47,7 @@ double subcooling action .Should() .Throw() - .WithMessage( - "*Subcooling in the condenser should be in [0;50] K!*" - ); + .WithMessage("*Subcooling in the condenser should be in [0;50] K!*"); } [Fact] @@ -69,10 +57,7 @@ public void RefrigerantName_Always_ReturnsEnteredName() => [Fact] public void Temperature_Always_ReturnsEnteredValueInCelsius() { - _sut.Temperature.Equals( - _temperature, - _comparison.Tolerance.DegreesCelsius() - ) + _sut.Temperature.Equals(_temperature, _comparison.Tolerance.DegreesCelsius()) .Should() .BeTrue(); _sut.Temperature.Unit.Should().Be(TemperatureUnit.DegreeCelsius); @@ -81,10 +66,7 @@ public void Temperature_Always_ReturnsEnteredValueInCelsius() [Fact] public void Subcooling_Always_ReturnsEnteredValueInKelvins() { - _sut.Subcooling.Equals( - _subcooling, - TemperatureDelta.FromKelvins(_comparison.Tolerance) - ) + _sut.Subcooling.Equals(_subcooling, TemperatureDelta.FromKelvins(_comparison.Tolerance)) .Should() .BeTrue(); _sut.Subcooling.Unit.Should().Be(TemperatureDeltaUnit.Kelvin); @@ -93,10 +75,7 @@ public void Subcooling_Always_ReturnsEnteredValueInKelvins() [Fact] public void Pressure_Always_ReturnsOutletPressureInKilopascals() { - _sut.Pressure.Equals( - _sut.Outlet.Pressure, - _comparison.Tolerance.Pascals() - ) + _sut.Pressure.Equals(_sut.Outlet.Pressure, _comparison.Tolerance.Pascals()) .Should() .BeTrue(); _sut.Pressure.Unit.Should().Be(PressureUnit.Kilopascal); @@ -104,7 +83,5 @@ public void Pressure_Always_ReturnsOutletPressureInKilopascals() [Fact] public void Outlet_Always_ReturnsSubcooledRefrigerant() => - _sut - .Outlet.Should() - .Be(_refrigerant.Subcooled(_temperature, _subcooling)); + _sut.Outlet.Should().Be(_refrigerant.Subcooled(_temperature, _subcooling)); } diff --git a/tests/VCRC.Tests/Components/EconomizerTests.cs b/tests/VCRC.Tests/Components/EconomizerTests.cs index 3fdc26c..965d712 100644 --- a/tests/VCRC.Tests/Components/EconomizerTests.cs +++ b/tests/VCRC.Tests/Components/EconomizerTests.cs @@ -2,7 +2,7 @@ namespace VCRC.Tests; -public class EconomizerTests : IClassFixture +public sealed class EconomizerTests : IClassFixture { private readonly ComparisonFixture _comparison; private readonly TemperatureDelta _superheat; @@ -20,26 +20,19 @@ public EconomizerTests(ComparisonFixture comparison) [Theory] [InlineData(-1.0)] [InlineData(51.0)] - public void Economizer_WrongSuperheat_ThrowsValidationException( - double superheat - ) + public void Economizer_WrongSuperheat_ThrowsValidationException(double superheat) { - Action action = () => - _ = new Economizer(_temperatureDifference, superheat.Kelvins()); + Action action = () => _ = new Economizer(_temperatureDifference, superheat.Kelvins()); action .Should() .Throw() - .WithMessage( - "*Superheat in the economizer should be in [0;50] K!*" - ); + .WithMessage("*Superheat in the economizer should be in [0;50] K!*"); } [Fact] public void Superheat_Always_ReturnsEnteredValueInKelvins() { - _sut.Superheat.Equals(_superheat, _comparison.Tolerance.Kelvins()) - .Should() - .BeTrue(); + _sut.Superheat.Equals(_superheat, _comparison.Tolerance.Kelvins()).Should().BeTrue(); _sut.Superheat.Unit.Should().Be(TemperatureDeltaUnit.Kelvin); } } diff --git a/tests/VCRC.Tests/Components/EconomizerWithTPITests.cs b/tests/VCRC.Tests/Components/EconomizerWithTPITests.cs index 46435cb..ed477f7 100644 --- a/tests/VCRC.Tests/Components/EconomizerWithTPITests.cs +++ b/tests/VCRC.Tests/Components/EconomizerWithTPITests.cs @@ -2,7 +2,7 @@ namespace VCRC.Tests; -public class EconomizerWithTPITests : IClassFixture +public sealed class EconomizerWithTPITests : IClassFixture { private readonly ComparisonFixture _comparison; private readonly IAuxiliaryHeatExchanger _sut; @@ -22,27 +22,21 @@ public static void Economizer_WrongTemperatureDifference_ThrowsValidationExcepti double temperatureDifference ) { - Action action = () => - _ = new EconomizerWithTPI(temperatureDifference.Kelvins()); + Action action = () => _ = new EconomizerWithTPI(temperatureDifference.Kelvins()); action .Should() .Throw() .WithMessage( - "*Temperature difference at the economizer 'cold' side " - + "should be in (0;50) K!*" + "*Temperature difference at the economizer 'cold' side should be in (0;50) K!*" ); } [Fact] public void TemperatureDifference_Always_ReturnsEnteredValueInKelvins() { - _sut.TemperatureDifference.Equals( - _temperatureDifference, - _comparison.Tolerance.Kelvins() - ) + _sut.TemperatureDifference.Equals(_temperatureDifference, _comparison.Tolerance.Kelvins()) .Should() .BeTrue(); - _sut.TemperatureDifference.Unit.Should() - .Be(TemperatureDeltaUnit.Kelvin); + _sut.TemperatureDifference.Unit.Should().Be(TemperatureDeltaUnit.Kelvin); } } diff --git a/tests/VCRC.Tests/Components/EjectorFlowsTests.cs b/tests/VCRC.Tests/Components/EjectorFlowsTests.cs index 0bd12af..146353e 100644 --- a/tests/VCRC.Tests/Components/EjectorFlowsTests.cs +++ b/tests/VCRC.Tests/Components/EjectorFlowsTests.cs @@ -2,7 +2,7 @@ namespace VCRC.Tests; -public class EjectorFlowsTests : IClassFixture +public sealed class EjectorFlowsTests : IClassFixture { private readonly ComparisonFixture _comparison; private readonly IEjector _ejector; @@ -21,8 +21,7 @@ public EjectorFlowsTests(ComparisonFixture comparison) _suctionInlet = _refrigerant.DewPointAt(5.DegreesCelsius()); _sut = _ejector.CalculateFlows(_nozzleInlet, _suctionInlet); var mixingInletSpeed = - _sut.FlowRatio.DecimalFractions - * CalculateOutletSpeed(_nozzleInlet, _sut.NozzleOutlet) + _sut.FlowRatio.DecimalFractions * CalculateOutletSpeed(_nozzleInlet, _sut.NozzleOutlet) + (1 - _sut.FlowRatio.DecimalFractions) * CalculateOutletSpeed(_suctionInlet, _sut.SuctionOutlet); _mixingInletKineticEnergy = ( @@ -35,9 +34,7 @@ public void EjectorFlows_WrongRefrigerants_ThrowsValidationException() { Action action = () => _ = _ejector.CalculateFlows( - new Refrigerant(FluidsList.R22).BubblePointAt( - 45.DegreesCelsius() - ), + new Refrigerant(FluidsList.R22).BubblePointAt(45.DegreesCelsius()), _suctionInlet ); action @@ -49,14 +46,12 @@ public void EjectorFlows_WrongRefrigerants_ThrowsValidationException() [Fact] public void EjectorFlows_WrongPressures_ThrowsValidationException() { - Action action = () => - _ = _ejector.CalculateFlows(_suctionInlet, _nozzleInlet); + Action action = () => _ = _ejector.CalculateFlows(_suctionInlet, _nozzleInlet); action .Should() .Throw() .WithMessage( - "*Ejector nozzle inlet pressure " - + "should be greater than suction inlet pressure!*" + "*Ejector nozzle inlet pressure should be greater than suction inlet pressure!*" ); } @@ -72,12 +67,7 @@ public void SuctionInlet_Always_ReturnsSpecifiedSuctionInletPoint() => public void NozzleOutlet_Always_ReturnsNozzleInletAfterExpansionToMixingPressure() { _sut.NozzleOutlet.Should() - .Be( - _sut.NozzleInlet.ExpansionTo( - _sut.MixingInlet.Pressure, - _ejector.NozzleEfficiency - ) - ); + .Be(_sut.NozzleInlet.ExpansionTo(_sut.MixingInlet.Pressure, _ejector.NozzleEfficiency)); _sut.NozzleOutlet.Phase.Should().Be(Phases.TwoPhase); } @@ -86,10 +76,7 @@ public void SuctionOutlet_Always_ReturnsSuctionInletAfterExpansionToMixingPressu { _sut.SuctionOutlet.Should() .Be( - _sut.SuctionInlet.ExpansionTo( - _sut.MixingInlet.Pressure, - _ejector.SuctionEfficiency - ) + _sut.SuctionInlet.ExpansionTo(_sut.MixingInlet.Pressure, _ejector.SuctionEfficiency) ); _sut.SuctionOutlet.Phase.Should().Be(Phases.TwoPhase); } @@ -101,8 +88,7 @@ public void MixingInlet_Always_ReturnsPointMixPointAt90PercentsOfSuctionPressure _sut.MixingInlet.Enthalpy.Should() .Be( _sut.FlowRatio.DecimalFractions * _nozzleInlet.Enthalpy - + (1 - _sut.FlowRatio.DecimalFractions) - * _suctionInlet.Enthalpy + + (1 - _sut.FlowRatio.DecimalFractions) * _suctionInlet.Enthalpy - _mixingInletKineticEnergy ); _sut.MixingInlet.Phase.Should().Be(Phases.TwoPhase); @@ -120,17 +106,13 @@ public void DiffuserOutlet_Always_ReturnsCompressedMixPoint() Input.Entropy(_sut.MixingInlet.Entropy), Input.Enthalpy( _sut.MixingInlet.Enthalpy - + _ejector - .DiffuserEfficiency - .DecimalFractions + + _ejector.DiffuserEfficiency.DecimalFractions * _mixingInletKineticEnergy ) ) .Pressure ), - Input.Enthalpy( - _sut.MixingInlet.Enthalpy + _mixingInletKineticEnergy - ) + Input.Enthalpy(_sut.MixingInlet.Enthalpy + _mixingInletKineticEnergy) ) ); _sut.DiffuserOutlet.Phase.Should().Be(Phases.TwoPhase); @@ -139,17 +121,10 @@ public void DiffuserOutlet_Always_ReturnsCompressedMixPoint() [Fact] public void FlowRatio_Always_ReturnsApproximatelyDiffuserOutletVaporQuality() => _sut - .FlowRatio.Equals( - _sut.DiffuserOutlet.Quality!.Value, - _comparison.Tolerance.Percent() - ) + .FlowRatio.Equals(_sut.DiffuserOutlet.Quality!.Value, _comparison.Tolerance.Percent()) .Should() .BeTrue(); - private static Speed CalculateOutletSpeed( - IFluidState inlet, - IFluidState outlet - ) => - Math.Sqrt(2 * (inlet.Enthalpy - outlet.Enthalpy).JoulesPerKilogram) - .MetersPerSecond(); + private static Speed CalculateOutletSpeed(IFluidState inlet, IFluidState outlet) => + Math.Sqrt(2 * (inlet.Enthalpy - outlet.Enthalpy).JoulesPerKilogram).MetersPerSecond(); } diff --git a/tests/VCRC.Tests/Components/EjectorTests.cs b/tests/VCRC.Tests/Components/EjectorTests.cs index 747d449..20a0751 100644 --- a/tests/VCRC.Tests/Components/EjectorTests.cs +++ b/tests/VCRC.Tests/Components/EjectorTests.cs @@ -1,6 +1,6 @@ namespace VCRC.Tests; -public class EjectorTests : IClassFixture +public sealed class EjectorTests : IClassFixture { private readonly ComparisonFixture _comparison; private readonly Ratio _diffuserEfficiency; @@ -14,11 +14,7 @@ public EjectorTests(ComparisonFixture comparison) _nozzleEfficiency = 0.9.DecimalFractions(); _suctionEfficiency = 0.9.DecimalFractions(); _diffuserEfficiency = 0.8.DecimalFractions(); - _sut = new Ejector( - _nozzleEfficiency, - _suctionEfficiency, - _diffuserEfficiency - ); + _sut = new Ejector(_nozzleEfficiency, _suctionEfficiency, _diffuserEfficiency); } [Theory] @@ -32,24 +28,12 @@ double isentropicEfficiency action .Should() .Throw() - .WithMessage( - "*Isentropic efficiency of the nozzle should be in (0;100) %!*" - ); + .WithMessage("*Isentropic efficiency of the nozzle should be in (0;100) %!*"); } [Theory] - [InlineData( - 0.0, - 90.0, - 80.0, - "Isentropic efficiency of the nozzle should be in (0;100) %!" - )] - [InlineData( - 100.0, - 90.0, - 80.0, - "Isentropic efficiency of the nozzle should be in (0;100) %!" - )] + [InlineData(0.0, 90.0, 80.0, "Isentropic efficiency of the nozzle should be in (0;100) %!")] + [InlineData(100.0, 90.0, 80.0, "Isentropic efficiency of the nozzle should be in (0;100) %!")] [InlineData( 90.0, 0.0, @@ -62,18 +46,8 @@ double isentropicEfficiency 80.0, "Isentropic efficiency of the suction section should be in (0;100) %!" )] - [InlineData( - 90.0, - 90.0, - 0.0, - "Isentropic efficiency of the diffuser should be in (0;100) %!" - )] - [InlineData( - 90.0, - 90.0, - 100.0, - "Isentropic efficiency of the diffuser should be in (0;100) %!" - )] + [InlineData(90.0, 90.0, 0.0, "Isentropic efficiency of the diffuser should be in (0;100) %!")] + [InlineData(90.0, 90.0, 100.0, "Isentropic efficiency of the diffuser should be in (0;100) %!")] public static void Ejector_WrongEfficiencyAny_ThrowsValidationException( double nozzleIsentropicEfficiency, double suctionIsentropicEfficiency, @@ -87,19 +61,13 @@ string message suctionIsentropicEfficiency.Percent(), diffuserIsentropicEfficiency.Percent() ); - action - .Should() - .Throw() - .WithMessage($"*{message}*"); + action.Should().Throw().WithMessage($"*{message}*"); } [Fact] public void NozzleEfficiency_Always_ReturnsEnteredValueInPercents() { - _sut.NozzleEfficiency.Equals( - _nozzleEfficiency, - _comparison.Tolerance.Percent() - ) + _sut.NozzleEfficiency.Equals(_nozzleEfficiency, _comparison.Tolerance.Percent()) .Should() .BeTrue(); _sut.NozzleEfficiency.Unit.Should().Be(RatioUnit.Percent); @@ -108,10 +76,7 @@ public void NozzleEfficiency_Always_ReturnsEnteredValueInPercents() [Fact] public void SuctionEfficiency_Always_ReturnsEnteredValueInPercents() { - _sut.SuctionEfficiency.Equals( - _suctionEfficiency, - _comparison.Tolerance.Percent() - ) + _sut.SuctionEfficiency.Equals(_suctionEfficiency, _comparison.Tolerance.Percent()) .Should() .BeTrue(); _sut.SuctionEfficiency.Unit.Should().Be(RatioUnit.Percent); @@ -120,10 +85,7 @@ public void SuctionEfficiency_Always_ReturnsEnteredValueInPercents() [Fact] public void DiffuserEfficiency_Always_ReturnsEnteredValueInPercents() { - _sut.DiffuserEfficiency.Equals( - _diffuserEfficiency, - _comparison.Tolerance.Percent() - ) + _sut.DiffuserEfficiency.Equals(_diffuserEfficiency, _comparison.Tolerance.Percent()) .Should() .BeTrue(); _sut.DiffuserEfficiency.Unit.Should().Be(RatioUnit.Percent); diff --git a/tests/VCRC.Tests/Components/EvaporatorTests.cs b/tests/VCRC.Tests/Components/EvaporatorTests.cs index bef9b75..bb4c78b 100644 --- a/tests/VCRC.Tests/Components/EvaporatorTests.cs +++ b/tests/VCRC.Tests/Components/EvaporatorTests.cs @@ -2,7 +2,7 @@ namespace VCRC.Tests; -public class EvaporatorTests : IClassFixture +public sealed class EvaporatorTests : IClassFixture { private readonly ComparisonFixture _comparison; private readonly IRefrigerant _refrigerant; @@ -22,31 +22,21 @@ public EvaporatorTests(ComparisonFixture comparison) [Theory] [InlineData(-74.0)] [InlineData(87.0)] - public void Evaporator_WrongTemperature_ThrowsValidationException( - double temperature - ) + public void Evaporator_WrongTemperature_ThrowsValidationException(double temperature) { CultureInfo.CurrentCulture = new CultureInfo("en-US"); Action action = () => - _ = new Evaporator( - _refrigerant.Name, - temperature.DegreesCelsius(), - _superheat - ); + _ = new Evaporator(_refrigerant.Name, temperature.DegreesCelsius(), _superheat); action .Should() .Throw() - .WithMessage( - "*Evaporating temperature should be in (-73.15;86.2) °C!*" - ); + .WithMessage("*Evaporating temperature should be in (-73.15;86.2) °C!*"); } [Theory] [InlineData(-1.0)] [InlineData(51.0)] - public void Evaporator_WrongSuperheat_ThrowsValidationException( - double superheat - ) + public void Evaporator_WrongSuperheat_ThrowsValidationException(double superheat) { Action action = () => _ = new Evaporator( @@ -57,9 +47,7 @@ double superheat action .Should() .Throw() - .WithMessage( - "*Superheat in the evaporator should be in [0;50] K!*" - ); + .WithMessage("*Superheat in the evaporator should be in [0;50] K!*"); } [Fact] @@ -69,10 +57,7 @@ public void RefrigerantName_Always_ReturnsEnteredName() => [Fact] public void Temperature_Always_ReturnsEnteredValueInCelsius() { - _sut.Temperature.Equals( - _temperature, - _comparison.Tolerance.DegreesCelsius() - ) + _sut.Temperature.Equals(_temperature, _comparison.Tolerance.DegreesCelsius()) .Should() .BeTrue(); _sut.Temperature.Unit.Should().Be(TemperatureUnit.DegreeCelsius); @@ -81,10 +66,7 @@ public void Temperature_Always_ReturnsEnteredValueInCelsius() [Fact] public void Superheat_Always_ReturnsEnteredValueInKelvins() { - _sut.Superheat.Equals( - _superheat, - TemperatureDelta.FromKelvins(_comparison.Tolerance) - ) + _sut.Superheat.Equals(_superheat, TemperatureDelta.FromKelvins(_comparison.Tolerance)) .Should() .BeTrue(); _sut.Superheat.Unit.Should().Be(TemperatureDeltaUnit.Kelvin); @@ -99,7 +81,5 @@ public void Pressure_Always_ReturnsOutletPressureInKilopascals() [Fact] public void Outlet_Always_ReturnsSuperheatedRefrigerant() => - _sut - .Outlet.Should() - .Be(_refrigerant.Superheated(_temperature, _superheat)); + _sut.Outlet.Should().Be(_refrigerant.Superheated(_temperature, _superheat)); } diff --git a/tests/VCRC.Tests/Components/GasCoolerTests.cs b/tests/VCRC.Tests/Components/GasCoolerTests.cs index a8579c7..f9d63fe 100644 --- a/tests/VCRC.Tests/Components/GasCoolerTests.cs +++ b/tests/VCRC.Tests/Components/GasCoolerTests.cs @@ -2,7 +2,7 @@ namespace VCRC.Tests; -public class GasCoolerTests : IClassFixture +public sealed class GasCoolerTests : IClassFixture { private readonly ComparisonFixture _comparison; private readonly Pressure _pressure; @@ -18,11 +18,7 @@ public GasCoolerTests(ComparisonFixture comparison) _temperature = 308.15.Kelvins(); _pressure = 8.Megapascals(); _sut = new GasCooler(_refrigerant.Name, _temperature); - _sutWithSpecifiedPressure = new GasCooler( - _refrigerant.Name, - _temperature, - _pressure - ); + _sutWithSpecifiedPressure = new GasCooler(_refrigerant.Name, _temperature, _pressure); } [Fact] @@ -34,8 +30,7 @@ public void GasCooler_AnyRefrigerantOtherThanR744WithUnspecifiedPressure_ThrowsA .Throw() .WithMessage( "It is impossible to automatically calculate " - + "the absolute pressure in the gas cooler! " - + "It is necessary to define it." + + "the absolute pressure in the gas cooler! It is necessary to define it." ); } @@ -43,30 +38,22 @@ public void GasCooler_AnyRefrigerantOtherThanR744WithUnspecifiedPressure_ThrowsA public void GasCooler_WrongTemperature_ThrowsValidationException() { CultureInfo.CurrentCulture = new CultureInfo("en-US"); - Action action = () => - _ = new GasCooler(_refrigerant.Name, 30.DegreesCelsius()); + Action action = () => _ = new GasCooler(_refrigerant.Name, 30.DegreesCelsius()); action .Should() .Throw() - .WithMessage( - "*Gas cooler outlet temperature " - + "should be greater than 30.98 °C!*" - ); + .WithMessage("*Gas cooler outlet temperature should be greater than 30.98 °C!*"); } [Fact] public void GasCooler_WrongPressure_ThrowsValidationException() { CultureInfo.CurrentCulture = new CultureInfo("en-US"); - Action action = () => - _ = new GasCooler(_refrigerant.Name, _temperature, Pressure.Zero); + Action action = () => _ = new GasCooler(_refrigerant.Name, _temperature, Pressure.Zero); action .Should() .Throw() - .WithMessage( - "*Gas cooler absolute pressure " - + "should be greater than 7.38 MPa!*" - ); + .WithMessage("*Gas cooler absolute pressure should be greater than 7.38 MPa!*"); } [Fact] @@ -76,10 +63,7 @@ public void RefrigerantName_Always_ReturnsEnteredName() => [Fact] public void Temperature_Always_ReturnsEnteredValueInCelsius() { - _sut.Temperature.Equals( - _temperature, - _comparison.Tolerance.DegreesCelsius() - ) + _sut.Temperature.Equals(_temperature, _comparison.Tolerance.DegreesCelsius()) .Should() .BeTrue(); _sut.Temperature.Unit.Should().Be(TemperatureUnit.DegreeCelsius); @@ -104,9 +88,7 @@ public void Pressure_IfSpecified_ReturnsSpecifiedValueInKilopascals() .Pressure.Equals(_pressure, _comparison.Tolerance.Pascals()) .Should() .BeTrue(); - _sutWithSpecifiedPressure - .Pressure.Unit.Should() - .Be(PressureUnit.Kilopascal); + _sutWithSpecifiedPressure.Pressure.Unit.Should().Be(PressureUnit.Kilopascal); } [Fact] diff --git a/tests/VCRC.Tests/Components/RecuperatorTests.cs b/tests/VCRC.Tests/Components/RecuperatorTests.cs index c9d364f..864ea31 100644 --- a/tests/VCRC.Tests/Components/RecuperatorTests.cs +++ b/tests/VCRC.Tests/Components/RecuperatorTests.cs @@ -2,7 +2,7 @@ namespace VCRC.Tests; -public class RecuperatorTests : IClassFixture +public sealed class RecuperatorTests : IClassFixture { private readonly ComparisonFixture _comparison; private readonly IAuxiliaryHeatExchanger _recuperator; @@ -18,17 +18,14 @@ public RecuperatorTests(ComparisonFixture comparison) [Theory] [InlineData(0.0)] [InlineData(50.0)] - public static void Recuperator_WrongSuperheat_ThrowsValidationException( - double superheat - ) + public static void Recuperator_WrongSuperheat_ThrowsValidationException(double superheat) { Action action = () => _ = new Recuperator(superheat.Kelvins()); action .Should() .Throw() .WithMessage( - "*Temperature difference at the recuperator 'hot' side " - + "should be in (0;50) K!*" + "*Temperature difference at the recuperator 'hot' side should be in (0;50) K!*" ); } @@ -36,14 +33,9 @@ double superheat public void TemperatureDifference_Always_ReturnsEnteredValueInKelvins() { _recuperator - .TemperatureDifference.Equals( - _temperatureDifference, - _comparison.Tolerance.Kelvins() - ) + .TemperatureDifference.Equals(_temperatureDifference, _comparison.Tolerance.Kelvins()) .Should() .BeTrue(); - _recuperator - .TemperatureDifference.Unit.Should() - .Be(TemperatureDeltaUnit.Kelvin); + _recuperator.TemperatureDifference.Unit.Should().Be(TemperatureDeltaUnit.Kelvin); } } diff --git a/tests/VCRC.Tests/EntropyAnalysis/EntropyAnalysisExtensionsTests.cs b/tests/VCRC.Tests/EntropyAnalysis/EntropyAnalysisExtensionsTests.cs index f0827c1..d49f551 100644 --- a/tests/VCRC.Tests/EntropyAnalysis/EntropyAnalysisExtensionsTests.cs +++ b/tests/VCRC.Tests/EntropyAnalysis/EntropyAnalysisExtensionsTests.cs @@ -2,7 +2,7 @@ namespace VCRC.Tests; -public class EntropyAnalysisExtensionsTests +public sealed class EntropyAnalysisExtensionsTests { private readonly IList _cycles; private readonly IList _indoor; @@ -11,18 +11,9 @@ public class EntropyAnalysisExtensionsTests public EntropyAnalysisExtensionsTests() { - _indoor = Enumerable - .Range(18, 5) - .Select(i => i.DegreesCelsius()) - .ToList(); - _indoorExtended = Enumerable - .Range(18, 6) - .Select(i => i.DegreesCelsius()) - .ToList(); - _outdoor = Enumerable - .Range(36, 5) - .Select(i => i.DegreesCelsius()) - .ToList(); + _indoor = Enumerable.Range(18, 5).Select(i => i.DegreesCelsius()).ToList(); + _indoorExtended = Enumerable.Range(18, 6).Select(i => i.DegreesCelsius()).ToList(); + _outdoor = Enumerable.Range(36, 5).Select(i => i.DegreesCelsius()).ToList(); _cycles = Enumerable .Range(0, _indoor.Count) .Select(i => CreateVCRC(_indoor[i], _outdoor[i])) @@ -32,8 +23,7 @@ public EntropyAnalysisExtensionsTests() [Fact] public void EntropyAnalysisInRange_ListsOfTemperaturesWithDifferentCount_ThrowsArgumentException() { - Action action = () => - _cycles.EntropyAnalysis(_indoorExtended, _outdoor); + Action action = () => _cycles.EntropyAnalysis(_indoorExtended, _outdoor); action .Should() .Throw() @@ -47,18 +37,12 @@ public void EntropyAnalysisInRange_Always_ReturnsAveragedEntropyAnalysisResult() .Should() .Be( _cycles - .Select( - (cycle, i) => - cycle.EntropyAnalysis(_indoor[i], _outdoor[i]) - ) + .Select((cycle, i) => cycle.EntropyAnalysis(_indoor[i], _outdoor[i])) .ToList() .Average() ); - private static IEntropyAnalysable CreateVCRC( - Temperature indoor, - Temperature outdoor - ) + private static IEntropyAnalysable CreateVCRC(Temperature indoor, Temperature outdoor) { const FluidsList refrigerantName = FluidsList.R32; var evaporator = new Evaporator( diff --git a/tests/VCRC.Tests/Fixtures/VCRCFixture.cs b/tests/VCRC.Tests/Fixtures/VCRCFixture.cs index 723c57b..a6305dc 100644 --- a/tests/VCRC.Tests/Fixtures/VCRCFixture.cs +++ b/tests/VCRC.Tests/Fixtures/VCRCFixture.cs @@ -25,10 +25,7 @@ protected VCRCFixture(FluidsList refrigerantName) } public abstract T Instance { get; } - - public IEntropyAnalysisResult AnalysisResult { get; protected set; } = - default!; - + public IEntropyAnalysisResult AnalysisResult { get; protected set; } = default!; public IRefrigerant Refrigerant { get; } public IEvaporator Evaporator { get; } public IAuxiliaryHeatExchanger Recuperator { get; } @@ -41,111 +38,104 @@ protected T CreateVCRC(IHeatReleaser heatReleaser) => ( typeof(T) switch { - var type when type == typeof(ISimpleVCRC) - => new SimpleVCRC(Evaporator, Compressor, heatReleaser) - as T, - var type when type == typeof(IVCRCWithRecuperator) - => new VCRCWithRecuperator( - Evaporator, - Recuperator, - Compressor, - heatReleaser - ) as T, - var type when type == typeof(IVCRCWithIIC) - => new VCRCWithIIC(Evaporator, Compressor, heatReleaser) + var type when type == typeof(ISimpleVCRC) => new SimpleVCRC( + Evaporator, + Compressor, + heatReleaser + ) as T, + var type when type == typeof(IVCRCWithRecuperator) => new VCRCWithRecuperator( + Evaporator, + Recuperator, + Compressor, + heatReleaser + ) as T, + var type when type == typeof(IVCRCWithIIC) => new VCRCWithIIC( + Evaporator, + Compressor, + heatReleaser + ) as T, + var type when type == typeof(IVCRCWithCIC) => new VCRCWithCIC( + Evaporator, + Compressor, + heatReleaser + ) as T, + var type when type == typeof(IVCRCWithPC) => new VCRCWithPC( + Evaporator, + Compressor, + heatReleaser + ) as T, + var type when type == typeof(IVCRCWithEconomizer) => new VCRCWithEconomizer( + Evaporator, + Compressor, + heatReleaser, + Economizer + ) as T, + var type when type == typeof(IVCRCWithEconomizerAndPC) => + new VCRCWithEconomizerAndPC(Evaporator, Compressor, heatReleaser, Economizer) as T, - var type when type == typeof(IVCRCWithCIC) - => new VCRCWithCIC(Evaporator, Compressor, heatReleaser) + var type when type == typeof(IVCRCWithEconomizerAndTPI) => + new VCRCWithEconomizerAndTPI(Evaporator, Compressor, heatReleaser, Economizer) as T, - var type when type == typeof(IVCRCWithPC) - => new VCRCWithPC(Evaporator, Compressor, heatReleaser) - as T, - var type when type == typeof(IVCRCWithEconomizer) - => new VCRCWithEconomizer( - Evaporator, - Compressor, - heatReleaser, - Economizer - ) as T, - var type when type == typeof(IVCRCWithEconomizerAndPC) - => new VCRCWithEconomizerAndPC( - Evaporator, - Compressor, - heatReleaser, - Economizer - ) as T, - var type when type == typeof(IVCRCWithEconomizerAndTPI) - => new VCRCWithEconomizerAndTPI( - Evaporator, - Compressor, - heatReleaser, - Economizer - ) as T, - var type when type == typeof(IVCRCWithEjector) - => new VCRCWithEjector( - Evaporator, - Compressor, - heatReleaser, - Ejector - ) as T, - var type when type == typeof(IVCRCWithEjectorAndEconomizer) - => new VCRCWithEjectorAndEconomizer( + var type when type == typeof(IVCRCWithEjector) => new VCRCWithEjector( + Evaporator, + Compressor, + heatReleaser, + Ejector + ) as T, + var type when type == typeof(IVCRCWithEjectorAndEconomizer) => + new VCRCWithEjectorAndEconomizer( Evaporator, Compressor, heatReleaser, Ejector, Economizer ) as T, - var type when type == typeof(IVCRCWithEjectorEconomizerAndPC) - => new VCRCWithEjectorEconomizerAndPC( + var type when type == typeof(IVCRCWithEjectorEconomizerAndPC) => + new VCRCWithEjectorEconomizerAndPC( Evaporator, Compressor, heatReleaser, Ejector, Economizer ) as T, - var type when type == typeof(IVCRCWithEjectorEconomizerAndTPI) - => new VCRCWithEjectorEconomizerAndTPI( + var type when type == typeof(IVCRCWithEjectorEconomizerAndTPI) => + new VCRCWithEjectorEconomizerAndTPI( Evaporator, Compressor, heatReleaser, Ejector, Economizer ) as T, - _ - => new VCRCMitsubishiZubadan( - Evaporator, - Compressor, - (Condenser)heatReleaser, - Economizer - ) as T + _ => new VCRCMitsubishiZubadan( + Evaporator, + Compressor, + (Condenser)heatReleaser, + Economizer + ) as T, } )!; protected IEjectorFlows CalculateEjectorFlowsIfNecessary() => typeof(T) switch { - var type when type == typeof(IVCRCWithEjector) - => Ejector.CalculateFlows( - (Instance as IVCRCWithEjector)!.Point3, - (Instance as IVCRCWithEjector)!.Point9 - ), - var type when type == typeof(IVCRCWithEjectorAndEconomizer) - => Ejector.CalculateFlows( - (Instance as IVCRCWithEjectorAndEconomizer)!.Point8, - (Instance as IVCRCWithEjectorAndEconomizer)!.Point14 - ), - var type when type == typeof(IVCRCWithEjectorEconomizerAndPC) - => Ejector.CalculateFlows( - (Instance as IVCRCWithEjectorEconomizerAndPC)!.Point8, - (Instance as IVCRCWithEjectorEconomizerAndPC)!.Point14 - ), - var type when type == typeof(IVCRCWithEjectorEconomizerAndTPI) - => Ejector.CalculateFlows( + var type when type == typeof(IVCRCWithEjector) => Ejector.CalculateFlows( + (Instance as IVCRCWithEjector)!.Point3, + (Instance as IVCRCWithEjector)!.Point9 + ), + var type when type == typeof(IVCRCWithEjectorAndEconomizer) => Ejector.CalculateFlows( + (Instance as IVCRCWithEjectorAndEconomizer)!.Point8, + (Instance as IVCRCWithEjectorAndEconomizer)!.Point14 + ), + var type when type == typeof(IVCRCWithEjectorEconomizerAndPC) => Ejector.CalculateFlows( + (Instance as IVCRCWithEjectorEconomizerAndPC)!.Point8, + (Instance as IVCRCWithEjectorEconomizerAndPC)!.Point14 + ), + var type when type == typeof(IVCRCWithEjectorEconomizerAndTPI) => + Ejector.CalculateFlows( (Instance as IVCRCWithEjectorEconomizerAndTPI)!.Point8, (Instance as IVCRCWithEjectorEconomizerAndTPI)!.Point14 ), - _ => default! + _ => default!, }; protected IEntropyAnalysisResult PerformEntropyAnalysis() => diff --git a/tests/VCRC.Tests/Fluids/RefrigerantTests.cs b/tests/VCRC.Tests/Fluids/RefrigerantTests.cs index d451f2c..672ee0a 100644 --- a/tests/VCRC.Tests/Fluids/RefrigerantTests.cs +++ b/tests/VCRC.Tests/Fluids/RefrigerantTests.cs @@ -2,21 +2,18 @@ namespace VCRC.Tests; -public class RefrigerantTests(ComparisonFixture comparison) +public sealed class RefrigerantTests(ComparisonFixture comparison) : IClassFixture { private readonly SpecificEnergy _enthalpyDelta = 50.KilojoulesPerKilogram(); private readonly Ratio _isentropicEfficiency = 80.Percent(); - private readonly IRefrigerant _sut = new Refrigerant( - FluidsList.R718 - ).WithState( + private readonly IRefrigerant _sut = new Refrigerant(FluidsList.R718).WithState( Input.Pressure(1.Atmospheres()), Input.Temperature(150.DegreesCelsius()) ); - private readonly TemperatureDelta _temperatureDelta = - TemperatureDelta.FromKelvins(10); + private readonly TemperatureDelta _temperatureDelta = TemperatureDelta.FromKelvins(10); private Pressure HighPressure => 2 * _sut.Pressure; private Pressure LowPressure => 0.5 * _sut.Pressure; @@ -29,8 +26,7 @@ public static void Refrigerant_WrongName_ThrowsValidationException() .Should() .Throw() .WithMessage( - "*The selected fluid is not a refrigerant " - + "(its name should start with 'R')!*" + "*The selected fluid is not a refrigerant (its name should start with 'R')!*" ); } @@ -62,29 +58,19 @@ public static void Glide_PureRefrigerants_ReturnsZero(FluidsList name) [Theory] [InlineData(FluidsList.R404A, 0.75017192257570287)] [InlineData(FluidsList.R407C, 6.9953896623448202)] - public void Glide_ZeotropicBlends_ReturnsNotZero( - FluidsList name, - double expected - ) + public void Glide_ZeotropicBlends_ReturnsNotZero(FluidsList name, double expected) { IRefrigerant refrigerant = new Refrigerant(name); - refrigerant - .Glide.Kelvins.Should() - .BeApproximately(expected, comparison.Tolerance); + refrigerant.Glide.Kelvins.Should().BeApproximately(expected, comparison.Tolerance); } [Theory] [InlineData(FluidsList.R507A, 0.0014729570078202414)] [InlineData(FluidsList.R511A, 0.0088663065580476541)] - public void Glide_AzeotropicBlends_ReturnsApproximatelyZero( - FluidsList name, - double expected - ) + public void Glide_AzeotropicBlends_ReturnsApproximatelyZero(FluidsList name, double expected) { IRefrigerant refrigerant = new Refrigerant(name); - refrigerant - .Glide.Kelvins.Should() - .BeApproximately(expected, comparison.Tolerance); + refrigerant.Glide.Kelvins.Should().BeApproximately(expected, comparison.Tolerance); } [Theory] @@ -92,9 +78,7 @@ double expected [InlineData(FluidsList.R134a)] [InlineData(FluidsList.R507A)] [InlineData(FluidsList.R511A)] - public static void HasGlide_PureRefrigerantsAndAzeotropicBlends_ReturnsFalse( - FluidsList name - ) + public static void HasGlide_PureRefrigerantsAndAzeotropicBlends_ReturnsFalse(FluidsList name) { IRefrigerant refrigerant = new Refrigerant(name); refrigerant.HasGlide.Should().BeFalse(); @@ -112,9 +96,7 @@ public static void HasGlide_ZeotropicBlends_ReturnsTrue(FluidsList name) [Theory] [InlineData(FluidsList.R32)] [InlineData(FluidsList.R134a)] - public static void IsSingleComponent_PureRefrigerants_ReturnsTrue( - FluidsList name - ) + public static void IsSingleComponent_PureRefrigerants_ReturnsTrue(FluidsList name) { IRefrigerant refrigerant = new Refrigerant(name); refrigerant.IsSingleComponent.Should().BeTrue(); @@ -125,9 +107,7 @@ FluidsList name [InlineData(FluidsList.R407C)] [InlineData(FluidsList.R507A)] [InlineData(FluidsList.R511A)] - public static void IsSingleComponent_ZeotropicAndAzeotropicBlends_ReturnsFalse( - FluidsList name - ) + public static void IsSingleComponent_ZeotropicAndAzeotropicBlends_ReturnsFalse(FluidsList name) { IRefrigerant refrigerant = new Refrigerant(name); refrigerant.IsSingleComponent.Should().BeFalse(); @@ -136,9 +116,7 @@ FluidsList name [Theory] [InlineData(FluidsList.R507A)] [InlineData(FluidsList.R511A)] - public static void IsAzeotropicBlend_AzeotropicBlends_ReturnsTrue( - FluidsList name - ) + public static void IsAzeotropicBlend_AzeotropicBlends_ReturnsTrue(FluidsList name) { IRefrigerant refrigerant = new Refrigerant(name); refrigerant.IsAzeotropicBlend.Should().BeTrue(); @@ -160,9 +138,7 @@ FluidsList name [Theory] [InlineData(FluidsList.R404A)] [InlineData(FluidsList.R407C)] - public static void IsZeotropicBlend_ZeotropicBlends_ReturnsTrue( - FluidsList name - ) + public static void IsZeotropicBlend_ZeotropicBlends_ReturnsTrue(FluidsList name) { IRefrigerant refrigerant = new Refrigerant(name); refrigerant.IsZeotropicBlend.Should().BeTrue(); @@ -185,14 +161,8 @@ FluidsList name public void Subcooled_TemperatureAndWrongSubcooling_ThrowsArgumentException() { Action action = () => - _ = _sut.Subcooled( - _sut.Temperature, - TemperatureDelta.FromKelvins(-5) - ); - action - .Should() - .Throw() - .WithMessage("Invalid subcooling!"); + _ = _sut.Subcooled(_sut.Temperature, TemperatureDelta.FromKelvins(-5)); + action.Should().Throw().WithMessage("Invalid subcooling!"); } [Fact] @@ -201,31 +171,21 @@ public void Subcooled_TemperatureAndNonZeroSubcooling_ReturnsRefrigerantAtSatPre var bubblePoint = _sut.BubblePointAt(_sut.Temperature); _sut.Subcooled(_sut.Temperature, TemperatureDelta.FromKelvins(3)) .Should() - .Be( - bubblePoint.CoolingTo( - bubblePoint.Temperature - TemperatureDelta.FromKelvins(3) - ) - ); + .Be(bubblePoint.CoolingTo(bubblePoint.Temperature - TemperatureDelta.FromKelvins(3))); } [Fact] public void Subcooled_TemperatureAndZeroSubcooling_ReturnsBubblePointAtTemperature() { var bubblePoint = _sut.BubblePointAt(_sut.Temperature); - _sut.Subcooled(_sut.Temperature, TemperatureDelta.Zero) - .Should() - .Be(bubblePoint); + _sut.Subcooled(_sut.Temperature, TemperatureDelta.Zero).Should().Be(bubblePoint); } [Fact] public void Subcooled_PressureAndWrongSubcooling_ThrowsArgumentException() { - Action action = () => - _ = _sut.Subcooled(_sut.Pressure, TemperatureDelta.FromKelvins(-5)); - action - .Should() - .Throw() - .WithMessage("Invalid subcooling!"); + Action action = () => _ = _sut.Subcooled(_sut.Pressure, TemperatureDelta.FromKelvins(-5)); + action.Should().Throw().WithMessage("Invalid subcooling!"); } [Fact] @@ -234,34 +194,22 @@ public void Subcooled_PressureAndNonZeroSubcooling_ReturnsRefrigerantAtSatPressu var bubblePoint = _sut.BubblePointAt(_sut.Pressure); _sut.Subcooled(_sut.Pressure, TemperatureDelta.FromKelvins(3)) .Should() - .Be( - bubblePoint.CoolingTo( - bubblePoint.Temperature - TemperatureDelta.FromKelvins(3) - ) - ); + .Be(bubblePoint.CoolingTo(bubblePoint.Temperature - TemperatureDelta.FromKelvins(3))); } [Fact] public void Subcooled_PressureAndZeroSubcooling_ReturnsBubblePointAtPressure() { var bubblePoint = _sut.BubblePointAt(_sut.Pressure); - _sut.Subcooled(_sut.Pressure, TemperatureDelta.Zero) - .Should() - .Be(bubblePoint); + _sut.Subcooled(_sut.Pressure, TemperatureDelta.Zero).Should().Be(bubblePoint); } [Fact] public void Superheated_TemperatureAndWrongSuperheat_ThrowsArgumentException() { Action action = () => - _ = _sut.Superheated( - _sut.Temperature, - TemperatureDelta.FromKelvins(-5) - ); - action - .Should() - .Throw() - .WithMessage("Invalid superheat!"); + _ = _sut.Superheated(_sut.Temperature, TemperatureDelta.FromKelvins(-5)); + action.Should().Throw().WithMessage("Invalid superheat!"); } [Fact] @@ -270,34 +218,21 @@ public void Superheated_TemperatureAndNonZeroSuperheat_ReturnsRefrigerantAtSatPr var dewPoint = _sut.DewPointAt(_sut.Temperature); _sut.Superheated(_sut.Temperature, TemperatureDelta.FromKelvins(8)) .Should() - .Be( - dewPoint.HeatingTo( - dewPoint.Temperature + TemperatureDelta.FromKelvins(8) - ) - ); + .Be(dewPoint.HeatingTo(dewPoint.Temperature + TemperatureDelta.FromKelvins(8))); } [Fact] public void Superheated_TemperatureAndZeroSuperheat_ReturnsDewPointAtTemperature() { var dewPoint = _sut.DewPointAt(_sut.Temperature); - _sut.Superheated(_sut.Temperature, TemperatureDelta.Zero) - .Should() - .Be(dewPoint); + _sut.Superheated(_sut.Temperature, TemperatureDelta.Zero).Should().Be(dewPoint); } [Fact] public void Superheated_PressureAndWrongSuperheat_ThrowsArgumentException() { - Action action = () => - _ = _sut.Superheated( - _sut.Pressure, - TemperatureDelta.FromKelvins(-5) - ); - action - .Should() - .Throw() - .WithMessage("Invalid superheat!"); + Action action = () => _ = _sut.Superheated(_sut.Pressure, TemperatureDelta.FromKelvins(-5)); + action.Should().Throw().WithMessage("Invalid superheat!"); } [Fact] @@ -306,20 +241,14 @@ public void Superheated_PressureAndNonZeroSuperheat_ReturnsRefrigerantAtSatPress var dewPoint = _sut.DewPointAt(_sut.Pressure); _sut.Superheated(_sut.Pressure, TemperatureDelta.FromKelvins(8)) .Should() - .Be( - dewPoint.HeatingTo( - dewPoint.Temperature + TemperatureDelta.FromKelvins(8) - ) - ); + .Be(dewPoint.HeatingTo(dewPoint.Temperature + TemperatureDelta.FromKelvins(8))); } [Fact] public void Superheated_PressureAndZeroSuperheat_ReturnsDewPointAtAtPressure() { var dewPoint = _sut.DewPointAt(_sut.Pressure); - _sut.Superheated(_sut.Pressure, TemperatureDelta.Zero) - .Should() - .Be(dewPoint); + _sut.Superheated(_sut.Pressure, TemperatureDelta.Zero).Should().Be(dewPoint); } [Fact] @@ -327,42 +256,20 @@ public void Methods_New_ReturnsInstancesOfTheRefrigerantType() { _sut.Clone().Should().BeOfType(); _sut.Factory().Should().BeOfType(); - _sut.IsentropicCompressionTo(HighPressure) - .Should() - .BeOfType(); - _sut.CompressionTo(HighPressure, _isentropicEfficiency) - .Should() - .BeOfType(); - _sut.IsenthalpicExpansionTo(LowPressure) - .Should() - .BeOfType(); - _sut.IsentropicExpansionTo(LowPressure) - .Should() - .BeOfType(); - _sut.ExpansionTo(LowPressure, _isentropicEfficiency) - .Should() - .BeOfType(); - _sut.CoolingTo(_sut.Temperature - _temperatureDelta) - .Should() - .BeOfType(); - _sut.CoolingTo(_sut.Enthalpy - _enthalpyDelta) - .Should() - .BeOfType(); - _sut.HeatingTo(_sut.Temperature + _temperatureDelta) - .Should() - .BeOfType(); - _sut.HeatingTo(_sut.Enthalpy + _enthalpyDelta) - .Should() - .BeOfType(); + _sut.IsentropicCompressionTo(HighPressure).Should().BeOfType(); + _sut.CompressionTo(HighPressure, _isentropicEfficiency).Should().BeOfType(); + _sut.IsenthalpicExpansionTo(LowPressure).Should().BeOfType(); + _sut.IsentropicExpansionTo(LowPressure).Should().BeOfType(); + _sut.ExpansionTo(LowPressure, _isentropicEfficiency).Should().BeOfType(); + _sut.CoolingTo(_sut.Temperature - _temperatureDelta).Should().BeOfType(); + _sut.CoolingTo(_sut.Enthalpy - _enthalpyDelta).Should().BeOfType(); + _sut.HeatingTo(_sut.Temperature + _temperatureDelta).Should().BeOfType(); + _sut.HeatingTo(_sut.Enthalpy + _enthalpyDelta).Should().BeOfType(); _sut.BubblePointAt(1.Atmospheres()).Should().BeOfType(); - _sut.BubblePointAt(100.DegreesCelsius()) - .Should() - .BeOfType(); + _sut.BubblePointAt(100.DegreesCelsius()).Should().BeOfType(); _sut.DewPointAt(1.Atmospheres()).Should().BeOfType(); _sut.DewPointAt(100.DegreesCelsius()).Should().BeOfType(); - _sut.TwoPhasePointAt(1.Atmospheres(), 50.Percent()) - .Should() - .BeOfType(); + _sut.TwoPhasePointAt(1.Atmospheres(), 50.Percent()).Should().BeOfType(); _sut.Mixing( 100.Percent(), _sut.CoolingTo(_sut.Temperature - _temperatureDelta), diff --git a/tests/VCRC.Tests/GlobalUsings.cs b/tests/VCRC.Tests/GlobalUsings.cs index ac086a1..83d38e5 100644 --- a/tests/VCRC.Tests/GlobalUsings.cs +++ b/tests/VCRC.Tests/GlobalUsings.cs @@ -1,5 +1,4 @@ -global using System.Diagnostics.CodeAnalysis; -global using System.Globalization; +global using System.Globalization; global using FluentAssertions; global using FluentValidation; global using SharpProp; diff --git a/tests/VCRC.Tests/Subcritical/SimpleVCRCSubcriticalTests.cs b/tests/VCRC.Tests/Subcritical/SimpleVCRCSubcriticalTests.cs index 61d7a3d..017a8ed 100644 --- a/tests/VCRC.Tests/Subcritical/SimpleVCRCSubcriticalTests.cs +++ b/tests/VCRC.Tests/Subcritical/SimpleVCRCSubcriticalTests.cs @@ -2,12 +2,10 @@ namespace VCRC.Tests; -public class SimpleVCRCSubcriticalTests( +public sealed class SimpleVCRCSubcriticalTests( ComparisonFixture comparison, SubcriticalVCRCFixture fixture -) - : IClassFixture, - IClassFixture> +) : IClassFixture, IClassFixture> { [Theory] [InlineData(5, 4)] @@ -35,8 +33,7 @@ double condensingTemperature .Should() .Throw() .WithMessage( - "*Condensing temperature " - + "should be greater than evaporating temperature!*" + "*Condensing temperature should be greater than evaporating temperature!*" ); } @@ -64,8 +61,7 @@ public void SimpleVCRC_WrongRefrigerants_ThrowsValidationException() [InlineData( 13, 35, - "Wrong temperature difference in the evaporator! " - + "Increase 'cold' source temperature." + "Wrong temperature difference in the evaporator! Increase 'cold' source temperature." )] [InlineData( 18, @@ -81,10 +77,7 @@ string message { IEntropyAnalysable vcrc = fixture.Instance; Action action = () => - vcrc.EntropyAnalysis( - indoor.DegreesCelsius(), - outdoor.DegreesCelsius() - ); + vcrc.EntropyAnalysis(indoor.DegreesCelsius(), outdoor.DegreesCelsius()); action.Should().Throw().WithMessage($"*{message}*"); } @@ -101,8 +94,7 @@ public void Condenser_ForThisCase_ReturnsEnteredValue() => fixture.Instance.Condenser.Should().Be(fixture.Condenser); [Fact] - public void GasCooler_ForThisCase_ReturnsNull() => - fixture.Instance.GasCooler.Should().BeNull(); + public void GasCooler_ForThisCase_ReturnsNull() => fixture.Instance.GasCooler.Should().BeNull(); [Fact] public void IsTranscritical_ForThisCase_ReturnsFalse() => @@ -116,16 +108,11 @@ public void Point1_Always_ReturnsEvaporatorOutlet() } [Fact] - [SuppressMessage("ReSharper", "InconsistentNaming")] public void Point2s_Always_ReturnsIsentropicCompressionStageDischarge() { fixture .Instance.Point2s.Should() - .Be( - fixture.Instance.Point1.IsentropicCompressionTo( - fixture.Condenser.Pressure - ) - ); + .Be(fixture.Instance.Point1.IsentropicCompressionTo(fixture.Condenser.Pressure)); fixture.Instance.Point2s.Phase.Should().Be(Phases.SupercriticalGas); } @@ -155,11 +142,7 @@ public void Point4_Always_ReturnsEvaporatorInlet() { fixture .Instance.Point4.Should() - .Be( - fixture.Instance.Point3.IsenthalpicExpansionTo( - fixture.Evaporator.Pressure - ) - ); + .Be(fixture.Instance.Point3.IsenthalpicExpansionTo(fixture.Evaporator.Pressure)); fixture.Instance.Point4.Phase.Should().Be(Phases.TwoPhase); } @@ -167,8 +150,7 @@ public void Point4_Always_ReturnsEvaporatorInlet() public void IsentropicSpecificWork_Always_ReturnsEnthalpyDifferenceForIsentropicCompression() => fixture .Instance.IsentropicSpecificWork.Equals( - fixture.Instance.Point2s.Enthalpy - - fixture.Instance.Point1.Enthalpy, + fixture.Instance.Point2s.Enthalpy - fixture.Instance.Point1.Enthalpy, comparison.Tolerance.JoulesPerKilogram() ) .Should() @@ -189,8 +171,7 @@ public void SpecificWork_Always_ReturnsEnthalpyDifferenceForRealCompression() => public void SpecificCoolingCapacity_Always_ReturnsEnthalpyDifferenceInEvaporator() => fixture .Instance.SpecificCoolingCapacity.Equals( - fixture.Instance.Point1.Enthalpy - - fixture.Instance.Point4.Enthalpy, + fixture.Instance.Point1.Enthalpy - fixture.Instance.Point4.Enthalpy, comparison.Tolerance.JoulesPerKilogram() ) .Should() @@ -200,8 +181,7 @@ public void SpecificCoolingCapacity_Always_ReturnsEnthalpyDifferenceInEvaporator public void SpecificHeatingCapacity_Always_ReturnsEnthalpyDifferenceInCondenser() => fixture .Instance.SpecificHeatingCapacity.Equals( - fixture.Instance.Point2.Enthalpy - - fixture.Instance.Point3.Enthalpy, + fixture.Instance.Point2.Enthalpy - fixture.Instance.Point3.Enthalpy, comparison.Tolerance.JoulesPerKilogram() ) .Should() @@ -212,13 +192,8 @@ public void EER_Always_ReturnsRatioBetweenSpecificCoolingCapacityAndSpecificWork { fixture .Instance.EER.Should() - .Be( - fixture.Instance.SpecificCoolingCapacity - / fixture.Instance.SpecificWork - ); - fixture - .Instance.EER.Should() - .BeApproximately(4.326011919496399, comparison.Tolerance); + .Be(fixture.Instance.SpecificCoolingCapacity / fixture.Instance.SpecificWork); + fixture.Instance.EER.Should().BeApproximately(4.326011919496399, comparison.Tolerance); } [Fact] @@ -226,13 +201,8 @@ public void COP_Always_ReturnsRatioBetweenSpecificHeatingCapacityAndSpecificWork { fixture .Instance.COP.Should() - .Be( - fixture.Instance.SpecificHeatingCapacity - / fixture.Instance.SpecificWork - ); - fixture - .Instance.COP.Should() - .BeApproximately(5.326011919496398, comparison.Tolerance); + .Be(fixture.Instance.SpecificHeatingCapacity / fixture.Instance.SpecificWork); + fixture.Instance.COP.Should().BeApproximately(5.326011919496398, comparison.Tolerance); } [Fact] @@ -281,9 +251,7 @@ public void EvaporatorEnergyLossRatio_ForThisCase_ReturnsAbout21() => [Fact] public void RecuperatorEnergyLossRatio_Always_Returns0() => - fixture - .AnalysisResult.RecuperatorEnergyLossRatio.Percent.Should() - .Be(0); + fixture.AnalysisResult.RecuperatorEnergyLossRatio.Percent.Should().Be(0); [Fact] public void EconomizerEnergyLossRatio_Always_Returns0() => @@ -299,9 +267,6 @@ public void AnalysisRelativeError_Always_ReturnsNegligibleValue() fixture .AnalysisResult.AnalysisRelativeError.Percent.Should() .BeApproximately(6.236322468275591e-14, comparison.Tolerance); - fixture - .AnalysisResult.Sum() - .Percent.Should() - .BeApproximately(100, comparison.Tolerance); + fixture.AnalysisResult.Sum().Percent.Should().BeApproximately(100, comparison.Tolerance); } } diff --git a/tests/VCRC.Tests/Subcritical/VCRCMitsubishiZubadanTests.cs b/tests/VCRC.Tests/Subcritical/VCRCMitsubishiZubadanTests.cs index 323977a..cf9d974 100644 --- a/tests/VCRC.Tests/Subcritical/VCRCMitsubishiZubadanTests.cs +++ b/tests/VCRC.Tests/Subcritical/VCRCMitsubishiZubadanTests.cs @@ -2,12 +2,10 @@ namespace VCRC.Tests; -public class VCRCMitsubishiZubadanTests( +public sealed class VCRCMitsubishiZubadanTests( ComparisonFixture comparison, SubcriticalVCRCFixture fixture -) - : IClassFixture, - IClassFixture> +) : IClassFixture, IClassFixture> { [Fact] public void VCRCMitsubishiZubadan_ExtraHighSubcooling_SolutionNotFound() @@ -23,10 +21,7 @@ public void VCRCMitsubishiZubadan_ExtraHighSubcooling_SolutionNotFound() ), fixture.Economizer ); - action - .Should() - .Throw() - .WithMessage("Solution not found!"); + action.Should().Throw().WithMessage("Solution not found!"); } [Fact] @@ -40,8 +35,7 @@ public void Recuperator_Always_CreatesAutomaticallyByTemperatureDifference() sut.Recuperator.Should() .Be( new Recuperator( - fixture.Instance.Point7.Temperature - - fixture.Instance.Point2.Temperature + fixture.Instance.Point7.Temperature - fixture.Instance.Point2.Temperature ) ); } @@ -55,8 +49,7 @@ public void Condenser_Always_ReturnsEnteredValue() => fixture.Instance.Condenser.Should().Be(fixture.Condenser); [Fact] - public void GasCooler_Always_ReturnsNull() => - fixture.Instance.GasCooler.Should().BeNull(); + public void GasCooler_Always_ReturnsNull() => fixture.Instance.GasCooler.Should().BeNull(); [Fact] public void Economizer_Always_ReturnsEnteredValue() @@ -121,17 +114,13 @@ public void Point2_Always_ReturnsRecuperatorColdOutlet() fixture.Instance.Point1.Enthalpy + fixture.Instance.HeatReleaserSpecificMassFlow / fixture.Instance.EvaporatorSpecificMassFlow - * ( - fixture.Instance.Point7.Enthalpy - - fixture.Instance.Point8.Enthalpy - ) + * (fixture.Instance.Point7.Enthalpy - fixture.Instance.Point8.Enthalpy) ) ); fixture.Instance.Point2.Phase.Should().Be(Phases.Gas); } [Fact] - [SuppressMessage("ReSharper", "InconsistentNaming")] public void Point3s_Always_ReturnsFirstIsentropicCompressionStageDischarge() { fixture @@ -163,25 +152,16 @@ public void Point4_Always_ReturnsDewPointAtIntermediatePressure() { fixture .Instance.Point4.Should() - .Be( - fixture.Refrigerant.DewPointAt( - fixture.Instance.IntermediatePressure - ) - ); + .Be(fixture.Refrigerant.DewPointAt(fixture.Instance.IntermediatePressure)); fixture.Instance.Point4.Phase.Should().Be(Phases.TwoPhase); } [Fact] - [SuppressMessage("ReSharper", "InconsistentNaming")] public void Point5s_Always_ReturnsSecondIsentropicCompressionStageDischarge() { fixture .Instance.Point5s.Should() - .Be( - fixture.Instance.Point4.IsentropicCompressionTo( - fixture.Condenser.Pressure - ) - ); + .Be(fixture.Instance.Point4.IsentropicCompressionTo(fixture.Condenser.Pressure)); fixture.Instance.Point5s.Phase.Should().Be(Phases.Gas); } @@ -219,9 +199,7 @@ public void Point7_Always_ReturnsRecuperatorHotInlet() fixture .Instance.RecuperatorHighPressure.Should() .BeGreaterThan(fixture.Instance.IntermediatePressure); - fixture - .Instance.RecuperatorHighPressure.Should() - .BeLessThan(fixture.Condenser.Pressure); + fixture.Instance.RecuperatorHighPressure.Should().BeLessThan(fixture.Condenser.Pressure); fixture.Instance.Point7.Phase.Should().Be(Phases.TwoPhase); } @@ -230,11 +208,7 @@ public void Point8_Always_ReturnsRecuperatorHotOutlet() { fixture .Instance.Point8.Should() - .Be( - fixture.Refrigerant.BubblePointAt( - fixture.Instance.RecuperatorHighPressure - ) - ); + .Be(fixture.Refrigerant.BubblePointAt(fixture.Instance.RecuperatorHighPressure)); fixture.Instance.Point8.Phase.Should().Be(Phases.TwoPhase); } @@ -269,10 +243,7 @@ public void Point10_Always_ReturnsEconomizerColdOutlet() fixture.Instance.HeatReleaserSpecificMassFlow - fixture.Instance.EvaporatorSpecificMassFlow ) - * ( - fixture.Instance.Point3.Enthalpy - - fixture.Instance.Point4.Enthalpy - ), + * (fixture.Instance.Point3.Enthalpy - fixture.Instance.Point4.Enthalpy), 100.JoulesPerKilogram() ) .Should() @@ -287,8 +258,7 @@ public void Point11_Always_ReturnsEconomizerHotOutlet() .Instance.Point11.Should() .Be( fixture.Instance.Point8.CoolingTo( - fixture.Instance.Point9.Temperature - + fixture.Economizer.TemperatureDifference + fixture.Instance.Point9.Temperature + fixture.Economizer.TemperatureDifference ) ); fixture.Instance.Point11.Phase.Should().Be(Phases.Liquid); @@ -299,11 +269,7 @@ public void Point12_Always_ReturnsEvaporatorInlet() { fixture .Instance.Point12.Should() - .Be( - fixture.Instance.Point11.IsenthalpicExpansionTo( - fixture.Evaporator.Pressure - ) - ); + .Be(fixture.Instance.Point11.IsenthalpicExpansionTo(fixture.Evaporator.Pressure)); fixture.Instance.Point12.Phase.Should().Be(Phases.TwoPhase); } @@ -322,14 +288,8 @@ public void SpecificMassFlows_Always_CalculatesAutomaticallyByHeatBalance() fixture.Instance.EvaporatorSpecificMassFlow * ( 1 - + ( - fixture.Instance.Point3.Enthalpy - - fixture.Instance.Point4.Enthalpy - ) - / ( - fixture.Instance.Point4.Enthalpy - - fixture.Instance.Point10.Enthalpy - ) + + (fixture.Instance.Point3.Enthalpy - fixture.Instance.Point4.Enthalpy) + / (fixture.Instance.Point4.Enthalpy - fixture.Instance.Point10.Enthalpy) ), comparison.Tolerance.Percent() ) @@ -351,14 +311,8 @@ public void IsentropicSpecificWork_Always_ReturnsEnthalpyDifferenceForIsentropic .Instance.IsentropicSpecificWork.Equals( fixture.Instance.Point3s.Enthalpy - fixture.Instance.Point2.Enthalpy - + fixture - .Instance - .HeatReleaserSpecificMassFlow - .DecimalFractions - * ( - fixture.Instance.Point5s.Enthalpy - - fixture.Instance.Point4.Enthalpy - ), + + fixture.Instance.HeatReleaserSpecificMassFlow.DecimalFractions + * (fixture.Instance.Point5s.Enthalpy - fixture.Instance.Point4.Enthalpy), comparison.Tolerance.JoulesPerKilogram() ) .Should() @@ -379,8 +333,7 @@ public void SpecificWork_Always_ReturnsEnthalpyDifferenceForRealCompression() => public void SpecificCoolingCapacity_Always_ReturnsEnthalpyDifferenceInEvaporator() => fixture .Instance.SpecificCoolingCapacity.Equals( - fixture.Instance.Point1.Enthalpy - - fixture.Instance.Point12.Enthalpy, + fixture.Instance.Point1.Enthalpy - fixture.Instance.Point12.Enthalpy, comparison.Tolerance.JoulesPerKilogram() ) .Should() @@ -391,10 +344,7 @@ public void SpecificHeatingCapacity_Always_ReturnsEnthalpyDifferenceInCondenser( fixture .Instance.SpecificHeatingCapacity.Equals( fixture.Instance.HeatReleaserSpecificMassFlow.DecimalFractions - * ( - fixture.Instance.Point5.Enthalpy - - fixture.Instance.Point6.Enthalpy - ), + * (fixture.Instance.Point5.Enthalpy - fixture.Instance.Point6.Enthalpy), comparison.Tolerance.JoulesPerKilogram() ) .Should() @@ -405,13 +355,8 @@ public void EER_Always_ReturnsRatioBetweenSpecificCoolingCapacityAndSpecificWork { fixture .Instance.EER.Should() - .Be( - fixture.Instance.SpecificCoolingCapacity - / fixture.Instance.SpecificWork - ); - fixture - .Instance.EER.Should() - .BeApproximately(4.380342435725647, comparison.Tolerance); + .Be(fixture.Instance.SpecificCoolingCapacity / fixture.Instance.SpecificWork); + fixture.Instance.EER.Should().BeApproximately(4.380342435725647, comparison.Tolerance); } [Fact] @@ -419,13 +364,8 @@ public void COP_Always_ReturnsRatioBetweenSpecificHeatingCapacityAndSpecificWork { fixture .Instance.COP.Should() - .Be( - fixture.Instance.SpecificHeatingCapacity - / fixture.Instance.SpecificWork - ); - fixture - .Instance.COP.Should() - .BeApproximately(5.380333104312685, comparison.Tolerance); + .Be(fixture.Instance.SpecificHeatingCapacity / fixture.Instance.SpecificWork); + fixture.Instance.COP.Should().BeApproximately(5.380333104312685, comparison.Tolerance); } [Fact] @@ -496,9 +436,6 @@ public void AnalysisRelativeError_Always_ReturnsNegligibleValue() fixture .AnalysisResult.AnalysisRelativeError.Percent.Should() .BeApproximately(1.208960702370679, comparison.Tolerance); - fixture - .AnalysisResult.Sum() - .Percent.Should() - .BeApproximately(100, comparison.Tolerance); + fixture.AnalysisResult.Sum().Percent.Should().BeApproximately(100, comparison.Tolerance); } } diff --git a/tests/VCRC.Tests/Subcritical/VCRCWithCICSubcriticalTests.cs b/tests/VCRC.Tests/Subcritical/VCRCWithCICSubcriticalTests.cs index 1df14ae..1eed336 100644 --- a/tests/VCRC.Tests/Subcritical/VCRCWithCICSubcriticalTests.cs +++ b/tests/VCRC.Tests/Subcritical/VCRCWithCICSubcriticalTests.cs @@ -1,11 +1,9 @@ namespace VCRC.Tests; -public class VCRCWithCICSubcriticalTests( +public sealed class VCRCWithCICSubcriticalTests( ComparisonFixture comparison, SubcriticalVCRCFixture fixture -) - : IClassFixture, - IClassFixture> +) : IClassFixture, IClassFixture> { [Fact] public void VCRCWithCIC_WrongRefrigerant_ThrowsValidationException() @@ -27,10 +25,7 @@ public void VCRCWithCIC_WrongRefrigerant_ThrowsValidationException() action .Should() .Throw() - .WithMessage( - "*Refrigerant should be " - + "a single component or an azeotropic blend!*" - ); + .WithMessage("*Refrigerant should be a single component or an azeotropic blend!*"); } [Fact] @@ -46,8 +41,7 @@ public void Condenser_ForThisCase_ReturnsEnteredValue() => fixture.Instance.Condenser.Should().Be(fixture.Condenser); [Fact] - public void GasCooler_ForThisCase_ReturnsNull() => - fixture.Instance.GasCooler.Should().BeNull(); + public void GasCooler_ForThisCase_ReturnsNull() => fixture.Instance.GasCooler.Should().BeNull(); [Fact] public void IsTranscritical_ForThisCase_ReturnsFalse() => @@ -61,7 +55,6 @@ public void Point1_Always_ReturnsEvaporatorOutlet() } [Fact] - [SuppressMessage("ReSharper", "InconsistentNaming")] public void Point2s_Always_ReturnsFirstIsentropicCompressionStageDischarge() { fixture @@ -93,25 +86,16 @@ public void Point3_Always_ReturnsSecondCompressionStageSuction() { fixture .Instance.Point3.Should() - .Be( - fixture.Refrigerant.DewPointAt( - fixture.Instance.IntermediatePressure - ) - ); + .Be(fixture.Refrigerant.DewPointAt(fixture.Instance.IntermediatePressure)); fixture.Instance.Point3.Phase.Should().Be(Phases.TwoPhase); } [Fact] - [SuppressMessage("ReSharper", "InconsistentNaming")] public void Point4s_Always_ReturnsSecondIsentropicCompressionStageDischarge() { fixture .Instance.Point4s.Should() - .Be( - fixture.Instance.Point3.IsentropicCompressionTo( - fixture.Condenser.Pressure - ) - ); + .Be(fixture.Instance.Point3.IsentropicCompressionTo(fixture.Condenser.Pressure)); fixture.Instance.Point4s.Phase.Should().Be(Phases.Gas); } @@ -154,11 +138,7 @@ public void Point7_Always_ReturnsSeparatorLiquidOutlet() { fixture .Instance.Point7.Should() - .Be( - fixture.Refrigerant.BubblePointAt( - fixture.Instance.IntermediatePressure - ) - ); + .Be(fixture.Refrigerant.BubblePointAt(fixture.Instance.IntermediatePressure)); fixture.Instance.Point7.Phase.Should().Be(Phases.TwoPhase); } @@ -167,11 +147,7 @@ public void Point8_Always_ReturnsEvaporatorInlet() { fixture .Instance.Point8.Should() - .Be( - fixture.Instance.Point7.IsenthalpicExpansionTo( - fixture.Evaporator.Pressure - ) - ); + .Be(fixture.Instance.Point7.IsenthalpicExpansionTo(fixture.Evaporator.Pressure)); fixture.Instance.Point8.Phase.Should().Be(Phases.TwoPhase); } @@ -190,24 +166,10 @@ public void SpecificMassFlows_Always_CalculatesAutomaticallyByHeatBalance() fixture.Instance.EvaporatorSpecificMassFlow * ( 1 - + ( - fixture.Instance.Point2.Enthalpy - - fixture.Instance.Point3.Enthalpy - ) - / ( - fixture.Instance.Point3.Enthalpy - - fixture.Instance.Point7.Enthalpy - ) + + (fixture.Instance.Point2.Enthalpy - fixture.Instance.Point3.Enthalpy) + / (fixture.Instance.Point3.Enthalpy - fixture.Instance.Point7.Enthalpy) ) - / ( - 1 - - fixture - .Instance - .Point6 - .Quality! - .Value - .DecimalFractions - ), + / (1 - fixture.Instance.Point6.Quality!.Value.DecimalFractions), comparison.Tolerance.Percent() ) .Should() @@ -227,14 +189,8 @@ public void IsentropicSpecificWork_Always_ReturnsEnthalpyDifferenceForIsentropic .Instance.IsentropicSpecificWork.Equals( fixture.Instance.Point2s.Enthalpy - fixture.Instance.Point1.Enthalpy - + fixture - .Instance - .HeatReleaserSpecificMassFlow - .DecimalFractions - * ( - fixture.Instance.Point4s.Enthalpy - - fixture.Instance.Point3.Enthalpy - ), + + fixture.Instance.HeatReleaserSpecificMassFlow.DecimalFractions + * (fixture.Instance.Point4s.Enthalpy - fixture.Instance.Point3.Enthalpy), comparison.Tolerance.JoulesPerKilogram() ) .Should() @@ -255,8 +211,7 @@ public void SpecificWork_Always_ReturnsEnthalpyDifferenceForRealCompression() => public void SpecificCoolingCapacity_Always_ReturnsEnthalpyDifferenceInEvaporator() => fixture .Instance.SpecificCoolingCapacity.Equals( - fixture.Instance.Point1.Enthalpy - - fixture.Instance.Point8.Enthalpy, + fixture.Instance.Point1.Enthalpy - fixture.Instance.Point8.Enthalpy, comparison.Tolerance.JoulesPerKilogram() ) .Should() @@ -267,10 +222,7 @@ public void SpecificHeatingCapacity_Always_ReturnsEnthalpyDifferenceInCondenser( fixture .Instance.SpecificHeatingCapacity.Equals( fixture.Instance.HeatReleaserSpecificMassFlow.DecimalFractions - * ( - fixture.Instance.Point4.Enthalpy - - fixture.Instance.Point5.Enthalpy - ), + * (fixture.Instance.Point4.Enthalpy - fixture.Instance.Point5.Enthalpy), comparison.Tolerance.JoulesPerKilogram() ) .Should() @@ -281,13 +233,8 @@ public void EER_Always_ReturnsRatioBetweenSpecificCoolingCapacityAndSpecificWork { fixture .Instance.EER.Should() - .Be( - fixture.Instance.SpecificCoolingCapacity - / fixture.Instance.SpecificWork - ); - fixture - .Instance.EER.Should() - .BeApproximately(4.70997760850132, comparison.Tolerance); + .Be(fixture.Instance.SpecificCoolingCapacity / fixture.Instance.SpecificWork); + fixture.Instance.EER.Should().BeApproximately(4.70997760850132, comparison.Tolerance); } [Fact] @@ -295,13 +242,8 @@ public void COP_Always_ReturnsRatioBetweenSpecificHeatingCapacityAndSpecificWork { fixture .Instance.COP.Should() - .Be( - fixture.Instance.SpecificHeatingCapacity - / fixture.Instance.SpecificWork - ); - fixture - .Instance.COP.Should() - .BeApproximately(5.709977608501319, comparison.Tolerance); + .Be(fixture.Instance.SpecificHeatingCapacity / fixture.Instance.SpecificWork); + fixture.Instance.COP.Should().BeApproximately(5.709977608501319, comparison.Tolerance); } [Fact] @@ -350,9 +292,7 @@ public void EvaporatorEnergyLossRatio_ForThisCase_ReturnsAbout22() => [Fact] public void RecuperatorEnergyLossRatio_Always_Returns0() => - fixture - .AnalysisResult.RecuperatorEnergyLossRatio.Percent.Should() - .Be(0); + fixture.AnalysisResult.RecuperatorEnergyLossRatio.Percent.Should().Be(0); [Fact] public void EconomizerEnergyLossRatio_Always_Returns0() => @@ -370,9 +310,6 @@ public void AnalysisRelativeError_Always_ReturnsNegligibleValue() fixture .AnalysisResult.AnalysisRelativeError.Percent.Should() .BeApproximately(0.4876971425224632, comparison.Tolerance); - fixture - .AnalysisResult.Sum() - .Percent.Should() - .BeApproximately(100, comparison.Tolerance); + fixture.AnalysisResult.Sum().Percent.Should().BeApproximately(100, comparison.Tolerance); } } diff --git a/tests/VCRC.Tests/Subcritical/VCRCWithEconomizerAndPCSubcriticalTests.cs b/tests/VCRC.Tests/Subcritical/VCRCWithEconomizerAndPCSubcriticalTests.cs index 163f8a3..df2497f 100644 --- a/tests/VCRC.Tests/Subcritical/VCRCWithEconomizerAndPCSubcriticalTests.cs +++ b/tests/VCRC.Tests/Subcritical/VCRCWithEconomizerAndPCSubcriticalTests.cs @@ -1,6 +1,6 @@ namespace VCRC.Tests; -public class VCRCWithEconomizerAndPCSubcriticalTests( +public sealed class VCRCWithEconomizerAndPCSubcriticalTests( ComparisonFixture comparison, SubcriticalVCRCFixture fixture ) @@ -23,9 +23,7 @@ public void VCRCWithEconomizerAndPC_WrongEconomizerSuperheat_ThrowsValidationExc action .Should() .Throw() - .WithMessage( - "*Wrong temperature difference at the economizer 'hot' side!*" - ); + .WithMessage("*Wrong temperature difference at the economizer 'hot' side!*"); } [Fact] @@ -36,18 +34,12 @@ public void VCRCWithEconomizerAndPC_WrongEconomizerTemperatureDifference_ThrowsV fixture.Evaporator, fixture.Compressor, fixture.Condenser, - new Economizer( - TemperatureDelta.FromKelvins(49), - fixture.Economizer.Superheat - ) + new Economizer(TemperatureDelta.FromKelvins(49), fixture.Economizer.Superheat) ); action .Should() .Throw() - .WithMessage( - "*Too high temperature difference " - + "at the economizer 'cold' side!*" - ); + .WithMessage("*Too high temperature difference at the economizer 'cold' side!*"); } [Fact] @@ -63,8 +55,7 @@ public void Condenser_ForThisCase_ReturnsEnteredValue() => fixture.Instance.Condenser.Should().Be(fixture.Condenser); [Fact] - public void GasCooler_ForThisCase_ReturnsNull() => - fixture.Instance.GasCooler.Should().BeNull(); + public void GasCooler_ForThisCase_ReturnsNull() => fixture.Instance.GasCooler.Should().BeNull(); [Fact] public void Economizer_Always_ReturnsEnteredValue() @@ -85,16 +76,11 @@ public void Point1_Always_ReturnsEvaporatorOutlet() } [Fact] - [SuppressMessage("ReSharper", "InconsistentNaming")] public void Point2s_Always_ReturnsFirstIsentropicCompressionStageDischarge() { fixture .Instance.Point2s.Should() - .Be( - fixture.Instance.Point1.IsentropicCompressionTo( - fixture.Condenser.Pressure - ) - ); + .Be(fixture.Instance.Point1.IsentropicCompressionTo(fixture.Condenser.Pressure)); fixture.Instance.Point2s.Phase.Should().Be(Phases.SupercriticalGas); } @@ -127,16 +113,11 @@ public void Point3_Always_ReturnsSecondCompressionStageSuction() } [Fact] - [SuppressMessage("ReSharper", "InconsistentNaming")] public void Point4s_Always_ReturnsSecondIsentropicCompressionStageDischarge() { fixture .Instance.Point4s.Should() - .Be( - fixture.Instance.Point3.IsentropicCompressionTo( - fixture.Condenser.Pressure - ) - ); + .Be(fixture.Instance.Point3.IsentropicCompressionTo(fixture.Condenser.Pressure)); fixture.Instance.Point4s.Phase.Should().Be(Phases.Gas); } @@ -198,8 +179,7 @@ public void Point8_Always_ReturnsEconomizerHotOutlet() .Instance.Point8.Should() .Be( fixture.Instance.Point6.CoolingTo( - fixture.Instance.Point7.Temperature - + fixture.Economizer.TemperatureDifference + fixture.Instance.Point7.Temperature + fixture.Economizer.TemperatureDifference ) ); fixture.Instance.Point8.Phase.Should().Be(Phases.Liquid); @@ -210,11 +190,7 @@ public void Point9_Always_ReturnsEvaporatorInlet() { fixture .Instance.Point9.Should() - .Be( - fixture.Instance.Point8.IsenthalpicExpansionTo( - fixture.Evaporator.Pressure - ) - ); + .Be(fixture.Instance.Point8.IsenthalpicExpansionTo(fixture.Evaporator.Pressure)); fixture.Instance.Point9.Phase.Should().Be(Phases.TwoPhase); } @@ -233,14 +209,8 @@ public void SpecificMassFlows_Always_CalculatesAutomaticallyByHeatBalance() fixture.Instance.EvaporatorSpecificMassFlow * ( 1 - + ( - fixture.Instance.Point6.Enthalpy - - fixture.Instance.Point8.Enthalpy - ) - / ( - fixture.Instance.Point3.Enthalpy - - fixture.Instance.Point7.Enthalpy - ) + + (fixture.Instance.Point6.Enthalpy - fixture.Instance.Point8.Enthalpy) + / (fixture.Instance.Point3.Enthalpy - fixture.Instance.Point7.Enthalpy) ), comparison.Tolerance.Percent() ) @@ -266,10 +236,7 @@ public void IsentropicSpecificWork_Always_ReturnsEnthalpyDifferenceForIsentropic fixture.Instance.HeatReleaserSpecificMassFlow - fixture.Instance.EvaporatorSpecificMassFlow ).DecimalFractions - * ( - fixture.Instance.Point4s.Enthalpy - - fixture.Instance.Point3.Enthalpy - ), + * (fixture.Instance.Point4s.Enthalpy - fixture.Instance.Point3.Enthalpy), comparison.Tolerance.JoulesPerKilogram() ) .Should() @@ -290,8 +257,7 @@ public void SpecificWork_Always_ReturnsEnthalpyDifferenceForRealCompression() => public void SpecificCoolingCapacity_Always_ReturnsEnthalpyDifferenceInEvaporator() => fixture .Instance.SpecificCoolingCapacity.Equals( - fixture.Instance.Point1.Enthalpy - - fixture.Instance.Point9.Enthalpy, + fixture.Instance.Point1.Enthalpy - fixture.Instance.Point9.Enthalpy, comparison.Tolerance.JoulesPerKilogram() ) .Should() @@ -302,10 +268,7 @@ public void SpecificHeatingCapacity_Always_ReturnsEnthalpyDifferenceInCondenser( fixture .Instance.SpecificHeatingCapacity.Equals( fixture.Instance.HeatReleaserSpecificMassFlow.DecimalFractions - * ( - fixture.Instance.Point5.Enthalpy - - fixture.Instance.Point6.Enthalpy - ), + * (fixture.Instance.Point5.Enthalpy - fixture.Instance.Point6.Enthalpy), comparison.Tolerance.JoulesPerKilogram() ) .Should() @@ -316,13 +279,8 @@ public void EER_Always_ReturnsRatioBetweenSpecificCoolingCapacityAndSpecificWork { fixture .Instance.EER.Should() - .Be( - fixture.Instance.SpecificCoolingCapacity - / fixture.Instance.SpecificWork - ); - fixture - .Instance.EER.Should() - .BeApproximately(4.571161584395723, comparison.Tolerance); + .Be(fixture.Instance.SpecificCoolingCapacity / fixture.Instance.SpecificWork); + fixture.Instance.EER.Should().BeApproximately(4.571161584395723, comparison.Tolerance); } [Fact] @@ -330,13 +288,8 @@ public void COP_Always_ReturnsRatioBetweenSpecificHeatingCapacityAndSpecificWork { fixture .Instance.COP.Should() - .Be( - fixture.Instance.SpecificHeatingCapacity - / fixture.Instance.SpecificWork - ); - fixture - .Instance.COP.Should() - .BeApproximately(5.571161584395725, comparison.Tolerance); + .Be(fixture.Instance.SpecificHeatingCapacity / fixture.Instance.SpecificWork); + fixture.Instance.COP.Should().BeApproximately(5.571161584395725, comparison.Tolerance); } [Fact] @@ -385,9 +338,7 @@ public void EvaporatorEnergyLossRatio_ForThisCase_ReturnsAbout22() => [Fact] public void RecuperatorEnergyLossRatio_Always_Returns0() => - fixture - .AnalysisResult.RecuperatorEnergyLossRatio.Percent.Should() - .Be(0); + fixture.AnalysisResult.RecuperatorEnergyLossRatio.Percent.Should().Be(0); [Fact] public void EconomizerEnergyLossRatio_ForThisCase_ReturnsAbout1() => @@ -407,9 +358,6 @@ public void AnalysisRelativeError_Always_ReturnsNegligibleValue() fixture .AnalysisResult.AnalysisRelativeError.Percent.Should() .BeApproximately(0.06974994089376046, comparison.Tolerance); - fixture - .AnalysisResult.Sum() - .Percent.Should() - .BeApproximately(100, comparison.Tolerance); + fixture.AnalysisResult.Sum().Percent.Should().BeApproximately(100, comparison.Tolerance); } } diff --git a/tests/VCRC.Tests/Subcritical/VCRCWithEconomizerAndTPISubcriticalTests.cs b/tests/VCRC.Tests/Subcritical/VCRCWithEconomizerAndTPISubcriticalTests.cs index 2209520..5c09cb1 100644 --- a/tests/VCRC.Tests/Subcritical/VCRCWithEconomizerAndTPISubcriticalTests.cs +++ b/tests/VCRC.Tests/Subcritical/VCRCWithEconomizerAndTPISubcriticalTests.cs @@ -1,6 +1,6 @@ namespace VCRC.Tests; -public class VCRCWithEconomizerAndTPISubcriticalTests( +public sealed class VCRCWithEconomizerAndTPISubcriticalTests( ComparisonFixture comparison, SubcriticalVCRCFixture fixture ) @@ -20,10 +20,7 @@ public void VCRCWithEconomizerAndTPI_WrongEconomizerSuperheat_ThrowsValidationEx action .Should() .Throw() - .WithMessage( - "*Too high temperature difference " - + "at the economizer 'cold' side!*" - ); + .WithMessage("*Too high temperature difference at the economizer 'cold' side!*"); } [Fact] @@ -39,8 +36,7 @@ public void Condenser_ForThisCase_ReturnsEnteredValue() => fixture.Instance.Condenser.Should().Be(fixture.Condenser); [Fact] - public void GasCooler_ForThisCase_ReturnsNull() => - fixture.Instance.GasCooler.Should().BeNull(); + public void GasCooler_ForThisCase_ReturnsNull() => fixture.Instance.GasCooler.Should().BeNull(); [Fact] public void Economizer_Always_ReturnsEnteredValue() @@ -61,7 +57,6 @@ public void Point1_Always_ReturnsEvaporatorOutlet() } [Fact] - [SuppressMessage("ReSharper", "InconsistentNaming")] public void Point2s_Always_ReturnsFirstIsentropicCompressionStageDischarge() { fixture @@ -93,25 +88,16 @@ public void Point3_Always_ReturnsSecondCompressionStageSuction() { fixture .Instance.Point3.Should() - .Be( - fixture.Refrigerant.DewPointAt( - fixture.Instance.IntermediatePressure - ) - ); + .Be(fixture.Refrigerant.DewPointAt(fixture.Instance.IntermediatePressure)); fixture.Instance.Point3.Phase.Should().Be(Phases.TwoPhase); } [Fact] - [SuppressMessage("ReSharper", "InconsistentNaming")] public void Point4s_Always_ReturnsSecondIsentropicCompressionStageDischarge() { fixture .Instance.Point4s.Should() - .Be( - fixture.Instance.Point3.IsentropicCompressionTo( - fixture.Condenser.Pressure - ) - ); + .Be(fixture.Instance.Point3.IsentropicCompressionTo(fixture.Condenser.Pressure)); fixture.Instance.Point4s.Phase.Should().Be(Phases.Gas); } @@ -160,29 +146,13 @@ public void Point7_Always_ReturnsEconomizerColdOutlet() ( fixture.Instance.Point6.Enthalpy.JoulesPerKilogram * ( - fixture - .Instance - .Point2 - .Enthalpy - .JoulesPerKilogram - - fixture - .Instance - .Point3 - .Enthalpy - .JoulesPerKilogram + fixture.Instance.Point2.Enthalpy.JoulesPerKilogram + - fixture.Instance.Point3.Enthalpy.JoulesPerKilogram ) + fixture.Instance.Point3.Enthalpy.JoulesPerKilogram * ( - fixture - .Instance - .Point5 - .Enthalpy - .JoulesPerKilogram - - fixture - .Instance - .Point8 - .Enthalpy - .JoulesPerKilogram + fixture.Instance.Point5.Enthalpy.JoulesPerKilogram + - fixture.Instance.Point8.Enthalpy.JoulesPerKilogram ) ) / ( @@ -204,8 +174,7 @@ public void Point8_Always_ReturnsEconomizerHotOutlet() .Instance.Point8.Should() .Be( fixture.Instance.Point5.CoolingTo( - fixture.Instance.Point6.Temperature - + fixture.Economizer.TemperatureDifference + fixture.Instance.Point6.Temperature + fixture.Economizer.TemperatureDifference ) ); fixture.Instance.Point8.Phase.Should().Be(Phases.Liquid); @@ -216,11 +185,7 @@ public void Point9_Always_ReturnsEvaporatorInlet() { fixture .Instance.Point9.Should() - .Be( - fixture.Instance.Point8.IsenthalpicExpansionTo( - fixture.Evaporator.Pressure - ) - ); + .Be(fixture.Instance.Point8.IsenthalpicExpansionTo(fixture.Evaporator.Pressure)); fixture.Instance.Point9.Phase.Should().Be(Phases.TwoPhase); } @@ -239,14 +204,8 @@ public void SpecificMassFlows_Always_CalculatesAutomaticallyByHeatBalance() fixture.Instance.EvaporatorSpecificMassFlow * ( 1 - + ( - fixture.Instance.Point2.Enthalpy - - fixture.Instance.Point3.Enthalpy - ) - / ( - fixture.Instance.Point3.Enthalpy - - fixture.Instance.Point7.Enthalpy - ) + + (fixture.Instance.Point2.Enthalpy - fixture.Instance.Point3.Enthalpy) + / (fixture.Instance.Point3.Enthalpy - fixture.Instance.Point7.Enthalpy) ), comparison.Tolerance.Percent() ) @@ -268,14 +227,8 @@ public void IsentropicSpecificWork_Always_ReturnsEnthalpyDifferenceForIsentropic .Instance.IsentropicSpecificWork.Equals( fixture.Instance.Point2s.Enthalpy - fixture.Instance.Point1.Enthalpy - + fixture - .Instance - .HeatReleaserSpecificMassFlow - .DecimalFractions - * ( - fixture.Instance.Point4s.Enthalpy - - fixture.Instance.Point3.Enthalpy - ), + + fixture.Instance.HeatReleaserSpecificMassFlow.DecimalFractions + * (fixture.Instance.Point4s.Enthalpy - fixture.Instance.Point3.Enthalpy), comparison.Tolerance.JoulesPerKilogram() ) .Should() @@ -296,8 +249,7 @@ public void SpecificWork_Always_ReturnsEnthalpyDifferenceForRealCompression() => public void SpecificCoolingCapacity_Always_ReturnsEnthalpyDifferenceInEvaporator() => fixture .Instance.SpecificCoolingCapacity.Equals( - fixture.Instance.Point1.Enthalpy - - fixture.Instance.Point9.Enthalpy, + fixture.Instance.Point1.Enthalpy - fixture.Instance.Point9.Enthalpy, comparison.Tolerance.JoulesPerKilogram() ) .Should() @@ -308,10 +260,7 @@ public void SpecificHeatingCapacity_Always_ReturnsEnthalpyDifferenceInCondenser( fixture .Instance.SpecificHeatingCapacity.Equals( fixture.Instance.HeatReleaserSpecificMassFlow.DecimalFractions - * ( - fixture.Instance.Point4.Enthalpy - - fixture.Instance.Point5.Enthalpy - ), + * (fixture.Instance.Point4.Enthalpy - fixture.Instance.Point5.Enthalpy), comparison.Tolerance.JoulesPerKilogram() ) .Should() @@ -322,13 +271,8 @@ public void EER_Always_ReturnsRatioBetweenSpecificCoolingCapacityAndSpecificWork { fixture .Instance.EER.Should() - .Be( - fixture.Instance.SpecificCoolingCapacity - / fixture.Instance.SpecificWork - ); - fixture - .Instance.EER.Should() - .BeApproximately(4.631753388612427, comparison.Tolerance); + .Be(fixture.Instance.SpecificCoolingCapacity / fixture.Instance.SpecificWork); + fixture.Instance.EER.Should().BeApproximately(4.631753388612427, comparison.Tolerance); } [Fact] @@ -336,13 +280,8 @@ public void COP_Always_ReturnsRatioBetweenSpecificHeatingCapacityAndSpecificWork { fixture .Instance.COP.Should() - .Be( - fixture.Instance.SpecificHeatingCapacity - / fixture.Instance.SpecificWork - ); - fixture - .Instance.COP.Should() - .BeApproximately(5.6317533886124265, comparison.Tolerance); + .Be(fixture.Instance.SpecificHeatingCapacity / fixture.Instance.SpecificWork); + fixture.Instance.COP.Should().BeApproximately(5.6317533886124265, comparison.Tolerance); } [Fact] @@ -391,9 +330,7 @@ public void EvaporatorEnergyLossRatio_ForThisCase_ReturnsAbout22() => [Fact] public void RecuperatorEnergyLossRatio_Always_Returns0() => - fixture - .AnalysisResult.RecuperatorEnergyLossRatio.Percent.Should() - .Be(0); + fixture.AnalysisResult.RecuperatorEnergyLossRatio.Percent.Should().Be(0); [Fact] public void EconomizerEnergyLossRatio_ForThisCase_ReturnsAbout1() => @@ -413,9 +350,6 @@ public void AnalysisRelativeError_Always_ReturnsNegligibleValue() fixture .AnalysisResult.AnalysisRelativeError.Percent.Should() .BeApproximately(0.4957145727345726, comparison.Tolerance); - fixture - .AnalysisResult.Sum() - .Percent.Should() - .BeApproximately(100, comparison.Tolerance); + fixture.AnalysisResult.Sum().Percent.Should().BeApproximately(100, comparison.Tolerance); } } diff --git a/tests/VCRC.Tests/Subcritical/VCRCWithEconomizerSubcriticalTests.cs b/tests/VCRC.Tests/Subcritical/VCRCWithEconomizerSubcriticalTests.cs index b12d5bb..052f612 100644 --- a/tests/VCRC.Tests/Subcritical/VCRCWithEconomizerSubcriticalTests.cs +++ b/tests/VCRC.Tests/Subcritical/VCRCWithEconomizerSubcriticalTests.cs @@ -1,11 +1,9 @@ namespace VCRC.Tests; -public class VCRCWithEconomizerSubcriticalTests( +public sealed class VCRCWithEconomizerSubcriticalTests( ComparisonFixture comparison, SubcriticalVCRCFixture fixture -) - : IClassFixture, - IClassFixture> +) : IClassFixture, IClassFixture> { [Fact] public void VCRCWithEconomizer_WrongEconomizerSuperheat_ThrowsValidationException() @@ -23,9 +21,7 @@ public void VCRCWithEconomizer_WrongEconomizerSuperheat_ThrowsValidationExceptio action .Should() .Throw() - .WithMessage( - "*Wrong temperature difference at the economizer 'hot' side!*" - ); + .WithMessage("*Wrong temperature difference at the economizer 'hot' side!*"); } [Fact] @@ -36,18 +32,12 @@ public void VCRCWithEconomizer_WrongEconomizerTemperatureDifference_ThrowsValida fixture.Evaporator, fixture.Compressor, fixture.Condenser, - new Economizer( - TemperatureDelta.FromKelvins(49), - fixture.Economizer.Superheat - ) + new Economizer(TemperatureDelta.FromKelvins(49), fixture.Economizer.Superheat) ); action .Should() .Throw() - .WithMessage( - "*Too high temperature difference " - + "at the economizer 'cold' side!*" - ); + .WithMessage("*Too high temperature difference at the economizer 'cold' side!*"); } [Fact] @@ -63,8 +53,7 @@ public void Condenser_ForThisCase_ReturnsEnteredValue() => fixture.Instance.Condenser.Should().Be(fixture.Condenser); [Fact] - public void GasCooler_ForThisCase_ReturnsNull() => - fixture.Instance.GasCooler.Should().BeNull(); + public void GasCooler_ForThisCase_ReturnsNull() => fixture.Instance.GasCooler.Should().BeNull(); [Fact] public void Economizer_Always_ReturnsEnteredValue() @@ -85,7 +74,6 @@ public void Point1_Always_ReturnsEvaporatorOutlet() } [Fact] - [SuppressMessage("ReSharper", "InconsistentNaming")] public void Point2s_Always_ReturnsFirstIsentropicCompressionStageDischarge() { fixture @@ -130,16 +118,11 @@ public void Point3_Always_ReturnsSecondCompressionStageSuction() } [Fact] - [SuppressMessage("ReSharper", "InconsistentNaming")] public void Point4s_Always_ReturnsSecondIsentropicCompressionStageDischarge() { fixture .Instance.Point4s.Should() - .Be( - fixture.Instance.Point3.IsentropicCompressionTo( - fixture.Condenser.Pressure - ) - ); + .Be(fixture.Instance.Point3.IsentropicCompressionTo(fixture.Condenser.Pressure)); fixture.Instance.Point4s.Phase.Should().Be(Phases.SupercriticalGas); } @@ -198,8 +181,7 @@ public void Point8_Always_ReturnsEconomizerHotOutlet() .Instance.Point8.Should() .Be( fixture.Instance.Point5.CoolingTo( - fixture.Instance.Point6.Temperature - + fixture.Economizer.TemperatureDifference + fixture.Instance.Point6.Temperature + fixture.Economizer.TemperatureDifference ) ); fixture.Instance.Point8.Phase.Should().Be(Phases.Liquid); @@ -210,11 +192,7 @@ public void Point9_Always_ReturnsEvaporatorInlet() { fixture .Instance.Point9.Should() - .Be( - fixture.Instance.Point8.IsenthalpicExpansionTo( - fixture.Evaporator.Pressure - ) - ); + .Be(fixture.Instance.Point8.IsenthalpicExpansionTo(fixture.Evaporator.Pressure)); fixture.Instance.Point9.Phase.Should().Be(Phases.TwoPhase); } @@ -233,14 +211,8 @@ public void SpecificMassFlows_Always_CalculatesAutomaticallyByHeatBalance() fixture.Instance.EvaporatorSpecificMassFlow * ( 1 - + ( - fixture.Instance.Point5.Enthalpy - - fixture.Instance.Point8.Enthalpy - ) - / ( - fixture.Instance.Point7.Enthalpy - - fixture.Instance.Point6.Enthalpy - ) + + (fixture.Instance.Point5.Enthalpy - fixture.Instance.Point8.Enthalpy) + / (fixture.Instance.Point7.Enthalpy - fixture.Instance.Point6.Enthalpy) ), comparison.Tolerance.Percent() ) @@ -262,14 +234,8 @@ public void IsentropicSpecificWork_Always_ReturnsEnthalpyDifferenceForIsentropic .Instance.IsentropicSpecificWork.Equals( fixture.Instance.Point2s.Enthalpy - fixture.Instance.Point1.Enthalpy - + fixture - .Instance - .HeatReleaserSpecificMassFlow - .DecimalFractions - * ( - fixture.Instance.Point4s.Enthalpy - - fixture.Instance.Point3.Enthalpy - ), + + fixture.Instance.HeatReleaserSpecificMassFlow.DecimalFractions + * (fixture.Instance.Point4s.Enthalpy - fixture.Instance.Point3.Enthalpy), comparison.Tolerance.JoulesPerKilogram() ) .Should() @@ -290,8 +256,7 @@ public void SpecificWork_Always_ReturnsEnthalpyDifferenceForRealCompression() => public void SpecificCoolingCapacity_Always_ReturnsEnthalpyDifferenceInEvaporator() => fixture .Instance.SpecificCoolingCapacity.Equals( - fixture.Instance.Point1.Enthalpy - - fixture.Instance.Point9.Enthalpy, + fixture.Instance.Point1.Enthalpy - fixture.Instance.Point9.Enthalpy, comparison.Tolerance.JoulesPerKilogram() ) .Should() @@ -302,10 +267,7 @@ public void SpecificHeatingCapacity_Always_ReturnsEnthalpyDifferenceInCondenser( fixture .Instance.SpecificHeatingCapacity.Equals( fixture.Instance.HeatReleaserSpecificMassFlow.DecimalFractions - * ( - fixture.Instance.Point4.Enthalpy - - fixture.Instance.Point5.Enthalpy - ), + * (fixture.Instance.Point4.Enthalpy - fixture.Instance.Point5.Enthalpy), comparison.Tolerance.JoulesPerKilogram() ) .Should() @@ -316,13 +278,8 @@ public void EER_Always_ReturnsRatioBetweenSpecificCoolingCapacityAndSpecificWork { fixture .Instance.EER.Should() - .Be( - fixture.Instance.SpecificCoolingCapacity - / fixture.Instance.SpecificWork - ); - fixture - .Instance.EER.Should() - .BeApproximately(4.511109316237719, comparison.Tolerance); + .Be(fixture.Instance.SpecificCoolingCapacity / fixture.Instance.SpecificWork); + fixture.Instance.EER.Should().BeApproximately(4.511109316237719, comparison.Tolerance); } [Fact] @@ -330,13 +287,8 @@ public void COP_Always_ReturnsRatioBetweenSpecificHeatingCapacityAndSpecificWork { fixture .Instance.COP.Should() - .Be( - fixture.Instance.SpecificHeatingCapacity - / fixture.Instance.SpecificWork - ); - fixture - .Instance.COP.Should() - .BeApproximately(5.511109316237718, comparison.Tolerance); + .Be(fixture.Instance.SpecificHeatingCapacity / fixture.Instance.SpecificWork); + fixture.Instance.COP.Should().BeApproximately(5.511109316237718, comparison.Tolerance); } [Fact] @@ -385,9 +337,7 @@ public void EvaporatorEnergyLossRatio_ForThisCase_ReturnsAbout21() => [Fact] public void RecuperatorEnergyLossRatio_Always_Returns0() => - fixture - .AnalysisResult.RecuperatorEnergyLossRatio.Percent.Should() - .Be(0); + fixture.AnalysisResult.RecuperatorEnergyLossRatio.Percent.Should().Be(0); [Fact] public void EconomizerEnergyLossRatio_ForThisCase_ReturnsAbout1() => @@ -407,9 +357,6 @@ public void AnalysisRelativeError_Always_ReturnsNegligibleValue() fixture .AnalysisResult.AnalysisRelativeError.Percent.Should() .BeApproximately(0.4828026105094935, comparison.Tolerance); - fixture - .AnalysisResult.Sum() - .Percent.Should() - .BeApproximately(100, comparison.Tolerance); + fixture.AnalysisResult.Sum().Percent.Should().BeApproximately(100, comparison.Tolerance); } } diff --git a/tests/VCRC.Tests/Subcritical/VCRCWithEjectorAndEconomizerSubcriticalTests.cs b/tests/VCRC.Tests/Subcritical/VCRCWithEjectorAndEconomizerSubcriticalTests.cs index 8a681fe..9bfe78f 100644 --- a/tests/VCRC.Tests/Subcritical/VCRCWithEjectorAndEconomizerSubcriticalTests.cs +++ b/tests/VCRC.Tests/Subcritical/VCRCWithEjectorAndEconomizerSubcriticalTests.cs @@ -1,6 +1,6 @@ namespace VCRC.Tests; -public class VCRCWithEjectorAndEconomizerSubcriticalTests( +public sealed class VCRCWithEjectorAndEconomizerSubcriticalTests( ComparisonFixture comparison, SubcriticalVCRCFixture fixture ) @@ -29,10 +29,7 @@ public void VCRCWithEjectorAndEconomizer_WrongRefrigerant_ThrowsValidationExcept action .Should() .Throw() - .WithMessage( - "*Refrigerant should be " - + "a single component or an azeotropic blend!*" - ); + .WithMessage("*Refrigerant should be a single component or an azeotropic blend!*"); } [Fact] @@ -52,9 +49,7 @@ public void VCRCWithEjectorAndEconomizer_WrongEconomizerSuperheat_ThrowsValidati action .Should() .Throw() - .WithMessage( - "*Wrong temperature difference at the economizer 'hot' side!*" - ); + .WithMessage("*Wrong temperature difference at the economizer 'hot' side!*"); } [Fact] @@ -66,18 +61,12 @@ public void VCRCWithEjectorAndEconomizer_WrongEconomizerTemperatureDifference_Th fixture.Compressor, fixture.Condenser, fixture.Ejector, - new Economizer( - TemperatureDelta.FromKelvins(49), - fixture.Economizer.Superheat - ) + new Economizer(TemperatureDelta.FromKelvins(49), fixture.Economizer.Superheat) ); action .Should() .Throw() - .WithMessage( - "*Too high temperature difference " - + "at the economizer 'cold' side!*" - ); + .WithMessage("*Too high temperature difference at the economizer 'cold' side!*"); } [Fact] @@ -93,8 +82,7 @@ public void Condenser_ForThisCase_ReturnsEnteredValue() => fixture.Instance.Condenser.Should().Be(fixture.Condenser); [Fact] - public void GasCooler_ForThisCase_ReturnsNull() => - fixture.Instance.GasCooler.Should().BeNull(); + public void GasCooler_ForThisCase_ReturnsNull() => fixture.Instance.GasCooler.Should().BeNull(); [Fact] public void Ejector_Always_ReturnsEnteredValue() @@ -119,16 +107,11 @@ public void Point1_Always_ReturnsSeparatorVaporOutlet() { fixture .Instance.Point1.Should() - .Be( - fixture.Refrigerant.DewPointAt( - fixture.EjectorFlows.DiffuserOutlet.Pressure - ) - ); + .Be(fixture.Refrigerant.DewPointAt(fixture.EjectorFlows.DiffuserOutlet.Pressure)); fixture.Instance.Point1.Phase.Should().Be(Phases.TwoPhase); } [Fact] - [SuppressMessage("ReSharper", "InconsistentNaming")] public void Point2s_Always_ReturnsFirstIsentropicCompressionStageDischarge() { fixture @@ -173,16 +156,11 @@ public void Point3_Always_ReturnsSecondCompressionStageSuction() } [Fact] - [SuppressMessage("ReSharper", "InconsistentNaming")] public void Point4s_Always_ReturnsSecondIsentropicCompressionStageDischarge() { fixture .Instance.Point4s.Should() - .Be( - fixture.Instance.Point3.IsentropicCompressionTo( - fixture.Condenser.Pressure - ) - ); + .Be(fixture.Instance.Point3.IsentropicCompressionTo(fixture.Condenser.Pressure)); fixture.Instance.Point4s.Phase.Should().Be(Phases.Gas); } @@ -241,8 +219,7 @@ public void Point8_Always_ReturnsEconomizerHotOutlet() .Instance.Point8.Should() .Be( fixture.Instance.Point5.CoolingTo( - fixture.Instance.Point6.Temperature - + fixture.Economizer.TemperatureDifference + fixture.Instance.Point6.Temperature + fixture.Economizer.TemperatureDifference ) ); fixture.Instance.Point8.Phase.Should().Be(Phases.Liquid); @@ -265,9 +242,7 @@ public void Point10_Always_ReturnsEjectorMixingInlet() [Fact] public void Point11_Always_ReturnsEjectorDiffuserOutlet() { - fixture - .Instance.Point11.Should() - .Be(fixture.EjectorFlows.DiffuserOutlet); + fixture.Instance.Point11.Should().Be(fixture.EjectorFlows.DiffuserOutlet); fixture.Instance.Point11.Phase.Should().Be(Phases.TwoPhase); } @@ -276,11 +251,7 @@ public void Point12_Always_ReturnsSeparatorLiquidOutlet() { fixture .Instance.Point12.Should() - .Be( - fixture.Refrigerant.BubblePointAt( - fixture.EjectorFlows.DiffuserOutlet.Pressure - ) - ); + .Be(fixture.Refrigerant.BubblePointAt(fixture.EjectorFlows.DiffuserOutlet.Pressure)); fixture.Instance.Point12.Phase.Should().Be(Phases.TwoPhase); } @@ -289,11 +260,7 @@ public void Point13_Always_ReturnsEvaporatorInlet() { fixture .Instance.Point13.Should() - .Be( - fixture.Instance.Point12.IsenthalpicExpansionTo( - fixture.Evaporator.Pressure - ) - ); + .Be(fixture.Instance.Point12.IsenthalpicExpansionTo(fixture.Evaporator.Pressure)); fixture.Instance.Point13.Phase.Should().Be(Phases.TwoPhase); } @@ -307,9 +274,7 @@ public void Point14_Always_ReturnsEvaporatorOutlet() [Fact] public void Point15_Always_ReturnsEjectorSuctionOutlet() { - fixture - .Instance.Point15.Should() - .Be(fixture.EjectorFlows.SuctionOutlet); + fixture.Instance.Point15.Should().Be(fixture.EjectorFlows.SuctionOutlet); fixture.Instance.Point15.Phase.Should().Be(Phases.Gas); } @@ -340,26 +305,12 @@ public void SpecificMassFlows_Always_CalculatesAutomaticallyByHeatBalance() fixture.Instance.EvaporatorSpecificMassFlow * ( fixture.Instance.Point11.Quality!.Value.DecimalFractions - / ( - 1 - - fixture - .Instance - .Point11 - .Quality! - .Value - .DecimalFractions - ) + / (1 - fixture.Instance.Point11.Quality!.Value.DecimalFractions) ) * ( 1 - + ( - fixture.Instance.Point5.Enthalpy - - fixture.Instance.Point8.Enthalpy - ) - / ( - fixture.Instance.Point7.Enthalpy - - fixture.Instance.Point6.Enthalpy - ) + + (fixture.Instance.Point5.Enthalpy - fixture.Instance.Point8.Enthalpy) + / (fixture.Instance.Point7.Enthalpy - fixture.Instance.Point6.Enthalpy) ), comparison.Tolerance.Percent() ) @@ -370,21 +321,8 @@ public void SpecificMassFlows_Always_CalculatesAutomaticallyByHeatBalance() fixture.Instance.HeatReleaserSpecificMassFlow - fixture.Instance.EvaporatorSpecificMassFlow * ( - fixture - .Instance - .Point11 - .Quality! - .Value - .DecimalFractions - / ( - 1 - - fixture - .Instance - .Point11 - .Quality! - .Value - .DecimalFractions - ) + fixture.Instance.Point11.Quality!.Value.DecimalFractions + / (1 - fixture.Instance.Point11.Quality!.Value.DecimalFractions) ), comparison.Tolerance.Percent() ) @@ -400,18 +338,9 @@ public void IsentropicSpecificWork_Always_ReturnsEnthalpyDifferenceForIsentropic fixture.Instance.HeatReleaserSpecificMassFlow - fixture.Instance.IntermediateSpecificMassFlow ).DecimalFractions - * ( - fixture.Instance.Point2s.Enthalpy - - fixture.Instance.Point1.Enthalpy - ) - + fixture - .Instance - .HeatReleaserSpecificMassFlow - .DecimalFractions - * ( - fixture.Instance.Point4s.Enthalpy - - fixture.Instance.Point3.Enthalpy - ), + * (fixture.Instance.Point2s.Enthalpy - fixture.Instance.Point1.Enthalpy) + + fixture.Instance.HeatReleaserSpecificMassFlow.DecimalFractions + * (fixture.Instance.Point4s.Enthalpy - fixture.Instance.Point3.Enthalpy), comparison.Tolerance.JoulesPerKilogram() ) .Should() @@ -432,8 +361,7 @@ public void SpecificWork_Always_ReturnsEnthalpyDifferenceForRealCompression() => public void SpecificCoolingCapacity_Always_ReturnsEnthalpyDifferenceInEvaporator() => fixture .Instance.SpecificCoolingCapacity.Equals( - fixture.Instance.Point14.Enthalpy - - fixture.Instance.Point13.Enthalpy, + fixture.Instance.Point14.Enthalpy - fixture.Instance.Point13.Enthalpy, comparison.Tolerance.JoulesPerKilogram() ) .Should() @@ -444,10 +372,7 @@ public void SpecificHeatingCapacity_Always_ReturnsEnthalpyDifferenceInCondenser( fixture .Instance.SpecificHeatingCapacity.Equals( fixture.Instance.HeatReleaserSpecificMassFlow.DecimalFractions - * ( - fixture.Instance.Point4.Enthalpy - - fixture.Instance.Point5.Enthalpy - ), + * (fixture.Instance.Point4.Enthalpy - fixture.Instance.Point5.Enthalpy), comparison.Tolerance.JoulesPerKilogram() ) .Should() @@ -458,13 +383,8 @@ public void EER_Always_ReturnsRatioBetweenSpecificCoolingCapacityAndSpecificWork { fixture .Instance.EER.Should() - .Be( - fixture.Instance.SpecificCoolingCapacity - / fixture.Instance.SpecificWork - ); - fixture - .Instance.EER.Should() - .BeApproximately(4.783695679338165, comparison.Tolerance); + .Be(fixture.Instance.SpecificCoolingCapacity / fixture.Instance.SpecificWork); + fixture.Instance.EER.Should().BeApproximately(4.783695679338165, comparison.Tolerance); } [Fact] @@ -472,13 +392,8 @@ public void COP_Always_ReturnsRatioBetweenSpecificHeatingCapacityAndSpecificWork { fixture .Instance.COP.Should() - .Be( - fixture.Instance.SpecificHeatingCapacity - / fixture.Instance.SpecificWork - ); - fixture - .Instance.COP.Should() - .BeApproximately(5.783610594561565, comparison.Tolerance); + .Be(fixture.Instance.SpecificHeatingCapacity / fixture.Instance.SpecificWork); + fixture.Instance.COP.Should().BeApproximately(5.783610594561565, comparison.Tolerance); } [Fact] @@ -529,9 +444,7 @@ public void EvaporatorEnergyLossRatio_ForThisCase_ReturnsAbout23() => [Fact] public void RecuperatorEnergyLossRatio_Always_Returns0() => - fixture - .AnalysisResult.RecuperatorEnergyLossRatio.Percent.Should() - .Be(0); + fixture.AnalysisResult.RecuperatorEnergyLossRatio.Percent.Should().Be(0); [Fact] public void EconomizerEnergyLossRatio_ForThisCase_ReturnsAbout1() => @@ -551,9 +464,6 @@ public void AnalysisRelativeError_Always_ReturnsNegligibleValue() fixture .AnalysisResult.AnalysisRelativeError.Percent.Should() .BeApproximately(0.166409223662599, comparison.Tolerance); - fixture - .AnalysisResult.Sum() - .Percent.Should() - .BeApproximately(100, comparison.Tolerance); + fixture.AnalysisResult.Sum().Percent.Should().BeApproximately(100, comparison.Tolerance); } } diff --git a/tests/VCRC.Tests/Subcritical/VCRCWithEjectorEconomizerAndPCSubcriticalTests.cs b/tests/VCRC.Tests/Subcritical/VCRCWithEjectorEconomizerAndPCSubcriticalTests.cs index 6f25cb7..a3b7b4d 100644 --- a/tests/VCRC.Tests/Subcritical/VCRCWithEjectorEconomizerAndPCSubcriticalTests.cs +++ b/tests/VCRC.Tests/Subcritical/VCRCWithEjectorEconomizerAndPCSubcriticalTests.cs @@ -1,6 +1,6 @@ namespace VCRC.Tests; -public class VCRCWithEjectorEconomizerAndPCSubcriticalTests( +public sealed class VCRCWithEjectorEconomizerAndPCSubcriticalTests( ComparisonFixture comparison, SubcriticalVCRCFixture fixture ) @@ -29,10 +29,7 @@ public void VCRCWithEjectorEconomizerAndPC_WrongRefrigerant_ThrowsValidationExce action .Should() .Throw() - .WithMessage( - "*Refrigerant should be " - + "a single component or an azeotropic blend!*" - ); + .WithMessage("*Refrigerant should be a single component or an azeotropic blend!*"); } [Fact] @@ -52,9 +49,7 @@ public void VCRCWithEjectorEconomizerAndPC_WrongEconomizerSuperheat_ThrowsValida action .Should() .Throw() - .WithMessage( - "*Wrong temperature difference at the economizer 'hot' side!*" - ); + .WithMessage("*Wrong temperature difference at the economizer 'hot' side!*"); } [Fact] @@ -66,18 +61,12 @@ public void VCRCWithEjectorEconomizerAndPC_WrongEconomizerTemperatureDifference_ fixture.Compressor, fixture.Condenser, fixture.Ejector, - new Economizer( - TemperatureDelta.FromKelvins(49), - fixture.Economizer.Superheat - ) + new Economizer(TemperatureDelta.FromKelvins(49), fixture.Economizer.Superheat) ); action .Should() .Throw() - .WithMessage( - "*Too high temperature difference " - + "at the economizer 'cold' side!*" - ); + .WithMessage("*Too high temperature difference at the economizer 'cold' side!*"); } [Fact] @@ -93,8 +82,7 @@ public void Condenser_ForThisCase_ReturnsEnteredValue() => fixture.Instance.Condenser.Should().Be(fixture.Condenser); [Fact] - public void GasCooler_ForThisCase_ReturnsNull() => - fixture.Instance.GasCooler.Should().BeNull(); + public void GasCooler_ForThisCase_ReturnsNull() => fixture.Instance.GasCooler.Should().BeNull(); [Fact] public void Ejector_Always_ReturnsEnteredValue() @@ -119,25 +107,16 @@ public void Point1_Always_ReturnsSeparatorVaporOutlet() { fixture .Instance.Point1.Should() - .Be( - fixture.Refrigerant.DewPointAt( - fixture.EjectorFlows.DiffuserOutlet.Pressure - ) - ); + .Be(fixture.Refrigerant.DewPointAt(fixture.EjectorFlows.DiffuserOutlet.Pressure)); fixture.Instance.Point1.Phase.Should().Be(Phases.TwoPhase); } [Fact] - [SuppressMessage("ReSharper", "InconsistentNaming")] public void Point2s_Always_ReturnsFirstIsentropicCompressionStageDischarge() { fixture .Instance.Point2s.Should() - .Be( - fixture.Instance.Point1.IsentropicCompressionTo( - fixture.Condenser.Pressure - ) - ); + .Be(fixture.Instance.Point1.IsentropicCompressionTo(fixture.Condenser.Pressure)); fixture.Instance.Point2s.Phase.Should().Be(Phases.Gas); } @@ -170,16 +149,11 @@ public void Point3_Always_ReturnsSecondCompressionStageSuction() } [Fact] - [SuppressMessage("ReSharper", "InconsistentNaming")] public void Point4s_Always_ReturnsSecondIsentropicCompressionStageDischarge() { fixture .Instance.Point4s.Should() - .Be( - fixture.Instance.Point3.IsentropicCompressionTo( - fixture.Condenser.Pressure - ) - ); + .Be(fixture.Instance.Point3.IsentropicCompressionTo(fixture.Condenser.Pressure)); fixture.Instance.Point4s.Phase.Should().Be(Phases.Gas); } @@ -241,8 +215,7 @@ public void Point8_Always_ReturnsEconomizerHotOutlet() .Instance.Point8.Should() .Be( fixture.Instance.Point6.CoolingTo( - fixture.Instance.Point7.Temperature - + fixture.Economizer.TemperatureDifference + fixture.Instance.Point7.Temperature + fixture.Economizer.TemperatureDifference ) ); fixture.Instance.Point8.Phase.Should().Be(Phases.Liquid); @@ -265,9 +238,7 @@ public void Point10_Always_ReturnsEjectorMixingInlet() [Fact] public void Point11_Always_ReturnsEjectorDiffuserOutlet() { - fixture - .Instance.Point11.Should() - .Be(fixture.EjectorFlows.DiffuserOutlet); + fixture.Instance.Point11.Should().Be(fixture.EjectorFlows.DiffuserOutlet); fixture.Instance.Point11.Phase.Should().Be(Phases.TwoPhase); } @@ -276,11 +247,7 @@ public void Point12_Always_ReturnsSeparatorLiquidOutlet() { fixture .Instance.Point12.Should() - .Be( - fixture.Refrigerant.BubblePointAt( - fixture.EjectorFlows.DiffuserOutlet.Pressure - ) - ); + .Be(fixture.Refrigerant.BubblePointAt(fixture.EjectorFlows.DiffuserOutlet.Pressure)); fixture.Instance.Point12.Phase.Should().Be(Phases.TwoPhase); } @@ -289,11 +256,7 @@ public void Point13_Always_ReturnsEvaporatorInlet() { fixture .Instance.Point13.Should() - .Be( - fixture.Instance.Point12.IsenthalpicExpansionTo( - fixture.Evaporator.Pressure - ) - ); + .Be(fixture.Instance.Point12.IsenthalpicExpansionTo(fixture.Evaporator.Pressure)); fixture.Instance.Point13.Phase.Should().Be(Phases.TwoPhase); } @@ -307,9 +270,7 @@ public void Point14_Always_ReturnsEvaporatorOutlet() [Fact] public void Point15_Always_ReturnsEjectorSuctionOutlet() { - fixture - .Instance.Point15.Should() - .Be(fixture.EjectorFlows.SuctionOutlet); + fixture.Instance.Point15.Should().Be(fixture.EjectorFlows.SuctionOutlet); fixture.Instance.Point15.Phase.Should().Be(Phases.Gas); } @@ -340,26 +301,12 @@ public void SpecificMassFlows_Always_CalculatesAutomaticallyByHeatBalance() fixture.Instance.EvaporatorSpecificMassFlow * ( fixture.Instance.Point11.Quality!.Value.DecimalFractions - / ( - 1 - - fixture - .Instance - .Point11 - .Quality! - .Value - .DecimalFractions - ) + / (1 - fixture.Instance.Point11.Quality!.Value.DecimalFractions) ) * ( 1 - + ( - fixture.Instance.Point6.Enthalpy - - fixture.Instance.Point8.Enthalpy - ) - / ( - fixture.Instance.Point3.Enthalpy - - fixture.Instance.Point7.Enthalpy - ) + + (fixture.Instance.Point6.Enthalpy - fixture.Instance.Point8.Enthalpy) + / (fixture.Instance.Point3.Enthalpy - fixture.Instance.Point7.Enthalpy) ), comparison.Tolerance.Percent() ) @@ -370,21 +317,8 @@ public void SpecificMassFlows_Always_CalculatesAutomaticallyByHeatBalance() fixture.Instance.HeatReleaserSpecificMassFlow - fixture.Instance.EvaporatorSpecificMassFlow * ( - fixture - .Instance - .Point11 - .Quality! - .Value - .DecimalFractions - / ( - 1 - - fixture - .Instance - .Point11 - .Quality! - .Value - .DecimalFractions - ) + fixture.Instance.Point11.Quality!.Value.DecimalFractions + / (1 - fixture.Instance.Point11.Quality!.Value.DecimalFractions) ), comparison.Tolerance.Percent() ) @@ -400,18 +334,9 @@ public void IsentropicSpecificWork_Always_ReturnsEnthalpyDifferenceForIsentropic fixture.Instance.HeatReleaserSpecificMassFlow - fixture.Instance.IntermediateSpecificMassFlow ).DecimalFractions - * ( - fixture.Instance.Point2s.Enthalpy - - fixture.Instance.Point1.Enthalpy - ) - + fixture - .Instance - .IntermediateSpecificMassFlow - .DecimalFractions - * ( - fixture.Instance.Point4s.Enthalpy - - fixture.Instance.Point3.Enthalpy - ), + * (fixture.Instance.Point2s.Enthalpy - fixture.Instance.Point1.Enthalpy) + + fixture.Instance.IntermediateSpecificMassFlow.DecimalFractions + * (fixture.Instance.Point4s.Enthalpy - fixture.Instance.Point3.Enthalpy), comparison.Tolerance.JoulesPerKilogram() ) .Should() @@ -432,8 +357,7 @@ public void SpecificWork_Always_ReturnsEnthalpyDifferenceForRealCompression() => public void SpecificCoolingCapacity_Always_ReturnsEnthalpyDifferenceInEvaporator() => fixture .Instance.SpecificCoolingCapacity.Equals( - fixture.Instance.Point14.Enthalpy - - fixture.Instance.Point13.Enthalpy, + fixture.Instance.Point14.Enthalpy - fixture.Instance.Point13.Enthalpy, comparison.Tolerance.JoulesPerKilogram() ) .Should() @@ -444,10 +368,7 @@ public void SpecificHeatingCapacity_Always_ReturnsEnthalpyDifferenceInCondenser( fixture .Instance.SpecificHeatingCapacity.Equals( fixture.Instance.HeatReleaserSpecificMassFlow.DecimalFractions - * ( - fixture.Instance.Point5.Enthalpy - - fixture.Instance.Point6.Enthalpy - ), + * (fixture.Instance.Point5.Enthalpy - fixture.Instance.Point6.Enthalpy), comparison.Tolerance.JoulesPerKilogram() ) .Should() @@ -458,13 +379,8 @@ public void EER_Always_ReturnsRatioBetweenSpecificCoolingCapacityAndSpecificWork { fixture .Instance.EER.Should() - .Be( - fixture.Instance.SpecificCoolingCapacity - / fixture.Instance.SpecificWork - ); - fixture - .Instance.EER.Should() - .BeApproximately(4.845602639140372, comparison.Tolerance); + .Be(fixture.Instance.SpecificCoolingCapacity / fixture.Instance.SpecificWork); + fixture.Instance.EER.Should().BeApproximately(4.845602639140372, comparison.Tolerance); } [Fact] @@ -472,13 +388,8 @@ public void COP_Always_ReturnsRatioBetweenSpecificHeatingCapacityAndSpecificWork { fixture .Instance.COP.Should() - .Be( - fixture.Instance.SpecificHeatingCapacity - / fixture.Instance.SpecificWork - ); - fixture - .Instance.COP.Should() - .BeApproximately(5.8455164532611485, comparison.Tolerance); + .Be(fixture.Instance.SpecificHeatingCapacity / fixture.Instance.SpecificWork); + fixture.Instance.COP.Should().BeApproximately(5.8455164532611485, comparison.Tolerance); } [Fact] @@ -529,9 +440,7 @@ public void EvaporatorEnergyLossRatio_ForThisCase_ReturnsAbout23() => [Fact] public void RecuperatorEnergyLossRatio_Always_Returns0() => - fixture - .AnalysisResult.RecuperatorEnergyLossRatio.Percent.Should() - .Be(0); + fixture.AnalysisResult.RecuperatorEnergyLossRatio.Percent.Should().Be(0); [Fact] public void EconomizerEnergyLossRatio_ForThisCase_ReturnsAbout1() => @@ -551,9 +460,6 @@ public void AnalysisRelativeError_Always_ReturnsNegligibleValue() fixture .AnalysisResult.AnalysisRelativeError.Percent.Should() .BeApproximately(0.023527093808216284, comparison.Tolerance); - fixture - .AnalysisResult.Sum() - .Percent.Should() - .BeApproximately(100, comparison.Tolerance); + fixture.AnalysisResult.Sum().Percent.Should().BeApproximately(100, comparison.Tolerance); } } diff --git a/tests/VCRC.Tests/Subcritical/VCRCWithEjectorEconomizerAndTPISubcriticalTests.cs b/tests/VCRC.Tests/Subcritical/VCRCWithEjectorEconomizerAndTPISubcriticalTests.cs index 608eef9..24df1ee 100644 --- a/tests/VCRC.Tests/Subcritical/VCRCWithEjectorEconomizerAndTPISubcriticalTests.cs +++ b/tests/VCRC.Tests/Subcritical/VCRCWithEjectorEconomizerAndTPISubcriticalTests.cs @@ -1,6 +1,6 @@ namespace VCRC.Tests; -public class VCRCWithEjectorEconomizerAndTPISubcriticalTests( +public sealed class VCRCWithEjectorEconomizerAndTPISubcriticalTests( ComparisonFixture comparison, SubcriticalVCRCFixture fixture ) @@ -29,10 +29,7 @@ public void VCRCWithEjectorEconomizerAndTPI_WrongRefrigerant_ThrowsValidationExc action .Should() .Throw() - .WithMessage( - "*Refrigerant should be " - + "a single component or an azeotropic blend!*" - ); + .WithMessage("*Refrigerant should be a single component or an azeotropic blend!*"); } [Fact] @@ -49,10 +46,7 @@ public void VCRCWithEjectorEconomizerAndTPI_WrongEconomizerTemperatureDifference action .Should() .Throw() - .WithMessage( - "*Too high temperature difference " - + "at the economizer 'cold' side!*" - ); + .WithMessage("*Too high temperature difference at the economizer 'cold' side!*"); } [Fact] @@ -68,8 +62,7 @@ public void Condenser_ForThisCase_ReturnsEnteredValue() => fixture.Instance.Condenser.Should().Be(fixture.Condenser); [Fact] - public void GasCooler_ForThisCase_ReturnsNull() => - fixture.Instance.GasCooler.Should().BeNull(); + public void GasCooler_ForThisCase_ReturnsNull() => fixture.Instance.GasCooler.Should().BeNull(); [Fact] public void Ejector_Always_ReturnsEnteredValue() @@ -94,20 +87,14 @@ public void Point1_Always_ReturnsSeparatorVaporOutlet() { fixture .Instance.Point1.Pressure.Pascals.Should() - .BeApproximately( - fixture.EjectorFlows.DiffuserOutlet.Pressure.Pascals, - 50 - ); + .BeApproximately(fixture.EjectorFlows.DiffuserOutlet.Pressure.Pascals, 50); fixture .Instance.Point1.Should() - .Be( - fixture.Refrigerant.DewPointAt(fixture.Instance.Point1.Pressure) - ); + .Be(fixture.Refrigerant.DewPointAt(fixture.Instance.Point1.Pressure)); fixture.Instance.Point1.Phase.Should().Be(Phases.TwoPhase); } [Fact] - [SuppressMessage("ReSharper", "InconsistentNaming")] public void Point2s_Always_ReturnsFirstIsentropicCompressionStageDischarge() { fixture @@ -139,25 +126,16 @@ public void Point3_Always_ReturnsSecondCompressionStageSuction() { fixture .Instance.Point3.Should() - .Be( - fixture.Refrigerant.DewPointAt( - fixture.Instance.IntermediatePressure - ) - ); + .Be(fixture.Refrigerant.DewPointAt(fixture.Instance.IntermediatePressure)); fixture.Instance.Point3.Phase.Should().Be(Phases.TwoPhase); } [Fact] - [SuppressMessage("ReSharper", "InconsistentNaming")] public void Point4s_Always_ReturnsSecondIsentropicCompressionStageDischarge() { fixture .Instance.Point4s.Should() - .Be( - fixture.Instance.Point3.IsentropicCompressionTo( - fixture.Condenser.Pressure - ) - ); + .Be(fixture.Instance.Point3.IsentropicCompressionTo(fixture.Condenser.Pressure)); fixture.Instance.Point4s.Phase.Should().Be(Phases.Gas); } @@ -213,29 +191,13 @@ public void Point7_Always_ReturnsEconomizerColdOutlet() ( fixture.Instance.Point6.Enthalpy.JoulesPerKilogram * ( - fixture - .Instance - .Point2 - .Enthalpy - .JoulesPerKilogram - - fixture - .Instance - .Point3 - .Enthalpy - .JoulesPerKilogram + fixture.Instance.Point2.Enthalpy.JoulesPerKilogram + - fixture.Instance.Point3.Enthalpy.JoulesPerKilogram ) + fixture.Instance.Point3.Enthalpy.JoulesPerKilogram * ( - fixture - .Instance - .Point5 - .Enthalpy - .JoulesPerKilogram - - fixture - .Instance - .Point8 - .Enthalpy - .JoulesPerKilogram + fixture.Instance.Point5.Enthalpy.JoulesPerKilogram + - fixture.Instance.Point8.Enthalpy.JoulesPerKilogram ) ) / ( @@ -257,8 +219,7 @@ public void Point8_Always_ReturnsEconomizerHotOutlet() .Instance.Point8.Should() .Be( fixture.Instance.Point5.CoolingTo( - fixture.Instance.Point6.Temperature - + fixture.Economizer.TemperatureDifference + fixture.Instance.Point6.Temperature + fixture.Economizer.TemperatureDifference ) ); fixture.Instance.Point8.Phase.Should().Be(Phases.Liquid); @@ -281,9 +242,7 @@ public void Point10_Always_ReturnsEjectorMixingInlet() [Fact] public void Point11_Always_ReturnsEjectorDiffuserOutlet() { - fixture - .Instance.Point11.Should() - .Be(fixture.EjectorFlows.DiffuserOutlet); + fixture.Instance.Point11.Should().Be(fixture.EjectorFlows.DiffuserOutlet); fixture.Instance.Point11.Phase.Should().Be(Phases.TwoPhase); } @@ -292,11 +251,7 @@ public void Point12_Always_ReturnsSeparatorLiquidOutlet() { fixture .Instance.Point12.Should() - .Be( - fixture.Refrigerant.BubblePointAt( - fixture.EjectorFlows.DiffuserOutlet.Pressure - ) - ); + .Be(fixture.Refrigerant.BubblePointAt(fixture.EjectorFlows.DiffuserOutlet.Pressure)); fixture.Instance.Point12.Phase.Should().Be(Phases.TwoPhase); } @@ -305,11 +260,7 @@ public void Point13_Always_ReturnsEvaporatorInlet() { fixture .Instance.Point13.Should() - .Be( - fixture.Instance.Point12.IsenthalpicExpansionTo( - fixture.Evaporator.Pressure - ) - ); + .Be(fixture.Instance.Point12.IsenthalpicExpansionTo(fixture.Evaporator.Pressure)); fixture.Instance.Point13.Phase.Should().Be(Phases.TwoPhase); } @@ -323,9 +274,7 @@ public void Point14_Always_ReturnsEvaporatorOutlet() [Fact] public void Point15_Always_ReturnsEjectorSuctionOutlet() { - fixture - .Instance.Point15.Should() - .Be(fixture.EjectorFlows.SuctionOutlet); + fixture.Instance.Point15.Should().Be(fixture.EjectorFlows.SuctionOutlet); fixture.Instance.Point15.Phase.Should().Be(Phases.Gas); } @@ -356,26 +305,12 @@ public void SpecificMassFlows_Always_CalculatesAutomaticallyByHeatBalance() fixture.Instance.EvaporatorSpecificMassFlow * ( fixture.Instance.Point11.Quality!.Value.DecimalFractions - / ( - 1 - - fixture - .Instance - .Point11 - .Quality! - .Value - .DecimalFractions - ) + / (1 - fixture.Instance.Point11.Quality!.Value.DecimalFractions) ) * ( 1 - + ( - fixture.Instance.Point2.Enthalpy - - fixture.Instance.Point3.Enthalpy - ) - / ( - fixture.Instance.Point3.Enthalpy - - fixture.Instance.Point7.Enthalpy - ) + + (fixture.Instance.Point2.Enthalpy - fixture.Instance.Point3.Enthalpy) + / (fixture.Instance.Point3.Enthalpy - fixture.Instance.Point7.Enthalpy) ), comparison.Tolerance.Percent() ) @@ -386,21 +321,8 @@ public void SpecificMassFlows_Always_CalculatesAutomaticallyByHeatBalance() fixture.Instance.HeatReleaserSpecificMassFlow - fixture.Instance.EvaporatorSpecificMassFlow * ( - fixture - .Instance - .Point11 - .Quality! - .Value - .DecimalFractions - / ( - 1 - - fixture - .Instance - .Point11 - .Quality! - .Value - .DecimalFractions - ) + fixture.Instance.Point11.Quality!.Value.DecimalFractions + / (1 - fixture.Instance.Point11.Quality!.Value.DecimalFractions) ), comparison.Tolerance.Percent() ) @@ -416,18 +338,9 @@ public void IsentropicSpecificWork_Always_ReturnsEnthalpyDifferenceForIsentropic fixture.Instance.HeatReleaserSpecificMassFlow - fixture.Instance.IntermediateSpecificMassFlow ).DecimalFractions - * ( - fixture.Instance.Point2s.Enthalpy - - fixture.Instance.Point1.Enthalpy - ) - + fixture - .Instance - .HeatReleaserSpecificMassFlow - .DecimalFractions - * ( - fixture.Instance.Point4s.Enthalpy - - fixture.Instance.Point3.Enthalpy - ), + * (fixture.Instance.Point2s.Enthalpy - fixture.Instance.Point1.Enthalpy) + + fixture.Instance.HeatReleaserSpecificMassFlow.DecimalFractions + * (fixture.Instance.Point4s.Enthalpy - fixture.Instance.Point3.Enthalpy), comparison.Tolerance.JoulesPerKilogram() ) .Should() @@ -448,8 +361,7 @@ public void SpecificWork_Always_ReturnsEnthalpyDifferenceForRealCompression() => public void SpecificCoolingCapacity_Always_ReturnsEnthalpyDifferenceInEvaporator() => fixture .Instance.SpecificCoolingCapacity.Equals( - fixture.Instance.Point14.Enthalpy - - fixture.Instance.Point13.Enthalpy, + fixture.Instance.Point14.Enthalpy - fixture.Instance.Point13.Enthalpy, comparison.Tolerance.JoulesPerKilogram() ) .Should() @@ -460,10 +372,7 @@ public void SpecificHeatingCapacity_Always_ReturnsEnthalpyDifferenceInCondenser( fixture .Instance.SpecificHeatingCapacity.Equals( fixture.Instance.HeatReleaserSpecificMassFlow.DecimalFractions - * ( - fixture.Instance.Point4.Enthalpy - - fixture.Instance.Point5.Enthalpy - ), + * (fixture.Instance.Point4.Enthalpy - fixture.Instance.Point5.Enthalpy), comparison.Tolerance.JoulesPerKilogram() ) .Should() @@ -474,13 +383,8 @@ public void EER_Always_ReturnsRatioBetweenSpecificCoolingCapacityAndSpecificWork { fixture .Instance.EER.Should() - .Be( - fixture.Instance.SpecificCoolingCapacity - / fixture.Instance.SpecificWork - ); - fixture - .Instance.EER.Should() - .BeApproximately(4.877124735439032, comparison.Tolerance); + .Be(fixture.Instance.SpecificCoolingCapacity / fixture.Instance.SpecificWork); + fixture.Instance.EER.Should().BeApproximately(4.877124735439032, comparison.Tolerance); } [Fact] @@ -488,13 +392,8 @@ public void COP_Always_ReturnsRatioBetweenSpecificHeatingCapacityAndSpecificWork { fixture .Instance.COP.Should() - .Be( - fixture.Instance.SpecificHeatingCapacity - / fixture.Instance.SpecificWork - ); - fixture - .Instance.COP.Should() - .BeApproximately(5.877039217058631, comparison.Tolerance); + .Be(fixture.Instance.SpecificHeatingCapacity / fixture.Instance.SpecificWork); + fixture.Instance.COP.Should().BeApproximately(5.877039217058631, comparison.Tolerance); } [Fact] @@ -545,9 +444,7 @@ public void EvaporatorEnergyLossRatio_ForThisCase_ReturnsAbout23() => [Fact] public void RecuperatorEnergyLossRatio_Always_Returns0() => - fixture - .AnalysisResult.RecuperatorEnergyLossRatio.Percent.Should() - .Be(0); + fixture.AnalysisResult.RecuperatorEnergyLossRatio.Percent.Should().Be(0); [Fact] public void EconomizerEnergyLossRatio_ForThisCase_ReturnsAbout1() => @@ -567,9 +464,6 @@ public void AnalysisRelativeError_Always_ReturnsNegligibleValue() fixture .AnalysisResult.AnalysisRelativeError.Percent.Should() .BeApproximately(0.17116247380301927, comparison.Tolerance); - fixture - .AnalysisResult.Sum() - .Percent.Should() - .BeApproximately(100, comparison.Tolerance); + fixture.AnalysisResult.Sum().Percent.Should().BeApproximately(100, comparison.Tolerance); } } diff --git a/tests/VCRC.Tests/Subcritical/VCRCWithEjectorSubcriticalTests.cs b/tests/VCRC.Tests/Subcritical/VCRCWithEjectorSubcriticalTests.cs index 6612927..18b0720 100644 --- a/tests/VCRC.Tests/Subcritical/VCRCWithEjectorSubcriticalTests.cs +++ b/tests/VCRC.Tests/Subcritical/VCRCWithEjectorSubcriticalTests.cs @@ -1,11 +1,9 @@ namespace VCRC.Tests; -public class VCRCWithEjectorSubcriticalTests( +public sealed class VCRCWithEjectorSubcriticalTests( ComparisonFixture comparison, SubcriticalVCRCFixture fixture -) - : IClassFixture, - IClassFixture> +) : IClassFixture, IClassFixture> { [Fact] public void VCRCWithEjector_WrongRefrigerant_ThrowsValidationException() @@ -28,10 +26,7 @@ public void VCRCWithEjector_WrongRefrigerant_ThrowsValidationException() action .Should() .Throw() - .WithMessage( - "*Refrigerant should be " - + "a single component or an azeotropic blend!*" - ); + .WithMessage("*Refrigerant should be a single component or an azeotropic blend!*"); } [Fact] @@ -47,8 +42,7 @@ public void Condenser_ForThisCase_ReturnsEnteredValue() => fixture.Instance.Condenser.Should().Be(fixture.Condenser); [Fact] - public void GasCooler_ForThisCase_ReturnsNull() => - fixture.Instance.GasCooler.Should().BeNull(); + public void GasCooler_ForThisCase_ReturnsNull() => fixture.Instance.GasCooler.Should().BeNull(); [Fact] public void Ejector_Always_ReturnsEnteredValue() @@ -66,25 +60,16 @@ public void Point1_Always_ReturnsSeparatorVaporOutlet() { fixture .Instance.Point1.Should() - .Be( - fixture.Refrigerant.DewPointAt( - fixture.EjectorFlows.DiffuserOutlet.Pressure - ) - ); + .Be(fixture.Refrigerant.DewPointAt(fixture.EjectorFlows.DiffuserOutlet.Pressure)); fixture.Instance.Point1.Phase.Should().Be(Phases.TwoPhase); } [Fact] - [SuppressMessage("ReSharper", "InconsistentNaming")] public void Point2s_Always_ReturnsIsentropicCompressionStageDischarge() { fixture .Instance.Point2s.Should() - .Be( - fixture.Instance.Point1.IsentropicCompressionTo( - fixture.Condenser.Pressure - ) - ); + .Be(fixture.Instance.Point1.IsentropicCompressionTo(fixture.Condenser.Pressure)); fixture.Instance.Point2s.Phase.Should().Be(Phases.Gas); } @@ -126,9 +111,7 @@ public void Point5_Always_ReturnsEjectorMixingInlet() [Fact] public void Point6_Always_ReturnsEjectorDiffuserOutlet() { - fixture - .Instance.Point6.Should() - .Be(fixture.EjectorFlows.DiffuserOutlet); + fixture.Instance.Point6.Should().Be(fixture.EjectorFlows.DiffuserOutlet); fixture.Instance.Point6.Phase.Should().Be(Phases.TwoPhase); } @@ -137,11 +120,7 @@ public void Point7_Always_ReturnsSeparatorLiquidOutlet() { fixture .Instance.Point7.Should() - .Be( - fixture.Refrigerant.BubblePointAt( - fixture.EjectorFlows.DiffuserOutlet.Pressure - ) - ); + .Be(fixture.Refrigerant.BubblePointAt(fixture.EjectorFlows.DiffuserOutlet.Pressure)); fixture.Instance.Point7.Phase.Should().Be(Phases.TwoPhase); } @@ -150,11 +129,7 @@ public void Point8_Always_ReturnsEvaporatorInlet() { fixture .Instance.Point8.Should() - .Be( - fixture.Instance.Point7.IsenthalpicExpansionTo( - fixture.Evaporator.Pressure - ) - ); + .Be(fixture.Instance.Point7.IsenthalpicExpansionTo(fixture.Evaporator.Pressure)); fixture.Instance.Point8.Phase.Should().Be(Phases.TwoPhase); } @@ -168,9 +143,7 @@ public void Point9_Always_ReturnsEvaporatorOutlet() [Fact] public void Point10_Always_ReturnsEjectorSuctionOutlet() { - fixture - .Instance.Point10.Should() - .Be(fixture.EjectorFlows.SuctionOutlet); + fixture.Instance.Point10.Should().Be(fixture.EjectorFlows.SuctionOutlet); fixture.Instance.Point10.Phase.Should().Be(Phases.Gas); } @@ -189,15 +162,7 @@ public void SpecificMassFlows_Always_CalculatesAutomaticallyByHeatBalance() fixture.Instance.EvaporatorSpecificMassFlow * ( fixture.Instance.Point6.Quality!.Value.DecimalFractions - / ( - 1 - - fixture - .Instance - .Point6 - .Quality! - .Value - .DecimalFractions - ) + / (1 - fixture.Instance.Point6.Quality!.Value.DecimalFractions) ), comparison.Tolerance.Percent() ) @@ -210,10 +175,7 @@ public void IsentropicSpecificWork_Always_ReturnsEnthalpyDifferenceForIsentropic fixture .Instance.IsentropicSpecificWork.Equals( fixture.Instance.HeatReleaserSpecificMassFlow.DecimalFractions - * ( - fixture.Instance.Point2s.Enthalpy - - fixture.Instance.Point1.Enthalpy - ), + * (fixture.Instance.Point2s.Enthalpy - fixture.Instance.Point1.Enthalpy), comparison.Tolerance.JoulesPerKilogram() ) .Should() @@ -234,8 +196,7 @@ public void SpecificWork_Always_ReturnsEnthalpyDifferenceForRealCompression() => public void SpecificCoolingCapacity_Always_ReturnsEnthalpyDifferenceInEvaporator() => fixture .Instance.SpecificCoolingCapacity.Equals( - fixture.Instance.Point9.Enthalpy - - fixture.Instance.Point8.Enthalpy, + fixture.Instance.Point9.Enthalpy - fixture.Instance.Point8.Enthalpy, comparison.Tolerance.JoulesPerKilogram() ) .Should() @@ -246,10 +207,7 @@ public void SpecificHeatingCapacity_Always_ReturnsEnthalpyDifferenceInCondenser( fixture .Instance.SpecificHeatingCapacity.Equals( fixture.Instance.HeatReleaserSpecificMassFlow.DecimalFractions - * ( - fixture.Instance.Point2.Enthalpy - - fixture.Instance.Point3.Enthalpy - ), + * (fixture.Instance.Point2.Enthalpy - fixture.Instance.Point3.Enthalpy), comparison.Tolerance.JoulesPerKilogram() ) .Should() @@ -260,13 +218,8 @@ public void EER_Always_ReturnsRatioBetweenSpecificCoolingCapacityAndSpecificWork { fixture .Instance.EER.Should() - .Be( - fixture.Instance.SpecificCoolingCapacity - / fixture.Instance.SpecificWork - ); - fixture - .Instance.EER.Should() - .BeApproximately(4.836643336835533, comparison.Tolerance); + .Be(fixture.Instance.SpecificCoolingCapacity / fixture.Instance.SpecificWork); + fixture.Instance.EER.Should().BeApproximately(4.836643336835533, comparison.Tolerance); } [Fact] @@ -274,13 +227,8 @@ public void COP_Always_ReturnsRatioBetweenSpecificHeatingCapacityAndSpecificWork { fixture .Instance.COP.Should() - .Be( - fixture.Instance.SpecificHeatingCapacity - / fixture.Instance.SpecificWork - ); - fixture - .Instance.COP.Should() - .BeApproximately(5.836563370628909, comparison.Tolerance); + .Be(fixture.Instance.SpecificHeatingCapacity / fixture.Instance.SpecificWork); + fixture.Instance.COP.Should().BeApproximately(5.836563370628909, comparison.Tolerance); } [Fact] @@ -331,9 +279,7 @@ public void EvaporatorEnergyLossRatio_ForThisCase_ReturnsAbout23() => [Fact] public void RecuperatorEnergyLossRatio_Always_Returns0() => - fixture - .AnalysisResult.RecuperatorEnergyLossRatio.Percent.Should() - .Be(0); + fixture.AnalysisResult.RecuperatorEnergyLossRatio.Percent.Should().Be(0); [Fact] public void EconomizerEnergyLossRatio_Always_Returns0() => @@ -349,9 +295,6 @@ public void AnalysisRelativeError_Always_ReturnsNegligibleValue() fixture .AnalysisResult.AnalysisRelativeError.Percent.Should() .BeApproximately(0.009995775827658926, comparison.Tolerance); - fixture - .AnalysisResult.Sum() - .Percent.Should() - .BeApproximately(100, comparison.Tolerance); + fixture.AnalysisResult.Sum().Percent.Should().BeApproximately(100, comparison.Tolerance); } } diff --git a/tests/VCRC.Tests/Subcritical/VCRCWithIICSubcriticalTests.cs b/tests/VCRC.Tests/Subcritical/VCRCWithIICSubcriticalTests.cs index 8a4c28c..828349b 100644 --- a/tests/VCRC.Tests/Subcritical/VCRCWithIICSubcriticalTests.cs +++ b/tests/VCRC.Tests/Subcritical/VCRCWithIICSubcriticalTests.cs @@ -1,11 +1,9 @@ namespace VCRC.Tests; -public class VCRCWithIICSubcriticalTests( +public sealed class VCRCWithIICSubcriticalTests( ComparisonFixture comparison, SubcriticalVCRCFixture fixture -) - : IClassFixture, - IClassFixture> +) : IClassFixture, IClassFixture> { [Fact] public void VCRCWithIIC_WrongRefrigerant_ThrowsValidationException() @@ -27,10 +25,7 @@ public void VCRCWithIIC_WrongRefrigerant_ThrowsValidationException() action .Should() .Throw() - .WithMessage( - "*Refrigerant should be " - + "a single component or an azeotropic blend!*" - ); + .WithMessage("*Refrigerant should be a single component or an azeotropic blend!*"); } [Fact] @@ -46,8 +41,7 @@ public void Condenser_ForThisCase_ReturnsEnteredValue() => fixture.Instance.Condenser.Should().Be(fixture.Condenser); [Fact] - public void GasCooler_ForThisCase_ReturnsNull() => - fixture.Instance.GasCooler.Should().BeNull(); + public void GasCooler_ForThisCase_ReturnsNull() => fixture.Instance.GasCooler.Should().BeNull(); [Fact] public void IsTranscritical_ForThisCase_ReturnsFalse() => @@ -61,7 +55,6 @@ public void Point1_Always_ReturnsEvaporatorOutlet() } [Fact] - [SuppressMessage("ReSharper", "InconsistentNaming")] public void Point2s_Always_ReturnsFirstIsentropicCompressionStageDischarge() { fixture @@ -106,16 +99,11 @@ public void Point3_Always_ReturnsSecondCompressionStageSuction() } [Fact] - [SuppressMessage("ReSharper", "InconsistentNaming")] public void Point4s_Always_ReturnsSecondIsentropicCompressionStageDischarge() { fixture .Instance.Point4s.Should() - .Be( - fixture.Instance.Point3.IsentropicCompressionTo( - fixture.Condenser.Pressure - ) - ); + .Be(fixture.Instance.Point3.IsentropicCompressionTo(fixture.Condenser.Pressure)); fixture.Instance.Point4s.Phase.Should().Be(Phases.SupercriticalGas); } @@ -158,11 +146,7 @@ public void Point7_Always_ReturnsSeparatorVaporOutlet() { fixture .Instance.Point7.Should() - .Be( - fixture.Refrigerant.DewPointAt( - fixture.Instance.IntermediatePressure - ) - ); + .Be(fixture.Refrigerant.DewPointAt(fixture.Instance.IntermediatePressure)); fixture.Instance.Point7.Phase.Should().Be(Phases.TwoPhase); } @@ -171,11 +155,7 @@ public void Point8_Always_ReturnsSeparatorLiquidOutlet() { fixture .Instance.Point8.Should() - .Be( - fixture.Refrigerant.BubblePointAt( - fixture.Instance.IntermediatePressure - ) - ); + .Be(fixture.Refrigerant.BubblePointAt(fixture.Instance.IntermediatePressure)); fixture.Instance.Point8.Phase.Should().Be(Phases.TwoPhase); } @@ -184,11 +164,7 @@ public void Point9_Always_ReturnsEvaporatorInlet() { fixture .Instance.Point9.Should() - .Be( - fixture.Instance.Point8.IsenthalpicExpansionTo( - fixture.Evaporator.Pressure - ) - ); + .Be(fixture.Instance.Point8.IsenthalpicExpansionTo(fixture.Evaporator.Pressure)); fixture.Instance.Point9.Phase.Should().Be(Phases.TwoPhase); } @@ -205,15 +181,7 @@ public void SpecificMassFlows_Always_CalculatesAutomaticallyByHeatBalance() fixture .Instance.HeatReleaserSpecificMassFlow.Equals( fixture.Instance.EvaporatorSpecificMassFlow - / ( - 1 - - fixture - .Instance - .Point6 - .Quality! - .Value - .DecimalFractions - ), + / (1 - fixture.Instance.Point6.Quality!.Value.DecimalFractions), comparison.Tolerance.Percent() ) .Should() @@ -234,14 +202,8 @@ public void IsentropicSpecificWork_Always_ReturnsEnthalpyDifferenceForIsentropic .Instance.IsentropicSpecificWork.Equals( fixture.Instance.Point2s.Enthalpy - fixture.Instance.Point1.Enthalpy - + fixture - .Instance - .HeatReleaserSpecificMassFlow - .DecimalFractions - * ( - fixture.Instance.Point4s.Enthalpy - - fixture.Instance.Point3.Enthalpy - ), + + fixture.Instance.HeatReleaserSpecificMassFlow.DecimalFractions + * (fixture.Instance.Point4s.Enthalpy - fixture.Instance.Point3.Enthalpy), comparison.Tolerance.JoulesPerKilogram() ) .Should() @@ -262,8 +224,7 @@ public void SpecificWork_Always_ReturnsEnthalpyDifferenceForRealCompression() => public void SpecificCoolingCapacity_Always_ReturnsEnthalpyDifferenceInEvaporator() => fixture .Instance.SpecificCoolingCapacity.Equals( - fixture.Instance.Point1.Enthalpy - - fixture.Instance.Point9.Enthalpy, + fixture.Instance.Point1.Enthalpy - fixture.Instance.Point9.Enthalpy, comparison.Tolerance.JoulesPerKilogram() ) .Should() @@ -274,10 +235,7 @@ public void SpecificHeatingCapacity_Always_ReturnsEnthalpyDifferenceInCondenser( fixture .Instance.SpecificHeatingCapacity.Equals( fixture.Instance.HeatReleaserSpecificMassFlow.DecimalFractions - * ( - fixture.Instance.Point4.Enthalpy - - fixture.Instance.Point5.Enthalpy - ), + * (fixture.Instance.Point4.Enthalpy - fixture.Instance.Point5.Enthalpy), comparison.Tolerance.JoulesPerKilogram() ) .Should() @@ -288,13 +246,8 @@ public void EER_Always_ReturnsRatioBetweenSpecificCoolingCapacityAndSpecificWork { fixture .Instance.EER.Should() - .Be( - fixture.Instance.SpecificCoolingCapacity - / fixture.Instance.SpecificWork - ); - fixture - .Instance.EER.Should() - .BeApproximately(4.591346929801504, comparison.Tolerance); + .Be(fixture.Instance.SpecificCoolingCapacity / fixture.Instance.SpecificWork); + fixture.Instance.EER.Should().BeApproximately(4.591346929801504, comparison.Tolerance); } [Fact] @@ -302,13 +255,8 @@ public void COP_Always_ReturnsRatioBetweenSpecificHeatingCapacityAndSpecificWork { fixture .Instance.COP.Should() - .Be( - fixture.Instance.SpecificHeatingCapacity - / fixture.Instance.SpecificWork - ); - fixture - .Instance.COP.Should() - .BeApproximately(5.591346929801503, comparison.Tolerance); + .Be(fixture.Instance.SpecificHeatingCapacity / fixture.Instance.SpecificWork); + fixture.Instance.COP.Should().BeApproximately(5.591346929801503, comparison.Tolerance); } [Fact] @@ -357,9 +305,7 @@ public void EvaporatorEnergyLossRatio_ForThisCase_ReturnsAbout22() => [Fact] public void RecuperatorEnergyLossRatio_Always_Returns0() => - fixture - .AnalysisResult.RecuperatorEnergyLossRatio.Percent.Should() - .Be(0); + fixture.AnalysisResult.RecuperatorEnergyLossRatio.Percent.Should().Be(0); [Fact] public void EconomizerEnergyLossRatio_Always_Returns0() => @@ -377,9 +323,6 @@ public void AnalysisRelativeError_Always_ReturnsNegligibleValue() fixture .AnalysisResult.AnalysisRelativeError.Percent.Should() .BeApproximately(0.47541346565012926, comparison.Tolerance); - fixture - .AnalysisResult.Sum() - .Percent.Should() - .BeApproximately(100, comparison.Tolerance); + fixture.AnalysisResult.Sum().Percent.Should().BeApproximately(100, comparison.Tolerance); } } diff --git a/tests/VCRC.Tests/Subcritical/VCRCWithPCSubcriticalTests.cs b/tests/VCRC.Tests/Subcritical/VCRCWithPCSubcriticalTests.cs index cb19179..40768d2 100644 --- a/tests/VCRC.Tests/Subcritical/VCRCWithPCSubcriticalTests.cs +++ b/tests/VCRC.Tests/Subcritical/VCRCWithPCSubcriticalTests.cs @@ -1,11 +1,9 @@ namespace VCRC.Tests; -public class VCRCWithPCSubcriticalTests( +public sealed class VCRCWithPCSubcriticalTests( ComparisonFixture comparison, SubcriticalVCRCFixture fixture -) - : IClassFixture, - IClassFixture> +) : IClassFixture, IClassFixture> { [Fact] public void VCRCWithPC_WrongRefrigerant_ThrowsValidationException() @@ -27,10 +25,7 @@ public void VCRCWithPC_WrongRefrigerant_ThrowsValidationException() action .Should() .Throw() - .WithMessage( - "*Refrigerant should be " - + "a single component or an azeotropic blend!*" - ); + .WithMessage("*Refrigerant should be a single component or an azeotropic blend!*"); } [Fact] @@ -46,8 +41,7 @@ public void Condenser_ForThisCase_ReturnsEnteredValue() => fixture.Instance.Condenser.Should().Be(fixture.Condenser); [Fact] - public void GasCooler_ForThisCase_ReturnsNull() => - fixture.Instance.GasCooler.Should().BeNull(); + public void GasCooler_ForThisCase_ReturnsNull() => fixture.Instance.GasCooler.Should().BeNull(); [Fact] public void IsTranscritical_ForThisCase_ReturnsFalse() => @@ -61,16 +55,11 @@ public void Point1_Always_ReturnsEvaporatorOutlet() } [Fact] - [SuppressMessage("ReSharper", "InconsistentNaming")] public void Point2s_Always_ReturnsFirstIsentropicCompressionStageDischarge() { fixture .Instance.Point2s.Should() - .Be( - fixture.Instance.Point1.IsentropicCompressionTo( - fixture.Condenser.Pressure - ) - ); + .Be(fixture.Instance.Point1.IsentropicCompressionTo(fixture.Condenser.Pressure)); fixture.Instance.Point2s.Phase.Should().Be(Phases.SupercriticalGas); } @@ -93,25 +82,16 @@ public void Point3_Always_ReturnsSeparatorVaporOutlet() { fixture .Instance.Point3.Should() - .Be( - fixture.Refrigerant.DewPointAt( - fixture.Instance.IntermediatePressure - ) - ); + .Be(fixture.Refrigerant.DewPointAt(fixture.Instance.IntermediatePressure)); fixture.Instance.Point3.Phase.Should().Be(Phases.TwoPhase); } [Fact] - [SuppressMessage("ReSharper", "InconsistentNaming")] public void Point4s_Always_ReturnsSecondIsentropicCompressionStageDischarge() { fixture .Instance.Point4s.Should() - .Be( - fixture.Instance.Point3.IsentropicCompressionTo( - fixture.Condenser.Pressure - ) - ); + .Be(fixture.Instance.Point3.IsentropicCompressionTo(fixture.Condenser.Pressure)); fixture.Instance.Point4s.Phase.Should().Be(Phases.Gas); } @@ -171,11 +151,7 @@ public void Point8_Always_ReturnsSeparatorLiquidOutlet() { fixture .Instance.Point8.Should() - .Be( - fixture.Refrigerant.BubblePointAt( - fixture.Instance.IntermediatePressure - ) - ); + .Be(fixture.Refrigerant.BubblePointAt(fixture.Instance.IntermediatePressure)); fixture.Instance.Point8.Phase.Should().Be(Phases.TwoPhase); } @@ -184,11 +160,7 @@ public void Point9_Always_ReturnsEvaporatorInlet() { fixture .Instance.Point9.Should() - .Be( - fixture.Instance.Point8.IsenthalpicExpansionTo( - fixture.Evaporator.Pressure - ) - ); + .Be(fixture.Instance.Point8.IsenthalpicExpansionTo(fixture.Evaporator.Pressure)); fixture.Instance.Point9.Phase.Should().Be(Phases.TwoPhase); } @@ -207,21 +179,8 @@ public void SpecificMassFlows_Always_CalculatesAutomaticallyByHeatBalance() fixture.Instance.EvaporatorSpecificMassFlow * ( 1 - + fixture - .Instance - .Point7 - .Quality! - .Value - .DecimalFractions - / ( - 1 - - fixture - .Instance - .Point7 - .Quality! - .Value - .DecimalFractions - ) + + fixture.Instance.Point7.Quality!.Value.DecimalFractions + / (1 - fixture.Instance.Point7.Quality!.Value.DecimalFractions) ), comparison.Tolerance.Percent() ) @@ -247,10 +206,7 @@ public void IsentropicSpecificWork_Always_ReturnsEnthalpyDifferenceForIsentropic fixture.Instance.HeatReleaserSpecificMassFlow - fixture.Instance.EvaporatorSpecificMassFlow ).DecimalFractions - * ( - fixture.Instance.Point4s.Enthalpy - - fixture.Instance.Point3.Enthalpy - ), + * (fixture.Instance.Point4s.Enthalpy - fixture.Instance.Point3.Enthalpy), comparison.Tolerance.JoulesPerKilogram() ) .Should() @@ -271,8 +227,7 @@ public void SpecificWork_Always_ReturnsEnthalpyDifferenceForRealCompression() => public void SpecificCoolingCapacity_Always_ReturnsEnthalpyDifferenceInEvaporator() => fixture .Instance.SpecificCoolingCapacity.Equals( - fixture.Instance.Point1.Enthalpy - - fixture.Instance.Point9.Enthalpy, + fixture.Instance.Point1.Enthalpy - fixture.Instance.Point9.Enthalpy, comparison.Tolerance.JoulesPerKilogram() ) .Should() @@ -283,10 +238,7 @@ public void SpecificHeatingCapacity_Always_ReturnsEnthalpyDifferenceInCondenser( fixture .Instance.SpecificHeatingCapacity.Equals( fixture.Instance.HeatReleaserSpecificMassFlow.DecimalFractions - * ( - fixture.Instance.Point5.Enthalpy - - fixture.Instance.Point6.Enthalpy - ), + * (fixture.Instance.Point5.Enthalpy - fixture.Instance.Point6.Enthalpy), comparison.Tolerance.JoulesPerKilogram() ) .Should() @@ -297,13 +249,8 @@ public void EER_Always_ReturnsRatioBetweenSpecificCoolingCapacityAndSpecificWork { fixture .Instance.EER.Should() - .Be( - fixture.Instance.SpecificCoolingCapacity - / fixture.Instance.SpecificWork - ); - fixture - .Instance.EER.Should() - .BeApproximately(4.652194564254316, comparison.Tolerance); + .Be(fixture.Instance.SpecificCoolingCapacity / fixture.Instance.SpecificWork); + fixture.Instance.EER.Should().BeApproximately(4.652194564254316, comparison.Tolerance); } [Fact] @@ -311,13 +258,8 @@ public void COP_Always_ReturnsRatioBetweenSpecificHeatingCapacityAndSpecificWork { fixture .Instance.COP.Should() - .Be( - fixture.Instance.SpecificHeatingCapacity - / fixture.Instance.SpecificWork - ); - fixture - .Instance.COP.Should() - .BeApproximately(5.652194564254314, comparison.Tolerance); + .Be(fixture.Instance.SpecificHeatingCapacity / fixture.Instance.SpecificWork); + fixture.Instance.COP.Should().BeApproximately(5.652194564254314, comparison.Tolerance); } [Fact] @@ -366,9 +308,7 @@ public void EvaporatorEnergyLossRatio_ForThisCase_ReturnsAbout22() => [Fact] public void RecuperatorEnergyLossRatio_Always_Returns0() => - fixture - .AnalysisResult.RecuperatorEnergyLossRatio.Percent.Should() - .Be(0); + fixture.AnalysisResult.RecuperatorEnergyLossRatio.Percent.Should().Be(0); [Fact] public void EconomizerEnergyLossRatio_Always_Returns0() => @@ -386,9 +326,6 @@ public void AnalysisRelativeError_Always_ReturnsNegligibleValue() fixture .AnalysisResult.AnalysisRelativeError.Percent.Should() .BeApproximately(0.12296170435208868, comparison.Tolerance); - fixture - .AnalysisResult.Sum() - .Percent.Should() - .BeApproximately(100, comparison.Tolerance); + fixture.AnalysisResult.Sum().Percent.Should().BeApproximately(100, comparison.Tolerance); } } diff --git a/tests/VCRC.Tests/Subcritical/VCRCWithRecuperatorSubcriticalTests.cs b/tests/VCRC.Tests/Subcritical/VCRCWithRecuperatorSubcriticalTests.cs index 27c070f..fe532d0 100644 --- a/tests/VCRC.Tests/Subcritical/VCRCWithRecuperatorSubcriticalTests.cs +++ b/tests/VCRC.Tests/Subcritical/VCRCWithRecuperatorSubcriticalTests.cs @@ -1,11 +1,9 @@ namespace VCRC.Tests; -public class VCRCWithRecuperatorSubcriticalTests( +public sealed class VCRCWithRecuperatorSubcriticalTests( ComparisonFixture comparison, SubcriticalVCRCFixture fixture -) - : IClassFixture, - IClassFixture> +) : IClassFixture, IClassFixture> { [Fact] public void VCRCWithRecuperator_WrongTemperatureDifferenceAtRecuperatorHotSide_ThrowsValidationException() @@ -20,10 +18,7 @@ public void VCRCWithRecuperator_WrongTemperatureDifferenceAtRecuperatorHotSide_T action .Should() .Throw() - .WithMessage( - "*Too high temperature difference " - + "at the recuperator 'hot' side!*" - ); + .WithMessage("*Too high temperature difference at the recuperator 'hot' side!*"); } [Fact] @@ -46,8 +41,7 @@ public void Condenser_ForThisCase_ReturnsEnteredValue() => fixture.Instance.Condenser.Should().Be(fixture.Condenser); [Fact] - public void GasCooler_ForThisCase_ReturnsNull() => - fixture.Instance.GasCooler.Should().BeNull(); + public void GasCooler_ForThisCase_ReturnsNull() => fixture.Instance.GasCooler.Should().BeNull(); [Fact] public void IsTranscritical_ForThisCase_ReturnsFalse() => @@ -67,24 +61,18 @@ public void Point2_Always_ReturnsRecuperatorColdOutlet() .Instance.Point2.Should() .Be( fixture.Instance.Point1.HeatingTo( - fixture.Instance.Point4.Temperature - - fixture.Recuperator.TemperatureDifference + fixture.Instance.Point4.Temperature - fixture.Recuperator.TemperatureDifference ) ); fixture.Instance.Point2.Phase.Should().Be(Phases.Gas); } [Fact] - [SuppressMessage("ReSharper", "InconsistentNaming")] public void Point3s_Always_ReturnsIsentropicCompressionStageDischarge() { fixture .Instance.Point3s.Should() - .Be( - fixture.Instance.Point2.IsentropicCompressionTo( - fixture.Condenser.Pressure - ) - ); + .Be(fixture.Instance.Point2.IsentropicCompressionTo(fixture.Condenser.Pressure)); fixture.Instance.Point3s.Phase.Should().Be(Phases.SupercriticalGas); } @@ -117,10 +105,7 @@ public void Point5_Always_ReturnsRecuperatorHotOutlet() .Be( fixture.Instance.Point4.CoolingTo( fixture.Instance.Point4.Enthalpy - - ( - fixture.Instance.Point2.Enthalpy - - fixture.Instance.Point1.Enthalpy - ) + - (fixture.Instance.Point2.Enthalpy - fixture.Instance.Point1.Enthalpy) ) ); fixture.Instance.Point5.Phase.Should().Be(Phases.Liquid); @@ -131,11 +116,7 @@ public void Point6_Always_ReturnsEvaporatorInlet() { fixture .Instance.Point6.Should() - .Be( - fixture.Instance.Point5.IsenthalpicExpansionTo( - fixture.Evaporator.Pressure - ) - ); + .Be(fixture.Instance.Point5.IsenthalpicExpansionTo(fixture.Evaporator.Pressure)); fixture.Instance.Point6.Phase.Should().Be(Phases.TwoPhase); } @@ -143,8 +124,7 @@ public void Point6_Always_ReturnsEvaporatorInlet() public void IsentropicSpecificWork_Always_ReturnsEnthalpyDifferenceForIsentropicCompression() => fixture .Instance.IsentropicSpecificWork.Equals( - fixture.Instance.Point3s.Enthalpy - - fixture.Instance.Point2.Enthalpy, + fixture.Instance.Point3s.Enthalpy - fixture.Instance.Point2.Enthalpy, comparison.Tolerance.JoulesPerKilogram() ) .Should() @@ -165,8 +145,7 @@ public void SpecificWork_Always_ReturnsEnthalpyDifferenceForRealCompression() => public void SpecificCoolingCapacity_Always_ReturnsEnthalpyDifferenceInEvaporator() => fixture .Instance.SpecificCoolingCapacity.Equals( - fixture.Instance.Point1.Enthalpy - - fixture.Instance.Point6.Enthalpy, + fixture.Instance.Point1.Enthalpy - fixture.Instance.Point6.Enthalpy, comparison.Tolerance.JoulesPerKilogram() ) .Should() @@ -176,8 +155,7 @@ public void SpecificCoolingCapacity_Always_ReturnsEnthalpyDifferenceInEvaporator public void SpecificHeatingCapacity_Always_ReturnsEnthalpyDifferenceInCondenser() => fixture .Instance.SpecificHeatingCapacity.Equals( - fixture.Instance.Point3.Enthalpy - - fixture.Instance.Point4.Enthalpy, + fixture.Instance.Point3.Enthalpy - fixture.Instance.Point4.Enthalpy, comparison.Tolerance.JoulesPerKilogram() ) .Should() @@ -188,13 +166,8 @@ public void EER_Always_ReturnsRatioBetweenSpecificCoolingCapacityAndSpecificWork { fixture .Instance.EER.Should() - .Be( - fixture.Instance.SpecificCoolingCapacity - / fixture.Instance.SpecificWork - ); - fixture - .Instance.EER.Should() - .BeApproximately(4.201006672315493, comparison.Tolerance); + .Be(fixture.Instance.SpecificCoolingCapacity / fixture.Instance.SpecificWork); + fixture.Instance.EER.Should().BeApproximately(4.201006672315493, comparison.Tolerance); } [Fact] @@ -202,13 +175,8 @@ public void COP_Always_ReturnsRatioBetweenSpecificHeatingCapacityAndSpecificWork { fixture .Instance.COP.Should() - .Be( - fixture.Instance.SpecificHeatingCapacity - / fixture.Instance.SpecificWork - ); - fixture - .Instance.COP.Should() - .BeApproximately(5.201006672315493, comparison.Tolerance); + .Be(fixture.Instance.SpecificHeatingCapacity / fixture.Instance.SpecificWork); + fixture.Instance.COP.Should().BeApproximately(5.201006672315493, comparison.Tolerance); } [Fact] @@ -275,9 +243,6 @@ public void AnalysisRelativeError_Always_ReturnsNegligibleValue() fixture .AnalysisResult.AnalysisRelativeError.Percent.Should() .BeApproximately(4.099022440185992e-14, comparison.Tolerance); - fixture - .AnalysisResult.Sum() - .Percent.Should() - .BeApproximately(100, comparison.Tolerance); + fixture.AnalysisResult.Sum().Percent.Should().BeApproximately(100, comparison.Tolerance); } } diff --git a/tests/VCRC.Tests/Transcritical/SimpleVCRCTranscriticalTests.cs b/tests/VCRC.Tests/Transcritical/SimpleVCRCTranscriticalTests.cs index cf5eec6..8ccbd32 100644 --- a/tests/VCRC.Tests/Transcritical/SimpleVCRCTranscriticalTests.cs +++ b/tests/VCRC.Tests/Transcritical/SimpleVCRCTranscriticalTests.cs @@ -1,11 +1,9 @@ namespace VCRC.Tests; -public class SimpleVCRCTranscriticalTests( +public sealed class SimpleVCRCTranscriticalTests( ComparisonFixture comparison, TranscriticalVCRCFixture fixture -) - : IClassFixture, - IClassFixture> +) : IClassFixture, IClassFixture> { [Fact] public void Evaporator_Always_ReturnsEnteredValue() => @@ -16,8 +14,7 @@ public void Compressor_Always_ReturnsEnteredValue() => fixture.Instance.Compressor.Should().Be(fixture.Compressor); [Fact] - public void Condenser_ForThisCase_ReturnsNull() => - fixture.Instance.Condenser.Should().BeNull(); + public void Condenser_ForThisCase_ReturnsNull() => fixture.Instance.Condenser.Should().BeNull(); [Fact] public void GasCooler_ForThisCase_ReturnsEnteredValue() => @@ -35,16 +32,11 @@ public void Point1_Always_ReturnsEvaporatorOutlet() } [Fact] - [SuppressMessage("ReSharper", "InconsistentNaming")] public void Point2s_Always_ReturnsIsentropicCompressionStageDischarge() { fixture .Instance.Point2s.Should() - .Be( - fixture.Instance.Point1.IsentropicCompressionTo( - fixture.GasCooler.Pressure - ) - ); + .Be(fixture.Instance.Point1.IsentropicCompressionTo(fixture.GasCooler.Pressure)); fixture.Instance.Point2s.Phase.Should().Be(Phases.Supercritical); } @@ -74,11 +66,7 @@ public void Point4_Always_ReturnsEvaporatorInlet() { fixture .Instance.Point4.Should() - .Be( - fixture.Instance.Point3.IsenthalpicExpansionTo( - fixture.Evaporator.Pressure - ) - ); + .Be(fixture.Instance.Point3.IsenthalpicExpansionTo(fixture.Evaporator.Pressure)); fixture.Instance.Point4.Phase.Should().Be(Phases.TwoPhase); } @@ -97,8 +85,7 @@ public void SpecificWork_Always_ReturnsEnthalpyDifferenceForRealCompression() => public void SpecificCoolingCapacity_Always_ReturnsEnthalpyDifferenceInEvaporator() => fixture .Instance.SpecificCoolingCapacity.Equals( - fixture.Instance.Point1.Enthalpy - - fixture.Instance.Point4.Enthalpy, + fixture.Instance.Point1.Enthalpy - fixture.Instance.Point4.Enthalpy, comparison.Tolerance.JoulesPerKilogram() ) .Should() @@ -108,8 +95,7 @@ public void SpecificCoolingCapacity_Always_ReturnsEnthalpyDifferenceInEvaporator public void SpecificHeatingCapacity_Always_ReturnsEnthalpyDifferenceInCondenser() => fixture .Instance.SpecificHeatingCapacity.Equals( - fixture.Instance.Point2.Enthalpy - - fixture.Instance.Point3.Enthalpy, + fixture.Instance.Point2.Enthalpy - fixture.Instance.Point3.Enthalpy, comparison.Tolerance.JoulesPerKilogram() ) .Should() @@ -120,13 +106,8 @@ public void EER_Always_ReturnsRatioBetweenSpecificCoolingCapacityAndSpecificWork { fixture .Instance.EER.Should() - .Be( - fixture.Instance.SpecificCoolingCapacity - / fixture.Instance.SpecificWork - ); - fixture - .Instance.EER.Should() - .BeApproximately(2.6245123507309613, comparison.Tolerance); + .Be(fixture.Instance.SpecificCoolingCapacity / fixture.Instance.SpecificWork); + fixture.Instance.EER.Should().BeApproximately(2.6245123507309613, comparison.Tolerance); } [Fact] @@ -134,13 +115,8 @@ public void COP_Always_ReturnsRatioBetweenSpecificHeatingCapacityAndSpecificWork { fixture .Instance.COP.Should() - .Be( - fixture.Instance.SpecificHeatingCapacity - / fixture.Instance.SpecificWork - ); - fixture - .Instance.COP.Should() - .BeApproximately(3.624512350730961, comparison.Tolerance); + .Be(fixture.Instance.SpecificHeatingCapacity / fixture.Instance.SpecificWork); + fixture.Instance.COP.Should().BeApproximately(3.624512350730961, comparison.Tolerance); } [Fact] @@ -189,9 +165,7 @@ public void EvaporatorEnergyLossRatio_ForThisCase_ReturnsAbout12() => [Fact] public void RecuperatorEnergyLossRatio_Always_Returns0() => - fixture - .AnalysisResult.RecuperatorEnergyLossRatio.Percent.Should() - .Be(0); + fixture.AnalysisResult.RecuperatorEnergyLossRatio.Percent.Should().Be(0); [Fact] public void EconomizerEnergyLossRatio_Always_Returns0() => @@ -207,9 +181,6 @@ public void AnalysisRelativeError_Always_ReturnsNegligibleValue() fixture .AnalysisResult.AnalysisRelativeError.Percent.Should() .BeApproximately(0, comparison.Tolerance); - fixture - .AnalysisResult.Sum() - .Percent.Should() - .BeApproximately(100, comparison.Tolerance); + fixture.AnalysisResult.Sum().Percent.Should().BeApproximately(100, comparison.Tolerance); } } diff --git a/tests/VCRC.Tests/Transcritical/VCRCWithCICTranscriticalTests.cs b/tests/VCRC.Tests/Transcritical/VCRCWithCICTranscriticalTests.cs index bc40a79..1569578 100644 --- a/tests/VCRC.Tests/Transcritical/VCRCWithCICTranscriticalTests.cs +++ b/tests/VCRC.Tests/Transcritical/VCRCWithCICTranscriticalTests.cs @@ -1,11 +1,9 @@ namespace VCRC.Tests; -public class VCRCWithCICTranscriticalTests( +public sealed class VCRCWithCICTranscriticalTests( ComparisonFixture comparison, TranscriticalVCRCFixture fixture -) - : IClassFixture, - IClassFixture> +) : IClassFixture, IClassFixture> { [Fact] public void Evaporator_Always_ReturnsEnteredValue() => @@ -16,8 +14,7 @@ public void Compressor_Always_ReturnsEnteredValue() => fixture.Instance.Compressor.Should().Be(fixture.Compressor); [Fact] - public void Condenser_ForThisCase_ReturnsNull() => - fixture.Instance.Condenser.Should().BeNull(); + public void Condenser_ForThisCase_ReturnsNull() => fixture.Instance.Condenser.Should().BeNull(); [Fact] public void GasCooler_ForThisCase_ReturnsEnteredValue() => @@ -35,7 +32,6 @@ public void Point1_Always_ReturnsEvaporatorOutlet() } [Fact] - [SuppressMessage("ReSharper", "InconsistentNaming")] public void Point2s_Always_ReturnsFirstIsentropicCompressionStageDischarge() { fixture @@ -67,25 +63,16 @@ public void Point3_Always_ReturnsSecondCompressionStageSuction() { fixture .Instance.Point3.Should() - .Be( - fixture.Refrigerant.DewPointAt( - fixture.Instance.IntermediatePressure - ) - ); + .Be(fixture.Refrigerant.DewPointAt(fixture.Instance.IntermediatePressure)); fixture.Instance.Point3.Phase.Should().Be(Phases.TwoPhase); } [Fact] - [SuppressMessage("ReSharper", "InconsistentNaming")] public void Point4s_Always_ReturnsSecondIsentropicCompressionStageDischarge() { fixture .Instance.Point4s.Should() - .Be( - fixture.Instance.Point3.IsentropicCompressionTo( - fixture.GasCooler.Pressure - ) - ); + .Be(fixture.Instance.Point3.IsentropicCompressionTo(fixture.GasCooler.Pressure)); fixture.Instance.Point4s.Phase.Should().Be(Phases.Supercritical); } @@ -128,11 +115,7 @@ public void Point7_Always_ReturnsSeparatorLiquidOutlet() { fixture .Instance.Point7.Should() - .Be( - fixture.Refrigerant.BubblePointAt( - fixture.Instance.IntermediatePressure - ) - ); + .Be(fixture.Refrigerant.BubblePointAt(fixture.Instance.IntermediatePressure)); fixture.Instance.Point7.Phase.Should().Be(Phases.TwoPhase); } @@ -141,11 +124,7 @@ public void Point8_Always_ReturnsEvaporatorInlet() { fixture .Instance.Point8.Should() - .Be( - fixture.Instance.Point7.IsenthalpicExpansionTo( - fixture.Evaporator.Pressure - ) - ); + .Be(fixture.Instance.Point7.IsenthalpicExpansionTo(fixture.Evaporator.Pressure)); fixture.Instance.Point8.Phase.Should().Be(Phases.TwoPhase); } @@ -164,24 +143,10 @@ public void SpecificMassFlows_Always_CalculatesAutomaticallyByHeatBalance() fixture.Instance.EvaporatorSpecificMassFlow * ( 1 - + ( - fixture.Instance.Point2.Enthalpy - - fixture.Instance.Point3.Enthalpy - ) - / ( - fixture.Instance.Point3.Enthalpy - - fixture.Instance.Point7.Enthalpy - ) + + (fixture.Instance.Point2.Enthalpy - fixture.Instance.Point3.Enthalpy) + / (fixture.Instance.Point3.Enthalpy - fixture.Instance.Point7.Enthalpy) ) - / ( - 1 - - fixture - .Instance - .Point6 - .Quality! - .Value - .DecimalFractions - ), + / (1 - fixture.Instance.Point6.Quality!.Value.DecimalFractions), comparison.Tolerance.Percent() ) .Should() @@ -201,14 +166,8 @@ public void IsentropicSpecificWork_Always_ReturnsEnthalpyDifferenceForIsentropic .Instance.IsentropicSpecificWork.Equals( fixture.Instance.Point2s.Enthalpy - fixture.Instance.Point1.Enthalpy - + fixture - .Instance - .HeatReleaserSpecificMassFlow - .DecimalFractions - * ( - fixture.Instance.Point4s.Enthalpy - - fixture.Instance.Point3.Enthalpy - ), + + fixture.Instance.HeatReleaserSpecificMassFlow.DecimalFractions + * (fixture.Instance.Point4s.Enthalpy - fixture.Instance.Point3.Enthalpy), comparison.Tolerance.JoulesPerKilogram() ) .Should() @@ -229,8 +188,7 @@ public void SpecificWork_Always_ReturnsEnthalpyDifferenceForRealCompression() => public void SpecificCoolingCapacity_Always_ReturnsEnthalpyDifferenceInEvaporator() => fixture .Instance.SpecificCoolingCapacity.Equals( - fixture.Instance.Point1.Enthalpy - - fixture.Instance.Point8.Enthalpy, + fixture.Instance.Point1.Enthalpy - fixture.Instance.Point8.Enthalpy, comparison.Tolerance.JoulesPerKilogram() ) .Should() @@ -241,10 +199,7 @@ public void SpecificHeatingCapacity_Always_ReturnsEnthalpyDifferenceInCondenser( fixture .Instance.SpecificHeatingCapacity.Equals( fixture.Instance.HeatReleaserSpecificMassFlow.DecimalFractions - * ( - fixture.Instance.Point4.Enthalpy - - fixture.Instance.Point5.Enthalpy - ), + * (fixture.Instance.Point4.Enthalpy - fixture.Instance.Point5.Enthalpy), comparison.Tolerance.JoulesPerKilogram() ) .Should() @@ -255,13 +210,8 @@ public void EER_Always_ReturnsRatioBetweenSpecificCoolingCapacityAndSpecificWork { fixture .Instance.EER.Should() - .Be( - fixture.Instance.SpecificCoolingCapacity - / fixture.Instance.SpecificWork - ); - fixture - .Instance.EER.Should() - .BeApproximately(2.7550099889190762, comparison.Tolerance); + .Be(fixture.Instance.SpecificCoolingCapacity / fixture.Instance.SpecificWork); + fixture.Instance.EER.Should().BeApproximately(2.7550099889190762, comparison.Tolerance); } [Fact] @@ -269,13 +219,8 @@ public void COP_Always_ReturnsRatioBetweenSpecificHeatingCapacityAndSpecificWork { fixture .Instance.COP.Should() - .Be( - fixture.Instance.SpecificHeatingCapacity - / fixture.Instance.SpecificWork - ); - fixture - .Instance.COP.Should() - .BeApproximately(3.755009988919076, comparison.Tolerance); + .Be(fixture.Instance.SpecificHeatingCapacity / fixture.Instance.SpecificWork); + fixture.Instance.COP.Should().BeApproximately(3.755009988919076, comparison.Tolerance); } [Fact] @@ -324,9 +269,7 @@ public void EvaporatorEnergyLossRatio_ForThisCase_ReturnsAbout13() => [Fact] public void RecuperatorEnergyLossRatio_Always_Returns0() => - fixture - .AnalysisResult.RecuperatorEnergyLossRatio.Percent.Should() - .Be(0); + fixture.AnalysisResult.RecuperatorEnergyLossRatio.Percent.Should().Be(0); [Fact] public void EconomizerEnergyLossRatio_Always_Returns0() => @@ -344,9 +287,6 @@ public void AnalysisRelativeError_Always_ReturnsNegligibleValue() fixture .AnalysisResult.AnalysisRelativeError.Percent.Should() .BeApproximately(0.42686412372849164, comparison.Tolerance); - fixture - .AnalysisResult.Sum() - .Percent.Should() - .BeApproximately(100, comparison.Tolerance); + fixture.AnalysisResult.Sum().Percent.Should().BeApproximately(100, comparison.Tolerance); } } diff --git a/tests/VCRC.Tests/Transcritical/VCRCWithEconomizerAndPCTranscriticalTests.cs b/tests/VCRC.Tests/Transcritical/VCRCWithEconomizerAndPCTranscriticalTests.cs index 9b4aac9..f55f725 100644 --- a/tests/VCRC.Tests/Transcritical/VCRCWithEconomizerAndPCTranscriticalTests.cs +++ b/tests/VCRC.Tests/Transcritical/VCRCWithEconomizerAndPCTranscriticalTests.cs @@ -1,6 +1,6 @@ namespace VCRC.Tests; -public class VCRCWithEconomizerAndPCTranscriticalTests( +public sealed class VCRCWithEconomizerAndPCTranscriticalTests( ComparisonFixture comparison, TranscriticalVCRCFixture fixture ) @@ -16,8 +16,7 @@ public void Compressor_Always_ReturnsEnteredValue() => fixture.Instance.Compressor.Should().Be(fixture.Compressor); [Fact] - public void Condenser_ForThisCase_ReturnsNull() => - fixture.Instance.Condenser.Should().BeNull(); + public void Condenser_ForThisCase_ReturnsNull() => fixture.Instance.Condenser.Should().BeNull(); [Fact] public void GasCooler_ForThisCase_ReturnsEnteredValue() => @@ -42,16 +41,11 @@ public void Point1_Always_ReturnsEvaporatorOutlet() } [Fact] - [SuppressMessage("ReSharper", "InconsistentNaming")] public void Point2s_Always_ReturnsFirstIsentropicCompressionStageDischarge() { fixture .Instance.Point2s.Should() - .Be( - fixture.Instance.Point1.IsentropicCompressionTo( - fixture.GasCooler.Pressure - ) - ); + .Be(fixture.Instance.Point1.IsentropicCompressionTo(fixture.GasCooler.Pressure)); fixture.Instance.Point2s.Phase.Should().Be(Phases.Supercritical); } @@ -84,16 +78,11 @@ public void Point3_Always_ReturnsSecondCompressionStageSuction() } [Fact] - [SuppressMessage("ReSharper", "InconsistentNaming")] public void Point4s_Always_ReturnsSecondIsentropicCompressionStageDischarge() { fixture .Instance.Point4s.Should() - .Be( - fixture.Instance.Point3.IsentropicCompressionTo( - fixture.GasCooler.Pressure - ) - ); + .Be(fixture.Instance.Point3.IsentropicCompressionTo(fixture.GasCooler.Pressure)); fixture.Instance.Point4s.Phase.Should().Be(Phases.Supercritical); } @@ -155,8 +144,7 @@ public void Point8_Always_ReturnsEconomizerHotOutlet() .Instance.Point8.Should() .Be( fixture.Instance.Point6.CoolingTo( - fixture.Instance.Point7.Temperature - + fixture.Economizer.TemperatureDifference + fixture.Instance.Point7.Temperature + fixture.Economizer.TemperatureDifference ) ); fixture.Instance.Point8.Phase.Should().Be(Phases.SupercriticalLiquid); @@ -167,11 +155,7 @@ public void Point9_Always_ReturnsEvaporatorInlet() { fixture .Instance.Point9.Should() - .Be( - fixture.Instance.Point8.IsenthalpicExpansionTo( - fixture.Evaporator.Pressure - ) - ); + .Be(fixture.Instance.Point8.IsenthalpicExpansionTo(fixture.Evaporator.Pressure)); fixture.Instance.Point9.Phase.Should().Be(Phases.TwoPhase); } @@ -190,14 +174,8 @@ public void SpecificMassFlows_Always_CalculatesAutomaticallyByHeatBalance() fixture.Instance.EvaporatorSpecificMassFlow * ( 1 - + ( - fixture.Instance.Point6.Enthalpy - - fixture.Instance.Point8.Enthalpy - ) - / ( - fixture.Instance.Point3.Enthalpy - - fixture.Instance.Point7.Enthalpy - ) + + (fixture.Instance.Point6.Enthalpy - fixture.Instance.Point8.Enthalpy) + / (fixture.Instance.Point3.Enthalpy - fixture.Instance.Point7.Enthalpy) ), comparison.Tolerance.Percent() ) @@ -223,10 +201,7 @@ public void IsentropicSpecificWork_Always_ReturnsEnthalpyDifferenceForIsentropic fixture.Instance.HeatReleaserSpecificMassFlow - fixture.Instance.EvaporatorSpecificMassFlow ).DecimalFractions - * ( - fixture.Instance.Point4s.Enthalpy - - fixture.Instance.Point3.Enthalpy - ), + * (fixture.Instance.Point4s.Enthalpy - fixture.Instance.Point3.Enthalpy), comparison.Tolerance.JoulesPerKilogram() ) .Should() @@ -247,8 +222,7 @@ public void SpecificWork_Always_ReturnsEnthalpyDifferenceForRealCompression() => public void SpecificCoolingCapacity_Always_ReturnsEnthalpyDifferenceInEvaporator() => fixture .Instance.SpecificCoolingCapacity.Equals( - fixture.Instance.Point1.Enthalpy - - fixture.Instance.Point9.Enthalpy, + fixture.Instance.Point1.Enthalpy - fixture.Instance.Point9.Enthalpy, comparison.Tolerance.JoulesPerKilogram() ) .Should() @@ -259,10 +233,7 @@ public void SpecificHeatingCapacity_Always_ReturnsEnthalpyDifferenceInCondenser( fixture .Instance.SpecificHeatingCapacity.Equals( fixture.Instance.HeatReleaserSpecificMassFlow.DecimalFractions - * ( - fixture.Instance.Point5.Enthalpy - - fixture.Instance.Point6.Enthalpy - ), + * (fixture.Instance.Point5.Enthalpy - fixture.Instance.Point6.Enthalpy), comparison.Tolerance.JoulesPerKilogram() ) .Should() @@ -273,13 +244,8 @@ public void EER_Always_ReturnsRatioBetweenSpecificCoolingCapacityAndSpecificWork { fixture .Instance.EER.Should() - .Be( - fixture.Instance.SpecificCoolingCapacity - / fixture.Instance.SpecificWork - ); - fixture - .Instance.EER.Should() - .BeApproximately(3.0102645369221146, comparison.Tolerance); + .Be(fixture.Instance.SpecificCoolingCapacity / fixture.Instance.SpecificWork); + fixture.Instance.EER.Should().BeApproximately(3.0102645369221146, comparison.Tolerance); } [Fact] @@ -287,13 +253,8 @@ public void COP_Always_ReturnsRatioBetweenSpecificHeatingCapacityAndSpecificWork { fixture .Instance.COP.Should() - .Be( - fixture.Instance.SpecificHeatingCapacity - / fixture.Instance.SpecificWork - ); - fixture - .Instance.COP.Should() - .BeApproximately(4.010264536922114, comparison.Tolerance); + .Be(fixture.Instance.SpecificHeatingCapacity / fixture.Instance.SpecificWork); + fixture.Instance.COP.Should().BeApproximately(4.010264536922114, comparison.Tolerance); } [Fact] @@ -342,9 +303,7 @@ public void EvaporatorEnergyLossRatio_ForThisCase_ReturnsAbout14() => [Fact] public void RecuperatorEnergyLossRatio_Always_Returns0() => - fixture - .AnalysisResult.RecuperatorEnergyLossRatio.Percent.Should() - .Be(0); + fixture.AnalysisResult.RecuperatorEnergyLossRatio.Percent.Should().Be(0); [Fact] public void EconomizerEnergyLossRatio_ForThisCase_ReturnsAbout2() => @@ -364,9 +323,6 @@ public void AnalysisRelativeError_Always_ReturnsNegligibleValue() fixture .AnalysisResult.AnalysisRelativeError.Percent.Should() .BeApproximately(0.27320895511843885, comparison.Tolerance); - fixture - .AnalysisResult.Sum() - .Percent.Should() - .BeApproximately(100, comparison.Tolerance); + fixture.AnalysisResult.Sum().Percent.Should().BeApproximately(100, comparison.Tolerance); } } diff --git a/tests/VCRC.Tests/Transcritical/VCRCWithEconomizerAndTPITranscriticalTests.cs b/tests/VCRC.Tests/Transcritical/VCRCWithEconomizerAndTPITranscriticalTests.cs index 9cb5a18..150b870 100644 --- a/tests/VCRC.Tests/Transcritical/VCRCWithEconomizerAndTPITranscriticalTests.cs +++ b/tests/VCRC.Tests/Transcritical/VCRCWithEconomizerAndTPITranscriticalTests.cs @@ -1,6 +1,6 @@ namespace VCRC.Tests; -public class VCRCWithEconomizerAndTPITranscriticalTests( +public sealed class VCRCWithEconomizerAndTPITranscriticalTests( ComparisonFixture comparison, TranscriticalVCRCFixture fixture ) @@ -16,8 +16,7 @@ public void Compressor_Always_ReturnsEnteredValue() => fixture.Instance.Compressor.Should().Be(fixture.Compressor); [Fact] - public void Condenser_ForThisCase_ReturnsNull() => - fixture.Instance.Condenser.Should().BeNull(); + public void Condenser_ForThisCase_ReturnsNull() => fixture.Instance.Condenser.Should().BeNull(); [Fact] public void GasCooler_ForThisCase_ReturnsEnteredValue() => @@ -42,7 +41,6 @@ public void Point1_Always_ReturnsEvaporatorOutlet() } [Fact] - [SuppressMessage("ReSharper", "InconsistentNaming")] public void Point2s_Always_ReturnsFirstIsentropicCompressionStageDischarge() { fixture @@ -74,25 +72,16 @@ public void Point3_Always_ReturnsSecondCompressionStageSuction() { fixture .Instance.Point3.Should() - .Be( - fixture.Refrigerant.DewPointAt( - fixture.Instance.IntermediatePressure - ) - ); + .Be(fixture.Refrigerant.DewPointAt(fixture.Instance.IntermediatePressure)); fixture.Instance.Point3.Phase.Should().Be(Phases.TwoPhase); } [Fact] - [SuppressMessage("ReSharper", "InconsistentNaming")] public void Point4s_Always_ReturnsSecondIsentropicCompressionStageDischarge() { fixture .Instance.Point4s.Should() - .Be( - fixture.Instance.Point3.IsentropicCompressionTo( - fixture.GasCooler.Pressure - ) - ); + .Be(fixture.Instance.Point3.IsentropicCompressionTo(fixture.GasCooler.Pressure)); fixture.Instance.Point4s.Phase.Should().Be(Phases.Supercritical); } @@ -141,29 +130,13 @@ public void Point7_Always_ReturnsEconomizerColdOutlet() ( fixture.Instance.Point6.Enthalpy.JoulesPerKilogram * ( - fixture - .Instance - .Point2 - .Enthalpy - .JoulesPerKilogram - - fixture - .Instance - .Point3 - .Enthalpy - .JoulesPerKilogram + fixture.Instance.Point2.Enthalpy.JoulesPerKilogram + - fixture.Instance.Point3.Enthalpy.JoulesPerKilogram ) + fixture.Instance.Point3.Enthalpy.JoulesPerKilogram * ( - fixture - .Instance - .Point5 - .Enthalpy - .JoulesPerKilogram - - fixture - .Instance - .Point8 - .Enthalpy - .JoulesPerKilogram + fixture.Instance.Point5.Enthalpy.JoulesPerKilogram + - fixture.Instance.Point8.Enthalpy.JoulesPerKilogram ) ) / ( @@ -185,8 +158,7 @@ public void Point8_Always_ReturnsEconomizerHotOutlet() .Instance.Point8.Should() .Be( fixture.Instance.Point5.CoolingTo( - fixture.Instance.Point6.Temperature - + fixture.Economizer.TemperatureDifference + fixture.Instance.Point6.Temperature + fixture.Economizer.TemperatureDifference ) ); fixture.Instance.Point8.Phase.Should().Be(Phases.SupercriticalLiquid); @@ -197,11 +169,7 @@ public void Point9_Always_ReturnsEvaporatorInlet() { fixture .Instance.Point9.Should() - .Be( - fixture.Instance.Point8.IsenthalpicExpansionTo( - fixture.Evaporator.Pressure - ) - ); + .Be(fixture.Instance.Point8.IsenthalpicExpansionTo(fixture.Evaporator.Pressure)); fixture.Instance.Point9.Phase.Should().Be(Phases.TwoPhase); } @@ -220,14 +188,8 @@ public void SpecificMassFlows_Always_CalculatesAutomaticallyByHeatBalance() fixture.Instance.EvaporatorSpecificMassFlow * ( 1 - + ( - fixture.Instance.Point2.Enthalpy - - fixture.Instance.Point3.Enthalpy - ) - / ( - fixture.Instance.Point3.Enthalpy - - fixture.Instance.Point7.Enthalpy - ) + + (fixture.Instance.Point2.Enthalpy - fixture.Instance.Point3.Enthalpy) + / (fixture.Instance.Point3.Enthalpy - fixture.Instance.Point7.Enthalpy) ), comparison.Tolerance.Percent() ) @@ -249,14 +211,8 @@ public void IsentropicSpecificWork_Always_ReturnsEnthalpyDifferenceForIsentropic .Instance.IsentropicSpecificWork.Equals( fixture.Instance.Point2s.Enthalpy - fixture.Instance.Point1.Enthalpy - + fixture - .Instance - .HeatReleaserSpecificMassFlow - .DecimalFractions - * ( - fixture.Instance.Point4s.Enthalpy - - fixture.Instance.Point3.Enthalpy - ), + + fixture.Instance.HeatReleaserSpecificMassFlow.DecimalFractions + * (fixture.Instance.Point4s.Enthalpy - fixture.Instance.Point3.Enthalpy), comparison.Tolerance.JoulesPerKilogram() ) .Should() @@ -277,8 +233,7 @@ public void SpecificWork_Always_ReturnsEnthalpyDifferenceForRealCompression() => public void SpecificCoolingCapacity_Always_ReturnsEnthalpyDifferenceInEvaporator() => fixture .Instance.SpecificCoolingCapacity.Equals( - fixture.Instance.Point1.Enthalpy - - fixture.Instance.Point9.Enthalpy, + fixture.Instance.Point1.Enthalpy - fixture.Instance.Point9.Enthalpy, comparison.Tolerance.JoulesPerKilogram() ) .Should() @@ -289,10 +244,7 @@ public void SpecificHeatingCapacity_Always_ReturnsEnthalpyDifferenceInCondenser( fixture .Instance.SpecificHeatingCapacity.Equals( fixture.Instance.HeatReleaserSpecificMassFlow.DecimalFractions - * ( - fixture.Instance.Point4.Enthalpy - - fixture.Instance.Point5.Enthalpy - ), + * (fixture.Instance.Point4.Enthalpy - fixture.Instance.Point5.Enthalpy), comparison.Tolerance.JoulesPerKilogram() ) .Should() @@ -303,13 +255,8 @@ public void EER_Always_ReturnsRatioBetweenSpecificCoolingCapacityAndSpecificWork { fixture .Instance.EER.Should() - .Be( - fixture.Instance.SpecificCoolingCapacity - / fixture.Instance.SpecificWork - ); - fixture - .Instance.EER.Should() - .BeApproximately(2.7733154591838005, comparison.Tolerance); + .Be(fixture.Instance.SpecificCoolingCapacity / fixture.Instance.SpecificWork); + fixture.Instance.EER.Should().BeApproximately(2.7733154591838005, comparison.Tolerance); } [Fact] @@ -317,13 +264,8 @@ public void COP_Always_ReturnsRatioBetweenSpecificHeatingCapacityAndSpecificWork { fixture .Instance.COP.Should() - .Be( - fixture.Instance.SpecificHeatingCapacity - / fixture.Instance.SpecificWork - ); - fixture - .Instance.COP.Should() - .BeApproximately(3.773315459183803, comparison.Tolerance); + .Be(fixture.Instance.SpecificHeatingCapacity / fixture.Instance.SpecificWork); + fixture.Instance.COP.Should().BeApproximately(3.773315459183803, comparison.Tolerance); } [Fact] @@ -372,9 +314,7 @@ public void EvaporatorEnergyLossRatio_ForThisCase_ReturnsAbout13() => [Fact] public void RecuperatorEnergyLossRatio_Always_Returns0() => - fixture - .AnalysisResult.RecuperatorEnergyLossRatio.Percent.Should() - .Be(0); + fixture.AnalysisResult.RecuperatorEnergyLossRatio.Percent.Should().Be(0); [Fact] public void EconomizerEnergyLossRatio_ForThisCase_ReturnsAbout2() => @@ -394,9 +334,6 @@ public void AnalysisRelativeError_Always_ReturnsNegligibleValue() fixture .AnalysisResult.AnalysisRelativeError.Percent.Should() .BeApproximately(0.4234305005094076, comparison.Tolerance); - fixture - .AnalysisResult.Sum() - .Percent.Should() - .BeApproximately(100, comparison.Tolerance); + fixture.AnalysisResult.Sum().Percent.Should().BeApproximately(100, comparison.Tolerance); } } diff --git a/tests/VCRC.Tests/Transcritical/VCRCWithEconomizerTranscriticalTests.cs b/tests/VCRC.Tests/Transcritical/VCRCWithEconomizerTranscriticalTests.cs index 5d75a55..5563261 100644 --- a/tests/VCRC.Tests/Transcritical/VCRCWithEconomizerTranscriticalTests.cs +++ b/tests/VCRC.Tests/Transcritical/VCRCWithEconomizerTranscriticalTests.cs @@ -1,11 +1,9 @@ namespace VCRC.Tests; -public class VCRCWithEconomizerTranscriticalTests( +public sealed class VCRCWithEconomizerTranscriticalTests( ComparisonFixture comparison, TranscriticalVCRCFixture fixture -) - : IClassFixture, - IClassFixture> +) : IClassFixture, IClassFixture> { [Fact] public void Evaporator_Always_ReturnsEnteredValue() => @@ -16,8 +14,7 @@ public void Compressor_Always_ReturnsEnteredValue() => fixture.Instance.Compressor.Should().Be(fixture.Compressor); [Fact] - public void Condenser_ForThisCase_ReturnsNull() => - fixture.Instance.Condenser.Should().BeNull(); + public void Condenser_ForThisCase_ReturnsNull() => fixture.Instance.Condenser.Should().BeNull(); [Fact] public void GasCooler_ForThisCase_ReturnsEnteredValue() => @@ -42,7 +39,6 @@ public void Point1_Always_ReturnsEvaporatorOutlet() } [Fact] - [SuppressMessage("ReSharper", "InconsistentNaming")] public void Point2s_Always_ReturnsFirstIsentropicCompressionStageDischarge() { fixture @@ -87,16 +83,11 @@ public void Point3_Always_ReturnsSecondCompressionStageSuction() } [Fact] - [SuppressMessage("ReSharper", "InconsistentNaming")] public void Point4s_Always_ReturnsSecondIsentropicCompressionStageDischarge() { fixture .Instance.Point4s.Should() - .Be( - fixture.Instance.Point3.IsentropicCompressionTo( - fixture.GasCooler.Pressure - ) - ); + .Be(fixture.Instance.Point3.IsentropicCompressionTo(fixture.GasCooler.Pressure)); fixture.Instance.Point4s.Phase.Should().Be(Phases.Supercritical); } @@ -155,8 +146,7 @@ public void Point8_Always_ReturnsEconomizerHotOutlet() .Instance.Point8.Should() .Be( fixture.Instance.Point5.CoolingTo( - fixture.Instance.Point6.Temperature - + fixture.Economizer.TemperatureDifference + fixture.Instance.Point6.Temperature + fixture.Economizer.TemperatureDifference ) ); fixture.Instance.Point8.Phase.Should().Be(Phases.SupercriticalLiquid); @@ -167,11 +157,7 @@ public void Point9_Always_ReturnsEvaporatorInlet() { fixture .Instance.Point9.Should() - .Be( - fixture.Instance.Point8.IsenthalpicExpansionTo( - fixture.Evaporator.Pressure - ) - ); + .Be(fixture.Instance.Point8.IsenthalpicExpansionTo(fixture.Evaporator.Pressure)); fixture.Instance.Point9.Phase.Should().Be(Phases.TwoPhase); } @@ -190,14 +176,8 @@ public void SpecificMassFlows_Always_CalculatesAutomaticallyByHeatBalance() fixture.Instance.EvaporatorSpecificMassFlow * ( 1 - + ( - fixture.Instance.Point5.Enthalpy - - fixture.Instance.Point8.Enthalpy - ) - / ( - fixture.Instance.Point7.Enthalpy - - fixture.Instance.Point6.Enthalpy - ) + + (fixture.Instance.Point5.Enthalpy - fixture.Instance.Point8.Enthalpy) + / (fixture.Instance.Point7.Enthalpy - fixture.Instance.Point6.Enthalpy) ), comparison.Tolerance.Percent() ) @@ -219,14 +199,8 @@ public void IsentropicSpecificWork_Always_ReturnsEnthalpyDifferenceForIsentropic .Instance.IsentropicSpecificWork.Equals( fixture.Instance.Point2s.Enthalpy - fixture.Instance.Point1.Enthalpy - + fixture - .Instance - .HeatReleaserSpecificMassFlow - .DecimalFractions - * ( - fixture.Instance.Point4s.Enthalpy - - fixture.Instance.Point3.Enthalpy - ), + + fixture.Instance.HeatReleaserSpecificMassFlow.DecimalFractions + * (fixture.Instance.Point4s.Enthalpy - fixture.Instance.Point3.Enthalpy), comparison.Tolerance.JoulesPerKilogram() ) .Should() @@ -247,8 +221,7 @@ public void SpecificWork_Always_ReturnsEnthalpyDifferenceForRealCompression() => public void SpecificCoolingCapacity_Always_ReturnsEnthalpyDifferenceInEvaporator() => fixture .Instance.SpecificCoolingCapacity.Equals( - fixture.Instance.Point1.Enthalpy - - fixture.Instance.Point9.Enthalpy, + fixture.Instance.Point1.Enthalpy - fixture.Instance.Point9.Enthalpy, comparison.Tolerance.JoulesPerKilogram() ) .Should() @@ -259,10 +232,7 @@ public void SpecificHeatingCapacity_Always_ReturnsEnthalpyDifferenceInCondenser( fixture .Instance.SpecificHeatingCapacity.Equals( fixture.Instance.HeatReleaserSpecificMassFlow.DecimalFractions - * ( - fixture.Instance.Point4.Enthalpy - - fixture.Instance.Point5.Enthalpy - ), + * (fixture.Instance.Point4.Enthalpy - fixture.Instance.Point5.Enthalpy), comparison.Tolerance.JoulesPerKilogram() ) .Should() @@ -273,13 +243,8 @@ public void EER_Always_ReturnsRatioBetweenSpecificCoolingCapacityAndSpecificWork { fixture .Instance.EER.Should() - .Be( - fixture.Instance.SpecificCoolingCapacity - / fixture.Instance.SpecificWork - ); - fixture - .Instance.EER.Should() - .BeApproximately(2.975458873387994, comparison.Tolerance); + .Be(fixture.Instance.SpecificCoolingCapacity / fixture.Instance.SpecificWork); + fixture.Instance.EER.Should().BeApproximately(2.975458873387994, comparison.Tolerance); } [Fact] @@ -287,13 +252,8 @@ public void COP_Always_ReturnsRatioBetweenSpecificHeatingCapacityAndSpecificWork { fixture .Instance.COP.Should() - .Be( - fixture.Instance.SpecificHeatingCapacity - / fixture.Instance.SpecificWork - ); - fixture - .Instance.COP.Should() - .BeApproximately(3.9754588733879945, comparison.Tolerance); + .Be(fixture.Instance.SpecificHeatingCapacity / fixture.Instance.SpecificWork); + fixture.Instance.COP.Should().BeApproximately(3.9754588733879945, comparison.Tolerance); } [Fact] @@ -342,9 +302,7 @@ public void EvaporatorEnergyLossRatio_ForThisCase_ReturnsAbout14() => [Fact] public void RecuperatorEnergyLossRatio_Always_Returns0() => - fixture - .AnalysisResult.RecuperatorEnergyLossRatio.Percent.Should() - .Be(0); + fixture.AnalysisResult.RecuperatorEnergyLossRatio.Percent.Should().Be(0); [Fact] public void EconomizerEnergyLossRatio_ForThisCase_ReturnsAbout2() => @@ -364,9 +322,6 @@ public void AnalysisRelativeError_Always_ReturnsNegligibleValue() fixture .AnalysisResult.AnalysisRelativeError.Percent.Should() .BeApproximately(0.4542938077352593, comparison.Tolerance); - fixture - .AnalysisResult.Sum() - .Percent.Should() - .BeApproximately(100, comparison.Tolerance); + fixture.AnalysisResult.Sum().Percent.Should().BeApproximately(100, comparison.Tolerance); } } diff --git a/tests/VCRC.Tests/Transcritical/VCRCWithEjectorAndEconomizerTranscriticalTests.cs b/tests/VCRC.Tests/Transcritical/VCRCWithEjectorAndEconomizerTranscriticalTests.cs index 95ad2b0..70633dc 100644 --- a/tests/VCRC.Tests/Transcritical/VCRCWithEjectorAndEconomizerTranscriticalTests.cs +++ b/tests/VCRC.Tests/Transcritical/VCRCWithEjectorAndEconomizerTranscriticalTests.cs @@ -1,6 +1,6 @@ namespace VCRC.Tests; -public class VCRCWithEjectorAndEconomizerTranscriticalTests( +public sealed class VCRCWithEjectorAndEconomizerTranscriticalTests( ComparisonFixture comparison, TranscriticalVCRCFixture fixture ) @@ -16,8 +16,7 @@ public void Compressor_Always_ReturnsEnteredValue() => fixture.Instance.Compressor.Should().Be(fixture.Compressor); [Fact] - public void Condenser_ForThisCase_ReturnsNull() => - fixture.Instance.Condenser.Should().BeNull(); + public void Condenser_ForThisCase_ReturnsNull() => fixture.Instance.Condenser.Should().BeNull(); [Fact] public void GasCooler_ForThisCase_ReturnsEnteredValue() => @@ -46,16 +45,11 @@ public void Point1_Always_ReturnsSeparatorVaporOutlet() { fixture .Instance.Point1.Should() - .Be( - fixture.Refrigerant.DewPointAt( - fixture.EjectorFlows.DiffuserOutlet.Pressure - ) - ); + .Be(fixture.Refrigerant.DewPointAt(fixture.EjectorFlows.DiffuserOutlet.Pressure)); fixture.Instance.Point1.Phase.Should().Be(Phases.TwoPhase); } [Fact] - [SuppressMessage("ReSharper", "InconsistentNaming")] public void Point2s_Always_ReturnsFirstIsentropicCompressionStageDischarge() { fixture @@ -100,16 +94,11 @@ public void Point3_Always_ReturnsSecondCompressionStageSuction() } [Fact] - [SuppressMessage("ReSharper", "InconsistentNaming")] public void Point4s_Always_ReturnsSecondIsentropicCompressionStageDischarge() { fixture .Instance.Point4s.Should() - .Be( - fixture.Instance.Point3.IsentropicCompressionTo( - fixture.GasCooler.Pressure - ) - ); + .Be(fixture.Instance.Point3.IsentropicCompressionTo(fixture.GasCooler.Pressure)); fixture.Instance.Point4s.Phase.Should().Be(Phases.Supercritical); } @@ -168,8 +157,7 @@ public void Point8_Always_ReturnsEconomizerHotOutlet() .Instance.Point8.Should() .Be( fixture.Instance.Point5.CoolingTo( - fixture.Instance.Point6.Temperature - + fixture.Economizer.TemperatureDifference + fixture.Instance.Point6.Temperature + fixture.Economizer.TemperatureDifference ) ); fixture.Instance.Point8.Phase.Should().Be(Phases.Supercritical); @@ -192,9 +180,7 @@ public void Point10_Always_ReturnsEjectorMixingInlet() [Fact] public void Point11_Always_ReturnsEjectorDiffuserOutlet() { - fixture - .Instance.Point11.Should() - .Be(fixture.EjectorFlows.DiffuserOutlet); + fixture.Instance.Point11.Should().Be(fixture.EjectorFlows.DiffuserOutlet); fixture.Instance.Point11.Phase.Should().Be(Phases.TwoPhase); } @@ -203,11 +189,7 @@ public void Point12_Always_ReturnsSeparatorLiquidOutlet() { fixture .Instance.Point12.Should() - .Be( - fixture.Refrigerant.BubblePointAt( - fixture.EjectorFlows.DiffuserOutlet.Pressure - ) - ); + .Be(fixture.Refrigerant.BubblePointAt(fixture.EjectorFlows.DiffuserOutlet.Pressure)); fixture.Instance.Point12.Phase.Should().Be(Phases.TwoPhase); } @@ -216,11 +198,7 @@ public void Point13_Always_ReturnsEvaporatorInlet() { fixture .Instance.Point13.Should() - .Be( - fixture.Instance.Point12.IsenthalpicExpansionTo( - fixture.Evaporator.Pressure - ) - ); + .Be(fixture.Instance.Point12.IsenthalpicExpansionTo(fixture.Evaporator.Pressure)); fixture.Instance.Point13.Phase.Should().Be(Phases.TwoPhase); } @@ -234,9 +212,7 @@ public void Point14_Always_ReturnsEvaporatorOutlet() [Fact] public void Point15_Always_ReturnsEjectorSuctionOutlet() { - fixture - .Instance.Point15.Should() - .Be(fixture.EjectorFlows.SuctionOutlet); + fixture.Instance.Point15.Should().Be(fixture.EjectorFlows.SuctionOutlet); fixture.Instance.Point15.Phase.Should().Be(Phases.Gas); } @@ -267,26 +243,12 @@ public void SpecificMassFlows_Always_CalculatesAutomaticallyByHeatBalance() fixture.Instance.EvaporatorSpecificMassFlow * ( fixture.Instance.Point11.Quality!.Value.DecimalFractions - / ( - 1 - - fixture - .Instance - .Point11 - .Quality! - .Value - .DecimalFractions - ) + / (1 - fixture.Instance.Point11.Quality!.Value.DecimalFractions) ) * ( 1 - + ( - fixture.Instance.Point5.Enthalpy - - fixture.Instance.Point8.Enthalpy - ) - / ( - fixture.Instance.Point7.Enthalpy - - fixture.Instance.Point6.Enthalpy - ) + + (fixture.Instance.Point5.Enthalpy - fixture.Instance.Point8.Enthalpy) + / (fixture.Instance.Point7.Enthalpy - fixture.Instance.Point6.Enthalpy) ), comparison.Tolerance.Percent() ) @@ -297,21 +259,8 @@ public void SpecificMassFlows_Always_CalculatesAutomaticallyByHeatBalance() fixture.Instance.HeatReleaserSpecificMassFlow - fixture.Instance.EvaporatorSpecificMassFlow * ( - fixture - .Instance - .Point11 - .Quality! - .Value - .DecimalFractions - / ( - 1 - - fixture - .Instance - .Point11 - .Quality! - .Value - .DecimalFractions - ) + fixture.Instance.Point11.Quality!.Value.DecimalFractions + / (1 - fixture.Instance.Point11.Quality!.Value.DecimalFractions) ), comparison.Tolerance.Percent() ) @@ -327,18 +276,9 @@ public void IsentropicSpecificWork_Always_ReturnsEnthalpyDifferenceForIsentropic fixture.Instance.HeatReleaserSpecificMassFlow - fixture.Instance.IntermediateSpecificMassFlow ).DecimalFractions - * ( - fixture.Instance.Point2s.Enthalpy - - fixture.Instance.Point1.Enthalpy - ) - + fixture - .Instance - .HeatReleaserSpecificMassFlow - .DecimalFractions - * ( - fixture.Instance.Point4s.Enthalpy - - fixture.Instance.Point3.Enthalpy - ), + * (fixture.Instance.Point2s.Enthalpy - fixture.Instance.Point1.Enthalpy) + + fixture.Instance.HeatReleaserSpecificMassFlow.DecimalFractions + * (fixture.Instance.Point4s.Enthalpy - fixture.Instance.Point3.Enthalpy), comparison.Tolerance.JoulesPerKilogram() ) .Should() @@ -359,8 +299,7 @@ public void SpecificWork_Always_ReturnsEnthalpyDifferenceForRealCompression() => public void SpecificCoolingCapacity_Always_ReturnsEnthalpyDifferenceInEvaporator() => fixture .Instance.SpecificCoolingCapacity.Equals( - fixture.Instance.Point14.Enthalpy - - fixture.Instance.Point13.Enthalpy, + fixture.Instance.Point14.Enthalpy - fixture.Instance.Point13.Enthalpy, comparison.Tolerance.JoulesPerKilogram() ) .Should() @@ -371,10 +310,7 @@ public void SpecificHeatingCapacity_Always_ReturnsEnthalpyDifferenceInCondenser( fixture .Instance.SpecificHeatingCapacity.Equals( fixture.Instance.HeatReleaserSpecificMassFlow.DecimalFractions - * ( - fixture.Instance.Point4.Enthalpy - - fixture.Instance.Point5.Enthalpy - ), + * (fixture.Instance.Point4.Enthalpy - fixture.Instance.Point5.Enthalpy), comparison.Tolerance.JoulesPerKilogram() ) .Should() @@ -385,13 +321,8 @@ public void EER_Always_ReturnsRatioBetweenSpecificCoolingCapacityAndSpecificWork { fixture .Instance.EER.Should() - .Be( - fixture.Instance.SpecificCoolingCapacity - / fixture.Instance.SpecificWork - ); - fixture - .Instance.EER.Should() - .BeApproximately(3.5076990300399533, comparison.Tolerance); + .Be(fixture.Instance.SpecificCoolingCapacity / fixture.Instance.SpecificWork); + fixture.Instance.EER.Should().BeApproximately(3.5076990300399533, comparison.Tolerance); } [Fact] @@ -399,13 +330,8 @@ public void COP_Always_ReturnsRatioBetweenSpecificHeatingCapacityAndSpecificWork { fixture .Instance.COP.Should() - .Be( - fixture.Instance.SpecificHeatingCapacity - / fixture.Instance.SpecificWork - ); - fixture - .Instance.COP.Should() - .BeApproximately(4.507637142530747, comparison.Tolerance); + .Be(fixture.Instance.SpecificHeatingCapacity / fixture.Instance.SpecificWork); + fixture.Instance.COP.Should().BeApproximately(4.507637142530747, comparison.Tolerance); } [Fact] @@ -456,9 +382,7 @@ public void EvaporatorEnergyLossRatio_ForThisCase_ReturnsAbout16() => [Fact] public void RecuperatorEnergyLossRatio_Always_Returns0() => - fixture - .AnalysisResult.RecuperatorEnergyLossRatio.Percent.Should() - .Be(0); + fixture.AnalysisResult.RecuperatorEnergyLossRatio.Percent.Should().Be(0); [Fact] public void EconomizerEnergyLossRatio_ForThisCase_ReturnsAbout2() => @@ -478,9 +402,6 @@ public void AnalysisRelativeError_Always_ReturnsNegligibleValue() fixture .AnalysisResult.AnalysisRelativeError.Percent.Should() .BeApproximately(0.16393672879741025, comparison.Tolerance); - fixture - .AnalysisResult.Sum() - .Percent.Should() - .BeApproximately(100, comparison.Tolerance); + fixture.AnalysisResult.Sum().Percent.Should().BeApproximately(100, comparison.Tolerance); } } diff --git a/tests/VCRC.Tests/Transcritical/VCRCWithEjectorEconomizerAndPCTranscriticalTests.cs b/tests/VCRC.Tests/Transcritical/VCRCWithEjectorEconomizerAndPCTranscriticalTests.cs index 6898e28..d97d1b3 100644 --- a/tests/VCRC.Tests/Transcritical/VCRCWithEjectorEconomizerAndPCTranscriticalTests.cs +++ b/tests/VCRC.Tests/Transcritical/VCRCWithEjectorEconomizerAndPCTranscriticalTests.cs @@ -1,6 +1,6 @@ namespace VCRC.Tests; -public class VCRCWithEjectorEconomizerAndPCTranscriticalTests( +public sealed class VCRCWithEjectorEconomizerAndPCTranscriticalTests( ComparisonFixture comparison, TranscriticalVCRCFixture fixture ) @@ -16,8 +16,7 @@ public void Compressor_Always_ReturnsEnteredValue() => fixture.Instance.Compressor.Should().Be(fixture.Compressor); [Fact] - public void Condenser_ForThisCase_ReturnsNull() => - fixture.Instance.Condenser.Should().BeNull(); + public void Condenser_ForThisCase_ReturnsNull() => fixture.Instance.Condenser.Should().BeNull(); [Fact] public void GasCooler_ForThisCase_ReturnsEnteredValue() => @@ -46,25 +45,16 @@ public void Point1_Always_ReturnsSeparatorVaporOutlet() { fixture .Instance.Point1.Should() - .Be( - fixture.Refrigerant.DewPointAt( - fixture.EjectorFlows.DiffuserOutlet.Pressure - ) - ); + .Be(fixture.Refrigerant.DewPointAt(fixture.EjectorFlows.DiffuserOutlet.Pressure)); fixture.Instance.Point1.Phase.Should().Be(Phases.TwoPhase); } [Fact] - [SuppressMessage("ReSharper", "InconsistentNaming")] public void Point2s_Always_ReturnsFirstIsentropicCompressionStageDischarge() { fixture .Instance.Point2s.Should() - .Be( - fixture.Instance.Point1.IsentropicCompressionTo( - fixture.GasCooler.Pressure - ) - ); + .Be(fixture.Instance.Point1.IsentropicCompressionTo(fixture.GasCooler.Pressure)); fixture.Instance.Point2s.Phase.Should().Be(Phases.Supercritical); } @@ -97,16 +87,11 @@ public void Point3_Always_ReturnsSecondCompressionStageSuction() } [Fact] - [SuppressMessage("ReSharper", "InconsistentNaming")] public void Point4s_Always_ReturnsSecondIsentropicCompressionStageDischarge() { fixture .Instance.Point4s.Should() - .Be( - fixture.Instance.Point3.IsentropicCompressionTo( - fixture.GasCooler.Pressure - ) - ); + .Be(fixture.Instance.Point3.IsentropicCompressionTo(fixture.GasCooler.Pressure)); fixture.Instance.Point4s.Phase.Should().Be(Phases.Supercritical); } @@ -168,8 +153,7 @@ public void Point8_Always_ReturnsEconomizerHotOutlet() .Instance.Point8.Should() .Be( fixture.Instance.Point6.CoolingTo( - fixture.Instance.Point7.Temperature - + fixture.Economizer.TemperatureDifference + fixture.Instance.Point7.Temperature + fixture.Economizer.TemperatureDifference ) ); fixture.Instance.Point8.Phase.Should().Be(Phases.Supercritical); @@ -192,9 +176,7 @@ public void Point10_Always_ReturnsEjectorMixingInlet() [Fact] public void Point11_Always_ReturnsEjectorDiffuserOutlet() { - fixture - .Instance.Point11.Should() - .Be(fixture.EjectorFlows.DiffuserOutlet); + fixture.Instance.Point11.Should().Be(fixture.EjectorFlows.DiffuserOutlet); fixture.Instance.Point11.Phase.Should().Be(Phases.TwoPhase); } @@ -203,11 +185,7 @@ public void Point12_Always_ReturnsSeparatorLiquidOutlet() { fixture .Instance.Point12.Should() - .Be( - fixture.Refrigerant.BubblePointAt( - fixture.EjectorFlows.DiffuserOutlet.Pressure - ) - ); + .Be(fixture.Refrigerant.BubblePointAt(fixture.EjectorFlows.DiffuserOutlet.Pressure)); fixture.Instance.Point12.Phase.Should().Be(Phases.TwoPhase); } @@ -216,11 +194,7 @@ public void Point13_Always_ReturnsEvaporatorInlet() { fixture .Instance.Point13.Should() - .Be( - fixture.Instance.Point12.IsenthalpicExpansionTo( - fixture.Evaporator.Pressure - ) - ); + .Be(fixture.Instance.Point12.IsenthalpicExpansionTo(fixture.Evaporator.Pressure)); fixture.Instance.Point13.Phase.Should().Be(Phases.TwoPhase); } @@ -234,9 +208,7 @@ public void Point14_Always_ReturnsEvaporatorOutlet() [Fact] public void Point15_Always_ReturnsEjectorSuctionOutlet() { - fixture - .Instance.Point15.Should() - .Be(fixture.EjectorFlows.SuctionOutlet); + fixture.Instance.Point15.Should().Be(fixture.EjectorFlows.SuctionOutlet); fixture.Instance.Point15.Phase.Should().Be(Phases.Gas); } @@ -267,26 +239,12 @@ public void SpecificMassFlows_Always_CalculatesAutomaticallyByHeatBalance() fixture.Instance.EvaporatorSpecificMassFlow * ( fixture.Instance.Point11.Quality!.Value.DecimalFractions - / ( - 1 - - fixture - .Instance - .Point11 - .Quality! - .Value - .DecimalFractions - ) + / (1 - fixture.Instance.Point11.Quality!.Value.DecimalFractions) ) * ( 1 - + ( - fixture.Instance.Point6.Enthalpy - - fixture.Instance.Point8.Enthalpy - ) - / ( - fixture.Instance.Point3.Enthalpy - - fixture.Instance.Point7.Enthalpy - ) + + (fixture.Instance.Point6.Enthalpy - fixture.Instance.Point8.Enthalpy) + / (fixture.Instance.Point3.Enthalpy - fixture.Instance.Point7.Enthalpy) ), comparison.Tolerance.Percent() ) @@ -297,21 +255,8 @@ public void SpecificMassFlows_Always_CalculatesAutomaticallyByHeatBalance() fixture.Instance.HeatReleaserSpecificMassFlow - fixture.Instance.EvaporatorSpecificMassFlow * ( - fixture - .Instance - .Point11 - .Quality! - .Value - .DecimalFractions - / ( - 1 - - fixture - .Instance - .Point11 - .Quality! - .Value - .DecimalFractions - ) + fixture.Instance.Point11.Quality!.Value.DecimalFractions + / (1 - fixture.Instance.Point11.Quality!.Value.DecimalFractions) ), comparison.Tolerance.Percent() ) @@ -327,18 +272,9 @@ public void IsentropicSpecificWork_Always_ReturnsEnthalpyDifferenceForIsentropic fixture.Instance.HeatReleaserSpecificMassFlow - fixture.Instance.IntermediateSpecificMassFlow ).DecimalFractions - * ( - fixture.Instance.Point2s.Enthalpy - - fixture.Instance.Point1.Enthalpy - ) - + fixture - .Instance - .IntermediateSpecificMassFlow - .DecimalFractions - * ( - fixture.Instance.Point4s.Enthalpy - - fixture.Instance.Point3.Enthalpy - ), + * (fixture.Instance.Point2s.Enthalpy - fixture.Instance.Point1.Enthalpy) + + fixture.Instance.IntermediateSpecificMassFlow.DecimalFractions + * (fixture.Instance.Point4s.Enthalpy - fixture.Instance.Point3.Enthalpy), comparison.Tolerance.JoulesPerKilogram() ) .Should() @@ -359,8 +295,7 @@ public void SpecificWork_Always_ReturnsEnthalpyDifferenceForRealCompression() => public void SpecificCoolingCapacity_Always_ReturnsEnthalpyDifferenceInEvaporator() => fixture .Instance.SpecificCoolingCapacity.Equals( - fixture.Instance.Point14.Enthalpy - - fixture.Instance.Point13.Enthalpy, + fixture.Instance.Point14.Enthalpy - fixture.Instance.Point13.Enthalpy, comparison.Tolerance.JoulesPerKilogram() ) .Should() @@ -371,10 +306,7 @@ public void SpecificHeatingCapacity_Always_ReturnsEnthalpyDifferenceInCondenser( fixture .Instance.SpecificHeatingCapacity.Equals( fixture.Instance.HeatReleaserSpecificMassFlow.DecimalFractions - * ( - fixture.Instance.Point5.Enthalpy - - fixture.Instance.Point6.Enthalpy - ), + * (fixture.Instance.Point5.Enthalpy - fixture.Instance.Point6.Enthalpy), comparison.Tolerance.JoulesPerKilogram() ) .Should() @@ -385,13 +317,8 @@ public void EER_Always_ReturnsRatioBetweenSpecificCoolingCapacityAndSpecificWork { fixture .Instance.EER.Should() - .Be( - fixture.Instance.SpecificCoolingCapacity - / fixture.Instance.SpecificWork - ); - fixture - .Instance.EER.Should() - .BeApproximately(3.5417485177872754, comparison.Tolerance); + .Be(fixture.Instance.SpecificCoolingCapacity / fixture.Instance.SpecificWork); + fixture.Instance.EER.Should().BeApproximately(3.5417485177872754, comparison.Tolerance); } [Fact] @@ -399,13 +326,8 @@ public void COP_Always_ReturnsRatioBetweenSpecificHeatingCapacityAndSpecificWork { fixture .Instance.COP.Should() - .Be( - fixture.Instance.SpecificHeatingCapacity - / fixture.Instance.SpecificWork - ); - fixture - .Instance.COP.Should() - .BeApproximately(4.541686029531546, comparison.Tolerance); + .Be(fixture.Instance.SpecificHeatingCapacity / fixture.Instance.SpecificWork); + fixture.Instance.COP.Should().BeApproximately(4.541686029531546, comparison.Tolerance); } [Fact] @@ -456,9 +378,7 @@ public void EvaporatorEnergyLossRatio_ForThisCase_ReturnsAbout17() => [Fact] public void RecuperatorEnergyLossRatio_Always_Returns0() => - fixture - .AnalysisResult.RecuperatorEnergyLossRatio.Percent.Should() - .Be(0); + fixture.AnalysisResult.RecuperatorEnergyLossRatio.Percent.Should().Be(0); [Fact] public void EconomizerEnergyLossRatio_ForThisCase_ReturnsAbout2() => @@ -478,9 +398,6 @@ public void AnalysisRelativeError_Always_ReturnsNegligibleValue() fixture .AnalysisResult.AnalysisRelativeError.Percent.Should() .BeApproximately(0.0805812133279584, comparison.Tolerance); - fixture - .AnalysisResult.Sum() - .Percent.Should() - .BeApproximately(100, comparison.Tolerance); + fixture.AnalysisResult.Sum().Percent.Should().BeApproximately(100, comparison.Tolerance); } } diff --git a/tests/VCRC.Tests/Transcritical/VCRCWithEjectorEconomizerAndTPITranscriticalTests.cs b/tests/VCRC.Tests/Transcritical/VCRCWithEjectorEconomizerAndTPITranscriticalTests.cs index 9150b51..7289a46 100644 --- a/tests/VCRC.Tests/Transcritical/VCRCWithEjectorEconomizerAndTPITranscriticalTests.cs +++ b/tests/VCRC.Tests/Transcritical/VCRCWithEjectorEconomizerAndTPITranscriticalTests.cs @@ -1,13 +1,11 @@ namespace VCRC.Tests; -public class VCRCWithEjectorEconomizerAndTPITranscriticalTests( +public sealed class VCRCWithEjectorEconomizerAndTPITranscriticalTests( ComparisonFixture comparison, TranscriticalVCRCFixture fixture ) : IClassFixture, - IClassFixture< - TranscriticalVCRCFixture - > + IClassFixture> { [Fact] public void Evaporator_Always_ReturnsEnteredValue() => @@ -18,8 +16,7 @@ public void Compressor_Always_ReturnsEnteredValue() => fixture.Instance.Compressor.Should().Be(fixture.Compressor); [Fact] - public void Condenser_ForThisCase_ReturnsNull() => - fixture.Instance.Condenser.Should().BeNull(); + public void Condenser_ForThisCase_ReturnsNull() => fixture.Instance.Condenser.Should().BeNull(); [Fact] public void GasCooler_ForThisCase_ReturnsEnteredValue() => @@ -48,20 +45,14 @@ public void Point1_Always_ReturnsSeparatorVaporOutlet() { fixture .Instance.Point1.Pressure.Pascals.Should() - .BeApproximately( - fixture.EjectorFlows.DiffuserOutlet.Pressure.Pascals, - 50 - ); + .BeApproximately(fixture.EjectorFlows.DiffuserOutlet.Pressure.Pascals, 50); fixture .Instance.Point1.Should() - .Be( - fixture.Refrigerant.DewPointAt(fixture.Instance.Point1.Pressure) - ); + .Be(fixture.Refrigerant.DewPointAt(fixture.Instance.Point1.Pressure)); fixture.Instance.Point1.Phase.Should().Be(Phases.TwoPhase); } [Fact] - [SuppressMessage("ReSharper", "InconsistentNaming")] public void Point2s_Always_ReturnsFirstIsentropicCompressionStageDischarge() { fixture @@ -93,25 +84,16 @@ public void Point3_Always_ReturnsSecondCompressionStageSuction() { fixture .Instance.Point3.Should() - .Be( - fixture.Refrigerant.DewPointAt( - fixture.Instance.IntermediatePressure - ) - ); + .Be(fixture.Refrigerant.DewPointAt(fixture.Instance.IntermediatePressure)); fixture.Instance.Point3.Phase.Should().Be(Phases.TwoPhase); } [Fact] - [SuppressMessage("ReSharper", "InconsistentNaming")] public void Point4s_Always_ReturnsSecondIsentropicCompressionStageDischarge() { fixture .Instance.Point4s.Should() - .Be( - fixture.Instance.Point3.IsentropicCompressionTo( - fixture.GasCooler.Pressure - ) - ); + .Be(fixture.Instance.Point3.IsentropicCompressionTo(fixture.GasCooler.Pressure)); fixture.Instance.Point4s.Phase.Should().Be(Phases.Supercritical); } @@ -167,29 +149,13 @@ public void Point7_Always_ReturnsEconomizerColdOutlet() ( fixture.Instance.Point6.Enthalpy.JoulesPerKilogram * ( - fixture - .Instance - .Point2 - .Enthalpy - .JoulesPerKilogram - - fixture - .Instance - .Point3 - .Enthalpy - .JoulesPerKilogram + fixture.Instance.Point2.Enthalpy.JoulesPerKilogram + - fixture.Instance.Point3.Enthalpy.JoulesPerKilogram ) + fixture.Instance.Point3.Enthalpy.JoulesPerKilogram * ( - fixture - .Instance - .Point5 - .Enthalpy - .JoulesPerKilogram - - fixture - .Instance - .Point8 - .Enthalpy - .JoulesPerKilogram + fixture.Instance.Point5.Enthalpy.JoulesPerKilogram + - fixture.Instance.Point8.Enthalpy.JoulesPerKilogram ) ) / ( @@ -211,8 +177,7 @@ public void Point8_Always_ReturnsEconomizerHotOutlet() .Instance.Point8.Should() .Be( fixture.Instance.Point5.CoolingTo( - fixture.Instance.Point6.Temperature - + fixture.Economizer.TemperatureDifference + fixture.Instance.Point6.Temperature + fixture.Economizer.TemperatureDifference ) ); fixture.Instance.Point8.Phase.Should().Be(Phases.Supercritical); @@ -235,9 +200,7 @@ public void Point10_Always_ReturnsEjectorMixingInlet() [Fact] public void Point11_Always_ReturnsEjectorDiffuserOutlet() { - fixture - .Instance.Point11.Should() - .Be(fixture.EjectorFlows.DiffuserOutlet); + fixture.Instance.Point11.Should().Be(fixture.EjectorFlows.DiffuserOutlet); fixture.Instance.Point11.Phase.Should().Be(Phases.TwoPhase); } @@ -246,11 +209,7 @@ public void Point12_Always_ReturnsSeparatorLiquidOutlet() { fixture .Instance.Point12.Should() - .Be( - fixture.Refrigerant.BubblePointAt( - fixture.EjectorFlows.DiffuserOutlet.Pressure - ) - ); + .Be(fixture.Refrigerant.BubblePointAt(fixture.EjectorFlows.DiffuserOutlet.Pressure)); fixture.Instance.Point12.Phase.Should().Be(Phases.TwoPhase); } @@ -259,11 +218,7 @@ public void Point13_Always_ReturnsEvaporatorInlet() { fixture .Instance.Point13.Should() - .Be( - fixture.Instance.Point12.IsenthalpicExpansionTo( - fixture.Evaporator.Pressure - ) - ); + .Be(fixture.Instance.Point12.IsenthalpicExpansionTo(fixture.Evaporator.Pressure)); fixture.Instance.Point13.Phase.Should().Be(Phases.TwoPhase); } @@ -277,9 +232,7 @@ public void Point14_Always_ReturnsEvaporatorOutlet() [Fact] public void Point15_Always_ReturnsEjectorSuctionOutlet() { - fixture - .Instance.Point15.Should() - .Be(fixture.EjectorFlows.SuctionOutlet); + fixture.Instance.Point15.Should().Be(fixture.EjectorFlows.SuctionOutlet); fixture.Instance.Point15.Phase.Should().Be(Phases.Gas); } @@ -310,26 +263,12 @@ public void SpecificMassFlows_Always_CalculatesAutomaticallyByHeatBalance() fixture.Instance.EvaporatorSpecificMassFlow * ( fixture.Instance.Point11.Quality!.Value.DecimalFractions - / ( - 1 - - fixture - .Instance - .Point11 - .Quality! - .Value - .DecimalFractions - ) + / (1 - fixture.Instance.Point11.Quality!.Value.DecimalFractions) ) * ( 1 - + ( - fixture.Instance.Point2.Enthalpy - - fixture.Instance.Point3.Enthalpy - ) - / ( - fixture.Instance.Point3.Enthalpy - - fixture.Instance.Point7.Enthalpy - ) + + (fixture.Instance.Point2.Enthalpy - fixture.Instance.Point3.Enthalpy) + / (fixture.Instance.Point3.Enthalpy - fixture.Instance.Point7.Enthalpy) ), comparison.Tolerance.Percent() ) @@ -340,21 +279,8 @@ public void SpecificMassFlows_Always_CalculatesAutomaticallyByHeatBalance() fixture.Instance.HeatReleaserSpecificMassFlow - fixture.Instance.EvaporatorSpecificMassFlow * ( - fixture - .Instance - .Point11 - .Quality! - .Value - .DecimalFractions - / ( - 1 - - fixture - .Instance - .Point11 - .Quality! - .Value - .DecimalFractions - ) + fixture.Instance.Point11.Quality!.Value.DecimalFractions + / (1 - fixture.Instance.Point11.Quality!.Value.DecimalFractions) ), comparison.Tolerance.Percent() ) @@ -370,18 +296,9 @@ public void IsentropicSpecificWork_Always_ReturnsEnthalpyDifferenceForIsentropic fixture.Instance.HeatReleaserSpecificMassFlow - fixture.Instance.IntermediateSpecificMassFlow ).DecimalFractions - * ( - fixture.Instance.Point2s.Enthalpy - - fixture.Instance.Point1.Enthalpy - ) - + fixture - .Instance - .HeatReleaserSpecificMassFlow - .DecimalFractions - * ( - fixture.Instance.Point4s.Enthalpy - - fixture.Instance.Point3.Enthalpy - ), + * (fixture.Instance.Point2s.Enthalpy - fixture.Instance.Point1.Enthalpy) + + fixture.Instance.HeatReleaserSpecificMassFlow.DecimalFractions + * (fixture.Instance.Point4s.Enthalpy - fixture.Instance.Point3.Enthalpy), comparison.Tolerance.JoulesPerKilogram() ) .Should() @@ -402,8 +319,7 @@ public void SpecificWork_Always_ReturnsEnthalpyDifferenceForRealCompression() => public void SpecificCoolingCapacity_Always_ReturnsEnthalpyDifferenceInEvaporator() => fixture .Instance.SpecificCoolingCapacity.Equals( - fixture.Instance.Point14.Enthalpy - - fixture.Instance.Point13.Enthalpy, + fixture.Instance.Point14.Enthalpy - fixture.Instance.Point13.Enthalpy, comparison.Tolerance.JoulesPerKilogram() ) .Should() @@ -414,10 +330,7 @@ public void SpecificHeatingCapacity_Always_ReturnsEnthalpyDifferenceInCondenser( fixture .Instance.SpecificHeatingCapacity.Equals( fixture.Instance.HeatReleaserSpecificMassFlow.DecimalFractions - * ( - fixture.Instance.Point4.Enthalpy - - fixture.Instance.Point5.Enthalpy - ), + * (fixture.Instance.Point4.Enthalpy - fixture.Instance.Point5.Enthalpy), comparison.Tolerance.JoulesPerKilogram() ) .Should() @@ -428,13 +341,8 @@ public void EER_Always_ReturnsRatioBetweenSpecificCoolingCapacityAndSpecificWork { fixture .Instance.EER.Should() - .Be( - fixture.Instance.SpecificCoolingCapacity - / fixture.Instance.SpecificWork - ); - fixture - .Instance.EER.Should() - .BeApproximately(3.1856966924103642, comparison.Tolerance); + .Be(fixture.Instance.SpecificCoolingCapacity / fixture.Instance.SpecificWork); + fixture.Instance.EER.Should().BeApproximately(3.1856966924103642, comparison.Tolerance); } [Fact] @@ -442,13 +350,8 @@ public void COP_Always_ReturnsRatioBetweenSpecificHeatingCapacityAndSpecificWork { fixture .Instance.COP.Should() - .Be( - fixture.Instance.SpecificHeatingCapacity - / fixture.Instance.SpecificWork - ); - fixture - .Instance.COP.Should() - .BeApproximately(4.1856342597396194, comparison.Tolerance); + .Be(fixture.Instance.SpecificHeatingCapacity / fixture.Instance.SpecificWork); + fixture.Instance.COP.Should().BeApproximately(4.1856342597396194, comparison.Tolerance); } [Fact] @@ -499,9 +402,7 @@ public void EvaporatorEnergyLossRatio_ForThisCase_ReturnsAbout15() => [Fact] public void RecuperatorEnergyLossRatio_Always_Returns0() => - fixture - .AnalysisResult.RecuperatorEnergyLossRatio.Percent.Should() - .Be(0); + fixture.AnalysisResult.RecuperatorEnergyLossRatio.Percent.Should().Be(0); [Fact] public void EconomizerEnergyLossRatio_ForThisCase_ReturnsAbout2() => @@ -521,9 +422,6 @@ public void AnalysisRelativeError_Always_ReturnsNegligibleValue() fixture .AnalysisResult.AnalysisRelativeError.Percent.Should() .BeApproximately(0.1495375528210737, comparison.Tolerance); - fixture - .AnalysisResult.Sum() - .Percent.Should() - .BeApproximately(100, comparison.Tolerance); + fixture.AnalysisResult.Sum().Percent.Should().BeApproximately(100, comparison.Tolerance); } } diff --git a/tests/VCRC.Tests/Transcritical/VCRCWithEjectorTranscriticalTests.cs b/tests/VCRC.Tests/Transcritical/VCRCWithEjectorTranscriticalTests.cs index 235bdb2..c5018a5 100644 --- a/tests/VCRC.Tests/Transcritical/VCRCWithEjectorTranscriticalTests.cs +++ b/tests/VCRC.Tests/Transcritical/VCRCWithEjectorTranscriticalTests.cs @@ -1,11 +1,9 @@ namespace VCRC.Tests; -public class VCRCWithEjectorTranscriticalTests( +public sealed class VCRCWithEjectorTranscriticalTests( ComparisonFixture comparison, TranscriticalVCRCFixture fixture -) - : IClassFixture, - IClassFixture> +) : IClassFixture, IClassFixture> { [Fact] public void Evaporator_Always_ReturnsEnteredValue() => @@ -16,8 +14,7 @@ public void Compressor_Always_ReturnsEnteredValue() => fixture.Instance.Compressor.Should().Be(fixture.Compressor); [Fact] - public void Condenser_ForThisCase_ReturnsNull() => - fixture.Instance.Condenser.Should().BeNull(); + public void Condenser_ForThisCase_ReturnsNull() => fixture.Instance.Condenser.Should().BeNull(); [Fact] public void GasCooler_ForThisCase_ReturnsEnteredValue() => @@ -39,25 +36,16 @@ public void Point1_Always_ReturnsSeparatorVaporOutlet() { fixture .Instance.Point1.Should() - .Be( - fixture.Refrigerant.DewPointAt( - fixture.EjectorFlows.DiffuserOutlet.Pressure - ) - ); + .Be(fixture.Refrigerant.DewPointAt(fixture.EjectorFlows.DiffuserOutlet.Pressure)); fixture.Instance.Point1.Phase.Should().Be(Phases.TwoPhase); } [Fact] - [SuppressMessage("ReSharper", "InconsistentNaming")] public void Point2s_Always_ReturnsIsentropicCompressionStageDischarge() { fixture .Instance.Point2s.Should() - .Be( - fixture.Instance.Point1.IsentropicCompressionTo( - fixture.GasCooler.Pressure - ) - ); + .Be(fixture.Instance.Point1.IsentropicCompressionTo(fixture.GasCooler.Pressure)); fixture.Instance.Point2s.Phase.Should().Be(Phases.Supercritical); } @@ -99,9 +87,7 @@ public void Point5_Always_ReturnsEjectorMixingInlet() [Fact] public void Point6_Always_ReturnsEjectorDiffuserOutlet() { - fixture - .Instance.Point6.Should() - .Be(fixture.EjectorFlows.DiffuserOutlet); + fixture.Instance.Point6.Should().Be(fixture.EjectorFlows.DiffuserOutlet); fixture.Instance.Point6.Phase.Should().Be(Phases.TwoPhase); } @@ -110,11 +96,7 @@ public void Point7_Always_ReturnsSeparatorLiquidOutlet() { fixture .Instance.Point7.Should() - .Be( - fixture.Refrigerant.BubblePointAt( - fixture.EjectorFlows.DiffuserOutlet.Pressure - ) - ); + .Be(fixture.Refrigerant.BubblePointAt(fixture.EjectorFlows.DiffuserOutlet.Pressure)); fixture.Instance.Point7.Phase.Should().Be(Phases.TwoPhase); } @@ -123,11 +105,7 @@ public void Point8_Always_ReturnsEvaporatorInlet() { fixture .Instance.Point8.Should() - .Be( - fixture.Instance.Point7.IsenthalpicExpansionTo( - fixture.Evaporator.Pressure - ) - ); + .Be(fixture.Instance.Point7.IsenthalpicExpansionTo(fixture.Evaporator.Pressure)); fixture.Instance.Point8.Phase.Should().Be(Phases.TwoPhase); } @@ -141,9 +119,7 @@ public void Point9_Always_ReturnsEvaporatorOutlet() [Fact] public void Point10_Always_ReturnsEjectorSuctionOutlet() { - fixture - .Instance.Point10.Should() - .Be(fixture.EjectorFlows.SuctionOutlet); + fixture.Instance.Point10.Should().Be(fixture.EjectorFlows.SuctionOutlet); fixture.Instance.Point10.Phase.Should().Be(Phases.Gas); } @@ -162,15 +138,7 @@ public void SpecificMassFlows_Always_CalculatesAutomaticallyByHeatBalance() fixture.Instance.EvaporatorSpecificMassFlow * ( fixture.Instance.Point6.Quality!.Value.DecimalFractions - / ( - 1 - - fixture - .Instance - .Point6 - .Quality! - .Value - .DecimalFractions - ) + / (1 - fixture.Instance.Point6.Quality!.Value.DecimalFractions) ), comparison.Tolerance.Percent() ) @@ -183,10 +151,7 @@ public void IsentropicSpecificWork_Always_ReturnsEnthalpyDifferenceForIsentropic fixture .Instance.IsentropicSpecificWork.Equals( fixture.Instance.HeatReleaserSpecificMassFlow.DecimalFractions - * ( - fixture.Instance.Point2s.Enthalpy - - fixture.Instance.Point1.Enthalpy - ), + * (fixture.Instance.Point2s.Enthalpy - fixture.Instance.Point1.Enthalpy), comparison.Tolerance.JoulesPerKilogram() ) .Should() @@ -207,8 +172,7 @@ public void SpecificWork_Always_ReturnsEnthalpyDifferenceForRealCompression() => public void SpecificCoolingCapacity_Always_ReturnsEnthalpyDifferenceInEvaporator() => fixture .Instance.SpecificCoolingCapacity.Equals( - fixture.Instance.Point9.Enthalpy - - fixture.Instance.Point8.Enthalpy, + fixture.Instance.Point9.Enthalpy - fixture.Instance.Point8.Enthalpy, comparison.Tolerance.JoulesPerKilogram() ) .Should() @@ -219,10 +183,7 @@ public void SpecificHeatingCapacity_Always_ReturnsEnthalpyDifferenceInCondenser( fixture .Instance.SpecificHeatingCapacity.Equals( fixture.Instance.HeatReleaserSpecificMassFlow.DecimalFractions - * ( - fixture.Instance.Point2.Enthalpy - - fixture.Instance.Point3.Enthalpy - ), + * (fixture.Instance.Point2.Enthalpy - fixture.Instance.Point3.Enthalpy), comparison.Tolerance.JoulesPerKilogram() ) .Should() @@ -233,13 +194,8 @@ public void EER_Always_ReturnsRatioBetweenSpecificCoolingCapacityAndSpecificWork { fixture .Instance.EER.Should() - .Be( - fixture.Instance.SpecificCoolingCapacity - / fixture.Instance.SpecificWork - ); - fixture - .Instance.EER.Should() - .BeApproximately(3.417683634972164, comparison.Tolerance); + .Be(fixture.Instance.SpecificCoolingCapacity / fixture.Instance.SpecificWork); + fixture.Instance.EER.Should().BeApproximately(3.417683634972164, comparison.Tolerance); } [Fact] @@ -247,13 +203,8 @@ public void COP_Always_ReturnsRatioBetweenSpecificHeatingCapacityAndSpecificWork { fixture .Instance.COP.Should() - .Be( - fixture.Instance.SpecificHeatingCapacity - / fixture.Instance.SpecificWork - ); - fixture - .Instance.COP.Should() - .BeApproximately(4.417629862018599, comparison.Tolerance); + .Be(fixture.Instance.SpecificHeatingCapacity / fixture.Instance.SpecificWork); + fixture.Instance.COP.Should().BeApproximately(4.417629862018599, comparison.Tolerance); } [Fact] @@ -304,9 +255,7 @@ public void EvaporatorEnergyLossRatio_ForThisCase_ReturnsAbout16() => [Fact] public void RecuperatorEnergyLossRatio_Always_Returns0() => - fixture - .AnalysisResult.RecuperatorEnergyLossRatio.Percent.Should() - .Be(0); + fixture.AnalysisResult.RecuperatorEnergyLossRatio.Percent.Should().Be(0); [Fact] public void EconomizerEnergyLossRatio_Always_Returns0() => @@ -322,9 +271,6 @@ public void AnalysisRelativeError_Always_ReturnsNegligibleValue() fixture .AnalysisResult.AnalysisRelativeError.Percent.Should() .BeApproximately(0.006721619195616396, comparison.Tolerance); - fixture - .AnalysisResult.Sum() - .Percent.Should() - .BeApproximately(100, comparison.Tolerance); + fixture.AnalysisResult.Sum().Percent.Should().BeApproximately(100, comparison.Tolerance); } } diff --git a/tests/VCRC.Tests/Transcritical/VCRCWithIICTranscriticalTests.cs b/tests/VCRC.Tests/Transcritical/VCRCWithIICTranscriticalTests.cs index 1add1f1..f652b49 100644 --- a/tests/VCRC.Tests/Transcritical/VCRCWithIICTranscriticalTests.cs +++ b/tests/VCRC.Tests/Transcritical/VCRCWithIICTranscriticalTests.cs @@ -1,11 +1,9 @@ namespace VCRC.Tests; -public class VCRCWithIICTranscriticalTests( +public sealed class VCRCWithIICTranscriticalTests( ComparisonFixture comparison, TranscriticalVCRCFixture fixture -) - : IClassFixture, - IClassFixture> +) : IClassFixture, IClassFixture> { [Fact] public void Evaporator_Always_ReturnsEnteredValue() => @@ -16,8 +14,7 @@ public void Compressor_Always_ReturnsEnteredValue() => fixture.Instance.Compressor.Should().Be(fixture.Compressor); [Fact] - public void Condenser_ForThisCase_ReturnsNull() => - fixture.Instance.Condenser.Should().BeNull(); + public void Condenser_ForThisCase_ReturnsNull() => fixture.Instance.Condenser.Should().BeNull(); [Fact] public void GasCooler_ForThisCase_ReturnsEnteredValue() => @@ -35,7 +32,6 @@ public void Point1_Always_ReturnsEvaporatorOutlet() } [Fact] - [SuppressMessage("ReSharper", "InconsistentNaming")] public void Point2s_Always_ReturnsFirstIsentropicCompressionStageDischarge() { fixture @@ -80,16 +76,11 @@ public void Point3_Always_ReturnsSecondCompressionStageSuction() } [Fact] - [SuppressMessage("ReSharper", "InconsistentNaming")] public void Point4s_Always_ReturnsSecondIsentropicCompressionStageDischarge() { fixture .Instance.Point4s.Should() - .Be( - fixture.Instance.Point3.IsentropicCompressionTo( - fixture.GasCooler.Pressure - ) - ); + .Be(fixture.Instance.Point3.IsentropicCompressionTo(fixture.GasCooler.Pressure)); fixture.Instance.Point4s.Phase.Should().Be(Phases.Supercritical); } @@ -132,11 +123,7 @@ public void Point7_Always_ReturnsSeparatorVaporOutlet() { fixture .Instance.Point7.Should() - .Be( - fixture.Refrigerant.DewPointAt( - fixture.Instance.IntermediatePressure - ) - ); + .Be(fixture.Refrigerant.DewPointAt(fixture.Instance.IntermediatePressure)); fixture.Instance.Point7.Phase.Should().Be(Phases.TwoPhase); } @@ -145,11 +132,7 @@ public void Point8_Always_ReturnsSeparatorLiquidOutlet() { fixture .Instance.Point8.Should() - .Be( - fixture.Refrigerant.BubblePointAt( - fixture.Instance.IntermediatePressure - ) - ); + .Be(fixture.Refrigerant.BubblePointAt(fixture.Instance.IntermediatePressure)); fixture.Instance.Point8.Phase.Should().Be(Phases.TwoPhase); } @@ -158,11 +141,7 @@ public void Point9_Always_ReturnsEvaporatorInlet() { fixture .Instance.Point9.Should() - .Be( - fixture.Instance.Point8.IsenthalpicExpansionTo( - fixture.Evaporator.Pressure - ) - ); + .Be(fixture.Instance.Point8.IsenthalpicExpansionTo(fixture.Evaporator.Pressure)); fixture.Instance.Point9.Phase.Should().Be(Phases.TwoPhase); } @@ -179,15 +158,7 @@ public void SpecificMassFlows_Always_CalculatesAutomaticallyByHeatBalance() fixture .Instance.HeatReleaserSpecificMassFlow.Equals( fixture.Instance.EvaporatorSpecificMassFlow - / ( - 1 - - fixture - .Instance - .Point6 - .Quality! - .Value - .DecimalFractions - ), + / (1 - fixture.Instance.Point6.Quality!.Value.DecimalFractions), comparison.Tolerance.Percent() ) .Should() @@ -208,14 +179,8 @@ public void IsentropicSpecificWork_Always_ReturnsEnthalpyDifferenceForIsentropic .Instance.IsentropicSpecificWork.Equals( fixture.Instance.Point2s.Enthalpy - fixture.Instance.Point1.Enthalpy - + fixture - .Instance - .HeatReleaserSpecificMassFlow - .DecimalFractions - * ( - fixture.Instance.Point4s.Enthalpy - - fixture.Instance.Point3.Enthalpy - ), + + fixture.Instance.HeatReleaserSpecificMassFlow.DecimalFractions + * (fixture.Instance.Point4s.Enthalpy - fixture.Instance.Point3.Enthalpy), comparison.Tolerance.JoulesPerKilogram() ) .Should() @@ -236,8 +201,7 @@ public void SpecificWork_Always_ReturnsEnthalpyDifferenceForRealCompression() => public void SpecificCoolingCapacity_Always_ReturnsEnthalpyDifferenceInEvaporator() => fixture .Instance.SpecificCoolingCapacity.Equals( - fixture.Instance.Point1.Enthalpy - - fixture.Instance.Point9.Enthalpy, + fixture.Instance.Point1.Enthalpy - fixture.Instance.Point9.Enthalpy, comparison.Tolerance.JoulesPerKilogram() ) .Should() @@ -248,10 +212,7 @@ public void SpecificHeatingCapacity_Always_ReturnsEnthalpyDifferenceInCondenser( fixture .Instance.SpecificHeatingCapacity.Equals( fixture.Instance.HeatReleaserSpecificMassFlow.DecimalFractions - * ( - fixture.Instance.Point4.Enthalpy - - fixture.Instance.Point5.Enthalpy - ), + * (fixture.Instance.Point4.Enthalpy - fixture.Instance.Point5.Enthalpy), comparison.Tolerance.JoulesPerKilogram() ) .Should() @@ -262,13 +223,8 @@ public void EER_Always_ReturnsRatioBetweenSpecificCoolingCapacityAndSpecificWork { fixture .Instance.EER.Should() - .Be( - fixture.Instance.SpecificCoolingCapacity - / fixture.Instance.SpecificWork - ); - fixture - .Instance.EER.Should() - .BeApproximately(2.935653303601381, comparison.Tolerance); + .Be(fixture.Instance.SpecificCoolingCapacity / fixture.Instance.SpecificWork); + fixture.Instance.EER.Should().BeApproximately(2.935653303601381, comparison.Tolerance); } [Fact] @@ -276,13 +232,8 @@ public void COP_Always_ReturnsRatioBetweenSpecificHeatingCapacityAndSpecificWork { fixture .Instance.COP.Should() - .Be( - fixture.Instance.SpecificHeatingCapacity - / fixture.Instance.SpecificWork - ); - fixture - .Instance.COP.Should() - .BeApproximately(3.935653303601381, comparison.Tolerance); + .Be(fixture.Instance.SpecificHeatingCapacity / fixture.Instance.SpecificWork); + fixture.Instance.COP.Should().BeApproximately(3.935653303601381, comparison.Tolerance); } [Fact] @@ -331,9 +282,7 @@ public void EvaporatorEnergyLossRatio_ForThisCase_ReturnsAbout14() => [Fact] public void RecuperatorEnergyLossRatio_Always_Returns0() => - fixture - .AnalysisResult.RecuperatorEnergyLossRatio.Percent.Should() - .Be(0); + fixture.AnalysisResult.RecuperatorEnergyLossRatio.Percent.Should().Be(0); [Fact] public void EconomizerEnergyLossRatio_Always_Returns0() => @@ -351,9 +300,6 @@ public void AnalysisRelativeError_Always_ReturnsNegligibleValue() fixture .AnalysisResult.AnalysisRelativeError.Percent.Should() .BeApproximately(0.4548531874847325, comparison.Tolerance); - fixture - .AnalysisResult.Sum() - .Percent.Should() - .BeApproximately(100, comparison.Tolerance); + fixture.AnalysisResult.Sum().Percent.Should().BeApproximately(100, comparison.Tolerance); } } diff --git a/tests/VCRC.Tests/Transcritical/VCRCWithPCTranscriticalTests.cs b/tests/VCRC.Tests/Transcritical/VCRCWithPCTranscriticalTests.cs index b53df86..f986485 100644 --- a/tests/VCRC.Tests/Transcritical/VCRCWithPCTranscriticalTests.cs +++ b/tests/VCRC.Tests/Transcritical/VCRCWithPCTranscriticalTests.cs @@ -1,11 +1,9 @@ namespace VCRC.Tests; -public class VCRCWithPCTranscriticalTests( +public sealed class VCRCWithPCTranscriticalTests( ComparisonFixture comparison, TranscriticalVCRCFixture fixture -) - : IClassFixture, - IClassFixture> +) : IClassFixture, IClassFixture> { [Fact] public void Evaporator_Always_ReturnsEnteredValue() => @@ -16,8 +14,7 @@ public void Compressor_Always_ReturnsEnteredValue() => fixture.Instance.Compressor.Should().Be(fixture.Compressor); [Fact] - public void Condenser_ForThisCase_ReturnsNull() => - fixture.Instance.Condenser.Should().BeNull(); + public void Condenser_ForThisCase_ReturnsNull() => fixture.Instance.Condenser.Should().BeNull(); [Fact] public void GasCooler_ForThisCase_ReturnsEnteredValue() => @@ -35,16 +32,11 @@ public void Point1_Always_ReturnsEvaporatorOutlet() } [Fact] - [SuppressMessage("ReSharper", "InconsistentNaming")] public void Point2s_Always_ReturnsFirstIsentropicCompressionStageDischarge() { fixture .Instance.Point2s.Should() - .Be( - fixture.Instance.Point1.IsentropicCompressionTo( - fixture.GasCooler.Pressure - ) - ); + .Be(fixture.Instance.Point1.IsentropicCompressionTo(fixture.GasCooler.Pressure)); fixture.Instance.Point2s.Phase.Should().Be(Phases.Supercritical); } @@ -67,25 +59,16 @@ public void Point3_Always_ReturnsSeparatorVaporOutlet() { fixture .Instance.Point3.Should() - .Be( - fixture.Refrigerant.DewPointAt( - fixture.Instance.IntermediatePressure - ) - ); + .Be(fixture.Refrigerant.DewPointAt(fixture.Instance.IntermediatePressure)); fixture.Instance.Point3.Phase.Should().Be(Phases.TwoPhase); } [Fact] - [SuppressMessage("ReSharper", "InconsistentNaming")] public void Point4s_Always_ReturnsSecondIsentropicCompressionStageDischarge() { fixture .Instance.Point4s.Should() - .Be( - fixture.Instance.Point3.IsentropicCompressionTo( - fixture.GasCooler.Pressure - ) - ); + .Be(fixture.Instance.Point3.IsentropicCompressionTo(fixture.GasCooler.Pressure)); fixture.Instance.Point4s.Phase.Should().Be(Phases.Supercritical); } @@ -145,11 +128,7 @@ public void Point8_Always_ReturnsSeparatorLiquidOutlet() { fixture .Instance.Point8.Should() - .Be( - fixture.Refrigerant.BubblePointAt( - fixture.Instance.IntermediatePressure - ) - ); + .Be(fixture.Refrigerant.BubblePointAt(fixture.Instance.IntermediatePressure)); fixture.Instance.Point8.Phase.Should().Be(Phases.TwoPhase); } @@ -158,11 +137,7 @@ public void Point9_Always_ReturnsEvaporatorInlet() { fixture .Instance.Point9.Should() - .Be( - fixture.Instance.Point8.IsenthalpicExpansionTo( - fixture.Evaporator.Pressure - ) - ); + .Be(fixture.Instance.Point8.IsenthalpicExpansionTo(fixture.Evaporator.Pressure)); fixture.Instance.Point9.Phase.Should().Be(Phases.TwoPhase); } @@ -181,21 +156,8 @@ public void SpecificMassFlows_Always_CalculatesAutomaticallyByHeatBalance() fixture.Instance.EvaporatorSpecificMassFlow * ( 1 - + fixture - .Instance - .Point7 - .Quality! - .Value - .DecimalFractions - / ( - 1 - - fixture - .Instance - .Point7 - .Quality! - .Value - .DecimalFractions - ) + + fixture.Instance.Point7.Quality!.Value.DecimalFractions + / (1 - fixture.Instance.Point7.Quality!.Value.DecimalFractions) ), comparison.Tolerance.Percent() ) @@ -221,10 +183,7 @@ public void IsentropicSpecificWork_Always_ReturnsEnthalpyDifferenceForIsentropic fixture.Instance.HeatReleaserSpecificMassFlow - fixture.Instance.EvaporatorSpecificMassFlow ).DecimalFractions - * ( - fixture.Instance.Point4s.Enthalpy - - fixture.Instance.Point3.Enthalpy - ), + * (fixture.Instance.Point4s.Enthalpy - fixture.Instance.Point3.Enthalpy), comparison.Tolerance.JoulesPerKilogram() ) .Should() @@ -245,8 +204,7 @@ public void SpecificWork_Always_ReturnsEnthalpyDifferenceForRealCompression() => public void SpecificCoolingCapacity_Always_ReturnsEnthalpyDifferenceInEvaporator() => fixture .Instance.SpecificCoolingCapacity.Equals( - fixture.Instance.Point1.Enthalpy - - fixture.Instance.Point9.Enthalpy, + fixture.Instance.Point1.Enthalpy - fixture.Instance.Point9.Enthalpy, comparison.Tolerance.JoulesPerKilogram() ) .Should() @@ -257,10 +215,7 @@ public void SpecificHeatingCapacity_Always_ReturnsEnthalpyDifferenceInCondenser( fixture .Instance.SpecificHeatingCapacity.Equals( fixture.Instance.HeatReleaserSpecificMassFlow.DecimalFractions - * ( - fixture.Instance.Point5.Enthalpy - - fixture.Instance.Point6.Enthalpy - ), + * (fixture.Instance.Point5.Enthalpy - fixture.Instance.Point6.Enthalpy), comparison.Tolerance.JoulesPerKilogram() ) .Should() @@ -271,13 +226,8 @@ public void EER_Always_ReturnsRatioBetweenSpecificCoolingCapacityAndSpecificWork { fixture .Instance.EER.Should() - .Be( - fixture.Instance.SpecificCoolingCapacity - / fixture.Instance.SpecificWork - ); - fixture - .Instance.EER.Should() - .BeApproximately(2.964401783635744, comparison.Tolerance); + .Be(fixture.Instance.SpecificCoolingCapacity / fixture.Instance.SpecificWork); + fixture.Instance.EER.Should().BeApproximately(2.964401783635744, comparison.Tolerance); } [Fact] @@ -285,13 +235,8 @@ public void COP_Always_ReturnsRatioBetweenSpecificHeatingCapacityAndSpecificWork { fixture .Instance.COP.Should() - .Be( - fixture.Instance.SpecificHeatingCapacity - / fixture.Instance.SpecificWork - ); - fixture - .Instance.COP.Should() - .BeApproximately(3.964401783635742, comparison.Tolerance); + .Be(fixture.Instance.SpecificHeatingCapacity / fixture.Instance.SpecificWork); + fixture.Instance.COP.Should().BeApproximately(3.964401783635742, comparison.Tolerance); } [Fact] @@ -340,9 +285,7 @@ public void EvaporatorEnergyLossRatio_ForThisCase_ReturnsAbout14() => [Fact] public void RecuperatorEnergyLossRatio_Always_Returns0() => - fixture - .AnalysisResult.RecuperatorEnergyLossRatio.Percent.Should() - .Be(0); + fixture.AnalysisResult.RecuperatorEnergyLossRatio.Percent.Should().Be(0); [Fact] public void EconomizerEnergyLossRatio_Always_Returns0() => @@ -360,9 +303,6 @@ public void AnalysisRelativeError_Always_ReturnsNegligibleValue() fixture .AnalysisResult.AnalysisRelativeError.Percent.Should() .BeApproximately(0.5199604127290963, comparison.Tolerance); - fixture - .AnalysisResult.Sum() - .Percent.Should() - .BeApproximately(100, comparison.Tolerance); + fixture.AnalysisResult.Sum().Percent.Should().BeApproximately(100, comparison.Tolerance); } } diff --git a/tests/VCRC.Tests/Transcritical/VCRCWithRecuperatorTranscriticalTests.cs b/tests/VCRC.Tests/Transcritical/VCRCWithRecuperatorTranscriticalTests.cs index 400cc07..e350068 100644 --- a/tests/VCRC.Tests/Transcritical/VCRCWithRecuperatorTranscriticalTests.cs +++ b/tests/VCRC.Tests/Transcritical/VCRCWithRecuperatorTranscriticalTests.cs @@ -1,11 +1,9 @@ namespace VCRC.Tests; -public class VCRCWithRecuperatorTranscriticalTests( +public sealed class VCRCWithRecuperatorTranscriticalTests( ComparisonFixture comparison, TranscriticalVCRCFixture fixture -) - : IClassFixture, - IClassFixture> +) : IClassFixture, IClassFixture> { [Fact] public void Evaporator_Always_ReturnsEnteredValue() => @@ -23,8 +21,7 @@ public void Compressor_Always_ReturnsEnteredValue() => fixture.Instance.Compressor.Should().Be(fixture.Compressor); [Fact] - public void Condenser_ForThisCase_ReturnsNull() => - fixture.Instance.Condenser.Should().BeNull(); + public void Condenser_ForThisCase_ReturnsNull() => fixture.Instance.Condenser.Should().BeNull(); [Fact] public void GasCooler_ForThisCase_ReturnsEnteredValue() => @@ -48,24 +45,18 @@ public void Point2_Always_ReturnsRecuperatorColdOutlet() .Instance.Point2.Should() .Be( fixture.Instance.Point1.HeatingTo( - fixture.Instance.Point4.Temperature - - fixture.Recuperator.TemperatureDifference + fixture.Instance.Point4.Temperature - fixture.Recuperator.TemperatureDifference ) ); fixture.Instance.Point2.Phase.Should().Be(Phases.SupercriticalGas); } [Fact] - [SuppressMessage("ReSharper", "InconsistentNaming")] public void Point3s_Always_ReturnsIsentropicCompressionStageDischarge() { fixture .Instance.Point3s.Should() - .Be( - fixture.Instance.Point2.IsentropicCompressionTo( - fixture.GasCooler.Pressure - ) - ); + .Be(fixture.Instance.Point2.IsentropicCompressionTo(fixture.GasCooler.Pressure)); fixture.Instance.Point3s.Phase.Should().Be(Phases.Supercritical); } @@ -98,10 +89,7 @@ public void Point5_Always_ReturnsRecuperatorHotOutlet() .Be( fixture.Instance.Point4.CoolingTo( fixture.Instance.Point4.Enthalpy - - ( - fixture.Instance.Point2.Enthalpy - - fixture.Instance.Point1.Enthalpy - ) + - (fixture.Instance.Point2.Enthalpy - fixture.Instance.Point1.Enthalpy) ) ); fixture.Instance.Point5.Phase.Should().Be(Phases.Supercritical); @@ -112,11 +100,7 @@ public void Point6_Always_ReturnsEvaporatorInlet() { fixture .Instance.Point6.Should() - .Be( - fixture.Instance.Point5.IsenthalpicExpansionTo( - fixture.Evaporator.Pressure - ) - ); + .Be(fixture.Instance.Point5.IsenthalpicExpansionTo(fixture.Evaporator.Pressure)); fixture.Instance.Point6.Phase.Should().Be(Phases.TwoPhase); } @@ -124,8 +108,7 @@ public void Point6_Always_ReturnsEvaporatorInlet() public void IsentropicSpecificWork_Always_ReturnsEnthalpyDifferenceForIsentropicCompression() => fixture .Instance.IsentropicSpecificWork.Equals( - fixture.Instance.Point3s.Enthalpy - - fixture.Instance.Point2.Enthalpy, + fixture.Instance.Point3s.Enthalpy - fixture.Instance.Point2.Enthalpy, comparison.Tolerance.JoulesPerKilogram() ) .Should() @@ -146,8 +129,7 @@ public void SpecificWork_Always_ReturnsEnthalpyDifferenceForRealCompression() => public void SpecificCoolingCapacity_Always_ReturnsEnthalpyDifferenceInEvaporator() => fixture .Instance.SpecificCoolingCapacity.Equals( - fixture.Instance.Point1.Enthalpy - - fixture.Instance.Point6.Enthalpy, + fixture.Instance.Point1.Enthalpy - fixture.Instance.Point6.Enthalpy, comparison.Tolerance.JoulesPerKilogram() ) .Should() @@ -157,8 +139,7 @@ public void SpecificCoolingCapacity_Always_ReturnsEnthalpyDifferenceInEvaporator public void SpecificHeatingCapacity_Always_ReturnsEnthalpyDifferenceInCondenser() => fixture .Instance.SpecificHeatingCapacity.Equals( - fixture.Instance.Point3.Enthalpy - - fixture.Instance.Point4.Enthalpy, + fixture.Instance.Point3.Enthalpy - fixture.Instance.Point4.Enthalpy, comparison.Tolerance.JoulesPerKilogram() ) .Should() @@ -169,13 +150,8 @@ public void EER_Always_ReturnsRatioBetweenSpecificCoolingCapacityAndSpecificWork { fixture .Instance.EER.Should() - .Be( - fixture.Instance.SpecificCoolingCapacity - / fixture.Instance.SpecificWork - ); - fixture - .Instance.EER.Should() - .BeApproximately(2.711892365925208, comparison.Tolerance); + .Be(fixture.Instance.SpecificCoolingCapacity / fixture.Instance.SpecificWork); + fixture.Instance.EER.Should().BeApproximately(2.711892365925208, comparison.Tolerance); } [Fact] @@ -183,13 +159,8 @@ public void COP_Always_ReturnsRatioBetweenSpecificHeatingCapacityAndSpecificWork { fixture .Instance.COP.Should() - .Be( - fixture.Instance.SpecificHeatingCapacity - / fixture.Instance.SpecificWork - ); - fixture - .Instance.COP.Should() - .BeApproximately(3.7118923659252077, comparison.Tolerance); + .Be(fixture.Instance.SpecificHeatingCapacity / fixture.Instance.SpecificWork); + fixture.Instance.COP.Should().BeApproximately(3.7118923659252077, comparison.Tolerance); } [Fact] @@ -256,9 +227,6 @@ public void AnalysisRelativeError_Always_ReturnsNegligibleValue() fixture .AnalysisResult.AnalysisRelativeError.Percent.Should() .BeApproximately(3.7834531981960063e-14, comparison.Tolerance); - fixture - .AnalysisResult.Sum() - .Percent.Should() - .BeApproximately(100, comparison.Tolerance); + fixture.AnalysisResult.Sum().Percent.Should().BeApproximately(100, comparison.Tolerance); } }