Modeling Chemical Reactions in Modelica by Use of
Modeling Chemical Reactions in Modelica by Use of
net/publication/228496177
CITATIONS READS
4 266
4 authors, including:
Some of the authors of this publication are also working on these related projects:
All content following this page was uploaded by François Cellier on 22 May 2014.
1 Introduction
Traditionally, chemical reaction sys-
tems are described as pure mass flow
systems. There is no need to consider
the energy flows as well, as long as
the thermo-dynamical properties of
the reaction system can be ignored.
As chemical reactions are characte-
rized by capacitive storage only, i.e.,
they don’t feature inductive storage,
the mass balance and energy balance
equations are decoupled from each
other [2].
A first attempt of describing the
thermodynamics of chemical reaction
systems in a systematic way was re-
ported in [5]. Unfortunately, the pri-
mary author of that paper, Aharon
Katzir-Katchalsky, died prematurely
during an attack by Palestinians on the
airport of Tel-Aviv. After his death,
this line of research stopped for sever-
al years. Fig.1: Chemical reaction bond graph
i.e., the molar flow of a reactant in a reaction, is ac- individual step reactions, namely:
companied by a potential variable, the chemical po-
tential, such that the product of the two variables
denotes energy flow. Amrhein’s bond graph simu-
lated simultaneously the mass flow and the mass-
energy flow through the reaction system. He mod-
eled a hydrogen-bromine reaction to be simulated
under different operating conditions. The simplest
experimental setup freezes the temperature and the Reaction #4, the least important of the five step reac-
pressure, i.e., the chemical reaction is simulated un- tions, was generously left out of the graph to keep
der isothermal and isobaric operating conditions. the graph planar. Second, the chemical reactors, i.e.,
Amrhein’s model is shown in Fig.1. the ChR-elements, require state information that is
Amrhein developed his new modeling methodol- being computed by the CS-elements. Hence there
ogy years before Modelica was created, and he need to be added signal paths between the CS-
coded his models in the old Dymola language before elements and the ChR-elements that were also left
a graphical interface had become available for Dy- out for enhanced readability.
mola. Hence the bond graph of Fig.1 is not a code, A completed graph of Amrhein’s model, now
but only a picture that was drawn manually to make coded in a current version of Dymola using BondLib
the code better understandable. [4] is shown in Fig.2. The grey lines are used to
The CS-elements represent the (capacitive) sto- connect bonds with junctions and vice-versa, i.e.,
rage of the five reactants, whereas the ChR-elements they represent the same energy flows as the bonds
represent the five individual step reactions. They are connected to them. The blue lines represent infor-
connected by a network of bonds, junctions, and mation flows. 0 and 1 represent junctions, and the
transformers representing the chemical reaction net- half-arrows represent bonds.
work. The model of Fig.2 can be simulated in Dymola
Yet, the graph shown in Fig.1 is far from com- without any problems, and for a temperature of T =
plete. First, it only shows four ChR-elements, al- 800 K and a pressure of p = 102 kPa, we obtain the
though the hydrogen-bromine reaction exhibits five trajectories shown in Fig.3.
Initially, we start out with 0.0075 mol of H2 and Br2 Unfortunately, the bond graph of Fig.2 is a mess, and
few researchers will be willing to go through the
each, create and consume the temporary atoms Br
and H , and after roughly 0.07 s, we end up with agony of describing chemical reactions in this fa-
shion. Therefore in the remainder of this paper, we
0.015 mol of HBr.
shall improve on the model step by step, and create
ever better models that can be used more easily.
there is now a vector of bond connectors, each discussed before, whereas the bond graph connectors
representing one reactant. on top and below the mass flow connector are single
connectors, one representing the heat flow and the
other representing the volumetric flow. Under iso-
thermal and isobaric operating conditions, these two
connectors are used to impose from the outside the
desired temperature of T = 800 K and the desired
pressure of p = 102 kPa.
Finally, the vector connector of the RF-element
also needs to be converted to a multi-bond connec-
tor, as shown in Fig.8.
shown in Fig.12. It would have been possible to deal The entire chemical reaction network is now shown
with molar flow rates using the ‘redeclare’ feature of in green. Each of the green bonds models three pa-
Modelica, but it was simpler to create yet another rallel energy flows. As the substances, represented
bond graph library, ChemBondLib, this time featur- through the (red) CF-elements, are modeled using
ing green chemo-bonds, that are identical to the red absolute masses (they are the very same CF-elements
thermo-bonds except for the way in which the mass that we had introduced in [3] before), one of the
flows are being represented. transformers shown in Fig.12 is placed between the
(green) chemical reaction network and each of the
(red) CF-elements.
The model is much simpler than that of Fig.2, be-
cause there is no longer any need to deal with the
heat and volumetric flows separately. These flows
are now transferred across the reaction network to-
gether with the mass flows.
The CF-elements now compute the three potential
(effort) variables, T, p, and . These variables are
then transferred across the chemical reaction network
Fig.12: Conversion from absolute mass flow rates to
to the side of the step reactions. The ChR-elements
molar flow rates
compute the three flow variables, Sdot, q, and .
We are now ready to formulate the third version of These are transferred back across the reaction net-
the chemical reaction model. This new model is work to the side of the reactants.
shown in Fig.13. Each CF-element computes a partial state vector
including the three variables S, V, and
n. The partial state vectors are conca-
tenated to a complete state vector in
the St-model that transfers the state
information back to the ChR-
elements, as the reactor models re-
quire the state information to compute
the flows.
As expected, the simulation results
obtained by this third version of the
model are identical to those received
earlier.
5 Multi-chemo-bonds or
Chemo-multi-bonds ?
We can now once again eliminate the
graphical representation of the chemi-
cal reaction network and replace it by
a multi-port transformer.
To this end, we again stack the five
CF-elements, as shown in Fig.14.
On the right side, we now have a
vector of (green) chemo-bond connec-
tors, each representing three flows, a
heat flow, a volumetric flow, and a
molar mass flow. Thus, the vector
chemo-bond connector can be inter-
preted as a multi-chemo-bond connec-
tor.
Fig.13: Chemical reaction modeled by chemo-bonds
The first two models are indistinguishable concern- sired values inside the CF-elements. Since both the
ing their computational efficiencies. The third and temperature and the pressure were assumed constant,
fourth model are a bit less efficient computationally. also the chemical potentials, i, are constant, and
The reason is the following. In the first two models, consequently, also those values could be entered as
we recognized that we could add up the partial en- parameters.
tropy flows and the partial volume flows and inte- In the general case, T, p, and i will not be con-
grate them together, whereas in models three and stant, and they will have to be computed from state
four, each CF-element contains three separate states, information, as already demonstrated in the general
one describing the partial entropy, a second describ- CF-elements for air and water presented in [3].
ing the partial volume, and a third describing the par- Temperature and pressure equilibration between
tial mass of each of the five reactants. different reactants can be modeled using heat ex-
change (HE) elements and pressure/volume ex-
change (PVE) elements, placed between the different
6 Conclusions CF-elements, as demonstrated in [3].
In the special case of an isothermal operating
In this paper, we have shown how different types of condition, a controlled entropy flow out of the sto-
bond graphs can be used to describe chemical reac- rages (CF-elements) could then be added to the mod-
tion systems. el that equals the entropy flow generated by the reac-
Only a single reaction system was used for dem- tion system, such that the total entropy, and thereby
onstration, namely a hydrogen-bromine reaction si- also the temperature remain constant. Alternatively,
mulated under isothermal and isobaric operating an HE-element could be added between the reaction
conditions. system and the environment that guarantees that the
Although we have been able to demonstrate that temperature of the reaction system remains at the
the models become simpler as we treat chemical ambient temperature.
reactions as convective flows, there is a yet much In the special case of an isobaric operating condi-
more important reason for doing this, a reason that tion, either a controlled volume flow would need to
does not become obvious from reading this paper be imposed from the outside, or alternatively, a PVE-
alone. element could be added between the reaction system
Amrhein simulated the same reaction system un- and the environment that guarantees that the pressure
der a series of different operating conditions [1,2]. of the reaction system remains at the ambient pres-
He replaced the isothermal condition by an adiabatic sure.
condition, for example, and he replaced the isobaric Thus, general CF-elements can be used indepen-
condition by an isochoric condition. dently of the operating conditions, which then are
It becomes clear from reading his documents that imposed on the model by external control flows in
each of his models looks slightly different, i.e., the the same way as a chemical engineer would set up
bond graph had to be adjusted a bit from one set of his or her experiment in the lab.
operating conditions to another. Unfortunately, we did not have either the time or
The reason for this inconvenience is that Amrhein the space in this paper to demonstrate how such a
did not compute all quantities where they naturally setup would need to be modeled using the Chem-
belong. Consequently, his models violated some of BondLib and ThermoBondLib Modelica libraries,
the premises of object-oriented modeling. All of the and therefore, the proposed generalization will have
potential (effort) variables and all of the state va- to be postponed to another time and another publica-
riables should be computed at the side of the reac- tion.
tants, whereas all of the flow variables should be The research presented in this paper represents
evaluated at the side of the step reactions. only a very first step in an ongoing research effort.
Using the convective flow approach to modeling Reactions among ideal gases are particularly easy to
chemical reaction systems, it won’t be necessary any model and simulate, and isothermal and isobaric op-
longer to modify the bond graph from one set of op- erating conditions are among the most convenient
erating conditions to another, because all variables operating conditions that may be assumed.
are indeed being computed where they belong. Much more research is needed before we can
The implementation of the (red) CF-elements claim that we have created a universal approach to
used in the simulations of this paper are not yet fully modeling and simulating all kinds of chemical reac-
general. As we were only interested in isothermal tion systems in a truly object-oriented physically in-
and isobaric operating conditions, it sufficed to set spired manner.
the temperature, T, and the pressure, p, to their de-
Author Biographies
François E. Cellier received his BS
degree in electrical engineering in
1972, his MS degree in automatic
control in 1973, and his PhD degree
in technical sciences in 1979, all
from the Swiss Federal Institute of
Technology (ETH) Zurich. Dr. Cellier worked at the
University of Arizona as professor of Electrical and
Computer Engineering from 1984 until 2005. He
then returned to his home country of Switzerland.
Dr. Cellier's main scientific interests concern model-
ing and simulation methodologies, and the design of
advanced software systems for simulation, computer
aided modeling, and computer-aided design. Dr. Cel-
lier has authored or co-authored more than 200 tech-
nical publications, and he has edited several books.
He published a textbook on Continuous System
Modeling in 1991 and a second textbook on Conti-
nuous System Simulation in 2006, both with Sprin-
ger-Verlag, New York.