Skip to content

Commit

Permalink
Merge pull request #167 from portyanikhin/dependabot/nuget/csharpier-…
Browse files Browse the repository at this point in the history
…0.29.1

Bump csharpier from 0.28.2 to 0.29.1
  • Loading branch information
portyanikhin authored Aug 29, 2024
2 parents ff38e97 + cba3753 commit f315536
Show file tree
Hide file tree
Showing 118 changed files with 1,191 additions and 3,910 deletions.
2 changes: 1 addition & 1 deletion .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"isRoot": true,
"tools": {
"csharpier": {
"version": "0.28.2",
"version": "0.29.1",
"commands": [
"dotnet-csharpier"
]
Expand Down
10 changes: 0 additions & 10 deletions .csharpierrc.json

This file was deleted.

21 changes: 5 additions & 16 deletions src/VCRC/Abstract/AbstractTwoStageVCRC.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,9 @@ public abstract class AbstractTwoStageVCRC : AbstractVCRC, ITwoStageVCRC
/// <param name="evaporator">Evaporator.</param>
/// <param name="compressor">Compressor.</param>
/// <param name="heatReleaser">Condenser or gas cooler.</param>
/// <exception cref="ValidationException">Only one refrigerant should be selected!</exception>
/// <exception cref="ValidationException">
/// Only one refrigerant should be selected!
/// </exception>
/// <exception cref="ValidationException">
/// Condensing temperature
/// should be greater than evaporating temperature!
/// Condensing temperature should be greater than evaporating temperature!
/// </exception>
protected AbstractTwoStageVCRC(
IEvaporator evaporator,
Expand All @@ -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
Expand All @@ -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);
}
24 changes: 3 additions & 21 deletions src/VCRC/Abstract/AbstractVCRC.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,9 @@ public abstract class AbstractVCRC : IVCRC
/// <param name="evaporator">Evaporator.</param>
/// <param name="compressor">Compressor.</param>
/// <param name="heatReleaser">Condenser or gas cooler.</param>
/// <exception cref="ValidationException">Only one refrigerant should be selected!</exception>
/// <exception cref="ValidationException">
/// Only one refrigerant should be selected!
/// </exception>
/// <exception cref="ValidationException">
/// Condensing temperature
/// should be greater than evaporating temperature!
/// Condensing temperature should be greater than evaporating temperature!
/// </exception>
protected AbstractVCRC(
IEvaporator evaporator,
Expand All @@ -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);
}
6 changes: 2 additions & 4 deletions src/VCRC/Abstract/IVCRC.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ public interface IVCRC : IEntropyAnalysable
public ICompressor Compressor { get; }

/// <summary>
/// Heat releaser (condenser for subcritical VCRC or
/// gas cooler for transcritical VCRC).
/// Heat releaser (condenser for subcritical VCRC or gas cooler for transcritical VCRC).
/// </summary>
public IHeatReleaser HeatReleaser { get; }

Expand All @@ -32,8 +31,7 @@ public interface IVCRC : IEntropyAnalysable
public IHeatReleaser? GasCooler { get; }

/// <summary>
/// <c>true</c> if VCRC is transcritical,
/// <c>false</c> if VCRC is subcritical.
/// <c>true</c> if VCRC is transcritical, <c>false</c> if VCRC is subcritical.
/// </summary>
public bool IsTranscritical { get; }

Expand Down
7 changes: 2 additions & 5 deletions src/VCRC/Abstract/Validators/VCRCValidator.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace VCRC;

internal class VCRCValidator : AbstractValidator<IVCRC>
internal sealed class VCRCValidator : AbstractValidator<IVCRC>
{
public VCRCValidator()
{
Expand All @@ -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!");
}
}
7 changes: 1 addition & 6 deletions src/VCRC/Components/Condenser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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 =>
Expand Down
12 changes: 3 additions & 9 deletions src/VCRC/Components/Economizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,15 @@
public record Economizer : EconomizerWithTPI, IEconomizer
{
/// <inheritdoc cref="Economizer"/>
/// <param name="temperatureDifference">
/// Temperature difference at the "cold" side.
/// </param>
/// <param name="temperatureDifference">Temperature difference at the "cold" side.</param>
/// <param name="superheat">Superheat.</param>
/// <exception cref="ValidationException">
/// 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!
/// </exception>
/// <exception cref="ValidationException">
/// Superheat in the economizer should be in [0;50] K!
/// </exception>
public Economizer(
TemperatureDelta temperatureDifference,
TemperatureDelta superheat
)
public Economizer(TemperatureDelta temperatureDifference, TemperatureDelta superheat)
: base(temperatureDifference)
{
Superheat = superheat.ToUnit(TemperatureDeltaUnit.Kelvin);
Expand Down
11 changes: 3 additions & 8 deletions src/VCRC/Components/EconomizerWithTPI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,13 @@
public record EconomizerWithTPI : IAuxiliaryHeatExchanger
{
/// <inheritdoc cref="EconomizerWithTPI"/>
/// <param name="temperatureDifference">
/// Temperature difference at the "cold" side.
/// </param>
/// <param name="temperatureDifference">Temperature difference at the "cold" side.</param>
/// <exception cref="ValidationException">
/// 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!
/// </exception>
public EconomizerWithTPI(TemperatureDelta temperatureDifference)
{
TemperatureDifference = temperatureDifference.ToUnit(
TemperatureDeltaUnit.Kelvin
);
TemperatureDifference = temperatureDifference.ToUnit(TemperatureDeltaUnit.Kelvin);
new EconomizerWithTPIValidator().ValidateAndThrow(this);
}

Expand Down
26 changes: 6 additions & 20 deletions src/VCRC/Components/Ejector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,9 @@ public Ejector(Ratio efficiency)
: this(efficiency, efficiency, efficiency) { }

/// <inheritdoc cref="Ejector"/>
/// <param name="nozzleEfficiency">
/// Isentropic efficiency of the nozzle.
/// </param>
/// <param name="suctionEfficiency">
/// Isentropic efficiency of the suction section.
/// </param>
/// <param name="diffuserEfficiency">
/// Isentropic efficiency of the diffuser.
/// </param>
/// <param name="nozzleEfficiency">Isentropic efficiency of the nozzle.</param>
/// <param name="suctionEfficiency">Isentropic efficiency of the suction section.</param>
/// <param name="diffuserEfficiency">Isentropic efficiency of the diffuser.</param>
/// <exception cref="ValidationException">
/// Isentropic efficiency of the nozzle should be in (0;100) %!
/// </exception>
Expand All @@ -38,11 +32,7 @@ public Ejector(Ratio efficiency)
/// <exception cref="ValidationException">
/// Isentropic efficiency of the diffuser should be in (0;100) %!
/// </exception>
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);
Expand All @@ -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);
}
48 changes: 12 additions & 36 deletions src/VCRC/Components/EjectorFlows.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,19 @@ public class EjectorFlows : IEjectorFlows
/// <param name="ejector">Ejector.</param>
/// <param name="nozzleInlet">Nozzle inlet.</param>
/// <param name="suctionInlet">Suction section inlet.</param>
/// <exception cref="ValidationException">Only one refrigerant should be selected!</exception>
/// <exception cref="ValidationException">
/// Only one refrigerant should be selected!
/// Ejector nozzle inlet pressure should be greater than suction inlet pressure!
/// </exception>
/// <exception cref="ValidationException">
/// Ejector nozzle inlet pressure
/// should be greater than suction inlet pressure!
/// </exception>
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();
}

Expand All @@ -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; }

Expand Down Expand Up @@ -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
)
);
Expand All @@ -98,9 +80,7 @@ double ToSolve(double flowRatio)
Input.Entropy(MixingInlet.Entropy),
Input.Enthalpy(
MixingInlet.Enthalpy
+ Ejector
.DiffuserEfficiency
.DecimalFractions
+ Ejector.DiffuserEfficiency.DecimalFractions
* MixingInletKineticEnergy
)
)
Expand All @@ -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();
}
7 changes: 1 addition & 6 deletions src/VCRC/Components/Evaporator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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 =>
Expand Down
Loading

0 comments on commit f315536

Please sign in to comment.