'Openmodelica fluid / composition mixture from multiple sources
I am a beginner in Openmodelica and trying to model a flow system with standard libraries. As shown in the picture below, I would like to simulate a system flow from different sources, each with different fluids (gases).
Example:
- source_fluid_1: N2
- source_fluid_2: Ar
- mixed_fluid: fluid mixture of source_fluid_1 and source_fluid_2
- sink
For source_fluid_1 and source_fluid_2 I have set the composition X=1 each. In the volume mixed_fluid I have as X_start {0.5, 0.5}.
According to the error information
Base class Medium not found in scope Fluid_Mixture_Example
and
Class Medium.ExtraProperty not found in scope FluidPort
it seems that I am doing something wrong with the definition of the medium.
But unfortunately I can't get any further here.
With the same fluid (gas) in both sources the model runs without problems.
In addition, I am not sure if I am doing the settings in the composition correctly.
I have looked at the Trace Substances in Modelica's examples, but they don't seem to cover my case.
I am very grateful if someone could help me.
model Fluid_Mixture_Example
Modelica.Fluid.Sources.Boundary_pT source_fluid_1(redeclare package Medium = Modelica.Media.IdealGases.SingleGases.N2, T = system.T_ambient, X = {1}, nPorts = 1, p = 5e5)
Modelica.Fluid.Sources.Boundary_pT source_fluid_2(redeclare package Medium = Modelica.Media.IdealGases.SingleGases.Ar, T = system.T_ambient, X = {1}, nPorts = 1, p = 10e5)
Modelica.Fluid.Sources.FixedBoundary sink(redeclare package Medium = Medium, nPorts = 1)
Modelica.Fluid.Fittings.SimpleGenericOrifice orifice1(redeclare package Medium = Medium, diameter = 0.0015, zeta = 1)
Modelica.Fluid.Fittings.SimpleGenericOrifice orifice2(redeclare package Medium = Medium, diameter = 0.0015, zeta = 1)
Modelica.Fluid.Vessels.ClosedVolume mixed_fluid(V = 1, X_start = {0.5, 0.5}, massDynamics = Modelica.Fluid.Types.Dynamics.FixedInitial, nPorts = 3, use_portsData = false)
end Fluid_Mixture_Example;
OpenModelica v1.18.1 (64-bit)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
