diff --git a/Physiolibrary/Chemical.mo b/Physiolibrary/Chemical.mo index cb4a33d..b424f0d 100644 --- a/Physiolibrary/Chemical.mo +++ b/Physiolibrary/Chemical.mo @@ -862,7 +862,7 @@ package Chemical "Domain with Molar Concentration and Molar Flow" "Flux from/to compartment" annotation (Placement(transformation(extent={{-10, -10},{10,10}}))); equation - q_out.conc = solute/volume; + q_out.conc = solute/volume; //TODO: solute/(solvent+solute)? state = solute; // der(solute)=q_out.q change = q_out.q; @@ -1249,14 +1249,13 @@ It works in two modes: -100},{100,100}}), graphics)); end Degradation; - model Stream "One-directional flow of solution" - //- Solute flowing together with solvent - One-directional stream (only zero or positive solvent flow values are allowed!)" + model Stream "Flow of whole solution" extends Physiolibrary.Chemical.Interfaces.OnePort; extends Physiolibrary.Chemical.Interfaces.ConditionalSolutionFlow; equation - // assert(q>=-Modelica.Constants.eps,"In MolarStream must be always the forward flow in forward direction! Not 'solventFlow<0'!"); - q_in.q = q*q_in.conc; + q_in.q = if + (q>0) then q*q_in.conc else q*q_out.conc; annotation ( Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{ @@ -1281,7 +1280,7 @@ It works in two modes: lineColor={0,0,255}, origin={2,-74}, rotation=180)}), - Diagram(coordinateSystem(preserveAspectRatio=true, + Diagram(coordinateSystem(preserveAspectRatio=false, extent={{-100,-100},{100,100}}), graphics), Documentation(revisions="
- | forward flow |
-backward flow |
+forward flow |
+backward flow |
solventFlow |
+solutionFlow |
>=0 |
-<0 |
+<=0 |
q_in.q |
-=solventFlow*q_in.conc |
-=solventFlow*q_out.conc |
+=solutionFlow*q_in.conc |
+=-q_out.q |
q_out.q |
=-q_in.q |
-=-q_in.q |
+=solutionFlow*q_out.conc |