Extends from Modelica.Icons.ExamplesPackage (Icon for packages containing runnable examples).
Name | Description |
---|---|
MixIdealGasAir | Ideal gas air medium model |
FlueGas | Ideal gas flue gas model |
N2AsMix | air and steam mixture (no condensation!, pseudo-mixture) |
IdealGasN2 | Test IdealGas.SingleMedia.N2 medium model |
TestMedia | Test interfaces of media |
IdealGasN2Mix | Test IdealGas.SingleMedia.N2 medium model |
An example for using ideal gas properties and how to compute isentropic enthalpy changes. The function that is implemented is approximate, but usually very good: the second medium record medium2 is given to compare the approximation.
Extends from Modelica.Icons.Example (Icon for runnable examples).
model MixIdealGasAir "Ideal gas air medium model" extends Modelica.Icons.Example; package Medium = IdealGases.MixtureGases.CombustionAir "Medium model"; Medium.BaseProperties medium( T(start = 200.0), X(start = {0.2,0.8}), p(start = 1.0e5)); Medium.BaseProperties medium2( T(start = 300.0), X(start = {0.2,0.8}), p(start = 2.0e5)); Medium.SpecificHeatCapacity cp=Medium.specificHeatCapacityCp(medium.state); Medium.SpecificHeatCapacity cv=Medium.specificHeatCapacityCv(medium.state); Medium.IsentropicExponent gamma=Medium.isentropicExponent(medium.state); Medium.SpecificEntropy s=Medium.specificEntropy(medium.state); Medium.SpecificEntropy s2=Medium.specificEntropy(medium2.state); Medium.VelocityOfSound a=Medium.velocityOfSound(medium.state); Medium.DynamicViscosity eta= Medium.dynamicViscosity(medium.state); Medium.ThermalConductivity lambda= Medium.thermalConductivity(medium.state); Real beta = Medium.isobaricExpansionCoefficient(medium.state); Real gamma2 = Medium.isothermalCompressibility(medium2.state); Medium.SpecificEnthalpy h_is = Medium.isentropicEnthalpyApproximation(2.0e5, medium); equation der(medium.p) = 1000.0; der(medium.T) = 1000; medium.X = {0.2,0.8}; der(medium2.p) = 1.0e3; der(medium2.T) = 0.0; der(medium2.X) = {0.0,0.0}; // s2 = s;end MixIdealGasAir;
An example for using ideal gas properties and how to compute isentropic enthalpy changes. The function that is implemented is approximate, but usually very good: the second medium record medium2 is given to compare the approximation.
Extends from Modelica.Icons.Example (Icon for runnable examples).
Type | Name | Default | Description |
---|---|---|---|
MolarMass | MMx[4] | Medium.data.MM | Molar masses of flue gas [kg/mol] |
model FlueGas "Ideal gas flue gas model" extends Modelica.Icons.Example; package Medium = IdealGases.MixtureGases.FlueGasLambdaOnePlus "Medium model"; Medium.ThermodynamicState state( T(start = 200.0), X(start = {0.2,0.3,0.4,0.1}), p(start = 1.0e5)); Medium.BaseProperties medium2( T(start = 300.0), X(start = {0.2,0.1,0.3,0.4}), p(start = 2.0e5)); Medium.SpecificHeatCapacity cp=Medium.specificHeatCapacityCp(state); Medium.SpecificHeatCapacity cv=Medium.specificHeatCapacityCv(state); Medium.IsentropicExponent gamma=Medium.isentropicExponent(state); Medium.SpecificEntropy s=Medium.specificEntropy(state); Medium.SpecificEntropy s2=Medium.specificEntropy(medium2.state); Medium.VelocityOfSound a=Medium.velocityOfSound(state); Real beta = Medium.isobaricExpansionCoefficient(state); Real gamma2 = Medium.isothermalCompressibility(medium2.state); Medium.SpecificEnthalpy h_is = Medium.isentropicEnthalpyApproximation(2.0e5, medium2); parameter Medium.MolarMass[4] MMx = Medium.data.MM "Molar masses of flue gas"; Medium.MolarMass MM = 1/sum(state.X[j]/MMx[j] for j in 1:4) "molar mass"; Real[4] dddX=Medium.density_derX(medium2.state); equation der(state.p) = 1000.0; der(state.T) = 1000; state.X = {0.2,0.2,0.4,0.2}; der(medium2.p) = 1.0e3; der(medium2.T) = 0.0; der(medium2.X[1:Medium.nX]) = {0.0,0.0,0.0,0.0};end FlueGas;
Extends from Modelica.Icons.Example (Icon for runnable examples).
Type | Name | Default | Description |
---|---|---|---|
Volume | V | 1 | Size of fixed volume [m3] |
MassFlowRate | m_flow_ext | 0.01 | Mass flow rate into volume [kg/s] |
EnthalpyFlowRate | H_flow_ext | 5000 | Enthalpy flow rate into volume [W] |
model IdealGasN2 "Test IdealGas.SingleMedia.N2 medium model" extends Modelica.Icons.Example; parameter Modelica.SIunits.Volume V=1 "Size of fixed volume"; parameter Medium.MassFlowRate m_flow_ext=0.01 "Mass flow rate into volume"; parameter Medium.EnthalpyFlowRate H_flow_ext=5000 "Enthalpy flow rate into volume"; package Medium = IdealGases.SingleGases.N2 "Medium model"; // initType=Medium.Choices.Init.SteadyState, Medium.BaseProperties medium(preferredMediumStates=true, p(start=1.e5), T(start=300)); Real m(quantity=Medium.mediumName, start = 1.0); SI.InternalEnergy U; Medium.SpecificHeatCapacity cp=Medium.specificHeatCapacityCp(medium); Medium.SpecificHeatCapacity cv=Medium.specificHeatCapacityCv(medium); Medium.IsentropicExponent gamma=Medium.isentropicExponent(medium); Medium.SpecificEntropy s=Medium.specificEntropy(medium); Medium.VelocityOfSound a=Medium.velocityOfSound(medium); equation m = medium.d*V; U = m*medium.u; // Mass balance der(m) = m_flow_ext; // Energy balance der(U) = H_flow_ext;end IdealGasN2;
Extends from Modelica.Icons.Example (Icon for runnable examples).
Type | Name | Default | Description |
---|---|---|---|
Volume | V | 1 | Size of volume [m3] |
MassFlowRate | m_flow_ext | 0.01 | Mass flow rate flowing into volume [kg/s] |
EnthalpyFlowRate | H_flow_ext | 5000 | Enthalpy flow rate flowing into volume [W] |
model IdealGasN2Mix "Test IdealGas.SingleMedia.N2 medium model" extends Modelica.Icons.Example; parameter Modelica.SIunits.Volume V=1 "Size of volume"; parameter Medium.MassFlowRate m_flow_ext=0.01 "Mass flow rate flowing into volume"; parameter Medium.EnthalpyFlowRate H_flow_ext=5000 "Enthalpy flow rate flowing into volume"; package Medium = N2AsMix "Medium model"; // initType=Medium.Choices.Init.SteadyState, Medium.BaseProperties medium(preferredMediumStates=true, p(start=1.e5), T(start=300)); Real m(quantity=Medium.mediumName, start = 1.0); SI.InternalEnergy U; Medium.SpecificHeatCapacity cp=Medium.specificHeatCapacityCp(medium); Medium.SpecificHeatCapacity cv=Medium.specificHeatCapacityCv(medium); Medium.IsentropicExponent gamma=Medium.isentropicExponent(medium); Medium.SpecificEntropy s=Medium.specificEntropy(medium); Medium.VelocityOfSound a=Medium.velocityOfSound(medium); equation m = medium.d*V; U = m*medium.u; medium.X = {1.0}; // Mass balance der(m) = m_flow_ext; // Energy balance der(U) = H_flow_ext;end IdealGasN2Mix;