You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to use Modelica Buildings with MSL mixture gasses.
In the simples possible case I connect a mass flow source to a pressure sink and use Modelica.Media.IdealGases.MixtureGases.FlueGasSixComponents.
model SourceToSink
package Medium = Modelica.Media.IdealGases.MixtureGases.FlueGasSixComponents;
Buildings.Fluid.Sources.MassFlowSource_T boundary(redeclare package Medium = Medium, nPorts=1);
Buildings.Fluid.Sources.Boundary_pT bou(redeclare package Medium = Medium, nPorts=1);
equation
connect(boundary.ports[1], bou.ports[1]);
end SourceToSink;
This gives a model with 26 equations and 25 unknowns.
Looking into Buildings.Fluid.Sources.BaseClasses.PartialSource_Xi_C.mo, I see some problems around the lines
if not use_X_in then
X_in_internal[1:Medium.nXi] = Xi_in_internal[1:Medium.nXi];
X_in_internal[Medium.nX] = 1-sum(X_in_internal[1:Medium.nXi]);
end if;
Since I have chosen not to use an external mass fraction input, I would expect a connection between X_in_internal and X. If I replace the two lines in the if statement with X_in_internal = X (like in the Modelica.Fluid.Sources) the model works.
Also, if I specify the X as an internal input vector in the simple model above, it fails to work.
The text was updated successfully, but these errors were encountered:
The problem seems to be caused because FlueGasSixComponents has reducedX=false. If it is instantiated with Modelica.Media.IdealGases.MixtureGases.FlueGasSixComponents(reducedX=true) the model works. While this is not a work-around, it points to the problem.
Note that
constantBoolean reducedX=true"= true if medium contains the equation sum(X) = 1.0; set reducedX=true if only one substance (see docu for details)";
constantBoolean fixedX=false"= true if medium contains the equation X = reference_X";
finalconstantInteger nS=size(substanceNames, 1) "Number of substances";
constantInteger nX=nS "Number of mass fractions";
constantInteger nXi=if fixedX then0elseif reducedX then nS -1else nS
"Number of structurally independent mass fractions (see docu for details)";
and in BaseProperties,
if reducedX andnot fixedX then
X[nX] =1-sum(Xi);
end if;
This is to correct the issue reported by @justnielsen through lbl-srg/modelica-buildings#1543
I am trying to use Modelica Buildings with MSL mixture gasses.
In the simples possible case I connect a mass flow source to a pressure sink and use
Modelica.Media.IdealGases.MixtureGases.FlueGasSixComponents
.This gives a model with 26 equations and 25 unknowns.
Looking into
Buildings.Fluid.Sources.BaseClasses.PartialSource_Xi_C.mo
, I see some problems around the linesSince I have chosen not to use an external mass fraction input, I would expect a connection between
X_in_internal
andX
. If I replace the two lines in the if statement withX_in_internal = X
(like in the Modelica.Fluid.Sources) the model works.Also, if I specify the
X
as an internal input vector in the simple model above, it fails to work.The text was updated successfully, but these errors were encountered: