|
2 | 2 |
|
3 | 3 | namespace SharpProp; |
4 | 4 |
|
| 5 | +/// <summary> |
| 6 | +/// Pure/pseudo-pure fluid or binary mixture. |
| 7 | +/// </summary> |
| 8 | +public interface IFluid |
| 9 | + : IAbstractFluid, |
| 10 | + IClonable<IFluid>, |
| 11 | + IEquatable<IFluid>, |
| 12 | + IFactory<IFluid>, |
| 13 | + IJsonable |
| 14 | +{ |
| 15 | + /// <summary> |
| 16 | + /// Selected fluid name. |
| 17 | + /// </summary> |
| 18 | + FluidsList Name { get; } |
| 19 | + |
| 20 | + /// <summary> |
| 21 | + /// Mass-based or volume-based fraction |
| 22 | + /// for binary mixtures (by default, %). |
| 23 | + /// </summary> |
| 24 | + Ratio Fraction { get; } |
| 25 | + |
| 26 | + /// <summary> |
| 27 | + /// Type of CoolProp backend. |
| 28 | + /// </summary> |
| 29 | + string CoolPropBackend { get; } |
| 30 | + |
| 31 | + /// <summary> |
| 32 | + /// Specify the phase state for all further calculations. |
| 33 | + /// </summary> |
| 34 | + /// <param name="phase">Phase state.</param> |
| 35 | + /// <returns>Current fluid instance.</returns> |
| 36 | + IFluid SpecifyPhase(Phases phase); |
| 37 | + |
| 38 | + /// <summary> |
| 39 | + /// Unspecify the phase state and go back to calculating it based on the inputs. |
| 40 | + /// </summary> |
| 41 | + /// <returns>Current fluid instance.</returns> |
| 42 | + IFluid UnspecifyPhase(); |
| 43 | + |
| 44 | + /// <summary> |
| 45 | + /// Returns a new fluid instance with a defined state. |
| 46 | + /// </summary> |
| 47 | + /// <param name="firstInput">First input property.</param> |
| 48 | + /// <param name="secondInput">Second input property.</param> |
| 49 | + /// <returns>A new fluid instance with a defined state.</returns> |
| 50 | + /// <exception cref="ArgumentException">Need to define 2 unique inputs!</exception> |
| 51 | + IFluid WithState(IKeyedInput<Parameters> firstInput, IKeyedInput<Parameters> secondInput); |
| 52 | + |
| 53 | + /// <summary> |
| 54 | + /// The process of isentropic compression to given pressure. |
| 55 | + /// </summary> |
| 56 | + /// <param name="pressure">Pressure.</param> |
| 57 | + /// <returns>The state of the fluid at the end of the process.</returns> |
| 58 | + /// <exception cref="ArgumentException"> |
| 59 | + /// Compressor outlet pressure should be higher than inlet pressure! |
| 60 | + /// </exception> |
| 61 | + IFluid IsentropicCompressionTo(Pressure pressure); |
| 62 | + |
| 63 | + /// <summary> |
| 64 | + /// The process of compression to given pressure. |
| 65 | + /// </summary> |
| 66 | + /// <param name="pressure">Pressure.</param> |
| 67 | + /// <param name="isentropicEfficiency">Compressor isentropic efficiency.</param> |
| 68 | + /// <returns>The state of the fluid at the end of the process.</returns> |
| 69 | + /// <exception cref="ArgumentException"> |
| 70 | + /// Compressor outlet pressure should be higher than inlet pressure! |
| 71 | + /// </exception> |
| 72 | + /// <exception cref="ArgumentException">Invalid compressor isentropic efficiency!</exception> |
| 73 | + IFluid CompressionTo(Pressure pressure, Ratio isentropicEfficiency); |
| 74 | + |
| 75 | + /// <summary> |
| 76 | + /// The process of isenthalpic expansion to given pressure. |
| 77 | + /// </summary> |
| 78 | + /// <param name="pressure">Pressure.</param> |
| 79 | + /// <returns>The state of the fluid at the end of the process.</returns> |
| 80 | + /// <exception cref="ArgumentException"> |
| 81 | + /// Expansion valve outlet pressure should be lower than inlet pressure! |
| 82 | + /// </exception> |
| 83 | + IFluid IsenthalpicExpansionTo(Pressure pressure); |
| 84 | + |
| 85 | + /// <summary> |
| 86 | + /// The process of isentropic expansion to given pressure. |
| 87 | + /// </summary> |
| 88 | + /// <param name="pressure">Pressure.</param> |
| 89 | + /// <returns>The state of the fluid at the end of the process.</returns> |
| 90 | + /// <exception cref="ArgumentException"> |
| 91 | + /// Expander outlet pressure should be lower than inlet pressure! |
| 92 | + /// </exception> |
| 93 | + IFluid IsentropicExpansionTo(Pressure pressure); |
| 94 | + |
| 95 | + /// <summary> |
| 96 | + /// The process of expansion to given pressure. |
| 97 | + /// </summary> |
| 98 | + /// <param name="pressure">Pressure.</param> |
| 99 | + /// <param name="isentropicEfficiency">Expander isentropic efficiency.</param> |
| 100 | + /// <returns>The state of the fluid at the end of the process.</returns> |
| 101 | + /// <exception cref="ArgumentException"> |
| 102 | + /// Expander outlet pressure should be lower than inlet pressure! |
| 103 | + /// </exception> |
| 104 | + /// <exception cref="ArgumentException">Invalid expander isentropic efficiency!</exception> |
| 105 | + IFluid ExpansionTo(Pressure pressure, Ratio isentropicEfficiency); |
| 106 | + |
| 107 | + /// <summary> |
| 108 | + /// The process of cooling to given temperature. |
| 109 | + /// </summary> |
| 110 | + /// <param name="temperature">Temperature.</param> |
| 111 | + /// <param name="pressureDrop">Pressure drop in the heat exchanger (optional).</param> |
| 112 | + /// <returns>The state of the fluid at the end of the process.</returns> |
| 113 | + /// <exception cref="ArgumentException"> |
| 114 | + /// During the cooling process, the temperature should decrease! |
| 115 | + /// </exception> |
| 116 | + /// <exception cref="ArgumentException">Invalid pressure drop in the heat exchanger!</exception> |
| 117 | + IFluid CoolingTo(Temperature temperature, Pressure? pressureDrop = null); |
| 118 | + |
| 119 | + /// <summary> |
| 120 | + /// The process of cooling to given enthalpy. |
| 121 | + /// </summary> |
| 122 | + /// <param name="enthalpy">Enthalpy.</param> |
| 123 | + /// <param name="pressureDrop">Pressure drop in the heat exchanger (optional).</param> |
| 124 | + /// <returns>The state of the fluid at the end of the process.</returns> |
| 125 | + /// <exception cref="ArgumentException"> |
| 126 | + /// During the cooling process, the enthalpy should decrease! |
| 127 | + /// </exception> |
| 128 | + /// <exception cref="ArgumentException">Invalid pressure drop in the heat exchanger!</exception> |
| 129 | + IFluid CoolingTo(SpecificEnergy enthalpy, Pressure? pressureDrop = null); |
| 130 | + |
| 131 | + /// <summary> |
| 132 | + /// The process of heating to given temperature. |
| 133 | + /// </summary> |
| 134 | + /// <param name="temperature">Temperature.</param> |
| 135 | + /// <param name="pressureDrop">Pressure drop in the heat exchanger (optional).</param> |
| 136 | + /// <returns>The state of the fluid at the end of the process.</returns> |
| 137 | + /// <exception cref="ArgumentException"> |
| 138 | + /// During the heating process, the temperature should increase! |
| 139 | + /// </exception> |
| 140 | + /// <exception cref="ArgumentException">Invalid pressure drop in the heat exchanger!</exception> |
| 141 | + IFluid HeatingTo(Temperature temperature, Pressure? pressureDrop = null); |
| 142 | + |
| 143 | + /// <summary> |
| 144 | + /// The process of heating to given enthalpy. |
| 145 | + /// </summary> |
| 146 | + /// <param name="enthalpy">Enthalpy.</param> |
| 147 | + /// <param name="pressureDrop">Pressure drop in the heat exchanger (optional).</param> |
| 148 | + /// <returns>The state of the fluid at the end of the process.</returns> |
| 149 | + /// <exception cref="ArgumentException"> |
| 150 | + /// During the heating process, the enthalpy should increase! |
| 151 | + /// </exception> |
| 152 | + /// <exception cref="ArgumentException">Invalid pressure drop in the heat exchanger!</exception> |
| 153 | + IFluid HeatingTo(SpecificEnergy enthalpy, Pressure? pressureDrop = null); |
| 154 | + |
| 155 | + /// <summary> |
| 156 | + /// Returns a bubble point at given pressure. |
| 157 | + /// </summary> |
| 158 | + /// <param name="pressure">Pressure.</param> |
| 159 | + /// <returns>A bubble point at given pressure.</returns> |
| 160 | + IFluid BubblePointAt(Pressure pressure); |
| 161 | + |
| 162 | + /// <summary> |
| 163 | + /// Returns a bubble point at given temperature. |
| 164 | + /// </summary> |
| 165 | + /// <param name="temperature">Temperature.</param> |
| 166 | + /// <returns>A bubble point at given temperature.</returns> |
| 167 | + IFluid BubblePointAt(Temperature temperature); |
| 168 | + |
| 169 | + /// <summary> |
| 170 | + /// Returns a dew point at given pressure. |
| 171 | + /// </summary> |
| 172 | + /// <param name="pressure">Pressure.</param> |
| 173 | + /// <returns>A dew point at given pressure.</returns> |
| 174 | + IFluid DewPointAt(Pressure pressure); |
| 175 | + |
| 176 | + /// <summary> |
| 177 | + /// Returns a dew point at given temperature. |
| 178 | + /// </summary> |
| 179 | + /// <param name="temperature">Temperature.</param> |
| 180 | + /// <returns>A dew point at given temperature.</returns> |
| 181 | + IFluid DewPointAt(Temperature temperature); |
| 182 | + |
| 183 | + /// <summary> |
| 184 | + /// Returns a two-phase point at given pressure. |
| 185 | + /// </summary> |
| 186 | + /// <param name="pressure">Pressure.</param> |
| 187 | + /// <param name="quality">Vapor quality.</param> |
| 188 | + /// <returns>Two-phase point at given pressure.</returns> |
| 189 | + IFluid TwoPhasePointAt(Pressure pressure, Ratio quality); |
| 190 | + |
| 191 | + /// <summary> |
| 192 | + /// The mixing process. |
| 193 | + /// </summary> |
| 194 | + /// <param name="firstSpecificMassFlow"> |
| 195 | + /// Specific mass flow rate of the fluid at the first state. |
| 196 | + /// </param> |
| 197 | + /// <param name="first">Fluid at the first state.</param> |
| 198 | + /// <param name="secondSpecificMassFlow"> |
| 199 | + /// Specific mass flow rate of the fluid at the second state. |
| 200 | + /// </param> |
| 201 | + /// <param name="second">Fluid at the second state.</param> |
| 202 | + /// <returns>The state of the fluid at the end of the process.</returns> |
| 203 | + /// <exception cref="ArgumentException"> |
| 204 | + /// The mixing process is possible only for the same fluids! |
| 205 | + /// </exception> |
| 206 | + /// <exception cref="ArgumentException"> |
| 207 | + /// The mixing process is possible only for flows with the same pressure! |
| 208 | + /// </exception> |
| 209 | + IFluid Mixing( |
| 210 | + Ratio firstSpecificMassFlow, |
| 211 | + IFluid first, |
| 212 | + Ratio secondSpecificMassFlow, |
| 213 | + IFluid second |
| 214 | + ); |
| 215 | +} |
| 216 | + |
5 | 217 | /// <inheritdoc cref="IFluid"/> |
6 | 218 | public class Fluid : AbstractFluid, IFluid |
7 | 219 | { |
|
0 commit comments