static void Main(string[] args) { Substance s = new Substance(new Pressure(5), new Enthalpy(3500)); Console.WriteLine(s.ToString()); s = new Substance(new Pressure(2), new Entropy(6)); Console.WriteLine(s.ToString()); s = new Substance(new Pressure(2, Pressure.Measure.MPa), new Entropy(6, Entropy.Measure.kJ_kgK)); Console.WriteLine(s.ToString()); s = new Substance(1500, 0.5); Console.WriteLine(s.ToString()); s = new Substance(new Temperature(150, Temperature.Measure.Celsius), Substance.State.Steam); Console.WriteLine(s.ToString()); s = new Substance(new Pressure(20, Pressure.Measure.bar), Substance.State.Water); Console.WriteLine(s.ToString()); Console.Read(); }
public void Region2aBackwardEquation_Tps_Test() { //Arrange double entropy1 = 7.5; //kJ/kg double pressure1 = 0.1; //MPa double entropy2 = 8; //kJ/kg double pressure2 = 0.1; //MPa double entropy3 = 8; //kJ/kg double pressure3 = 2.5; //MPa Substance substance1; Substance substance2; Substance substance3; //Act substance1 = new Substance(new Pressure(pressure1), new Entropy(entropy1)); substance2 = new Substance(new Pressure(pressure2), new Entropy(entropy2)); substance3 = new Substance(new Pressure(pressure3), new Entropy(entropy3)); //Assert Assert.AreEqual(0.399517097 * Math.Pow(10, 3), (double)substance1.Temperature.Value, 0.0001, "Substance1: Substance has wrong temperature"); Assert.AreEqual(1.824, (double)substance1.SpecificVolume, 0.001, "Substance1: Substance has wrong specific volume"); Assert.AreEqual(2729, (double)substance1.SpecificEnthalpy.Value, 0.5, "Substance1: Substance has wrong specific enthalpy"); Assert.AreEqual(2547, (double)substance1.SpecificInternalEnergy, 0.5, "Substance1: Substance has wrong specific internal energy"); Assert.AreEqual(7.5, (double)substance1.SpecificEntropy.Value, 0.1, "Substance1: Substance has wrong specific specific entropy"); Assert.AreEqual(2.009, (double)substance1.SpecificIsobaricHeatCapacity, 0.001, "Substance1: Substance has wrong specific isobaric heat capacity"); Assert.AreEqual(490, (double)substance1.SpeedOfSound, 0.5, "Substance1: Substance has wrong speed of sound"); Assert.AreEqual(1.509, (double)substance1.SpecificIsochoricHeatCapacity, 0.001, "Substance1: Substance has wrong specific isochoric heat capacity"); Assert.AreEqual(0.514127081 * Math.Pow(10, 3), (double)substance2.Temperature.Value, 0.0001, "Substance2: Substance has wrong temperature"); Assert.AreEqual(2.364, (double)substance2.SpecificVolume, 0.001, "Substance2: Substance has wrong specific volume"); Assert.AreEqual(2957, (double)substance2.SpecificEnthalpy.Value, 0.5, "Substance2: Substance has wrong specific enthalpy"); Assert.AreEqual(2720, (double)substance2.SpecificInternalEnergy, 0.5, "Substance2: Substance has wrong specific internal energy"); Assert.AreEqual(8, (double)substance2.SpecificEntropy.Value, 0.01, "Substance2: Substance has wrong specific specific entropy"); Assert.AreEqual(1.986, (double)substance2.SpecificIsobaricHeatCapacity, 0.001, "Substance2: Substance has wrong specific isobaric heat capacity"); Assert.AreEqual(555.8, (double)substance2.SpeedOfSound, 0.1, "Substance2: Substance has wrong speed of sound"); Assert.AreEqual(1.514, (double)substance2.SpecificIsochoricHeatCapacity, 0.001, "Substance2: Substance has wrong specific isochoric heat capacity"); Assert.AreEqual(0.103984917 * Math.Pow(10, 4), (double)substance3.Temperature.Value, 0.0001, "Substance3: Substance has wrong temperature"); Assert.AreEqual(0.1909, (double)substance3.SpecificVolume, 0.0001, "Substance3: Substance has wrong specific volume"); Assert.AreEqual(4071, (double)substance3.SpecificEnthalpy.Value, 0.5, "Substance3: Substance has wrong specific enthalpy"); Assert.AreEqual(3593, (double)substance3.SpecificInternalEnergy, 0.5, "Substance3: Substance has wrong specific internal energy"); Assert.AreEqual(8, (double)substance3.SpecificEntropy.Value, 0.01, "Substance3: Substance has wrong specific specific entropy"); Assert.AreEqual(2.35, (double)substance3.SpecificIsobaricHeatCapacity, 0.01, "Substance3: Substance has wrong specific isobaric heat capacity"); Assert.AreEqual(772.6, (double)substance3.SpeedOfSound, 0.1, "Substance3: Substance has wrong speed of sound"); Assert.AreEqual(1.869, (double)substance3.SpecificIsochoricHeatCapacity, 0.001, "Substance3: Substance has wrong specific isochoric heat capacity"); }
public void Region2cBackwardEquation_Tps_Test() { //Arrange double entropy1 = 5.75; //kJ/kg double pressure1 = 20; //MPa double entropy2 = 5.25; //kJ/kg double pressure2 = 80; //MPa double entropy3 = 5.75; //kJ/kg double pressure3 = 80; //MPa Substance substance1; Substance substance2; Substance substance3; //Act substance1 = new Substance(new Pressure(pressure1), new Entropy(entropy1)); substance2 = new Substance(new Pressure(pressure2), new Entropy(entropy2)); substance3 = new Substance(new Pressure(pressure3), new Entropy(entropy3)); //Assert Assert.AreEqual(0.697992849 * Math.Pow(10, 3), (double)substance1.Temperature.Value, 0.0001, "Substance1: Substance has wrong temperature"); Assert.AreEqual(1.147 * Math.Pow(10, -2), (double)substance1.SpecificVolume, 0.001, "Substance1: Substance has wrong specific volume"); Assert.AreEqual(2952, (double)substance1.SpecificEnthalpy.Value, 0.5, "Substance1: Substance has wrong specific enthalpy"); Assert.AreEqual(2723, (double)substance1.SpecificInternalEnergy, 0.5, "Substance1: Substance has wrong specific internal energy"); Assert.AreEqual(5.75, (double)substance1.SpecificEntropy.Value, 0.01, "Substance1: Substance has wrong specific specific entropy"); Assert.AreEqual(4.769, (double)substance1.SpecificIsobaricHeatCapacity, 0.001, "Substance1: Substance has wrong specific isobaric heat capacity"); Assert.AreEqual(545.2, (double)substance1.SpeedOfSound, 0.1, "Substance1: Substance has wrong speed of sound"); Assert.AreEqual(2.417, (double)substance1.SpecificIsochoricHeatCapacity, 0.001, "Substance1: Substance has wrong specific isochoric heat capacity"); Assert.AreEqual(0.854011484 * Math.Pow(10, 3), (double)substance2.Temperature.Value, 0.0001, "Substance2: Substance has wrong temperature"); Assert.AreEqual(3.146 * Math.Pow(10, -3), (double)substance2.SpecificVolume, 0.001, "Substance2: Substance has wrong specific volume"); Assert.AreEqual(2887, (double)substance2.SpecificEnthalpy.Value, 0.5, "Substance2: Substance has wrong specific enthalpy"); Assert.AreEqual(2635, (double)substance2.SpecificInternalEnergy, 0.5, "Substance2: Substance has wrong specific internal energy"); Assert.AreEqual(5.25, (double)substance2.SpecificEntropy.Value, 0.01, "Substance2: Substance has wrong specific specific entropy"); Assert.AreEqual(5.456, (double)substance2.SpecificIsobaricHeatCapacity, 0.001, "Substance2: Substance has wrong specific isobaric heat capacity"); Assert.AreEqual(695, (double)substance2.SpeedOfSound, 0.1, "Substance2: Substance has wrong speed of sound"); Assert.AreEqual(2.488, (double)substance2.SpecificIsochoricHeatCapacity, 0.001, "Substance2: Substance has wrong specific isochoric heat capacity"); Assert.AreEqual(0.949017998 * Math.Pow(10, 3), (double)substance3.Temperature.Value, 0.0001, "Substance3: Substance has wrong temperature"); Assert.AreEqual(4.261 * Math.Pow(10, -3), (double)substance3.SpecificVolume, 0.0001, "Substance3: Substance has wrong specific volume"); Assert.AreEqual(3336, (double)substance3.SpecificEnthalpy.Value, 0.5, "Substance3: Substance has wrong specific enthalpy"); Assert.AreEqual(2995, (double)substance3.SpecificInternalEnergy, 0.5, "Substance3: Substance has wrong specific internal energy"); Assert.AreEqual(5.75, (double)substance3.SpecificEntropy.Value, 0.01, "Substance3: Substance has wrong specific specific entropy"); Assert.AreEqual(4.129, (double)substance3.SpecificIsobaricHeatCapacity, 0.01, "Substance3: Substance has wrong specific isobaric heat capacity"); Assert.AreEqual(735, (double)substance3.SpeedOfSound, 0.1, "Substance3: Substance has wrong speed of sound"); Assert.AreEqual(2.297, (double)substance3.SpecificIsochoricHeatCapacity, 0.001, "Substance3: Substance has wrong specific isochoric heat capacity"); }
public void Region2_Test() { //Arrange double temperature1 = 300; //K double pressure1 = 0.0035; //MPa double temperature2 = 700; //K double pressure2 = 0.0035; //MPa double temperature3 = 700; //K double pressure3 = 30; //MPa Substance substance1; Substance substance2; Substance substance3; //Act substance1 = new Substance(temperature1, pressure1); substance2 = new Substance(temperature2, pressure2); substance3 = new Substance(temperature3, pressure3); //Assert Assert.AreEqual(0.394913866 * Math.Pow(10, 2), (double)substance1.SpecificVolume, 0.0000001, "Substance1: Substance has wrong specific volume"); Assert.AreEqual(0.254991145 * Math.Pow(10, 4), (double)substance1.SpecificEnthalpy.Value, 0.0001, "Substance1: Substance has wrong specific enthalpy"); Assert.AreEqual(0.241169160 * Math.Pow(10, 4), (double)substance1.SpecificInternalEnergy, 0.0001, "Substance1: Substance has wrong specific internal energy"); Assert.AreEqual(8.52238967, (double)substance1.SpecificEntropy.Value, 0.0000001, "Substance1: Substance has wrong specific specific entropy"); Assert.AreEqual(0.191300162 * Math.Pow(10, 1), (double)substance1.SpecificIsobaricHeatCapacity, 0.000001, "Substance1: Substance has wrong specific isobaric heat capacity"); Assert.AreEqual(0.427920172 * Math.Pow(10, 3), (double)substance1.SpeedOfSound, 0.001, "Substance1: Substance has wrong specific speed of sound"); Assert.AreEqual(1.441, (double)substance1.SpecificIsochoricHeatCapacity, 0.001, "Substance1: Substance has wrong specific isochoric heat capacity"); Assert.AreEqual(0.923015898 * Math.Pow(10, 2), (double)substance2.SpecificVolume, 0.0000001, "Substance2: Substance has wrong specific volume"); Assert.AreEqual(0.333568375 * Math.Pow(10, 4), (double)substance2.SpecificEnthalpy.Value, 0.0001, "Substance2: Substance has wrong specific enthalpy"); Assert.AreEqual(0.301262819 * Math.Pow(10, 4), (double)substance2.SpecificInternalEnergy, 0.0001, "Substance2: Substance has wrong specific internal energy"); Assert.AreEqual(0.101749996 * Math.Pow(10, 2), (double)substance2.SpecificEntropy.Value, 0.0000001, "Substance2: Substance has wrong specific specific entropy"); Assert.AreEqual(0.208141274 * Math.Pow(10, 1), (double)substance2.SpecificIsobaricHeatCapacity, 0.000001, "Substance2: Substance has wrong specific isobaric heat capacity"); Assert.AreEqual(0.644289068 * Math.Pow(10, 3), (double)substance2.SpeedOfSound, 0.001, "Substance2: Substance has wrong specific speed of sound"); Assert.AreEqual(1.620, (double)substance2.SpecificIsochoricHeatCapacity, 0.001, "Substance2: Substance has wrong specific isochoric heat capacity"); Assert.AreEqual(0.542946619 * Math.Pow(10, -2), (double)substance3.SpecificVolume, 0.0000001, "Substance3: Substance has wrong specific volume"); Assert.AreEqual(0.263149474 * Math.Pow(10, 4), (double)substance3.SpecificEnthalpy.Value, 0.0001, "Substance3: Substance has wrong specific enthalpy"); Assert.AreEqual(0.246861076 * Math.Pow(10, 4), (double)substance3.SpecificInternalEnergy, 0.0001, "Substance3: Substance has wrong specific internal energy"); Assert.AreEqual(0.517540298 * Math.Pow(10, 1), (double)substance3.SpecificEntropy.Value, 0.0000001, "Substance3: Substance has wrong specific specific entropy"); Assert.AreEqual(0.103505092 * Math.Pow(10, 2), (double)substance3.SpecificIsobaricHeatCapacity, 0.000001, "Substance3: Substance has wrong specific isobaric heat capacity"); Assert.AreEqual(0.480386523 * Math.Pow(10, 3), (double)substance3.SpeedOfSound, 0.001, "Substance3: Substance has wrong specific speed of sound"); Assert.AreEqual(2.976, (double)substance3.SpecificIsochoricHeatCapacity, 0.01, "Substance3: Substance has wrong specific isochoric heat capacity"); }
public void Region2bBackwardEquation_Tps_Test() { //Arrange double entropy1 = 6; //kJ/kg double pressure1 = 8; //MPa double entropy2 = 7.5; //kJ/kg double pressure2 = 8; //MPa double entropy3 = 6; //kJ/kg double pressure3 = 90; //MPa Substance substance1; Substance substance2; Substance substance3; //Act substance1 = new Substance(new Pressure(pressure1), new Entropy(entropy1)); substance2 = new Substance(new Pressure(pressure2), new Entropy(entropy2)); substance3 = new Substance(new Pressure(pressure3), new Entropy(entropy3)); //Assert Assert.AreEqual(0.600484040 * Math.Pow(10, 3), (double)substance1.Temperature.Value, 0.0001, "Substance1: Substance has wrong temperature"); Assert.AreEqual(2.767 * Math.Pow(10, -2), (double)substance1.SpecificVolume, 0.001, "Substance1: Substance has wrong specific volume"); Assert.AreEqual(2907, (double)substance1.SpecificEnthalpy.Value, 0.5, "Substance1: Substance has wrong specific enthalpy"); Assert.AreEqual(2686, (double)substance1.SpecificInternalEnergy, 0.5, "Substance1: Substance has wrong specific internal energy"); Assert.AreEqual(6, (double)substance1.SpecificEntropy.Value, 0.1, "Substance1: Substance has wrong specific specific entropy"); Assert.AreEqual(3.84, (double)substance1.SpecificIsobaricHeatCapacity, 0.01, "Substance1: Substance has wrong specific isobaric heat capacity"); Assert.AreEqual(530.7, (double)substance1.SpeedOfSound, 0.5, "Substance1: Substance has wrong speed of sound"); Assert.AreEqual(2.276, (double)substance1.SpecificIsochoricHeatCapacity, 0.001, "Substance1: Substance has wrong specific isochoric heat capacity"); Assert.AreEqual(0.106495556 * Math.Pow(10, 4), (double)substance2.Temperature.Value, 0.0001, "Substance2: Substance has wrong temperature"); Assert.AreEqual(6.05 * Math.Pow(10, -2), (double)substance2.SpecificVolume, 0.001, "Substance2: Substance has wrong specific volume"); Assert.AreEqual(4104, (double)substance2.SpecificEnthalpy.Value, 0.5, "Substance2: Substance has wrong specific enthalpy"); Assert.AreEqual(3620, (double)substance2.SpecificInternalEnergy, 0.5, "Substance2: Substance has wrong specific internal energy"); Assert.AreEqual(7.5, (double)substance2.SpecificEntropy.Value, 0.01, "Substance2: Substance has wrong specific specific entropy"); Assert.AreEqual(2.429, (double)substance2.SpecificIsobaricHeatCapacity, 0.001, "Substance2: Substance has wrong specific isobaric heat capacity"); Assert.AreEqual(778.9, (double)substance2.SpeedOfSound, 0.1, "Substance2: Substance has wrong speed of sound"); Assert.AreEqual(1.909, (double)substance2.SpecificIsochoricHeatCapacity, 0.001, "Substance2: Substance has wrong specific isochoric heat capacity"); Assert.AreEqual(0.103801126 * Math.Pow(10, 4), (double)substance3.Temperature.Value, 0.0001, "Substance3: Substance has wrong temperature"); Assert.AreEqual(4.544 * Math.Pow(10, -3), (double)substance3.SpecificVolume, 0.0001, "Substance3: Substance has wrong specific volume"); Assert.AreEqual(3628, (double)substance3.SpecificEnthalpy.Value, 0.5, "Substance3: Substance has wrong specific enthalpy"); Assert.AreEqual(3219, (double)substance3.SpecificInternalEnergy, 0.5, "Substance3: Substance has wrong specific internal energy"); Assert.AreEqual(6, (double)substance3.SpecificEntropy.Value, 0.01, "Substance3: Substance has wrong specific specific entropy"); Assert.AreEqual(3.633, (double)substance3.SpecificIsobaricHeatCapacity, 0.01, "Substance3: Substance has wrong specific isobaric heat capacity"); Assert.AreEqual(793.2, (double)substance3.SpeedOfSound, 0.1, "Substance3: Substance has wrong speed of sound"); Assert.AreEqual(2.229, (double)substance3.SpecificIsochoricHeatCapacity, 0.001, "Substance3: Substance has wrong specific isochoric heat capacity"); }
public void Region2cBackwardEquation_Tph_Test() { //Arrange double enthalpy1 = 2700; //kJ/kg double pressure1 = 40; //MPa double enthalpy2 = 2700; //kJ/kg double pressure2 = 60; //MPa double enthalpy3 = 3200; //kJ/kg double pressure3 = 60; //MPa Substance substance1; Substance substance2; Substance substance3; //Act substance1 = new Substance(new Pressure(pressure1), new Enthalpy(enthalpy1)); substance2 = new Substance(new Pressure(pressure2), new Enthalpy(enthalpy2)); substance3 = new Substance(new Pressure(pressure3), new Enthalpy(enthalpy3)); //Assert Assert.AreEqual(0.743056411 * Math.Pow(10, 3), (double)substance1.Temperature.Value, 0.0001, "Substance1: Substance has wrong temperature"); Assert.AreEqual(4.564 * Math.Pow(10, -3), (double)substance1.SpecificVolume, 0.001, "Substance1: Substance has wrong specific volume"); Assert.AreEqual(2700, (double)substance1.SpecificEnthalpy.Value, 0.5, "Substance1: Substance has wrong specific enthalpy"); Assert.AreEqual(2517, (double)substance1.SpecificInternalEnergy, 0.5, "Substance1: Substance has wrong specific internal energy"); Assert.AreEqual(5.202, (double)substance1.SpecificEntropy.Value, 0.001, "Substance1: Substance has wrong specific specific entropy"); Assert.AreEqual(8.157, (double)substance1.SpecificIsobaricHeatCapacity, 0.001, "Substance1: Substance has wrong specific isobaric heat capacity"); Assert.AreEqual(528.8, (double)substance1.SpeedOfSound, 0.1, "Substance1: Substance has wrong speed of sound"); Assert.AreEqual(2.757, (double)substance1.SpecificIsochoricHeatCapacity, 0.001, "Substance1: Substance has wrong specific isochoric heat capacity"); Assert.AreEqual(0.791137067 * Math.Pow(10, 3), (double)substance2.Temperature.Value, 0.0001, "Substance2: Substance has wrong temperature"); Assert.AreEqual(3.319 * Math.Pow(10, -3), (double)substance2.SpecificVolume, 0.001, "Substance2: Substance has wrong specific volume"); Assert.AreEqual(2700, (double)substance2.SpecificEnthalpy.Value, 0.5, "Substance2: Substance has wrong specific enthalpy"); Assert.AreEqual(2501, (double)substance2.SpecificInternalEnergy, 0.5, "Substance2: Substance has wrong specific internal energy"); Assert.AreEqual(5.101, (double)substance2.SpecificEntropy.Value, 0.001, "Substance2: Substance has wrong specific specific entropy"); Assert.AreEqual(6.862, (double)substance2.SpecificIsobaricHeatCapacity, 0.001, "Substance2: Substance has wrong specific isobaric heat capacity"); Assert.AreEqual(607.8, (double)substance2.SpeedOfSound, 0.1, "Substance2: Substance has wrong speed of sound"); Assert.AreEqual(2.635, (double)substance2.SpecificIsochoricHeatCapacity, 0.001, "Substance2: Substance has wrong specific isochoric heat capacity"); Assert.AreEqual(0.882756860 * Math.Pow(10, 3), (double)substance3.Temperature.Value, 0.0001, "Substance3: Substance has wrong temperature"); Assert.AreEqual(4.987 * Math.Pow(10, -3), (double)substance3.SpecificVolume, 0.001, "Substance3: Substance has wrong specific volume"); Assert.AreEqual(3200, (double)substance3.SpecificEnthalpy.Value, 0.5, "Substance3: Substance has wrong specific enthalpy"); Assert.AreEqual(2901, (double)substance3.SpecificInternalEnergy, 0.5, "Substance3: Substance has wrong specific internal energy"); Assert.AreEqual(5.702, (double)substance3.SpecificEntropy.Value, 0.001, "Substance3: Substance has wrong specific specific entropy"); Assert.AreEqual(4.397, (double)substance3.SpecificIsobaricHeatCapacity, 0.001, "Substance3: Substance has wrong specific isobaric heat capacity"); Assert.AreEqual(670.4, (double)substance3.SpeedOfSound, 0.1, "Substance3: Substance has wrong speed of sound"); Assert.AreEqual(2.313, (double)substance3.SpecificIsochoricHeatCapacity, 0.001, "Substance3: Substance has wrong specific isochoric heat capacity"); }
public void Region2bBackwardEquation_Tph_Test() { //Arrange double enthalpy1 = 3500; //kJ/kg double pressure1 = 5; //MPa double enthalpy2 = 4000; //kJ/kg double pressure2 = 5; //MPa double enthalpy3 = 3500; //kJ/kg double pressure3 = 25; //MPa Substance substance1; Substance substance2; Substance substance3; //Act substance1 = new Substance(new Pressure(pressure1), new Enthalpy(enthalpy1)); substance2 = new Substance(new Pressure(pressure2), new Enthalpy(enthalpy2)); substance3 = new Substance(new Pressure(pressure3), new Enthalpy(enthalpy3)); //Assert Assert.AreEqual(0.801299102 * Math.Pow(10, 3), (double)substance1.Temperature.Value, 0.0001, "Substance1: Substance has wrong temperature"); Assert.AreEqual(7.147 * Math.Pow(10, -2), (double)substance1.SpecificVolume, 0.001, "Substance1: Substance has wrong specific volume"); Assert.AreEqual(3500, (double)substance1.SpecificEnthalpy.Value, 0.5, "Substance1: Substance has wrong specific enthalpy"); Assert.AreEqual(3143, (double)substance1.SpecificInternalEnergy, 0.5, "Substance1: Substance has wrong specific internal energy"); Assert.AreEqual(7.061, (double)substance1.SpecificEntropy.Value, 0.001, "Substance1: Substance has wrong specific specific entropy"); Assert.AreEqual(2.324, (double)substance1.SpecificIsobaricHeatCapacity, 0.001, "Substance1: Substance has wrong specific isobaric heat capacity"); Assert.AreEqual(674.9, (double)substance1.SpeedOfSound, 0.1, "Substance1: Substance has wrong speed of sound"); Assert.AreEqual(1.761, (double)substance1.SpecificIsochoricHeatCapacity, 0.001, "Substance1: Substance has wrong specific isochoric heat capacity"); Assert.AreEqual(0.101531583 * Math.Pow(10, 4), (double)substance2.Temperature.Value, 0.0001, "Substance2: Substance has wrong temperature"); Assert.AreEqual(9.259 * Math.Pow(10, -2), (double)substance2.SpecificVolume, 0.0001, "Substance2: Substance has wrong specific volume"); Assert.AreEqual(4000, (double)substance2.SpecificEnthalpy.Value, 0.1, "Substance2: Substance has wrong specific enthalpy"); Assert.AreEqual(3537, (double)substance2.SpecificInternalEnergy, 0.5, "Substance2: Substance has wrong specific internal energy"); Assert.AreEqual(7.614, (double)substance2.SpecificEntropy.Value, 0.001, "Substance2: Substance has wrong specific specific entropy"); Assert.AreEqual(2.37, (double)substance2.SpecificIsobaricHeatCapacity, 0.01, "Substance2: Substance has wrong specific isobaric heat capacity"); Assert.AreEqual(762.1, (double)substance2.SpeedOfSound, 0.5, "Substance2: Substance has wrong speed of sound"); Assert.AreEqual(1.866, (double)substance2.SpecificIsochoricHeatCapacity, 0.001, "Substance2: Substance has wrong specific isochoric heat capacity"); Assert.AreEqual(0.875279054 * Math.Pow(10, 3), (double)substance3.Temperature.Value, 0.0001, "Substance3: Substance has wrong temperature"); Assert.AreEqual(1.42 * Math.Pow(10, -2), (double)substance3.SpecificVolume, 0.01, "Substance3: Substance has wrong specific volume"); Assert.AreEqual(3500, (double)substance3.SpecificEnthalpy.Value, 0.1, "Substance3: Substance has wrong specific enthalpy"); Assert.AreEqual(3145, (double)substance3.SpecificInternalEnergy, 0.1, "Substance3: Substance has wrong specific internal energy"); Assert.AreEqual(6.371, (double)substance3.SpecificEntropy.Value, 0.001, "Substance3: Substance has wrong specific specific entropy"); Assert.AreEqual(2.96, (double)substance3.SpecificIsobaricHeatCapacity, 0.01, "Substance3: Substance has wrong specific isobaric heat capacity"); Assert.AreEqual(678.3, (double)substance3.SpeedOfSound, 0.1, "Substance3: Substance has wrong speed of sound"); Assert.AreEqual(1.999, (double)substance3.SpecificIsochoricHeatCapacity, 0.001, "Substance3: Substance has wrong specific isochoric heat capacity"); }
public void Region2aBackwardEquation_Tph_Test() { //Arrange double enthalpy1 = 3000; //kJ/kg double pressure1 = 0.001; //MPa double enthalpy2 = 3000; //kJ/kg double pressure2 = 3; //MPa double enthalpy3 = 4000; //kJ/kg double pressure3 = 3; //MPa Substance substance1; Substance substance2; Substance substance3; //Act substance1 = new Substance(new Pressure(pressure1), new Enthalpy(enthalpy1)); substance2 = new Substance(new Pressure(pressure2), new Enthalpy(enthalpy2)); substance3 = new Substance(new Pressure(pressure3), new Enthalpy(enthalpy3)); //Assert Assert.AreEqual(0.534433241 * Math.Pow(10, 3), (double)substance1.Temperature.Value, 0.0001, "Substance1: Substance has wrong temperature"); Assert.AreEqual(246.6, (double)substance1.SpecificVolume, 0.1, "Substance1: Substance has wrong specific volume"); Assert.AreEqual(3000, (double)substance1.SpecificEnthalpy.Value, 0.5, "Substance1: Substance has wrong specific enthalpy"); Assert.AreEqual(2753, (double)substance1.SpecificInternalEnergy, 0.5, "Substance1: Substance has wrong specific internal energy"); Assert.AreEqual(10.21, (double)substance1.SpecificEntropy.Value, 0.01, "Substance1: Substance has wrong specific specific entropy"); Assert.AreEqual(1.976, (double)substance1.SpecificIsobaricHeatCapacity, 0.001, "Substance1: Substance has wrong specific isobaric heat capacity"); Assert.AreEqual(567.3, (double)substance1.SpeedOfSound, 0.1, "Substance1: Substance has wrong speed of sound"); Assert.AreEqual(1.514, (double)substance1.SpecificIsochoricHeatCapacity, 0.001, "Substance1: Substance has wrong specific isochoric heat capacity"); Assert.AreEqual(0.575373370 * Math.Pow(10, 3), (double)substance2.Temperature.Value, 0.0001, "Substance2: Substance has wrong temperature"); Assert.AreEqual(8.161 * Math.Pow(10, -2), (double)substance2.SpecificVolume, 0.0001, "Substance2: Substance has wrong specific volume"); Assert.AreEqual(3000, (double)substance2.SpecificEnthalpy.Value, 0.1, "Substance2: Substance has wrong specific enthalpy"); Assert.AreEqual(2755, (double)substance2.SpecificInternalEnergy, 0.5, "Substance2: Substance has wrong specific internal energy"); Assert.AreEqual(6.551, (double)substance2.SpecificEntropy.Value, 0.001, "Substance2: Substance has wrong specific specific entropy"); Assert.AreEqual(2.53, (double)substance2.SpecificIsobaricHeatCapacity, 0.01, "Substance2: Substance has wrong specific isobaric heat capacity"); Assert.AreEqual(562, (double)substance2.SpeedOfSound, 0.5, "Substance2: Substance has wrong specific isobaric heat capacity"); Assert.AreEqual(1.794, (double)substance2.SpecificIsochoricHeatCapacity, 0.001, "Substance2: Substance has wrong specific isochoric heat capacity"); Assert.AreEqual(0.101077577 * Math.Pow(10, 4), (double)substance3.Temperature.Value, 0.0001, "Substance3: Substance has wrong temperature"); Assert.AreEqual(0.1544, (double)substance3.SpecificVolume, 0.0001, "Substance3: Substance has wrong specific volume"); Assert.AreEqual(4000, (double)substance3.SpecificEnthalpy.Value, 0.1, "Substance3: Substance has wrong specific enthalpy"); Assert.AreEqual(3537, (double)substance3.SpecificInternalEnergy, 0.1, "Substance3: Substance has wrong specific internal energy"); Assert.AreEqual(7.847, (double)substance3.SpecificEntropy.Value, 0.001, "Substance3: Substance has wrong specific specific entropy"); Assert.AreEqual(2.34, (double)substance3.SpecificIsobaricHeatCapacity, 0.01, "Substance3: Substance has wrong specific isobaric heat capacity"); Assert.AreEqual(761.9, (double)substance3.SpeedOfSound, 0.1, "Substance3: Substance has wrong specific isobaric heat capacity"); Assert.AreEqual(1.853, (double)substance3.SpecificIsochoricHeatCapacity, 0.001, "Substance3: Substance has wrong specific isochoric heat capacity"); }
public void Region1BackwardEquation_Tps_Test() { //Arrange double entropy1 = 0.5; //kJ/(kg*K) double pressure1 = 3; //MPa double entropy2 = 0.5; //kJ/(kg*K) double pressure2 = 80; //MPa double entropy3 = 3; //kJ/(kg*K) double pressure3 = 80; //MPa Substance substance1; Substance substance2; Substance substance3; //Act substance1 = new Substance(new Pressure(pressure1), new Entropy(entropy1)); substance2 = new Substance(new Pressure(pressure2), new Entropy(entropy2)); substance3 = new Substance(new Pressure(pressure3), new Entropy(entropy3)); //Assert Assert.AreEqual(0.307842258 * Math.Pow(10, 3), (double)substance1.Temperature.Value, 0.0001, "Substance1: Substance has wrong temperature"); Assert.AreEqual(1.005 * Math.Pow(10, -3), (double)substance1.SpecificVolume, 0.000001, "Substance1: Substance has wrong specific volume"); Assert.AreEqual(148.1, (double)substance1.SpecificEnthalpy.Value, 0.1, "Substance1: Substance has wrong specific enthalpy"); Assert.AreEqual(145, (double)substance1.SpecificInternalEnergy, 0.1, "Substance1: Substance has wrong specific internal energy"); Assert.AreEqual(0.5, (double)substance1.SpecificEntropy.Value, 0.001, "Substance1: Substance has wrong specific specific entropy"); Assert.AreEqual(4.172, (double)substance1.SpecificIsobaricHeatCapacity, 0.001, "Substance1: Substance has wrong specific isobaric heat capacity"); Assert.AreEqual(1526, (double)substance1.SpeedOfSound, 0.5, "Substance1: Substance has wrong specific isobaric heat capacity"); Assert.AreEqual(4.088, (double)substance1.SpecificIsochoricHeatCapacity, 0.001, "Substance1: Substance has wrong specific isochoric heat capacity"); Assert.AreEqual(0.309979785 * Math.Pow(10, 3), (double)substance2.Temperature.Value, 0.0001, "Substance2: Substance has wrong temperature"); Assert.AreEqual(9.748 * Math.Pow(10, -4), (double)substance2.SpecificVolume, 0.000001, "Substance2: Substance has wrong specific volume"); Assert.AreEqual(224.2, (double)substance2.SpecificEnthalpy.Value, 0.1, "Substance2: Substance has wrong specific enthalpy"); Assert.AreEqual(146.2, (double)substance2.SpecificInternalEnergy, 0.1, "Substance2: Substance has wrong specific internal energy"); Assert.AreEqual(0.5, (double)substance2.SpecificEntropy.Value, 0.001, "Substance2: Substance has wrong specific specific entropy"); Assert.AreEqual(4.021, (double)substance2.SpecificIsobaricHeatCapacity, 0.001, "Substance2: Substance has wrong specific isobaric heat capacity"); Assert.AreEqual(1657, (double)substance2.SpeedOfSound, 0.5, "Substance2: Substance has wrong specific isobaric heat capacity"); Assert.AreEqual(3.893, (double)substance2.SpecificIsochoricHeatCapacity, 0.001, "Substance2: Substance has wrong specific isochoric heat capacity"); Assert.AreEqual(0.565899909 * Math.Pow(10, 3), (double)substance3.Temperature.Value, 0.0001, "Substance3: Substance has wrong temperature"); Assert.AreEqual(1.226 * Math.Pow(10, -3), (double)substance3.SpecificVolume, 0.000001, "Substance3: Substance has wrong specific volume"); Assert.AreEqual(1292, (double)substance3.SpecificEnthalpy.Value, 0.5, "Substance3: Substance has wrong specific enthalpy"); Assert.AreEqual(1194, (double)substance3.SpecificInternalEnergy, 0.5, "Substance3: Substance has wrong specific internal energy"); Assert.AreEqual(3, (double)substance3.SpecificEntropy.Value, 0.001, "Substance3: Substance has wrong specific specific entropy"); Assert.AreEqual(4.484, (double)substance3.SpecificIsobaricHeatCapacity, 0.001, "Substance3: Substance has wrong specific isobaric heat capacity"); Assert.AreEqual(1325, (double)substance3.SpeedOfSound, 0.5, "Substance3: Substance has wrong specific isobaric heat capacity"); Assert.AreEqual(3.013, (double)substance3.SpecificIsochoricHeatCapacity, 0.001, "Substance3: Substance has wrong specific isochoric heat capacity"); }
public void Region5_Test() { //Arrange double temperature1 = 1500; //K double pressure1 = 0.5; //MPa double temperature2 = 1500; //K double pressure2 = 30; //MPa double temperature3 = 2000; //K double pressure3 = 30; //MPa Substance substance1; Substance substance2; Substance substance3; //Act substance1 = new Substance(temperature1, pressure1); substance2 = new Substance(temperature2, pressure2); substance3 = new Substance(temperature3, pressure3); //Assert Assert.AreEqual(0.138455090 * Math.Pow(10, 1), (double)substance1.SpecificVolume, 0.0000001, "Substance1: Substance has wrong specific volume"); Assert.AreEqual(0.521976855 * Math.Pow(10, 4), (double)substance1.SpecificEnthalpy.Value, 0.00001, "Substance1: Substance has wrong specific enthalpy"); Assert.AreEqual(0.452749310 * Math.Pow(10, 4), (double)substance1.SpecificInternalEnergy, 0.00001, "Substance1: Substance has wrong specific internal energy"); Assert.AreEqual(0.965408875 * Math.Pow(10,1), (double)substance1.SpecificEntropy.Value, 0.00000001, "Substance1: Substance has wrong specific specific entropy"); Assert.AreEqual(0.261609445 * Math.Pow(10, 1), (double)substance1.SpecificIsobaricHeatCapacity, 0.0000001, "Substance1: Substance has wrong specific isobaric heat capacity"); Assert.AreEqual(0.917068690 * Math.Pow(10, 3), (double)substance1.SpeedOfSound, 0.00001, "Substance1: Substance has wrong specific speed of sound"); Assert.AreEqual(2.153, (double)substance1.SpecificIsochoricHeatCapacity, 0.001, "Substance1: Substance has wrong specific isochoric heat capacity"); Assert.AreEqual(0.230761299 * Math.Pow(10, -1), (double)substance2.SpecificVolume, 0.00000001, "Substance2: Substance has wrong specific volume"); Assert.AreEqual(0.516723514 * Math.Pow(10, 4), (double)substance2.SpecificEnthalpy.Value, 0.00001, "Substance2: Substance has wrong specific enthalpy"); Assert.AreEqual(0.447495124 * Math.Pow(10, 4), (double)substance2.SpecificInternalEnergy, 0.00001, "Substance2: Substance has wrong specific internal energy"); Assert.AreEqual(0.772970133 * Math.Pow(10, 1), (double)substance2.SpecificEntropy.Value, 0.0000001, "Substance2: Substance has wrong specific specific entropy"); Assert.AreEqual(0.272724317 * Math.Pow(10, 1), (double)substance2.SpecificIsobaricHeatCapacity, 0.0000001, "Substance2: Substance has wrong specific isobaric heat capacity"); Assert.AreEqual(0.928548002 * Math.Pow(10, 3), (double)substance2.SpeedOfSound, 0.00001, "Substance2: Substance has wrong specific speed of sound"); Assert.AreEqual(0.311385219 * Math.Pow(10, -1), (double)substance3.SpecificVolume, 0.00000001, "Substance3: Substance has wrong specific volume"); Assert.AreEqual(0.657122604 * Math.Pow(10, 4), (double)substance3.SpecificEnthalpy.Value, 0.00001, "Substance3: Substance has wrong specific enthalpy"); Assert.AreEqual(0.563707038 * Math.Pow(10, 4), (double)substance3.SpecificInternalEnergy, 0.00001, "Substance3: Substance has wrong specific internal energy"); Assert.AreEqual(0.853640523 * Math.Pow(10, 1), (double)substance3.SpecificEntropy.Value, 0.00000001, "Substance3: Substance has wrong specific specific entropy"); Assert.AreEqual(0.288569882 * Math.Pow(10, 1), (double)substance3.SpecificIsobaricHeatCapacity, 0.0000001, "Substance3: Substance has wrong specific isobaric heat capacity"); Assert.AreEqual(0.106736948 * Math.Pow(10, 4), (double)substance3.SpeedOfSound, 0.00001, "Substance3: Substance has wrong specific speed of sound"); }
public void Region1BackwardEquation_Tph_Test() { //Arrange double enthalpy1 = 500; //kJ/kg double pressure1 = 3; //MPa double enthalpy2 = 500; //kJ/kg double pressure2 = 80; //MPa double enthalpy3 = 1500; //kJ/kg double pressure3 = 80; //MPa Substance substance1; Substance substance2; Substance substance3; //Act substance1 = new Substance(new Pressure(pressure1), new Enthalpy(enthalpy1)); substance2 = new Substance(new Pressure(pressure2), new Enthalpy(enthalpy2)); substance3 = new Substance(new Pressure(pressure3), new Enthalpy(enthalpy3)); //Assert Assert.AreEqual(0.391798509 * Math.Pow(10, 3), (double)substance1.Temperature.Value, 0.0001, "Substance1: Substance has wrong temperature"); Assert.AreEqual(1.058 * Math.Pow(10, -3), (double)substance1.SpecificVolume, 0.000001, "Substance1: Substance has wrong specific volume"); Assert.AreEqual(500, (double)substance1.SpecificEnthalpy.Value, 0.1, "Substance1: Substance has wrong specific enthalpy"); Assert.AreEqual(496.8, (double)substance1.SpecificInternalEnergy, 0.1, "Substance1: Substance has wrong specific internal energy"); Assert.AreEqual(1.511, (double)substance1.SpecificEntropy.Value, 0.001, "Substance1: Substance has wrong specific specific entropy"); Assert.AreEqual(4.237, (double)substance1.SpecificIsobaricHeatCapacity, 0.001, "Substance1: Substance has wrong specific isobaric heat capacity"); Assert.AreEqual(1529, (double)substance1.SpeedOfSound, 0.5, "Substance1: Substance has wrong speed of sound"); Assert.AreEqual(3.671, (double)substance1.SpecificIsochoricHeatCapacity, 0.001, "Substance1: Substance has wrong specific isochoric heat capacity"); Assert.AreEqual(0.378108626 * Math.Pow(10, 3), (double)substance2.Temperature.Value, 0.0001, "Substance2: Substance has wrong temperature"); Assert.AreEqual(1.011 * Math.Pow(10, -3), (double)substance2.SpecificVolume, 0.000001, "Substance2: Substance has wrong specific volume"); Assert.AreEqual(500, (double)substance2.SpecificEnthalpy.Value, 0.1, "Substance2: Substance has wrong specific enthalpy"); Assert.AreEqual(419.1, (double)substance2.SpecificInternalEnergy, 0.1, "Substance2: Substance has wrong specific internal energy"); Assert.AreEqual(1.304, (double)substance2.SpecificEntropy.Value, 0.001, "Substance2: Substance has wrong specific specific entropy"); Assert.AreEqual(4.072, (double)substance2.SpecificIsobaricHeatCapacity, 0.001, "Substance2: Substance has wrong specific isobaric heat capacity"); Assert.AreEqual(1697, (double)substance2.SpeedOfSound, 0.5, "Substance2: Substance has wrong specific isobaric heat capacity"); Assert.AreEqual(3.640, (double)substance2.SpecificIsochoricHeatCapacity, 0.001, "Substance2: Substance has wrong specific isochoric heat capacity"); Assert.AreEqual(0.611041229 * Math.Pow(10, 3), (double)substance3.Temperature.Value, 0.0001, "Substance3: Substance has wrong temperature"); Assert.AreEqual(1.322 * Math.Pow(10, -3), (double)substance3.SpecificVolume, 0.000001, "Substance3: Substance has wrong specific volume"); Assert.AreEqual(1500, (double)substance3.SpecificEnthalpy.Value, 0.1, "Substance3: Substance has wrong specific enthalpy"); Assert.AreEqual(1394, (double)substance3.SpecificInternalEnergy, 0.5, "Substance3: Substance has wrong specific internal energy"); Assert.AreEqual(3.353, (double)substance3.SpecificEntropy.Value, 0.001, "Substance3: Substance has wrong specific specific entropy"); Assert.AreEqual(4.731, (double)substance3.SpecificIsobaricHeatCapacity, 0.001, "Substance3: Substance has wrong specific isobaric heat capacity"); Assert.AreEqual(1187, (double)substance3.SpeedOfSound, 0.5, "Substance3: Substance has wrong specific isobaric heat capacity"); Assert.AreEqual(2.915, (double)substance3.SpecificIsochoricHeatCapacity, 0.001, "Substance3: Substance has wrong specific isochoric heat capacity"); }
public void Region1_Test() { //Arrange double temperature1 = 300; //K double pressure1 = 3; //MPa double temperature2 = 300; //K double pressure2 = 80; //MPa double temperature3 = 500; //K double pressure3 = 3; //MPa Substance substance1; Substance substance2; Substance substance3; //Act substance1 = new Substance(temperature1, pressure1); substance2 = new Substance(temperature2, pressure2); substance3 = new Substance(temperature3, pressure3); //Assert Assert.AreEqual(0.100215168 * Math.Pow(10, -2), (double)substance1.SpecificVolume, 0.0000001, "Substance1: Substance has wrong specific volume"); Assert.AreEqual(0.115331273 * Math.Pow(10, 3), (double)substance1.SpecificEnthalpy.Value, 0.0001, "Substance1: Substance has wrong specific enthalpy"); Assert.AreEqual(0.112324818 * Math.Pow(10, 3), (double)substance1.SpecificInternalEnergy, 0.0001, "Substance1: Substance has wrong specific internal energy"); Assert.AreEqual(0.392294792, (double)substance1.SpecificEntropy.Value, 0.0000001, "Substance1: Substance has wrong specific specific entropy"); Assert.AreEqual(0.417301218 * Math.Pow(10, 1), (double)substance1.SpecificIsobaricHeatCapacity, 0.000001, "Substance1: Substance has wrong specific isobaric heat capacity"); Assert.AreEqual(0.150773921 * Math.Pow(10, 4), (double)substance1.SpeedOfSound, 0.001, "Substance1: Substance has wrong specific isobaric heat capacity"); Assert.AreEqual(4.121, (double)substance1.SpecificIsochoricHeatCapacity, 0.01, "Substance1: Substance has wrong specific isochoric heat capacity"); Assert.AreEqual(0.971180894 * Math.Pow(10, -3), (double)substance2.SpecificVolume, 0.0000001, "Substance2: Substance has wrong specific volume"); Assert.AreEqual(0.184142828 * Math.Pow(10, 3), (double)substance2.SpecificEnthalpy.Value, 0.0001, "Substance2: Substance has wrong specific enthalpy"); Assert.AreEqual(0.106448356 * Math.Pow(10, 3), (double)substance2.SpecificInternalEnergy, 0.0001, "Substance2: Substance has wrong specific internal energy"); Assert.AreEqual(0.368563852, (double)substance2.SpecificEntropy.Value, 0.0000001, "Substance2: Substance has wrong specific specific entropy"); Assert.AreEqual(0.401008987 * Math.Pow(10, 1), (double)substance2.SpecificIsobaricHeatCapacity, 0.000001, "Substance2: Substance has wrong specific isobaric heat capacity"); Assert.AreEqual(0.163469054 * Math.Pow(10, 4), (double)substance2.SpeedOfSound, 0.001, "Substance2: Substance has wrong specific isobaric heat capacity"); Assert.AreEqual(3.917, (double)substance2.SpecificIsochoricHeatCapacity, 0.01, "Substance2: Substance has wrong specific isochoric heat capacity"); Assert.AreEqual(0.120241800 * Math.Pow(10, -2), (double)substance3.SpecificVolume, 0.0000001, "Substance3: Substance has wrong specific volume"); Assert.AreEqual(0.975542239 * Math.Pow(10, 3), (double)substance3.SpecificEnthalpy.Value, 0.0001, "Substance3: Substance has wrong specific enthalpy"); Assert.AreEqual(0.971934985 * Math.Pow(10, 3), (double)substance3.SpecificInternalEnergy, 0.0001, "Substance3: Substance has wrong specific internal energy"); Assert.AreEqual(0.258041912 * Math.Pow(10, 1), (double)substance3.SpecificEntropy.Value, 0.0000001, "Substance3: Substance has wrong specific specific entropy"); Assert.AreEqual(0.465580682 * Math.Pow(10, 1), (double)substance3.SpecificIsobaricHeatCapacity, 0.000001, "Substance3: Substance has wrong specific isobaric heat capacity"); Assert.AreEqual(0.124071337 * Math.Pow(10, 4), (double)substance3.SpeedOfSound, 0.001, "Substance3: Substance has wrong specific isobaric heat capacity"); Assert.AreEqual(3.221, (double)substance3.SpecificIsochoricHeatCapacity, 0.01, "Substance3: Substance has wrong specific isochoric heat capacity"); }
public void Region4_Test_LiquidState() { //Arrange double temperature1 = 300; //K double temperature2 = 500; //K double temperature3 = 600; //K Substance substance1; Substance substance2; Substance substance3; //Act substance1 = new Substance(new Temperature(temperature1), Substance.State.Water); substance2 = new Substance(new Temperature(temperature2), Substance.State.Water); substance3 = new Substance(new Temperature(temperature3), Substance.State.Water); //Assert Assert.AreEqual(0.353658941 * Math.Pow(10, -2), (double)substance1.Pressure.Value, 0.0000001, "Substance1: Substance has wrong pressure"); Assert.AreEqual(1.003 * Math.Pow(10, -3), (double)substance1.SpecificVolume, 0.001, "Substance1: Substance has wrong specific volume"); Assert.AreEqual(112.6, (double)substance1.SpecificEnthalpy.Value, 0.1, "Substance1: Substance has wrong specific enthalpy"); Assert.AreEqual(112.6, (double)substance1.SpecificInternalEnergy, 0.1, "Substance1: Substance has wrong specific internal energy"); Assert.AreEqual(0.3931, (double)substance1.SpecificEntropy.Value, 0.0001, "Substance1: Substance has wrong specific specific entropy"); Assert.AreEqual(4.181, (double)substance1.SpecificIsobaricHeatCapacity, 0.001, "Substance1: Substance has wrong specific isobaric heat capacity"); Assert.AreEqual(1503, (double)substance1.SpeedOfSound, 0.5, "Substance1: Substance has wrong specific speed of sound"); Assert.AreEqual(4.131, (double)substance1.SpecificIsochoricHeatCapacity, 0.001, "Substance1: Substance has wrong specific isochoric heat capacity"); Assert.AreEqual(0.263889776 * Math.Pow(10, 1), (double)substance2.Pressure.Value, 0.0000001, "Substance2: Substance has wrong pressure"); Assert.AreEqual(1.203 * Math.Pow(10, -3), (double)substance2.SpecificVolume, 0.001, "Substance2: Substance has wrong specific volume"); Assert.AreEqual(975.5, (double)substance2.SpecificEnthalpy.Value, 0.1, "Substance2: Substance has wrong specific enthalpy"); Assert.AreEqual(972.3, (double)substance2.SpecificInternalEnergy, 0.1, "Substance2: Substance has wrong specific internal energy"); Assert.AreEqual(2.581, (double)substance2.SpecificEntropy.Value, 0.001, "Substance2: Substance has wrong specific specific entropy"); Assert.AreEqual(4.659, (double)substance2.SpecificIsobaricHeatCapacity, 0.001, "Substance2: Substance has wrong specific isobaric heat capacity"); Assert.AreEqual(1239, (double)substance2.SpeedOfSound, 0.5, "Substance2: Substance has wrong specific speed of sound"); Assert.AreEqual(3.222, (double)substance2.SpecificIsochoricHeatCapacity, 0.001, "Substance2: Substance has wrong specific isochoric heat capacity"); Assert.AreEqual(0.123443146 * Math.Pow(10, 2), (double)substance3.Pressure.Value, 0.0000001, "Substance1: Substance has wrong pressure"); Assert.AreEqual(1.54 * Math.Pow(10, -3), (double)substance3.SpecificVolume, 0.01, "Substance3: Substance has wrong specific volume"); Assert.AreEqual(1505, (double)substance3.SpecificEnthalpy.Value, 0.5, "Substance3: Substance has wrong specific enthalpy"); Assert.AreEqual(1486, (double)substance3.SpecificInternalEnergy, 0.5, "Substance3: Substance has wrong specific internal energy"); Assert.AreEqual(3.519, (double)substance3.SpecificEntropy.Value, 0.001, "Substance3: Substance has wrong specific specific entropy"); Assert.AreEqual(6.956, (double)substance3.SpecificIsobaricHeatCapacity, 0.001, "Substance3: Substance has wrong specific isobaric heat capacity"); Assert.AreEqual(751.6, (double)substance3.SpeedOfSound, 0.1, "Substance3: Substance has wrong specific speed of sound"); Assert.AreEqual(3.045, (double)substance3.SpecificIsochoricHeatCapacity, 0.01, "Substance3: Substance has wrong specific isochoric heat capacity"); }
public void Region4_Test_Steam() { //Arrange double temperature1 = 300; //K double temperature2 = 500; //K double temperature3 = 600; //K Substance substance1; Substance substance2; Substance substance3; //Act substance1 = new Substance(new Temperature(temperature1), Substance.State.Steam); substance2 = new Substance(new Temperature(temperature2), Substance.State.Steam); substance3 = new Substance(new Temperature(temperature3), Substance.State.Steam); //Assert Assert.AreEqual(0.353658941 * Math.Pow(10, -2), (double)substance1.Pressure.Value, 0.0000001, "Substance1: Substance has wrong pressure"); Assert.AreEqual(39.08, (double)substance1.SpecificVolume, 0.01, "Substance1: Substance has wrong specific volume"); Assert.AreEqual(2550, (double)substance1.SpecificEnthalpy.Value, 0.5, "Substance1: Substance has wrong specific enthalpy"); Assert.AreEqual(2412, (double)substance1.SpecificInternalEnergy, 0.5, "Substance1: Substance has wrong specific internal energy"); Assert.AreEqual(8.518, (double)substance1.SpecificEntropy.Value, 0.001, "Substance1: Substance has wrong specific specific entropy"); Assert.AreEqual(1.914, (double)substance1.SpecificIsobaricHeatCapacity, 0.001, "Substance1: Substance has wrong specific isobaric heat capacity"); Assert.AreEqual(427.9, (double)substance1.SpeedOfSound, 0.1, "Substance1: Substance has wrong specific speed of sound"); Assert.AreEqual(1.442, (double)substance1.SpecificIsochoricHeatCapacity, 0.001, "Substance1: Substance has wrong specific isochoric heat capacity"); Assert.AreEqual(0.263889776 * Math.Pow(10, 1), (double)substance2.Pressure.Value, 0.0000001, "Substance1: Substance has wrong pressure"); Assert.AreEqual(7.577 * Math.Pow(10, -2), (double)substance2.SpecificVolume, 0.001, "Substance2: Substance has wrong specific volume"); Assert.AreEqual(2803, (double)substance2.SpecificEnthalpy.Value, 0.5, "Substance2: Substance has wrong specific enthalpy"); Assert.AreEqual(2603, (double)substance2.SpecificInternalEnergy, 0.5, "Substance2: Substance has wrong specific internal energy"); Assert.AreEqual(6.235, (double)substance2.SpecificEntropy.Value, 0.001, "Substance2: Substance has wrong specific specific entropy"); Assert.AreEqual(3.463, (double)substance2.SpecificIsobaricHeatCapacity, 0.001, "Substance2: Substance has wrong specific isobaric heat capacity"); Assert.AreEqual(504.6, (double)substance2.SpeedOfSound, 0.1, "Substance2: Substance has wrong specific speed of sound"); Assert.AreEqual(2.271, (double)substance2.SpecificIsochoricHeatCapacity, 0.001, "Substance2: Substance has wrong specific isochoric heat capacity"); Assert.AreEqual(0.123443146 * Math.Pow(10, 2), (double)substance3.Pressure.Value, 0.0000001, "Substance1: Substance has wrong pressure"); Assert.AreEqual(1.373 * Math.Pow(10, -2), (double)substance3.SpecificVolume, 0.01, "Substance3: Substance has wrong specific volume"); Assert.AreEqual(2678, (double)substance3.SpecificEnthalpy.Value, 0.5, "Substance3: Substance has wrong specific enthalpy"); Assert.AreEqual(2508, (double)substance3.SpecificInternalEnergy, 0.5, "Substance3: Substance has wrong specific internal energy"); Assert.AreEqual(5.473, (double)substance3.SpecificEntropy.Value, 0.001, "Substance3: Substance has wrong specific specific entropy"); Assert.AreEqual(9.169, (double)substance3.SpecificIsobaricHeatCapacity, 0.001, "Substance3: Substance has wrong specific isobaric heat capacity"); Assert.AreEqual(457.1, (double)substance3.SpeedOfSound, 0.1, "Substance3: Substance has wrong specific speed of sound"); Assert.AreEqual(3.331, (double)substance3.SpecificIsochoricHeatCapacity, 0.01, "Substance3: Substance has wrong specific isochoric heat capacity"); }
public void Region4BackwardEquateion_Test_LiquidState() { //Arrange double pressure1 = 0.1; //MPa double pressure2 = 1; //MPa double pressure3 = 10; //MPa Substance substance1; Substance substance2; Substance substance3; //Act substance1 = new Substance(new Pressure(pressure1), Substance.State.Water); substance2 = new Substance(new Pressure(pressure2), Substance.State.Water); substance3 = new Substance(new Pressure(pressure3), Substance.State.Water); //Assert Assert.AreEqual(0.372755919 * Math.Pow(10, 3), (double)substance1.Temperature.Value, 0.000001, "Substance1: Substance has wrong temperature"); Assert.AreEqual(1.043 * Math.Pow(10, -3), (double)substance1.SpecificVolume, 0.00001, "Substance1: Substance has wrong specific volume"); Assert.AreEqual(417.4, (double)substance1.SpecificEnthalpy.Value, 0.1, "Substance1: Substance has wrong specific enthalpy"); Assert.AreEqual(417.3, (double)substance1.SpecificInternalEnergy, 0.1, "Substance1: Substance has wrong specific internal energy"); Assert.AreEqual(1.303, (double)substance1.SpecificEntropy.Value, 0.001, "Substance1: Substance has wrong specific specific entropy"); Assert.AreEqual(4.216, (double)substance1.SpecificIsobaricHeatCapacity, 0.001, "Substance1: Substance has wrong specific isobaric heat capacity"); Assert.AreEqual(1545, (double)substance1.SpeedOfSound, 0.5, "Substance1: Substance has wrong specific speed of sound"); Assert.AreEqual(3.77, (double)substance1.SpecificIsochoricHeatCapacity, 0.01, "Substance1: Substance has wrong specific isochoric heat capacity"); Assert.AreEqual(0.453035632 * Math.Pow(10, 3), (double)substance2.Temperature.Value, 0.000001, "Substance2: Substance has wrong temperature"); Assert.AreEqual(1.127 * Math.Pow(10, -3), (double)substance2.SpecificVolume, 0.00001, "Substance2: Substance has wrong specific volume"); Assert.AreEqual(762.7, (double)substance2.SpecificEnthalpy.Value, 0.1, "Substance2: Substance has wrong specific enthalpy"); Assert.AreEqual(761.6, (double)substance2.SpecificInternalEnergy, 0.1, "Substance2: Substance has wrong specific internal energy"); Assert.AreEqual(2.138, (double)substance2.SpecificEntropy.Value, 0.001, "Substance2: Substance has wrong specific specific entropy"); Assert.AreEqual(4.405, (double)substance2.SpecificIsobaricHeatCapacity, 0.001, "Substance2: Substance has wrong specific isobaric heat capacity"); Assert.AreEqual(1392, (double)substance2.SpeedOfSound, 0.5, "Substance2: Substance has wrong specific speed of sound"); Assert.AreEqual(3.397, (double)substance2.SpecificIsochoricHeatCapacity, 0.001, "Substance2: Substance has wrong specific isochoric heat capacity"); Assert.AreEqual(0.584149488 * Math.Pow(10, 3), (double)substance3.Temperature.Value, 0.000001, "Substance3: Substance has wrong pressure"); Assert.AreEqual(1.453 * Math.Pow(10, -3), (double)substance3.SpecificVolume, 0.01, "Substance3: Substance has wrong specific volume"); Assert.AreEqual(1408, (double)substance3.SpecificEnthalpy.Value, 0.5, "Substance3: Substance has wrong specific enthalpy"); Assert.AreEqual(1393, (double)substance3.SpecificInternalEnergy, 0.5, "Substance3: Substance has wrong specific internal energy"); Assert.AreEqual(3.36, (double)substance3.SpecificEntropy.Value, 0.01, "Substance3: Substance has wrong specific specific entropy"); Assert.AreEqual(6.127, (double)substance3.SpecificIsobaricHeatCapacity, 0.001, "Substance3: Substance has wrong specific isobaric heat capacity"); Assert.AreEqual(847.7, (double)substance3.SpeedOfSound, 0.1, "Substance3: Substance has wrong specific speed of sound"); Assert.AreEqual(3.044, (double)substance3.SpecificIsochoricHeatCapacity, 0.01, "Substance3: Substance has wrong specific isochoric heat capacity"); }