Exemple #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);
            }
        }
Exemple #2
0
        /// <summary>
        /// Get Saturation Temperature from a given Pressure using the type of <see cref="Fluid"/>
        /// </summary>
        public Temperature GetSatTemperature(Pressure FromThisPressure)
        {
            if (FromThisPressure < LimitPressureMin)
            {
                Log.Debug($"SharpFluid -> GetSatTemperature -> {FromThisPressure} cant be bolow {LimitPressureMin}");
                return(Temperature.Zero);
            }


            if (FromThisPressure > CriticalPressure)
            {
                Log.Debug($"SharpFluid -> GetSatTemperature -> Pressure ({FromThisPressure}) is above CriticalPressure {CriticalPressure}. CriticalPressure is returned instead!");
                return(CriticalTemperature);
            }
            else
            {
                REF.update(input_pairs.PQ_INPUTS, FromThisPressure.Pascals, 1);
                return(REF.T());
            }
        }