such as CPUs and networks, run over discrete time
scale while handling real-time tasks and communica-
tion packets. Digital components can be easily exe-
cuted on the CPUs, using the multitasking capabili-
ties of the simulation cores to simulate the concurrent
nature of the distributed control system.
On the other hand, the physical components of
the control system – such as actuators, sensors and
mechatronic parts – are continuous time components
which can be described by some kind of non-linear
differential equations. As real system are too complex
to lead to explicit solutions of their dynamic behavior,
they must be integrated on computers using a numeri-
cal solver. Numerical integration is still an active field
in numerical analysis, and provides many effective
numerical solvers and associated software suites, able
to solve the continuous models either using time dis-
cretization or state quantization (Ben Khaled-El Feki,
2014).
Finally, all the components of the simulated sys-
tem must be carefully interconnected, and their time
scales must be meshed to provide consistent simula-
tion results over the different time representations and
scales. Both modeling and numerical integration deal
with approximations, hence it is first needed to find
a satisfactory trade-off between the simulation speed
and precision.
Real-time simulation needs to consider two time
scales:
• Real-time: it is the time reference of the real physical
system that is modeled and simulated, e.g. as mea-
sured by an absolute wall clock;
• Simulated time: it is the time elapsed during the exe-
cution of the simulation that can be measured by the
numerical integrator clock (i.e., by the accumulation
of integration steps).
To be consistent, the simulated time and real-time
must be carefully meshed to meet at some precise
points (Ben Khaled-El Feki, 2014).
Several simulation steps of growing accuracy and
fidelity to the real implementation can be processed,
from basic functional investigation in continuous time
until hardware-in-the-loop setups including parts of
the final components, just prior to real tests.
Model-in-the-loop. A first step is the choice of a
control structure, based on a model of the plant and
on the control objective. The control toolbox now
contains many tools to state and solve a large vari-
ety of control problems applied to various plants. Be-
sides control theory, preliminary design and tests of-
ten rely on simulation tools such as Scilab/Scicos or
Matlab/Simulink.
Software-in-the-loop. As for MIL, the SIL phase
considers only simulated (i.e. software) elements,
but it takes into account the actual production code,
including implementation related constraints such as
fixed-point computations and memory size limits.
Hardware-in-the-loop. After validating the soft-
ware in a real-time SIL simulation, the production
hardware can be checked in a real-time Hardware-
In-the-Loop (HIL) simulation. A HIL simulation is
made of mixed simulated and real components, which
means that some real components –usually the phys-
ical control target– are replaced by their software
avatar.
The next sections are devoted to the development
of a simulation framework dedicated to the case of a
distributed electrical functional electrical system.
2 THE FES FRAMEWORK
Functional electrical stimulation (FES) is one of ex-
isting rehabilitation techniques to restore lost motor
functions for motor-impaired people. For example, in
case of spinal cord injuries, the natural pathways be-
tween the central nervous system (CNS) and periph-
eral nerves are open under the lesion level. Therefore
such lesions forbid both the activation of movements
through motor nerves and the collection of sensory
information by the CNS.
In FES systems, electrodes are connected to
nerves or muscles and generate electrical pulses to in-
duce contractions of muscles. Similar electrodes can
be used to collect activity signals from muscles (Elec-
troMyoGrams EMG) or from nerves (ElectroNeuro-
Grams ENG). FES is primarily used for rehabilitation
of functions for people with disabilities. Until now
FES is mainly used in open-loop mode, where the
therapist selects predefined currents patterns (e.g., fre-
quency, intensity) according to the desired effect on
the patient. It is argued, e.g. (Zhang et al., 2013), that
closed-loop FES is necessary to safely control and co-
ordinate the numerous electrodes and muscles needed
to generate complex movements such as walking.
Sensors 1
st
ctrl Sensors 2
nd
ctrl
Actuators Ctrl 1 Actuators Ctrl 2
Ctrl law 1
POD
EMG
POD
STIM
Set-point
Controller
Ctrl law 2
Set-point
POD
EMG
POD
EMG
POD
STIM
Shared
sensors
Mutual exclusion
between
Controllers
Figure 1: Feedback FES.
In that case (Figure 1), the stimulation controller
is fed back by various sensors, such as limbs joints
ICINCO 2016 - 13th International Conference on Informatics in Control, Automation and Robotics
456