VisSim Primer

R. A. Kolk - Adjunct Prof. Electrical Engineering

 

1. Introduction:

VisSim is a "state of the art" block diagram based simulation language designed to assist you in the analysis and design of systems (both continouus and discrete), controls, data acquisition and system monitoring. Since VisSim is graphical in nature, no programming language experience is required or even necessary. Block diagrams (as they appear in textbooks) may be entered directly into VisSim using the mouse and keyboard. After construction is complete, the diagram may be simulated (solved) and subsequently analyzed. VisSim is available in several versions ranging from the micro version to the professional version. The student version, installed at the University, limits the individual block count in any block diagram to a maximum of 255 and the analysis section of the student version is limited to systems of order 15 or less.

2. Primitive Blocks:

VisSim has the following capabilities:

· Block library and diagram editor for creating Block diagrams.

· Numerical methods for simulating (solving in time) the block diagram

· Numerical methods for analyzing a block diagram in the (jw plane and s-plane)

 

All VisSim blocks have a standard structure consisting of inputs (triangular connectors into the block), outputs (triangular connectors out of the block), and parameters (observed and set by placing the mouse curser on the block and pressing the right mouse button). The Block library (under the pulldown menu Blocks) is accessed by placing the mouse on the menu bar heading Blocks, pressing and holding the left mouse button. To access a block, place the mouse curser on the desired name in the Blocks menu, push and hold the left mouse button while dragging the block to the desired location on the screen. Repeat this procedure as many times as required. The contents of the block library is presented on the last page of this primer.

3. UT 103 Login Procedure:

Prior to starting a VisSim session, obtain a formatted 3.5" floppy disk to save any VisSim block diagrams and results you generate. To begin a VisSim session the following steps are performed;

 

· Turn on the PC and monitor

· After bootup a menu screen with 7 choices will appear, type the f7 key to invoke VisSim.

· The VisSim Introductory Menu will appear in about 10 seconds.

 

Push the OK button and the VisSim menu bar will appear across the top of the screen with the remainder of the screen blank. Insert the floppy disk into the drive and you're ready to create block diagrams, simulate, analyze, print, and save them.

4. Examples:

 

Ex 1: Second Order Continuous System: In this example we will construct and simulate a continuous second order lag filter with transfer function defined as T(p) =   . This system requires two integrators, three gains, and two summing junctions. Blocks are connected together in VisSim by wires which communicate data from one block to the next. To form a wire, the mouse curser is placed on either an input or an output triangle of a block, the left button is pressed and held while the mouse is dragged to either an output or input triangle of another block and then the button is released. Once the connections are made, the blocks can be straightened by placing the mouse on the block, pressing the left button and dragging the block to its desired loacation. The block diagram may now be simulated. We will find its unit step response and plot it. From the Blocks menu, the step block is selected and connected to the remaining input of the leftmost summing junction. A plot block is selected and connected to the output of the rightmost summing junction to display the response. The block diagram still needs to know "how long to simulate for". This parameter along with a stepsize parameter (used for integration accuracy) are set under the VisSim pulldown menu entitled Simulate and submenu entitled Change Parameters .... For this problem we will select a stepsize of .01 seconds and a time range (range end) of 2 seconds. The Simulate, Change Parameter..." menu is shown in the figure entitled Simulate - Change Parameter ... Menu. We are now ready to simulate by selecting the go option under the Simulate pulldown menu. The VisSim diagram and results are presented in the Ex 1 Zero State Response figure.

This response is called a zero-state response because all state initial conditions are set to zero. The zero-input response could also be produced. We will specify state (integrator) initial conditions of 1 on both states by placing the mouse curser on each of the integrators, depressing the right button and entering the initial condition (1). With the input disconnected, the block diagram is resimulated using the Simulate, go command with the results shown in the figure entitled Ex 1 Zero State Response.

 

Ex. 2 Discrete Integrator & Compound Blocks: In discrete time systems it is often necessary to generate functions of the form form xk (where k is the time index, 0, 1, 2, ...). k can be generated by applying a regularly spaced unit height pulse to a running sum block diagram. A running sum is defined by the following equation; output = output_past_value + incremental_change. The VisSim pulsetrain block is used to generate a boolean trigger signal (high/low = 1/0) at regularly spaced time intervals. The pulsetrain denotes the instants in time at which a discrete event (such as a unit deay) is active. The VisSim pulsetrain block is selected and placed on the VisSim screen. By rightbuttoning the pulsetrain block it's parameters are displayed. The time between pulses parameter is first highlighted using the mouse leftbutton and then defined as .25 - the value is saved by selecting "ok". By applying the pulsetrain to the incremental_change (input) a piecewise constant valued signal (k - the time index) will be produced. This is shown in the figure entitled Ex 2 Incorrect K=0 Response (which uses a time panel = .05 and a final time = 3). Notice that k = 1 at time = 0. This is not correct and is due to the pulsetrain operator outputting a pulse initially at time = 0. To correct this the pulsetrain input is delayed by one time step (.25 seconds) by rightbuttoning on the pulsetrain block, highlighting the timedelay option value, and entering .25. The results of this change are shown in the figure entitled Ex 2 Correct Response.

 

Compound Blocks: This example has created a k-index which can be used in any simulation. It will be advantageous to save this block diagram as an icon (compound block) so it can be added to any block diagram using the file pulldown menu - add option. To create a compound block the following steps are followed.

 

1. Remove any display devices as they slow down the VisSim simulation. The plot block is the only output device in this block diagram. To delete it, first lasso it by placing the mouse cursor outside of its upper left corner, depress the mouse left button, while holding the button down drag the mouse cursor to just outside the lower right corner of the plot box, let go of the mouse left button. If you have properly lassoed the plot block it will display in reverse video. Next hit the delete key on the keyboard and the plot block will dissappear.

 

2. Lasso the entire block diagram, it will be displayed in reverse video. Select Edit Diagram on the VisSim menu bar and select the Create Compound Block option. You will be prompted for a name. Enter k - index as a descriptive name and hit ok. (Note: any name could be used here but you may as well choose something meaningful).

 

3. Your compound block will appear as a single block on the VisSim screen. It will have the same types of properties (inputs, outputs, parameters, graphical movement) as any of the VisSim Blocks. To see the contents of the block place the mouse cursor on it and depress the right button (this is called exploding the block). To move back up one level place the mouse cursor on any blank background and depress the mouse right button.

 

4. Your compound block has no inputs or outputs. It would be desirable to have k as the output. To add an output get to the top level of the compound block, select Edit Diagram on the VisSim menu bar and select the Add output option. The mouse cursor will change to an x. Place the x on the compound block and depress the left mouse button once. One output tab will be added to the compound block. To terminate the Add output mode, place the mouse cursor (still an x) on any blank background and press the left button once. The mouse cursor will change back to normal.

 

5. Verify the interior connections of the compound block by first exploding the block and then wiring the desired output to the output tab on the right side of the screen, in this example, k is the desired output.

 

6. At the top level, move the k-index compound block to the upper left corner of your screen and from the file pulldown menu on the VisSim menu bar and select the Save As... option. You will be prompted for a filename (limited to 8 characters). Before entering the filename, select the a: drive on the rightmost part of the menu. Now enter the filename that you wish to save this as, a good name here may be k_index, no extension is required as VisSim appends the extension .vsm to all of its files. After saving the compound block (on your floppy disk) it may be added to any VisSim block diagram using the Add option of the File pulldown menu on the VisSim menu bar. (Remember to specify the drive in this step as you will usually be working on the C: drive and adding from the A: drive).

 

Ex 3 Using Compound Blocks and Saving Your Diagrams: Consider the problem of simulating the function ( )k with the value of the time panel selected as 0.25. The VisSim menu File, option Add is selected. The file to be added is located by directory and name, in this case it is named k_index and is located on the a: drive directory. After adding this file, the k_index compound block will appear in the upper left corner of your screen. The remainder of the block diagram is constructed using the power operator, plot box and constant box.

An input is added (Edit Diagram, Add Input) to the power block (bottom input for exponent) and 1/2 is fed to the upper input (upper input for base). (Note: normally the exponent of the power operator is accessable only by exploding the pow block. To specify an exponent externally you must add an input to the pow block. The results of a simulation with time panel = .01 and final time = 3.0 seconds is presented to the right. To save the complete diagram, select the pulldown menu file, option save as and enter the drive (always save on a: drive) and name.

 

Ex. 4 Printing Diagrams and Plots: In this example we will calculate the total response of a transfer function given as; T(E) =     with input ( )k and output initial condition equal to 5. The VisSim diagram is constructed using icons from the Block menu and the input is created using the "file - add" of the previously developed k-index compound block. A digital update time between samples of 0.25 seconds is used and the simulation is run for 3 seconds with a continuous time interval of 0.01 seconds. Note the pulsetrain (with "time between pulses" set to 0.25) used to trigger the unit delay block. The block diagram and simulation results are presented in the figure to the right.

 

5. Purchasing Information:

To run VisSim on your PC you will need; at least 2 MB ram, a hard disk, VGA monitor, mouse, and Windows 3.0 or higher. Complete VisSim manuals and special student rate packages are available directly from Visual Solutions, Inc. at (508) 692-5499 or (508) 392-0100 and select SALES using the phone routing system. The student package, under $100, applies to Univ. of Hartford students and includes a copy of the personal version of VisSim and a student version of the ANALYZE add-on option. Manuals are also included.

 

 

Annotation:

 

comment

Adds a comment box

date

Displays date & time

scalarToVec

Groups scalar signals to vector wire

vecToScalar

Ungroups vector to scalars

variable

Wireless transmission of signal

wirelabel

One line comment field

wirePositioner

Manual wire elbow

Arithmetic:

 

1/x

-x

*

/

abs

gain

pow

sign

summingJunction

Boolean:

 

>

Greater than

<

Less than

>=

Greater than or equal to

<=

Less than or equal to

==

Equal to

!=

Not equal to

not

Boolean not

and

Boolean and

or

Boolean or

xor

Boolean exclusive or

Integration:

 

 

integrator

 

limitedIntegrator

 

resetIntegrator

transferFunction

Nonlinear:

 

 

crossDetect

 

deadband

int

y=integer part of x

limit

y=max(min(x,lowerBound),upperBound)

map

y=table(x); table = 1D or 2D

max

merge

min

quantize

relay

samplehold

 

Random Generators:

 

gaussian

y=normally distributed r.v.

uniform

y=normally distributed r.v. (0-1)

Real Time:

 

rtDataIn

y=sensor input data

rtDataOut

y=actuation output data

Signal Producers:

 

button

if (button white) then y=0, else y=1

const

y = const

import

reads up to 16 signals from an ASCII file

parabola

pulseTrain

ramp

realTime

y = time (msec) from start of VisSim session

sinusoid

slider

mouse driven analog input

step

unknown

Implicit equation unknown variable block

Signal Consumers:

 

constraint

Implicit equation equality constraint block

display

digital display of input signal

error

Error condition =

export

Writes up to 16 signals to an ASCII file

meter

D'arsonval Type meter display

plot

Plots up to 4 input signals

stop

Transcendental:

 

acos

y = arc cosine(x)

asin

y = arc sine(x)

atan2

bessel

cos

y = cos(x), x in rad/sec

exp

ln

log10

sin

y = sin(s), x in rad/sec

sqrt

tan

y = tangent(x), x in rad/sec

Time Delay:

 

timeDelay

continuous time delay of seconds

unitDelay

DDE:

Dynamic Data Exchange with other Windows applications.

userFunction:

Dynamic Link Library interface to FORTRAN, C, and PASCAL programs.