if there are no intersecting characteristics (Polyanin
et al., 2002). Otherwise, the so-called shock waves
appear which can be dealt with using the concept of
multi-valued solutions or by introducing discontinuity
at the shock wave’s front. In this paper we avoid mak-
ing restrictive a priori assumptions that would exclude
the possibility of intersecting characteristics. Further-
more, our algorithm will not handle the shock waves
by itself. Instead, the algorithm will detect intersect-
ing characteristics during runtime and inform the user
of the problem.
Let us discuss the existing approaches to computer
simulation of the dynamical system (1) in the MAT-
LAB/Simulink environment paying primary attention
to the method of characteristics (Polyanin et al., 2002)
as it is arguably the most accurate and efficient tool to
solve a general PDE like (1a).
There are numerous MATLAB scripts that imple-
ment the method of characteristics, e.g., (von Peters-
dorff, 2012). Assuming that the functions v, f , and
u are given as functions of t, x, and (to some extent)
w(t, ·)
[0,`]
, such MATLAB scripts can be used to cal-
culate solutions of the systems of the form (1). How-
ever, these solvers are “offline” in the sense that the
state w(t, x) is available for all values of t and x only
after the script is executed completely. We cannot,
in a straightforward manner, embed such an “offline”
solver into a Simulink model as a MATLAB Function
block because it will not output the full state w(t,·)
[0,`]
as the simulation time t increases.
We are interested in an “online” solver, which is to
say that, as the simulation time t increases, it should
continuously produce an approximation of the current
state w(t,·)
[0,`]
. An “online” solver is required if at
each moment in time the terms v, f , and u in (1) de-
pend on the full system state w(t, ·)
[0,`]
in a non-trivial
manner or are defined via feedback of the full system
state through another dynamical system which may
be the case, e.g., under feedback control.
Simulink is a suitable environment to implement
(1) in the “online” fashion. Having a block which
takes the values of v, f , and u and outputs a discrete
approximation of the full system state w(t,·)
[0,`]
, it
would be easy to plug it into a larger system. How-
ever, we are not aware of Simulink implementations
of the method of characteristics for the general case
of system (1). Let us describe some alternatives that
are available in Simulink at the moment and motivate
our effort to implement the method of characteristics.
Space discretization (finite difference) method,
also known as the Method of Lines (Schiesser, 2012),
can be used to transform the PDE into a system of
ordinary differential equations (ODEs) which has na-
tive Simulink implementation. In general, these ap-
proaches suffer from instability because of numerical
diffusion and dispersion (Zijlema, 2015). We illus-
trate this problem in Section 4.
Another approach is to reformulate the PDE as
a time-delay system. For example, (Witrant and
Niculescu, 2010) consider a variable-velocity trans-
port system with sinks or sources
w
t
+ v(t)w
x
= f (t),
w(t, 0) = u(t),
y(t) = w(t,1).
(2)
Using the method of characteristics, it is trans-
formed into a delay-differential equation which can
be plugged into a Simulink model. The special case
of (2) with f (t) = 0 is included in Simulink under the
name of Variable Transport Delay block (Zhang and
Yeddanapudi, 2012). In general, however, converting
a model like (1) into a time-delay form requires deep
analysis and may not always be possible.
Finally, there are examples of connecting
Simulink to dedicated PDE solving environments
(Van Schijndel, 2009) but such an approach is only
justified for simulating complex phenomena. For a
simple transport process the overhead is excessive.
Hence, we set the goal of designing a simple but
versatile Simulink block which can simulate the dy-
namics of a wide range of first-order quasilinear PDEs
based on the method of characteristics. The block is
to be employed in modeling the systems like (1). The
accuracy of simulation should be adjustable via some
parameters. The block has to be easy to use without
extensive analysis of the mathematical model. Fur-
thermore, it must have straightforward interface and
be easily embeddable into larger Simulink models.
Remark 3. To the best of the authors’ knowledge,
the only example that comes close to reaching the
goal of this paper is (Herr
´
an-Gonz
´
alez et al., 2009).
It is a library of Simulink blocks modeling gas ducts,
valves, compressors, etc. Although the blocks indeed
implement the method of characteristics, the library
is directed exclusively at modeling gas distribution
pipeline networks which results in a limited choice
of possible dynamics. Our approach is more general
as we model dynamics (1) in an abstract sense. We
allow arbitrary velocity and source terms as well as
initial functions.
The plan of the paper is as follows. In Sec. 2 we
provide theoretical background to the proposed sim-
ulation approach. Specifically, in Sec. 2.1 we recall
the method of characteristics whereas in Sec. 2.2 we
introduce its algorithmic realization suitable for “on-
line” simulation and assess the accuracy of the algo-
rithm. Sec. 3 describes implementation of the algo-
rithm as a Simulink block. In Sec. 4, performance of
SIMULTECH 2020 - 10th International Conference on Simulation and Modeling Methodologies, Technologies and Applications
140