@@ -732,34 +732,46 @@ Connector with one flow signal of type Real.
732732
733733 partial model Accumulation
734734 extends Physiolibrary.Fluid.Interfaces.CompositionSetup;
735- extends Medium.SubstancesUseSetup;
735+
736+
737+ parameter String ForeSubstances[nFS] = fill ("" ,nFS);
738+ parameter String RearSubstances[nRS] = fill ("" ,nRS);
739+
740+
741+ parameter Integer nFS = 0 "Number of substance forward ports" annotation (
742+ Evaluate = true,
743+ Dialog(connectorSizing = true, group = "Ports" ));
744+ parameter Integer nRS = 0 "Number of substance rearward ports" annotation (
745+ Evaluate = true,
746+ Dialog(connectorSizing = true, group = "Ports" ));
747+
748+ public
749+ Chemical.Interfaces.Fore foreSubstance[nFS]
750+ "Forward ports of selected substances"
751+ annotation (Placement(transformation(extent={{90,-10},{110,10}}), iconTransformation(extent={{90,-10},{110,10}})));
752+ Chemical.Interfaces.Rear rearSubstance[nRS]
753+ "Rearward ports of selectted substances"
754+ annotation (Placement(transformation(extent={{-110,-10},{-90,10}}), iconTransformation(extent={{-110,-10},{-90,10}})));
736755
737756 parameter Integer nPorts = 0 "Number of hydraulic ports" annotation (
738757 Evaluate = true,
739758 Dialog(connectorSizing = true, group = "Ports" ));
740759 Interfaces.FluidPorts_a q_in[nPorts](redeclare package Medium = Medium, each h_outflow(nominal= Medium.SpecificEnthalpyNominal)) annotation (
741760 Placement(transformation(extent = {{-10, -28}, {10, 28}}), iconTransformation(extent = {{-7, -26}, {7, 26}}, rotation = 180, origin = {-1, 0})));
742- parameter Boolean useSubstances = false "=true, if substance ports are used" annotation (
743- Evaluate = true,
744- HideResult = true,
745- choices(checkBox = true),
746- Dialog(group = "Conditional inputs" ));
761+
747762 parameter Boolean onElectricGround = false "=true, if electric potencial is zero" annotation (
748763 Evaluate = true,
749764 choices(checkBox = true));
750765 //,Dialog(group="Conditional inputs"));
751- Medium.SubstancesPort substances if useSubstances annotation (
752- Placement(transformation(extent={{-120,-20},{-80,20}}), iconTransformation(extent={{-120,
753- -20},{-80,20}})));
754766
755767 Medium.ChemicalSolution chemicalSolution(
756- useFore = useFore ,
757- useRear = useRear ,
768+ nFS = nFS, nRS = nRS, RearSubstances = RearSubstances, ForeSubstances = ForeSubstances ,
769+ foreSubstance = ( if nFS > 0 then foreSubstance else dummyFore), rearSubstance = ( if nRS > 0 then rearSubstance else dummyRear) ,
758770 startSubstanceMasses = m_start,
759771 p = pressure,
760772 h = enthalpy / mass,
761773 X = if not Medium.reducedX then massFractions else cat(1 , massFractions, {1 - sum (massFractions)}),
762- _i = i) if useSubstances ; //enthalpy / mass,
774+ _i = i) if (nFS + nRS) > 0 ; //enthalpy / mass,
763775
764776 parameter Boolean use_mass_start = false "Use mass_start, otherwise volume_start" annotation (
765777 Evaluate = true,
@@ -813,6 +825,7 @@ Connector with one flow signal of type Real.
813825 Physiolibrary.Types.RealIO.MassFlowRateOutput substanceMassFlowsFromStream[Medium.nS](nominal= Medium.SubstanceFlowNominal);
814826 Physiolibrary.Types.RealIO.MassInput substanceMasses[Medium.nS](nominal= Medium.SubstanceFlowNominal);
815827
828+
816829 initial equation
817830 // assert(abs(1 - sum(x_mass_start)) < 1e-5, "Sum of x_mass_start must be 1. (Composition initialization failed)");
818831 /* assert(
@@ -824,7 +837,7 @@ Connector with one flow signal of type Real.
824837 "Initial concentration composition must have at least
825838 -2 values!");
826839 */
827- if not useSubstances then
840+ if nFS + nRS == 0 then
828841 substanceMasses = m_start;
829842 end if ;
830843 if Medium.reducedX then
@@ -846,8 +859,7 @@ Connector with one flow signal of type Real.
846859 if not useThermalPort then
847860 heatFromEnvironment = 0 ;
848861 end if ;
849- if useSubstances then
850- connect (substances, chemicalSolution.substances);
862+ if nFS+ nRS> 0 then
851863 connect (chemicalSolution.massFlows, massFlows);
852864 connect (chemicalSolution.enthalpyFromSubstances, enthalpyFromSubstances);
853865 connect (chemicalSolution.substanceMasses, substanceMasses);
@@ -3220,8 +3232,6 @@ The sensor is ideal, i.e., it does not influence the fluid.
32203232 annotation (Placement(transformation(extent={{-302,-44},{-322,-24}})));
32213233 Physiolibrary.Thermal.Sources.UnlimitedHeat coreHeat(T = system.T_ambient) annotation (
32223234 Placement(transformation(extent = {{-274, -44}, {-294, -24}})));
3223- Chemical.Processes.Diffusion diffusion annotation (Placement(transformation(extent={{-178,18},{-158,38}})));
3224- Media.Air.SubstancesPort substancesPort annotation (Placement(transformation(extent={{-236,-26},{-196,14}})));
32253235 equation
32263236 connect (environment.y, flowMeasure.q_in) annotation (
32273237 Line(points = {{-340, 88}, {-318, 88}, {-318, 76}}, color = {127, 0, 0}, thickness = 0.5));
@@ -3255,16 +3265,6 @@ The sensor is ideal, i.e., it does not influence the fluid.
32553265 connect (evaporation.gas_port, upperRespiratoryTract.substances.H2O)
32563266 annotation (Line(points={{-352,-28},{-352,0},{-328,0}}, color={158,66,
32573267 200}));
3258- connect (diffusion.rear, substancesPort.O2fore)
3259- annotation (Line(
3260- points={{-178,28},{-215.9,28},{-215.9,-5.9}},
3261- color={158,66,200},
3262- thickness=0.5));
3263- connect (upperRespiratoryTract.substances, substancesPort)
3264- annotation (Line(
3265- points={{-328,0},{-336,0},{-336,-52},{-216,-52},{-216,-6}},
3266- color={158,66,200},
3267- thickness=0.5));
32683268 annotation (
32693269 Icon(coordinateSystem(preserveAspectRatio = false)),
32703270 Diagram(coordinateSystem(preserveAspectRatio = false, extent = {{-360, -100}, {100, 100}})),
@@ -4938,10 +4938,11 @@ The sensor is ideal, i.e., it does not influence the fluid.
49384938 Physiolibrary.Fluid.Sensors.FlowMeasure flowMeasure(redeclare package Medium = Air) annotation (
49394939 Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = 270, origin = {-318, 66})));
49404940 Physiolibrary.Fluid.Components.ElasticVessel upperRespiratoryTract(redeclare package Medium = Air,
4941- useSubstances= true ,
4941+ ForeSubstances= {"H2O" },
4942+ RearSubstances= {"H2O" },
49424943 volume_start= 0.0001 ,
49434944 massFractions_start= Air.reference_X[1 :Air.nS - 1 ], useThermalPort = true , Compliance = TotalCompliance / 100 , ZeroPressureVolume(displayUnit = "ml" ) = 0.0001 , ResidualVolume(displayUnit = "ml" ) = 0.0001 , nPorts= 2 ,
4944- substances(useH2Orear = true ) ) annotation (
4945+ nRS = 1 ,nFS = 0 ) annotation (
49454946 Placement(transformation(extent = {{-328, -10}, {-308, 10}})));
49464947 Physiolibrary.Fluid.Components.Resistor upperRespiratoryTractResistance(redeclare package Medium = Air, Resistance = 0.5 * TracheaResistance) annotation (
49474948 Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = 90, origin={-318,34})));
@@ -4959,7 +4960,6 @@ The sensor is ideal, i.e., it does not influence the fluid.
49594960 quantity= Chemical.Boundaries.Internal.Types.ConcentrationQuantities.x_molpmol,
49604961 FixedValue= 1 ) annotation (Placement(transformation(extent={{-396,-46},{-376,-26}})));
49614962 Chemical.Processes.GasSolubility gasSolubility annotation (Placement(transformation(extent={{-358,-46},{-338,-26}})));
4962- Media.Air.SubstancesPort substancesPort(useH2Orear= true ) annotation (Placement(transformation(extent={{-370,-10},{-330,30}})));
49634963 equation
49644964 connect (environment.y, flowMeasure.q_in) annotation (
49654965 Line(points = {{-340, 88}, {-318, 88}, {-318, 76}}, color = {127, 0, 0}, thickness = 0.5));
@@ -4983,14 +4983,9 @@ The sensor is ideal, i.e., it does not influence the fluid.
49834983 points={{-376,-36},{-358,-36}},
49844984 color={158,66,200},
49854985 thickness=0.5));
4986- connect (upperRespiratoryTract.substances, substancesPort)
4987- annotation (Line(
4988- points={{-328,0},{-328,-16},{-350,-16},{-350,10}},
4989- color={158,66,200},
4990- thickness=0.5));
4991- connect (gasSolubility.fore, substancesPort.H2Orear)
4986+ connect (gasSolubility.fore, upperRespiratoryTract.rearSubstance[1 ])
49924987 annotation (Line(
4993- points={{-338,-36},{-330,-36},{-330,-18 },{-376,-18 },{-376,10.1 },{-349.9,10.1 }},
4988+ points={{-338,-36},{-330,-36},{-330,-16 },{-334,-16 },{-334,0 },{-328,0 }},
49944989 color={158,66,200},
49954990 thickness=0.5));
49964991 annotation (
0 commit comments