Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 2 additions & 33 deletions SharpFluids/SharpFluids files/Fluid.cs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ protected virtual void UpdateFluidConstants()
/// <summary>
/// Updates the values of the <see cref="Fluid"/> after an update
/// </summary>
protected virtual void UpdateValues()
public virtual void UpdateValues()
{
try
{
Expand Down Expand Up @@ -244,37 +244,6 @@ public virtual void SetLimitsToZero()
}


/// <summary>
/// Copy all the values from <paramref name="other"/> to this <see cref="Fluid"/>
/// </summary>
/// <param name="other"><see cref="Fluid"/> to be copied from</param>
public void Copy(Fluid other)
{
//Copying Refrigerant type
CopyType(other);

this.Enthalpy = other.Enthalpy;
this.MassFlow = other.MassFlow;
this.Mass = other.Mass;
this.Pressure = other.Pressure;
this.Temperature = other.Temperature;
this.Entropy = other.Entropy;
this.Quality = other.Quality;
this.Density = other.Density;
this.Cp = other.Cp;
this.Cv = other.Cv;
this.CriticalPressure = other.CriticalPressure;
this.DynamicViscosity = other.DynamicViscosity;
this.Conductivity = other.Conductivity;
this.Prandtl = other.Prandtl;
this.SoundSpeed = other.SoundSpeed;
this.SurfaceTension = other.SurfaceTension;
this.FailState = other.FailState;
this.MolarMass = other.MolarMass;
this.Compressibility = other.Compressibility;
this.InternalEnergy = other.InternalEnergy;
}

/// <summary>
/// Copy just the type of fluid from <paramref name="other"/> to this <see cref="Fluid"/>
/// </summary>
Expand Down Expand Up @@ -552,7 +521,7 @@ protected void CheckFractionLimits(double fraction)
}


private void CheckBeforeUpdate()
public void CheckBeforeUpdate()
{
if (REF is null)
SetNewMedia(Media);
Expand Down
4 changes: 2 additions & 2 deletions SharpFluids/SharpFluids files/FluidEnvelope.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ public partial class Fluid

for (Pressure i = CriticalPressure - Pressure.FromBars(1); i > LimitPressureMin; i -= Increment)
{
UpdatePX(i, 0);
this.UpdatePX(i, 0);

if (!FailState)
localListLiq.Add((i, Enthalpy));


UpdatePX(i, 1);
this.UpdatePX(i, 1);

if (!FailState)
localListGas.Add((i, Enthalpy));
Expand Down
33 changes: 33 additions & 0 deletions SharpFluids/SharpFluids files/FluidExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -130,5 +130,38 @@ public static Fluid RemovePower(this Fluid local, Power powerToBeRemoved)
local.AddPower(powerToBeRemoved * -1);
return local;
}

/// <summary>
/// Copy all the values from <paramref name="other"/> to this <see cref="Fluid"/>
/// </summary>
/// <param name="other"><see cref="Fluid"/> to be copied from</param>
public static Fluid Copy(this Fluid local, Fluid other)
{
//Copying Refrigerant type
local.CopyType(other);

local.Enthalpy = other.Enthalpy;
local.MassFlow = other.MassFlow;
local.Mass = other.Mass;
local.Pressure = other.Pressure;
local.Temperature = other.Temperature;
local.Entropy = other.Entropy;
local.Quality = other.Quality;
local.Density = other.Density;
local.Cp = other.Cp;
local.Cv = other.Cv;
local.CriticalPressure = other.CriticalPressure;
local.DynamicViscosity = other.DynamicViscosity;
local.Conductivity = other.Conductivity;
local.Prandtl = other.Prandtl;
local.SoundSpeed = other.SoundSpeed;
local.SurfaceTension = other.SurfaceTension;
local.FailState = other.FailState;
local.MolarMass = other.MolarMass;
local.Compressibility = other.Compressibility;
local.InternalEnergy = other.InternalEnergy;
return local;
}

}
}
29 changes: 15 additions & 14 deletions SharpFluids/SharpFluids files/FluidProperties .cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,68 +64,68 @@ public partial class Fluid
/// </summary>
[JsonProperty(PropertyName = "D", DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate)]
//[JsonProperty]
public Density Density { get; protected set; }
public Density Density { get; set; }


/// <summary>
/// Get the <see cref="UnitsNet.DynamicViscosity"/> of the <see cref="Fluid"/>.
/// </summary>
[JsonProperty(PropertyName = "DV", DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate)]
//[JsonProperty]
public DynamicViscosity DynamicViscosity { get; protected set; }
public DynamicViscosity DynamicViscosity { get; set; }

/// <summary>
/// Get the <see cref="UnitsNet.ThermalConductivity"/> of the <see cref="Fluid"/>.
/// <br> <see cref="UnitsNet.ThermalConductivity"/> is also just called Conductivity</br>
/// </summary>
[JsonProperty(PropertyName = "C", DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate)]
//[JsonProperty]
public ThermalConductivity Conductivity { get; protected set; }
public ThermalConductivity Conductivity { get; set; }

/// <summary>
/// Get the Cp of the <see cref="Fluid"/>.
/// <br>Engineers may refers to this as "Heat capacity at constant pressure".</br>
/// </summary>
[JsonProperty(PropertyName = "Cp", DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate)]
//[JsonProperty]
public SpecificEntropy Cp { get; protected set; }
public SpecificEntropy Cp { get; set; }

/// <summary>
/// Get the Cv of the <see cref="Fluid"/>.
/// <br>Engineers may refers to this as "Heat capacity at constant volume".</br>
/// </summary>
[JsonProperty(PropertyName = "Cv", DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate)]
//[JsonProperty]
public SpecificEntropy Cv { get; protected set; }
public SpecificEntropy Cv { get; set; }

/// <summary>
/// Get the <see cref="UnitsNet.Speed"/> of Sound of the <see cref="Fluid"/>.
/// </summary>
[JsonProperty(PropertyName = "SS", DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate)]
//[JsonProperty]
public Speed SoundSpeed { get; protected set; }
public Speed SoundSpeed { get; set; }

/// <summary>
/// Get the Surface Tension of the <see cref="Fluid"/>.
/// <br>This is only valid when the <see cref="Fluid"/> is a mixture of gas and liquid!</br>
/// </summary>
[JsonProperty(PropertyName = "ST", DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate)]
//[JsonProperty]
public ForcePerLength SurfaceTension { get; protected set; }
public ForcePerLength SurfaceTension { get; set; }

/// <summary>
/// Get the <see cref="UnitsNet.MolarMass"/> of the <see cref="Fluid"/>.
/// </summary>
[JsonProperty(PropertyName = "MM", DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate)]
//[JsonProperty]
public MolarMass MolarMass { get; protected set; }
public MolarMass MolarMass { get; set; }

/// <summary>
/// Get the Internal Energy of the <see cref="Fluid"/>.
/// </summary>
[JsonProperty(PropertyName = "IE", DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate)]
//[JsonProperty]
public SpecificEnergy InternalEnergy { get; protected set; }
public SpecificEnergy InternalEnergy { get; set; }

/// <summary>
/// Get the Prandtl number of the <see cref="Fluid"/>.
Expand All @@ -134,7 +134,7 @@ public partial class Fluid
/// </summary>
[JsonProperty(PropertyName = "Pl", DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate)]
//[JsonProperty]
public double Prandtl { get; protected set; }
public double Prandtl { get; set; }

/// <summary>
/// Get the Compressibility of the <see cref="Fluid"/>.
Expand All @@ -143,7 +143,7 @@ public partial class Fluid
/// </summary>
[JsonProperty(PropertyName = "Co", DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate)]
//[JsonProperty]
public double Compressibility { get; protected set; }
public double Compressibility { get; set; }

/// <summary>
/// Get the Quality of the <see cref="Fluid"/>.
Expand All @@ -154,7 +154,7 @@ public partial class Fluid
/// </summary>
[JsonProperty(PropertyName = "Q", DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate)]
//[JsonProperty]
public double Quality { get; protected set; }
public double Quality { get; set; }



Expand Down Expand Up @@ -373,7 +373,7 @@ public VolumeFlow VolumeFlow
/// </summary>
[JsonProperty(PropertyName = "CP", DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate)]
//[JsonProperty]
public Pressure CriticalPressure { get; protected set; }
public Pressure CriticalPressure { get; set; }

/// <summary>
/// This library's minimum <see cref="UnitsNet.Pressure"/> for the selected <see cref="Fluid"/>.
Expand Down Expand Up @@ -413,7 +413,8 @@ public VolumeFlow VolumeFlow
/// <summary>
/// Used to access the CoolProp DLL.
/// </summary>
protected AbstractState REF;
[JsonIgnore]
public AbstractState REF;


/// <summary>
Expand Down
Loading