Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

www.mentor.

com/systemvision
Combining ModelSim

and Simulink


with SystemVision

in an Integrated
Simulation Environment
















R. Scott Cooper
Mentor Graphics Corporation


Combining ModelSim and Simulink with SystemVision - 2 -
Introduction
Multi-technology system development poses many
challenges for conventional design tools. Multi-
technology designs are complex because they can
incorporate many different technologies within a
single system. These systems typically include
analog (continuous) and digital (discrete) effects,
often spread across several areas of engineering
specialization. As a result, such systems are
commonly designed and verified with a
combination of CAD/CAE tools.
Simulation environments that can directly use
such tools as resources for system-level design and
verification are essential for two main reasons: 1) to
allow the integration of individual components and
subsystems into a single, simulatable system, and 2)
to allow effective communication and design
collaboration among individuals involved in the
development of such systems.
This paper discusses one such environment, the
SystemVision Modeling Solution. SystemVision
has the ability to effectively integrate compiled
ModelSim libraries, Simulink block diagrams, and
additional multi-technology design elements into a
single simulatable system.
This was demonstrated by developing
an Unmanned Aerial Vehicle (UAV) system with
the combined power of these tools. The role of
these tools was as follows:
SystemVision this tool provided the ability
to model detailed physics-based devices in
the electrical and mechanical domains.
SystemVision was also used as the
integration environment for the entire
system simulation.
ModelSim this tool was used to develop
and test two digital subsystems to be
ultimately implemented as FPGAs.
Simulink this tool was used to develop a
servo controller that is embedded as part of
the UAV Rudder subsystem.
Unmanned Aerial Vehicle (UAV) Overview
Referring to the system implementation illustrated
in the cover figure, the unmanned aerial vehicle
system works as follows: the vehicle operator,
stationed on the ground, operates a hand-held
joystick device (shown in the Command block). This
joystick device produces two analog commands that
control the throttle (propeller speed) and rudder
(steering), respectively.
Both the throttle and rudder commands are
multiplexed and sampled by an A/D converter and
the resulting digital words are sent to the Encoder
block. The digital words are then combined to form
a serial bitstream. These actions are controlled by a
state machine within the Encoder block.
Data is transmitted to the Flight Vehicle in a
standard RF format, where it is demodulated and
decoded back into the original binary logic format
of the bitstream.
The two channels within the bitstream are
identified and converted back into the digital word
representations of each joystick command. This
digital information is then used to generate voltage
pulses, whose width is proportional to the value of
the commanded data. A second state machine, this
one located in the Decoder block, sequences all of
these actions.
The pulse width data for each channel is
converted back into an analog representation of the
input command and filtered in the Conditioning block
before being driven into the Throttle and Rudder
subsystems. The Throttle subsystem is not
discussed in this paper.
The Rudder subsystem consists of a servo
controller, power amplifier (not shown), DC motor
and rudder assembly. The servo controller ensures
that the actual rudder position closely matches the
commanded profile. The rudder assembly consists
of two control horns to convert between rotational
and translational movement. Rudder positioning is
achieved via these control horns, coupled through a
translational linkage.
The Impact of Specialists
In an ideal world, each subsystem of this design
would be developed with a common, universal tool
that could also be used to perform integrated
systems-based analysis. For example, all of the
subsystems in the UAV design can be fully
developed and analyzed using SystemVision alone.
Unfortunately, this is not the approach typically


Combining ModelSim and Simulink with SystemVision - 3 -
taken in practice. A more likely scenario is one in
which technology specialists each develop design
subsystems using their own preferred tools, and
then contribute these subsystems to the overall
design.
The UAV design could easily involve three such
specialists: an analog and mixed-analog/digital
specialist; a digital/firmware specialist; and a
controls specialist.
The SystemVision environment itself would be
a natural fit for the analog and mixed-analog/digital
specialist. The ability to freely combine analog and
digital effectsboth at the schematic level as well
as within various models themselvesis essential
for this type of system.
The digital/firmware specialist would likely be
familiar with tools focused exclusively on digital or
firmware design. Many such tools exist, one of the
most popular being ModelSim, the digital simulator
of choice for a variety of front-end tools.
The controls specialist would likely be
comfortable in the MATLAB/Simulink
environment, as this tool dominates the controls
field.
So in the real world, the three specialists would
likely use three separate tools to develop their
various subsystems. And this approach works fine
while the subsystems are initially under
development. But what happens when the
subsystems need to be integrated together in order
to analyze systemic interactions between them? This
is where some problems arise.
In many cases, the problem of integrating
subsystems is left to the prototyping phase of the
design. One major drawback to this approach (and
there are many) is that none but the most obvious
problems will be detected in a single prototype, and
it can be quite expensive (in terms of both time and
money) to make major design changes during this
phase.
A better approach would be to simulate the
subsystems together in a virtual prototyping
environment, prior to creating any actual hardware.
This was the approach taken here. How the
subsystems of the UAV design were virtually
integrated together is discussed next.
ModelSim and SystemVision
Both the Ground Controller (Encoder) and Flight
Vehicle (Decoder) blocks are composed entirely of
digital components, and would likely be developed
by the digital/firmware specialist using a tool like
ModelSim. Compiled resource libraries would be
generated from ModelSim, and then read by
SystemVision.
How is this accomplished? Along with its
mixed-analog/digital solver, SystemVision also
incorporates a tightly-integrated version of the
ModelSim solver at the kernel level, such that both
simulation solvers run in the same Windows
process. This means that the simulation is quite
efficient, and that the user doesnt need to explicitly
direct the ModelSim portion of the simulation
through ModelSim itself.
In the cover figure, the Encoder and Decoder
block symbols simply point to their respective
design units that have been stored in ModelSim
resource libraries. These design units then become
part of the overall system simulation.
Simulink and SystemVision
For the Rudder subsystems servo design,
SystemVision co-simulates with Simulink over a
virtual bus. Although this communication occurs
synchronously between the two tools, each tool can
simulate its portion of the design independently
between synchronization points, using either fixed
or variable time steps. Both continuous and discrete
designs are supported.
The tools communicating over the virtual bus
can be located on a single computer or
implemented over a network or the internet. This
allows co-simulation to be achieved across
geographically different locations, if desired.
How SystemVision and Simulink connect to the
virtual bus is depicted in Figure 1. Interface
components are added to the desired ports in the
SystemVision design, and corresponding
components are added to ports in the Simulink
design. These components also allow users to set
communication rates between the tools.



Combining ModelSim and Simulink with SystemVision - 4 -

Figure 1 - Interface Between SystemVision and Simulink
Simulation results for this system in response to
arbitrary rudder positioning commands are shown
in Figure 2. The waveforms given include the
commanded profile from the Ground Controller
(Rudder Command), the PW2Analog converter output
(PW2Analog Output) and the actual rudder position
(Rudder Output) from the Flight Vehicle.


Figure 2 UAV Simulation Results
Summary
Complex multi-technology system development
requires specialists who use preferred technology-
specific tools to develop their designs. It is often
the case that these designs are actually subsystems
of a larger system. It then becomes essential to have
a simulation environment that can use these
technology-specific tools as resources to allow
simulations of the larger system. The SystemVision
Modeling Solution was used as such a simulation
environment to incorporate ModelSim design units
and a Simulink block as part of a complex multi-
technology UAV design.
For More Information
For a detailed description of the UAV
system discussed in this paper, please refer
to: Design Team Collaboration within a
Modeling and Analysis Environment, as
well as related case studies. These can be
found at the following web location:
http://www.mentor.com/system/tech_pub
s/
Download SystemVision for hands-on
system modeling and analysis. All of the
UAV project files are available with the
download:
www.mentor.com/systemvision/downloads
.html
Learn more about VHDL-AMS by reading
The System Designers Guide to VHDL-
AMS: Analog, Mixed-Signal, and Mixed-
Technology Modeling. Written by Peter
Ashenden, University of Adelaide, Gregory
Peterson, University of Tennessee, and
Darrell Teegarden, Mentor Graphics.
http://books.elsevier.com/mk/default.asp?i
sbn=1558607498


www.mentor.com/systemvision TECH8870w
For more information, call us or visit www.mentor.com/systemvision
Copyright 2010 Mentor Graphics Corporation. This document contains information
that is proprietary to Mentor Graphics Corporation and may be duplicated in whole or in
part by the original recipient for internal business purposed only, provided that this
entire notice appears in all copies. In accepting this document, the recipient agrees to
make every reasonable effort to prevent the unauthorized use of this information.

Corporate Headquarters
Mentor Graphics Corporation
8005 S.W. Boeckman Road
Wilsonville, Oregon 97070 USA
Phone: 503-685-7000
North American Support Center
Phone: 800-547-4303
Fax: 800-684-1795
Europe
Mentor Graphics Deutschland GmbH
Arnulfstrasse 201
80634 Munich
Germany
Phone: +49.89.57096.0
Fax: +49.89.57096.400

Japan
Mentor Graphics Japan Co., Ltd.
Gotenyama Hills
7-35, Kita-Shinagawa 4-chome
Shinagawa-Ku, Tokyo 140
J apan
Phone: 81-3-5488-3030
Fax: 81-3-5488-3031


Silicon Valley
Mentor Graphics Corporation
1001 Ridder Park Drive
San J ose, California 95131 USA
Phone: 408-436-1500
Fax: 408-436-1501

Pacific Rim
Mentor Graphics Taiwan
Room 1603, 16F,
International Trade Building
No. 333, Section 1, Keelung Road
Taipei, Taiwan, ROC
Phone: 886-2-27576020
Fax: 886-2-27576027

You might also like