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=" @@ -1307,25 +1306,26 @@ It works in two modes:

Possible field values:

- - + + - + - + - - + + - +

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

+
")); end Stream; @@ -1436,7 +1436,7 @@ It works in two modes: ")); end Speciation; - model Dilution "Adding the solvent to solution" + model Dilution "Adding/removing of the solvent to/from solution" extends Physiolibrary.Chemical.Interfaces.OnePort; parameter Boolean useDilutionInput = false diff --git a/Physiolibrary/Thermal.mo b/Physiolibrary/Thermal.mo index f8c8bd3..4de1af4 100644 --- a/Physiolibrary/Thermal.mo +++ b/Physiolibrary/Thermal.mo @@ -291,7 +291,7 @@ package Thermal {100,100}}), graphics)); end Conductor; - model Stream "One-directional flow of heated mass" + model Stream "Flow of whole heated mass" extends Interfaces.OnePort; extends Interfaces.ConditionalMassFlow; @@ -299,8 +299,7 @@ package Thermal "Of flow circuit medium"; equation - // assert(substanceFlow>=-Modelica.Constants.eps,"In HeatStream must be always the forward flow direction! Not 'substanceFlow<0'!"); - q_in.Q_flow = q*q_in.T*SpecificHeat; + q_in.Q_flow = if (q>0) then q*q_in.T*SpecificHeat else q*q_out.T*SpecificHeat; annotation ( Icon(coordinateSystem(preserveAspectRatio=false,extent={{-100,-100},{ @@ -323,6 +322,31 @@ package Thermal Documentation(revisions="

2009-2010

Marek Matejak, Charles University, Prague, Czech Republic

+", info=" +

Bidirectional heated mass flow by temperature

+

Possible field values:

+ + + + + + + + + + + + + + + + + + + + +

forward flow

backward flow

massFlow

>=0

<=0

q_in.q

=massFlow*q_in.T*SpecificHeat

=-q_out.q

q_out.q

=-q_in.q

=massFlow*q_out.T*SpecificHeat

+
"), Diagram(coordinateSystem(preserveAspectRatio=true, extent={{-100, -100},{100,100}}), graphics)); end Stream; @@ -585,7 +609,7 @@ i.e., it defines a fixed temperature as a boundary condition. lineColor={191,0,0}, fillColor={191,0,0}, fillPattern=FillPattern.Solid), - Text(extent={{-160,110},{40,50}}, lineColor= {191,0,0}, textString= "%name")})); + Text(extent={{-160,110},{40,50}}, lineColor = {191,0,0}, textString = "%name")})); end HeatPort_a; connector HeatPort_b "Heat outflow" @@ -608,7 +632,7 @@ i.e., it defines a fixed temperature as a boundary condition. lineColor={191,0,0}, fillColor={255,255,255}, fillPattern=FillPattern.Solid), - Text(extent={{-160,110},{40,50}}, lineColor= {191,0,0}, textString= "%name")})); + Text(extent={{-160,110},{40,50}}, lineColor = {191,0,0}, textString = "%name")})); end HeatPort_b;