Ejemplo n.º 1
0
        /// <summary>
        /// Updates the values of the <see cref="Fluid"/> after an update
        /// </summary>
        protected virtual void UpdateValues()
        {
            try
            {
                if (Media.BackendType == "HEOS")
                {
                    //Mixed fluids does not have these properties
                    SoundSpeed      = REF.speed_sound();
                    MolarMass       = REF.molar_mass();
                    Compressibility = REF.compressibility_factor();
                }

                Enthalpy         = REF.hmass();
                Temperature      = REF.T();
                Pressure         = REF.p();
                Entropy          = REF.smass();
                Quality          = REF.Q();
                Density          = REF.rhomass();
                Cp               = REF.cpmass();
                Cv               = REF.cvmass();
                DynamicViscosity = REF.viscosity();
                Prandtl          = REF.Prandtl();
                SurfaceTension   = REF.surface_tension();
                InternalEnergy   = REF.umass();
                Conductivity     = REF.conductivity();
                Phase            = (Phases)REF.phase();
                FailState        = false;
            }
            catch (Exception e)
            {
                Log.Error($"SharpFluid -> UpdateValues -> {e}");
                throw new Exception("UpdateValues", e);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Get Saturation Pressure from a given Temperature using the type of <see cref="Fluid"/>
        /// </summary>
        public Pressure GetSatPressure(Temperature FromThisTemperature)
        {
            if (FromThisTemperature < LimitTemperatureMin)
            {
                Log.Debug($"SharpFluid -> GetSatPressure -> {FromThisTemperature} cant be bolow {LimitTemperatureMin}");
                return(Pressure.Zero);
            }


            if (FromThisTemperature >= CriticalTemperature)
            {
                Log.Debug($"SharpFluid -> GetSatPressure -> Temperature ({FromThisTemperature}) is above CriticalTemperature {CriticalTemperature}. CriticalTemperature is returned instead!");
                return(CriticalPressure);
            }
            else
            {
                REF.update(input_pairs.QT_INPUTS, 1, FromThisTemperature.Kelvins);
                return(REF.p());
            }
        }