| 1 | within ;
|
|---|
| 2 | package Test
|
|---|
| 3 | package Types
|
|---|
| 4 | type Area = Modelica.SIunits.Area(nominal = 10);
|
|---|
| 5 | type SpecificHeatCapacity = Modelica.SIunits.SpecificHeatCapacity(nominal = 500);
|
|---|
| 6 | type Length = Modelica.SIunits.Length(nominal = 1);
|
|---|
| 7 | type ThermalConductivity = Modelica.SIunits.ThermalConductivity(nominal = 1e3);
|
|---|
| 8 | type HeatCapacity = Modelica.SIunits.HeatCapacity(nominal = 1e3);
|
|---|
| 9 | type Temperature = Modelica.SIunits.Temperature(nominal = 500);
|
|---|
| 10 | type Pressure = Modelica.SIunits.Pressure(nominal = 1e7);
|
|---|
| 11 | type Density = Modelica.SIunits.Density(nominal = 1e2);
|
|---|
| 12 | type Volume = Modelica.SIunits.Volume(nominal = 10);
|
|---|
| 13 | type SpecificVolume = Modelica.SIunits.SpecificVolume(nominal = 0.01);
|
|---|
| 14 | type MassFlowRate = Modelica.SIunits.MassFlowRate(nominal = 100);
|
|---|
| 15 | type HeatFlowRate = Modelica.SIunits.HeatFlowRate(nominal = 1e6);
|
|---|
| 16 | type SpecificEnthalpy = SpecificEnergy;
|
|---|
| 17 | type SpecificEnergy = Modelica.SIunits.SpecificEnergy(nominal = 1e6);
|
|---|
| 18 | type SpecificEntropy = Modelica.SIunits.SpecificEntropy(nominal = 1e3);
|
|---|
| 19 | type SpecificHeatCapacityWater = Modelica.SIunits.SpecificHeatCapacity(nominal = 1e3);
|
|---|
| 20 | type SpecificHeatCapacityAtConstantPressure =
|
|---|
| 21 | Modelica.SIunits.SpecificHeatCapacity ( nominal = 1e3);
|
|---|
| 22 | type SpecificHeatCapacityAtConstantVolume =
|
|---|
| 23 | Modelica.SIunits.SpecificHeatCapacity ( nominal = 1e3);
|
|---|
| 24 | type HeatFlux = Real(final quantity = "HeatFlux", final unit = "W/m2", nominal = 1e4);
|
|---|
| 25 | type Stress = Modelica.SIunits.NormalStress(nominal = 1e7);
|
|---|
| 26 | type ThermalConductance = Modelica.SIunits.ThermalConductance(nominal = 1e-2);
|
|---|
| 27 | type DynamicViscosity = Modelica.SIunits.DynamicViscosity(nominal = 1e-5);
|
|---|
| 28 | type Velocity = Modelica.SIunits.Velocity(nominal = 1e3);
|
|---|
| 29 | type CoefficientOfHeatTransfer = Modelica.SIunits.CoefficientOfHeatTransfer(nominal = 5000, min = 0);
|
|---|
| 30 | type DerSpecificVolumeByPressure = Real(final unit = "m2/s2", nominal = 1e-10);
|
|---|
| 31 | type DerSpecificVolumeByTemperature = Real(final unit = "m3/(kg.K)", nominal = 1e-5);
|
|---|
| 32 | type DerSpecificVolumeByTemperatureWater = Real(final unit = "m3/(kg.K)", nominal = 1e-5);
|
|---|
| 33 | type DerEnergyByPressure = Modelica.SIunits.DerEnergyByPressure(nominal = 1e-2);
|
|---|
| 34 | type DerPressureByTemperature = Modelica.SIunits.DerPressureByTemperature(nominal = 1e5);
|
|---|
| 35 | type Power = Modelica.SIunits.Power(nominal = 1e7);
|
|---|
| 36 | type ReynoldsNumber = Modelica.SIunits.ReynoldsNumber(nominal = 1e5);
|
|---|
| 37 | type NusseltNumber = Modelica.SIunits.NusseltNumber(nominal = 100);
|
|---|
| 38 | type PrandtlNumber = Modelica.SIunits.PrandtlNumber(nominal = 10);
|
|---|
| 39 | type PressureRatio = Real(final quantity = "PressureRatio", final unit = "1", nominal = 2);
|
|---|
| 40 | type Mass = Modelica.SIunits.Mass(nominal = 1e3);
|
|---|
| 41 | type Energy = Modelica.SIunits.Energy(nominal = 1e6);
|
|---|
| 42 | type MolarMass = Modelica.SIunits.MolarMass(nominal = 0.0440095);
|
|---|
| 43 |
|
|---|
| 44 | type Temp_C = Modelica.SIunits.Conversions.NonSIunits.Temperature_degC;
|
|---|
| 45 | end Types;
|
|---|
| 46 |
|
|---|
| 47 | model fluids_property_plot_10e_5
|
|---|
| 48 | import Test.Types.*;
|
|---|
| 49 | //Reference parameters for adimensionalization
|
|---|
| 50 | constant Pressure p_crit = 7.377e6;
|
|---|
| 51 | constant Temperature T_crit = 304.13;
|
|---|
| 52 | constant SpecificVolume v_crit = 94.07e-6 / MM;
|
|---|
| 53 | constant SpecificHeatCapacityWater R = Modelica.Constants.R / MM "Specific gas constant";
|
|---|
| 54 | constant MolarMass MM = 0.0440095;
|
|---|
| 55 | //Start parameters
|
|---|
| 56 | parameter Pressure p_start = 1e7;
|
|---|
| 57 | parameter Temperature T_start = 600;
|
|---|
| 58 | parameter SpecificVolume v_start = R * T_start / p_start;
|
|---|
| 59 | parameter Real r_mu_start = rc_mu / (1 + Q1_mu * ((p_start / p_crit * T_start / T_crit) ^ 0.5 - 1)) ^ 2;
|
|---|
| 60 | parameter Real c_mu_start = b_mu * (exp(Q2_mu * (T_start / T_crit) ^ 0.5 - 1) + Q3_mu * ((p_start / p_crit) ^ 0.5 - 1) ^ 2);
|
|---|
| 61 | //Constants of the correlations
|
|---|
| 62 | parameter Types.SpecificVolume b = 0.077796074 * R * T_crit / p_crit;
|
|---|
| 63 | parameter Real w = 0.228 "acentric factor 0.225";
|
|---|
| 64 | parameter Real m = 0.37464 + 1.54226 * w - 0.26992 * w ^ 2;
|
|---|
| 65 | parameter Real ac = 0.45723553 * R ^ 2 * T_crit ^ 2 / p_crit;
|
|---|
| 66 | parameter Real mu_crit = 7.7 * T_crit ^ (-1 / 6) * (MM * 1e3) ^ 0.5 * (p_crit / 1e5) ^ (2 / 3);
|
|---|
| 67 | parameter Real rc_mu = mu_crit * T_crit / (p_crit / 1e5) / (p_crit * v_crit / R / T_crit);
|
|---|
| 68 | parameter Real Q1_mu = 0.829599 + 0.350857 * w - 0.747680 * w ^ 2;
|
|---|
| 69 | parameter Real Q2_mu = 1.94546 - 3.19777 * w + 2.80193 * w ^ 2;
|
|---|
| 70 | parameter Real Q3_mu = 0.299757 - 2.20855 * w + 6.64959 * w ^ 2;
|
|---|
| 71 | parameter Real a_mu = 0.457233553 * rc_mu ^ 2 * (p_crit / 1e5) ^ 2 / T_crit;
|
|---|
| 72 | parameter Real b_mu = 0.077796074 * rc_mu * (p_crit / 1e5) / T_crit;
|
|---|
| 73 | parameter Real a_k = 0.45724 * rc_k ^ 2 * (p_crit / 1e5) ^ 2 / T_crit;
|
|---|
| 74 | parameter Real b_k = 0.07780 * rc_k * (p_crit / 1e5) / T_crit;
|
|---|
| 75 | parameter Real rc_k = k_crit * T_crit / (p_crit / 1e5) / (p_crit * v_crit / R / T_crit);
|
|---|
| 76 | parameter Real k_crit = T_crit ^ (-1 / 6) * (MM * 1e3) ^ (-0.5) * (p_crit / 1e5) ^ (2 / 3) / 21;
|
|---|
| 77 | parameter Real Q1_k = 0.929163;
|
|---|
| 78 | parameter Real Q2_k = 0.012330;
|
|---|
| 79 | parameter Real Q3_k = 0.433261;
|
|---|
| 80 | parameter Real Q4_k = -0.054170;
|
|---|
| 81 | parameter Pressure p = 120e5;
|
|---|
| 82 | Temperature T;
|
|---|
| 83 | parameter Real A = 273.14;
|
|---|
| 84 | parameter Real B = 400;
|
|---|
| 85 |
|
|---|
| 86 | //Coefficients of the correlations
|
|---|
| 87 | Real r_mu(start = r_mu_start, nominal = 1);
|
|---|
| 88 | Real c_mu(start = c_mu_start, nominal = 1e2);
|
|---|
| 89 |
|
|---|
| 90 | parameter Real r_k_start = rc_k / (1 - Q1_k * (1 - (p_start / p_crit) ^ 0.5)) ^ 2;
|
|---|
| 91 | parameter Real c_k_start = b_k * (1 + Q2_k * (T_start / T_crit - 1) ^ 0.0125 + Q3_k * (T_start / T_crit - 1) ^ 1.75 + Q4_k * ((p_start / p_crit) ^ 0.5 - 1) ^ 2);
|
|---|
| 92 | Real T1;
|
|---|
| 93 |
|
|---|
| 94 | DynamicViscosity mu(start = 10e-5) "Dynamic viscosity";
|
|---|
| 95 |
|
|---|
| 96 | equation
|
|---|
| 97 | //Coefficients
|
|---|
| 98 | T = (B - A) * time + A;
|
|---|
| 99 | T1=T-273.14;
|
|---|
| 100 |
|
|---|
| 101 | r_mu = rc_mu / (1 + Q1_mu * ((p / p_crit * T / T_crit) ^ 0.5 - 1)) ^ 2;
|
|---|
| 102 | c_mu = b_mu * (exp(Q2_mu * (T / T_crit) ^ 0.5 - 1) + Q3_mu * ((p / p_crit) ^ 0.5 - 1) ^ 2);
|
|---|
| 103 | T = r_mu * (p *1e-5) / (mu * 1e7 - c_mu) - a_mu / (mu * 1e7 * (mu * 1e7 + b_mu) + b_mu * (mu * 1e7 - b_mu));
|
|---|
| 104 | //T * (mu * 1e7 - c_mu) * (mu * 1e7 * (mu * 1e7 + b_mu) + b_mu * (mu * 1e7 - b_mu)) = r_mu * (p / 1e5) * (mu * 1e7 * (mu * 1e7 + b_mu) + b_mu * (mu * 1e7 - b_mu)) - a_mu * (mu * 1e7 - c_mu);
|
|---|
| 105 | end fluids_property_plot_10e_5;
|
|---|
| 106 |
|
|---|
| 107 | annotation (uses(Modelica(version="3.2.2")));
|
|---|
| 108 | end Test;
|
|---|