On Simulating Processor Schedules and Network
Protocols within CPS using TrueTime
Sreram Balasubramaniyan

R.C.Hemesh

Department of Information Technology
Kalasalingam University
Srivilliputhur, India
bsreram85@gmail.com

Department of Electrical and Electronics Engineering
Kalasalingam University
Srivilliputhur, India
kirthihemesh@gmail.com

B.Subathra

Saravanakumar Gurusamy

Department of ICE
Kalasalingam University
Srivilliputhur, India
clk0602@gmail.com

Department of ICE
Kalasalingam University
Srivilliputhur, India
saravana.control@gmail.com

Seshadri Srinivasan
International Research Center
Kalasalingam University
Srivilliputhur, India
seshucontrol@gmail.com

Abstract—Studying cyber-physical system (CPS) for a given
network protocol and processor schedules is a challenging task.
This investigation illustrates the role of TrueTime a MATLAB
package for simulating CPS encapsulating information on
processor schedules, and network protocols. Properties of CPS
such as temporal behaviors, performance and stability can be
studied using the TrueTime tool. Furthermore, these simulations
can be used to benchmark design and propose design
alternatives. The procedure to use the toolbox for simulations
and instantiate various blocks to study CPS is illustrated in the
paper. Finally, an illustrative example has been presented of CPS
simulation with wireless network. Our example demonstrates
that TrueTime is a useful tool for studying CPS performance,
timing behavior, schedulability analysis, and studying suitable
network protocols.
Keywords— Cyber-Physical System (CPS), network protocol,
Processor Scheduling, TrueTime, simulations, Timing behavior,
CPS performance

I.

INTRODUCTION

Cyber-Physical Systems (CPS) deals with integration of
cyber world with the physical systems [12,33]. They are touted
to be future of engineering systems and have found
applications in wider domains such as automated highway
systems [1], industrial automation [3], Intelligent
Transportation [2], and smart energy systems to name a few.
The performance of the CPS is affected by the operating
principles of the cyber components such as scheduling and

978-1-4799-7849-6/15/$31.00 ©2015 IEEE

network protocols. Therefore, to design and benchmark CPS,
its performance has to be tested with these components during
design stage. As physical testing is limited due to cost
considerations, simulation have emerged as promising
solutions. Simulation tools that can be used for studying timing
behavior, stability, and performance are required for designing
CPS and performing design modifications. Furthermore, such
simulation tools can be used for bench-marking CPS designs.
TrueTime proposed by A. Cervin [24] is a tool that can be used
for studying performance of control systems with a given
network protocol and processor scheduling. This investigation
studies the role of TrueTime in simulating CPS. In particular,
simulation of CPS with timing discrepancy for a given network
protocol, and process scheduling is studied. Furthermore,
validation of controller design for a given performance
specifications using TrueTime is also studied.
In literature, several tools and methodologies are used for
studying the CPS performance that include specific aspect of
CPS such as network performance, processor scheduling, or
physical system properties. For instance, Network Simulator
NS-2 [28], has the capability to add different protocols for all
combinations of networks [34]. Visim [26] is another tool that
uses NS-2 internally, but simplifies the task of simulating
Mobile ad-hoc Wireless Network routing protocols. Authors
demonstrated the performance of different routing prtocols. It
is much easier to use and adapt than NS-2.
Formal models based on timed-automata for modeling the
timing interfaces and then verified the timing performances

2015 IEEE International Conference on Computational Intelligence and Computing Research

using UPPAAL [31] have been studied in [3, 19]. Sreram [9]
presented a simultaneous co-design and verification approach
which utilizes the UPPAAL tool to verify the timed automata
of a system having heterogeneous components. TimesTool [30]
is another tool to analyze the dynamic behavior of the system
and verify the task parameters and a given scheduling policy.
It can also verify all the instances of the future states if the
given system is schedulable.

Section III shows the implementation of TrueTime with an
example and describes it with appropriate results and how to
utilize the same effectively for validation of performance and
stability of systems with timing imperfections and variable
delay. Section IV concludes the paper by discussing the salient
features of TrueTime.

Ptolemy [27] studies the functional model, and helps in
analysis of real-time embedded systems and concentrates
mainly on concurrent components, while metroII describes the
architectural model [7]. Besides facilitating hierarchical
models, the segregation in the architectural control and data
flow between individual components enables the reliability
and more usage in future models. Dymola [29] is a tool
available open source for the modelling and analysis of
integrated and complex systems, having the capability to
simulate complex systems with multiple Functional Mockup
Units. However, these tools can only study specific aspect of
CPS such as network scheduling, timing analysis, verification
or physical simulations. Designing CPS requires simulating the
physical system considering the operating principles of the
cyber components such as network protocol and processor
schedules. TrueTime proposed by A. Cervin et al. [8] can be
used to study the performance of CPS alongside the operating
principles of cyber components. The role of TrueTime for
designing CPS has not been completely exploited in literature.

Every TrueTime toolbox simulation scheme should contain
three crucial parts: TrueTime kernel (computer, I/O device or
some embedded system), TrueTime network (network model)
and a controlled process. There is also an optional part
TrueTime battery. TrueTime kernel is responsible for I/O and
network data acquisition or data processing and calculations. It
can realize a control algorithm/logic and it is the “brain” of
every device. It uses several simple M-files (modified by us to
satisfy our needs) which handle all mentioned operations. In
the kernel can be executed several independent tasks (periodic,
non-periodic) which can cooperate on the same goal. If we
include TrueTime battery block we can set power supply for
true time kernels.

II.

SIMULATION OF CPS IN TRUETIME

A. Detailed Description of TrueTime blocks
Several blocks contribute towards the simulation of Cyber
Physical system. TrueTime Library is shown in Fig. 1, and
important blocks being detailed as below.

TrueTime is a simulation tool for controller task execution
in real-time kernels, network transmissions, and continuous
plant dynamics [35]. TrueTime simulates the real time
behavior of multi-tasking real-time kernels containing
controller tasks. It can also be used to control behaviour on
CPU and network scheduling . The support of Battery enables
TrueTime to support physical systems which is operated on a
separate power source [4, 5]. The current version 2.0 in beta
release, introduces several new features including ultrasound
network and modifying the kernel block to introduce automatic
connections using hidden goto block so that the receive and
send block can be called internally from the configurations that
are made in block dialogues. This removes the necessity of
connections between the kernel and the network blocks that
were mandatory earlier. Moreover, for wireless networks this
enables easy transfer of data packets and mimics the real world
scenario.
Main contribution in this work is to analyse the role of
TrueTime in simulating CPS with timing imperfections in
network and processors [36]. The network has imperfections
such as network delays [14], temporal delays in processor
schedules etc. In [3], it has been shown that most of these
timing uncertainties can be modelled as delays. These delays
have been modelled using empirical distribution [16, 17],
Markov Chain [15], Markov Chain Monte Carlo [13], non-liner
models [20]. This investigation extends the delay models
within CPS and then tries to simulate CPS performance with
network imperfections. The method to simulate and study the
behavior are also presented.
The investigation is divided into following sections. Section
II deals with important blocks and its functions and parameters.

Fig. 1. TrueTime Library

1) Kernel block: The core block of TrueTime helps to set
the initialization file which can be used not only to specify and
set the scheduler parameters but also the interrupt handlers, and
power management block handlers. These can be configured as
separate files which helps in modularity and custom
configurations of individual handlers. The Kernel block can be
used to simulate sensors, actuators and controllers. One
additional advantage of the kernel block is that the
functionality of the Sensor/Actuator/Controller blocks can be
simulated in a single block or can be simulated in combination

2015 IEEE International Conference on Computational Intelligence and Computing Research

as shown in Section III. Kernel block has the following
parameters
• Name of the init function – defines the name of an Mfile or a MEX file where the initialization code is
stored.
• Init function argument – defines the optional arguments
that is to be passed to the initialization code.
• Number of analog inputs and outputs – defines the
number of inputs and outputs.
• Node numbers - defines the network device as a node.
• Local clock drift – It is the time drift from the nominal
time. i.e., actual simulation time.
The local clock drift and offset parameters can be used to
introduce jitter and validate the same with the network and
controller design.
.
2) Network block:
Network block helps in specifying the protocol and can be
configured to have packet drops in a specified probability, and
if configured packets are dropped randomly with the
probability.
• Network type – defines the type of the network and
underlying protocol used.
• Network number – it is a network ID and every network
should have separate number.
• Number of nodes – defines the number of kernel
elements in the network.
• Data rate (bits/sec) – To set network speed.
• Minimum frame (bits) – Messages are constrained to
this value.
• Loss probability – probability of packet drop in the
network.
Note that the Network block supports various Protocols
including Ethernet and CAN networks.
.
3) Wireless Network:
This block simulates transfer of a packet in a wireless
network with appropriate protocol and depends on the
following parameters.
• Network Type – defines the type of network and
determines the underlying MAC protocol to be used.
• Network Number – defines the unique id of network.
• Number of nodes – it is a network ID and every
network should have separate number.
• Data Rate and Minimum Frame size – defines the
bandwidth and the minimum size of each packet.

• Transmit power, signal threshold and path loss
exponent helps in signal reception and network
availability for the wireless nodes.
• Ack timeout and retry limit helps in retransmission of
packets for specific protocols that supports
retransmission.
• Optional 'Show Power consumption output port' helps
in monitoring the power consumed by the network.
Note that the wireless network supports WLAN, ZigBee
and NCM_WIRELESS Networks. 802.11b, 802.15.4 and
802.11n network standards are implemented by the
corresponding network types. Wireless Network requires
additional two dimensional position input for its operation
4) Ultrasound Network This block helps in simulating the
ultrasound networks which emit sound in different frequencies,
and requires the following parameters.
• Network number and Number of nodes – Unique
network ID and number of kernel nodes in the network.
• Ping Length – defines the distance till which the nodes
can transfer the packets.
• Speed of sound – Speed of sound in the particular
environment (glass/liquid/air).
5) Other Blocks: Other blocks include Battery, Receive
and send blocks. The battery block utilizes the available power,
and is specified the initial operational energy available in the
block. When the simulation is run, the available power is
consumed and when the all the power is consumed, the
corresponding kernel block is switched off. Further operation
of the block is aborted, and the system can be simulated for
stability and performance when a particular block
(Sensor/Controller) is down after all the configured power is
utilized. The Receive and Send blocks are now inbuilt in the
Kernel block and might not be necessary to run the simulation,
however, if custom protocol implementation is required in the
Network block to have control over what packet is transmitted,
encryption and decryption of packets etc., these blocks prove
useful and are necessary.
Each block in the TrueTime tool is useful to simulate
different environments, protocols, physical systems and their
timing performances, and can prove an inevitable tool for
validating timing tolerances.
III.

SIMULATION EXAMPLE

Fig. 2 shows the simulation example of a DC-Servo motor
[32] using a networked control system using a wireless
communication network. It consists of two nodes namely
sensor/actuator node and a controller node. The periodical
sampling process is done by sensor/actuator node and is sent to
controller node where the control task in this node is calculated
and the signal is fedback to the sensor/actuator node [37,38].
The simulation is done using WLAN protocol.

2015 IEEE International Conference on Computational Intelligence and Computing Research

Fig. 2. Block Diagram

The underlying kernel can be initialized with desired
scheduling algorithms, so that the system can be validated for
different scheduling algorithms, even before practical
implementation of scheduling protocols using networks.
TrueTime along with Simulink tool can also validate
variable delays introduced as part of network or other modules.
The simulation example introduces the variable delay in
transmitting the actuator signal to the plant. Network schedule
gives the appropriate values for each of the transmitted signals
via the network.
Fig. 6 shows the network schedule for the variable delay
system. The performance of the system can be obtained from
the underlying control algorithm, which again can be specified
as an external handler. The timing constraints that are to be
specified in the controller algorithm introduces practical delays
experienced by the system in real world, and hence is able to
validate the timing tolerances of the system.

Fig. 3. Response for FP scheduling

In multi-core environments, the number of processors in the
system can be set. It also allows us to customize the handlers
and interrupts by specifying external handler. TrueTime
supports protocols like CAN, Ethernet and other networks and
also supports WLAN, Zigbee and NCM_Wireless protocols for
wireless networks. These can also be evaluated in a noisy
environment by introducing packet drops

2015 IEEE International Conference on Computational Intelligence and Computing Research

Fig. 6. Network Schedule
Fig. 4. Response for DM scheduling

REFERENCES
[1]

Fig. 5. Response for EDF scheduling

IV.

CONCLUSION

TrueTime helps in validating performance of control
systems with a given network and helps in simulation of
various network protocols. It can be used to study the effect of
variation of various network parameters including but not
limited to bandwidth, packet loss, and compatibility with
different protocols. In combination with Simulink and Matlab
toolboxes, it can also simulate real-time systems. TrueTime can
be further extended to support more protocols, so that the
validation can be done in various environments and the
performance of each can be compared. Options to validate
various performance measures, timing constraints, various
protocols and scheduling algorithms, and options to extend the
protocols to implement and include custom protocols, makes it
one of the inevitable tools in simulation of CPS.

Srinivasan, Seshadhri, and Ramakalyan Ayyagari. "Advanced driver
assistance system for AHS over communication links with random
packet dropouts," Mechanical Systems and Signal Processing 49, no. 1
(2014): 53-62.
[2] Seshadhri, S., and R. Ayyagari. "Platooning over packet-dropping
links."International Journal of Vehicle Autonomous Systems 9, no. 1-2
(2011): 46-62.
[3] Srinivasan, Seshadhri, Furio Buonopane, Juri Vain, and Srini
Ramaswamy. "Model checking response times in Networked
Automation Systems using jitter bounds." Computers in Industry,
Volume 74, December 2015, Pages 186-200, ISSN 0166-3615.
[4] Chvostek T, Kratky A, Foltin M, Simulation of Network Using
TrueTime Toolbox. In: Technical Computing, 15th Annual Conference
Proceedings. Prague, Czech Republic, 2007.
[5] Urban, M-Blaho, M. Murgas, and J. Foltin. M.: "Simulation of
Networked Control Systems via TrueTime." Technical Computing
Prague (2011).
[6] Jensen, J.C.; Chang, D.H.; Lee, E.A., "A model-based design
methodology for cyber-physical systems," in Wireless Communications
and Mobile Computing Conference (IWCMC), 2011 7th International ,
vol., no., pp.1666-1671, 4-8 July 2011.
[7] Davare, A.; Densmore, D.; Guo, L.; Passerone, R.; SangiovanniVincentelli,
A.
L.;
Simalatsar,
A.
&
Zhu,
Q.,
metroII: A Design Environment for Cyber-physical Systems
ACM Trans. Embed. Comput. Syst., ACM, 2013, 12, 49:1-49:31.
[8] Anton Cervin, Dan Henriksson, Bo Lincoln, Johan Eker, Karl-Erik
Årzén: IEEE Control Systems Magazine,23:3, pp. 16–30, How Does
Control Timing Affect Performance? Analysis and Simulation of Timing
Using Jitterbug and TrueTimeune 2003.
[9] Sreram Balasubramaniyan, Seshadhri Srinivasan,
Design and
Verfication of Cyber Physical Systems with Heterogeneous
Components, Advanced Computing and Communications Society
ADCOM 2015.
[10] Wang,
Y.;
Vuran,
M.
C.
&
Goddard,
S.
Cyber
physical
Systems
in
Industrial
Process
Control
SIGBED Rev., ACM, 2008, 5, 12:1-12:2.
[11] Akshay H. Rajhans, Multi-Model Heterogeneous Verification of
CyberPhysical Systems, PhD Dissertations, Carnegie Mellon University,
2013.
[12] Sreram, B., Furio Buonopane, Seshadhri Srinivasan, B. Subathra, and R.
Ayyagari. "Verification of design contracts for cyber-physical system
design using evolutionary optimization." In Circuit, Power and
Computing Technologies (ICCPCT), 2015 International Conference on,
pp. 1-6. IEEE, 2015.

2015 IEEE International Conference on Computational Intelligence and Computing Research

[13] Seshadhri, S., and R. Ayyagari. "Dynamic controller for Network
Control Systems with random communication delay." International
Journal of Systems, Control and Communications 3, no. 2 (2011): 178193.
[14] Seshadhri, S. "Estimation and design methodologies for networked
control systems with communication constraints." PhD diss., Ph. D.
dissertation, Dept. Instrumentation and Control Eng., National Institute
of Technology, Tiruchirappalli., Tiruchirappalli, India, 2010.
[15] Seshadhri, S., and R. Ayyagari. "Hybrid Controllers for Systems with
Random Communication Delays." In ARTCom, pp. 954-958. 2009.
[16] S. Srinivasan, , Mishiga Vallabhan, Srini Ramaswamy, and Ulle Kotta.
"Adaptive LQR controller for Networked Control Systems subjected to
random communication delays." In American Control Conference
(ACC), 2013, pp. 783-787. IEEE, 2013.
[17] S. Srinivasan, Mishiga Vallabhan, Srini Ramaswamy, and Ulle Kotta.
"Adaptive regulator for networked control systems: MATLAB and true
time implementation." In Control and Decision Conference (CCDC),
2013 25th Chinese, pp. 2551-2555. IEEE, 2013.
[18] Mishiga Vallabhan, Seshadhri Srinivasan, S. Ashok, S. Ramaswamy,
and R. Ayyagari. "An Analytical Framework for Analysis and Design of
Networked Control Systems with Random Delays and Packet Losses.”
25th IEEE Decision and Control Conference, 2012.
[19] S. Srinivasan, Furio Buonopane, Srini Ramaswamy, and Juri Vain.
"Verifying Response Times in Networked Automation Systems Using
Jitter Bounds." In Software Reliability Engineering Workshops
(ISSREW), 2014 IEEE International Symposium on, pp. 47-50. IEEE,
2014.
[20] Srinivasan, Seshadhri, Furio Buonopane, G. Saravanakumar, B.
Subathra, and Srini Ramaswamy. "Modelling time-varying delays in
networked automation systems with heterogeneous networks using
machine learning techniques." In Automation Science and Engineering
(CASE), 2015 IEEE International Conference on, pp. 362-368. IEEE,
2015.
[21] Sreram, B.; Bounapane, F.; Subathra, B.; Srinivasan, S.; N,
Muthukumar; "Estimating Random Delays in Modbus over TCP/IP
network Using Experiments and General Linear Regression Neural
Networks with Genetic Algorithm Smoothing, Advances in Intelligent
Systems and Computing, vol. 2, no. 398, 2015, Springer.
[22] Derler, P.; Lee, E.A.; Vincentelli, A.S., "Modeling Cyber–Physical
Systems," in Proceedings of the IEEE , vol.100, no.1, pp.13-28, Jan.
2012.
[23] Rajhans, A.; Bhave, A.; Ruchkin, I.; Krogh, B.H.; Garlan, D.; Platzer,
A.; Schmerl, B., "Supporting Heterogeneity in Cyber-Physical Systems
Architectures," in Automatic Control, IEEE Transactions on , vol.59,
no.12, pp.3178-3193, Dec. 2014
[24] A. Cervin, D. Henriksson, M. Ohlin, TrueTime 2.0 beta 5 - Reference
Manual, Department of Automatic Control, Lund University, Sweden,

[25]
[26]

[27]
[28]

[29]
[30]

[31]

[32]

[33]

[34]

[35]

[36]

[37]
[38]

June
2010.
cit:
10.10.2011,
available
at
<http://www3.control.lth.se/truetime/>
http://cyberphysicalsystems.org/
Nazmus Saquib, Md. Sabbir Rahman Sakib, Al-Sakib Khan Pathan,
ViSim: A user-friendly graphical simulation tool for performance
analysis of MANET routing protocols, Mathematical and Computer
Modelling, Volume 53, Issues 11–12, June 2011, Pages 2204-2218,
ISSN 0895-7177, http://dx.doi.org/10.1016/j.mcm.2010.08.026.
Claudius Ptolemaeus, “System Design, Modeling, and Simulation using
Ptolemy II,” Ptolemy.org, 2014.
S. Kurkowski, T. Camp, N. Mushell, M. Colagrosso, A visualization and
analysis tool for wireless simulations: iNSpect, in: Proceedings of 13th
IEEE International Symposium on Modeling, Analysis, and Simulation
of Computer and Telecommunication Systems, 27–29 September 2005,
pp. 503–506.
http://www.3ds.com/fileadmin/PRODUCTS/CATIA/DYMOLA/PDF/D
ymola_2016_Release_Notes_.pdf
Tobias Amnell, Elena Fersman, Leonid Mokrushin, Paul Pettersson, and
Wang Yi. TIMES: a Tool for Schedulability Analysis and Code
Generation of Real-Time Systems. To appear in Proceedings of the 1st
International Workshop on Formal Modeling and Analysis of Timed
Systems, FORMATS 2003, Marseille, France, September 6-7, 2003.
Behrmann, G., David, A. & Larsen, K. A Tutorial on Uppaal Formal
Methods for the Design of Real-Time Systems, Springer Berlin
Heidelberg, 2004, 3185, 200-236.
Aliane, N., "A Matlab/Simulink-Based Interactive Module for Servo
Systems Learning," in Education, IEEE Transactions on, vol.53, no.2,
pp.265-271, May 2010.
"A Matlab/Simulink-Based Interactive Module for Servo Systems
Learning," in Education, IEEE Transactions on, vol.53, no.2, pp.265271, May 2010.
Saquib, N.. "ViSim: A user-friendly graphical simulation tool for
performance analysis of MANET routing protocols", Mathematical and
Computer Modelling, 201106
ElMoustapha Ould-Ahmed-Vall. "Simulation of LargeScale Networked
Control Systems Using GTSNetS", Lecture Notes in Control and
Information Science, 2006
Srinivasan, Seshadhri, Furio Buonopane, G. Saravanakumar, B.
Subathra, and Srini Ramaswamy. "Modelling time-varying delays in
networked automation systems with heterogeneous networks using
machine learning techniques", 2015 IEEE International Conference on
Automation Science and Engineering (CASE), 2015
http://www.control.lth.se
Song, Zhiqiang, and Xianzhong Zhou. "Research and simulation of
wireless sensor and actuator networked control system", 2013 25th
Chinese Control and Decision Conference(CCDC),2013

