文档库 最新最全的文档下载
当前位置:文档库 › VisSim_用户手册part1

VisSim_用户手册part1

Version 8.0
VisSim User's Guide

By Visual Solutions, Inc.
Visual Solutions, Inc.
VisSim User's Guide Version 8.0
Copyright . 2010 Visual Solutions, Inc. Visual Solutions, Inc.
All rights reserved. 487 Groton Road
Westford, MA 01886

Trademarks VisSim, VisSim/Analyze, VisSim/CAN, VisSim/C-Code, VisSim/C-Code Support Library source, VisSim/Comm, VisSim/Comm C-Code, VisSim/Comm Red Rapids, VisSim/Comm Turbo Codes, VisSim/Comm Wireless LAN, VisSim/Fixed-Point, VisSim/Knobs & Gauges, VisSim/Model-Wizard, VisSim/Motion, VisSim/Neural-Net, VisSim/OPC, VisSim/OptimzePRO, VisSim/Real-TimePRO, VisSim/State Charts, VisSim/Serial, VisSim/UDP, VisSim Viewer,and flexWires are trademarks of Visual Solutions. All other products mentioned in this manual are trademarks or registered trademarks of their respective manufacturers.
Copyright and use The information in this manual is subject to change without notice and
restrictions does not represent a commitment by Visual Solutions. Visual
Solutions does not assume any responsibility for errors that may
appear in this document.

No part of this manual may be reprinted or reproduced or utilized in any form or by any electronic, mechanical, or other means without permission in writing from Visual Solutions. The Software may not be copied or reproduced in any form, except as stated in the terms of the Software License Agreement.
Acknowledgements The following engineers contributed significantly to preparation of
this manual: Mike Borrello, Allan Corbeil, and Richard Kolk.



Contents


Introduction 1 What is VisSim.......................................................................................................................... 1

The VisSim product family ....................................................................................................... 1

Resources for learning VisSim..................................................................................................3

New features.............................................................................................................................. 3

Interactive webinars................................................................................................................... 4

VisSim movies .......................................................................................................................... 4

Sample diagrams ....................................................................................................................... 4

Training ..................................................................................................................................... 5

Quickstart 7 Overview of VisSim environment.............................................................................................7

Work area....................................................................................................................8

Menu bar .....

................................................................................................................ 8

Toolbars ...................................................................................................................... 9

Scroll bars and Diagram Browser ............................................................................... 9

Status bar................................................................................................................... 10

Simulating a sample VisSim model......................................................................................... 10

Building and simulating a simple VisSim model .................................................................... 13

Working with Block Diagrams 21 Navigating block diagrams......................................................................................................21

Panning and zooming at the current level ................................................................. 21

Moving to different levels.........................................................................................21

Managing block diagrams ....................................................................................................... 23

Creating new block diagrams....................................................................................23

Opening existing block diagrams..............................................................................23

Changing the appearance of block diagrams............................................................. 23

Protecting block diagrams.........................................................................................27

Saving block diagrams .............................................................................................. 28

Adding block diagrams ............................................................................................. 29

Embedding block diagrams.......................................................................................29

Tracking block diagram progress..............................................................................32

Switching between block diagrams...........................................................................33

E-mailing a block diagram ........................................................................................ 33

Printing a block diagram ........................................................................................... 34

Refreshing a block diagram....................................................................................... 35

Closing block diagrams.............................................................................................35

Working with Toolboxes 37 Controls toolbox......................................................................................................................37

Delay approximati

on toolbox .................................................................................................. 37

Dynamic systems toolbox........................................................................................................ 37

Electric toolbox ....................................................................................................................... 38

Electromechanical toolbox ...................................................................................................... 38

Fixed point toolbox.................................................................................................................. 38

Hydraulic toolbox....................................................................................................................39

Logic toolbox .......................................................................................................................... 40

Oil and gas toolbox.................................................................................................................. 40

Process toolbox........................................................................................................................ 40

Quaternion operation toolbox..................................................................................................40

Signal generation toolbox........................................................................................................ 41

Thermal toolbox ...................................................................................................................... 41

Tools toolbox........................................................................................................................... 41


Working with Blocks 43 Types of blocks ....................................................................................................................... 43

Inserting blocks ....................................................................................................................... 44


Specifying block parameters ................................................................................................... 45

Evaluating block parameters during simulation........................................................45

Entering block labels.................................................................................................46

Entering alphanumeric text strings............................................................................46

Entering numeric data ............................................................................................... 46

Entering expressions ................................................................................................. 46

Entering complex numbers........................................................................................ 47

Entering matrix data...................................

...............................................................47

Entering macros in file names...................................................................................49

Using path aliases to reference files .......................................................................... 49


Setting up connector tabs......................................................................................................... 51

Specifying connector tab colors and signal data types .............................................. 51

Displaying signal data values....................................................................................52

Adding and removing connector tabs........................................................................ 52

Labeling connector tabs ............................................................................................ 53

Setting connection classes.........................................................................................53

Restricting connections to class members.................................................................55


Selecting blocks....................................................................................................................... 56


Editing blocks.......................................................................................................................... 56

Moving and copying blocks ...................................................................................... 56

Flipping blocks.......................................................................................................... 59

Aligning blocks ......................................................................................................... 59

Finding and replacing blocks .................................................................................... 60

Deleting blocks.......................................................................................................... 62


Creating block hierarchy ......................................................................................................... 62

Creating a compound block....................................................................................... 62

Drilling into a compound block ................................................................................ 63

Editing compound block properties .......................................................................... 64

Labeling connector tabs on compound blocks .......................................................... 72

Dissolving a compound block...................................................................................72

Re-using compound blocks ....................................................................................... 73


Working with Signals 75 Types of signals.........................................................................

..............................................75

Blocks that accept vector and matrix signals ............................................................ 75

Signal data types ....................................................................................................... 76

Transmitting signals ................................................................................................................ 76

Connection rules........................................................................................................ 76

Connecting blocks.....................................................................................................77

Creating a specific wiring a path...............................................................................77

Displaying signal values............................................................................................ 78

Coloring wires...........................................................................................................78

Labeling wires...........................................................................................................78

Hiding wires..............................................................................................................78

Deleting wires ........................................................................................................... 78

Using variables to transmit signals............................................................................ 78


Simulating Dynamic Systems 83 Types of dynamic systems....................................................................................................... 83

Continuous system simulation .................................................................................. 83

Discrete time system simulation................................................................................ 90

Hybrid system simulation.......................................................................................... 91

Multi-rate simulation................................................................................................. 92

Conditional execution ............................................................................................... 92

Executing modes ..................................................................................................................... 93

Normal mode execution ............................................................................................ 93

Batch mode execution ............................................................................................... 93

Rapid mode execution...............................................................................................94


Setting simulation parameters ................................................................................................. 94

Setting up the simulation range...

..............................................................................95

Setting up an integration method............................................................................... 98

Setting up simulation preferences ........................................................................... 104

Setting simulation defaults......................................................................................109


Controlling a simulation........................................................................................................110

Using the Simulation Control Panel........................................................................110

Starting a simulation ............................................................................................... 110

Stopping a simulation.............................................................................................. 111

Continuing a simulation .......................................................................................... 111

Resetting a simulation to initial conditions ............................................................. 111

Dynamically modifying signal values.....................................................................111

Speeding up simulations.......................................................................................... 111

Trimming a system.................................................................................................. 112

Resetting error conditions ....................................................................................... 112

Snapping system states............................................................................................ 112

Resetting system states............................................................................................ 112


Debugging dynamic models .................................................................................................. 113

Correcting algebraic loop errors.............................................................................. 113

Single-stepping a simulation ................................................................................... 118

Probing signal values .............................................................................................. 119

Correcting integration that has discontinuities ........................................................ 119

Stabilizing system behavior .................................................................................... 119

Checking for wiring mistakes ................................................................................. 119


Viewing simulations..............................................................................................................120


Solving Implicit Equations 121 Setting up an implicit equation..........................................................

.................................... 121

Solving an implicit equation.................................................................................................. 121


Using the implicit solver in compound blocks ...................................................................... 124


Creating custom implicit solvers ........................................................................................... 125

Source files for building a custom implicit solver................................................... 125


Using vissimRequest() in a custom implicit solver.................................................125

Building a custom implicit solver ........................................................................... 127

Using the constraint block with a custom implicit solver ....................................... 127



Performing Global Optimization 129 Global optimization basics .................................................................................................... 129

Cost functions with many local minimum values ................................................... 129

Cost functions with no minimum values.................................................................129

Performing global optimization............................................................................................. 129


Troubleshooting..................................................................................................................... 131


Creating custom global optimizers........................................................................................131

Source files for building a custom global optimizer................................................ 132

Using vissimRequest() in a custom global optimizer..............................................132

Building a custom global optimizer ........................................................................ 134


Designing Digital Filters 135 Digital filter basics ................................................................................................................ 135

Filter operations..................................................................................................................... 135


Time domain filters with tapped delay .................................................................................. 136


Time domain filters with transfer functions .......................................................................... 136


Frequency domain filter implementation............................................................................... 136


Comparison of FIR and IIR filters......................................................................................... 137


Interactive filter design with the transferFunction block.......................................................137


IIR filter design ....................................

................................................................................. 138


FIR filter design..................................................................................................................... 142

Using the FIR Filter Properties dialog box.............................................................. 142

Discrete and continuous FIR filter design...............................................................144


Working with Matrices 147 VML Window ....................................................................................................................... 147

Entering VML functions ......................................................................................... 147

VML arithmetic operators.......................................................................................148

Opening a new VML window.................................................................................148

Passing data to your block diagram......................................................................... 148

Closing the VML window....................................................................................... 148

VML functions ...................................................................................................................... 148

abs(m)...................................................................................................................... 149

cos(m)...................................................................................................................... 149

diag(v) ..................................................................................................................... 150

eye(n) ...................................................................................................................... 150

exp(m) ..................................................................................................................... 150

inv(m)...................................................................................................................... 150

length(m)................................................................................................................. 151

log10(m).................................................................................................................. 151

log2(m).................................................................................................................... 151

log(m)...................................................................................................................... 151

max(m).................................................................................................................... 152

min(m)..................................................................................................................... 152

ones(n).......................................................................

.............................................. 152

pi ............................................................................................................................. 153

rand(n)..................................................................................................................... 153

reshape(m.r,c).......................................................................................................... 153

sin(m) ...................................................................................................................... 153

size(m,k).................................................................................................................. 154


sqrt(m)..................................................................................................................... 154

sum(m) .................................................................................................................... 154

zeros(n).................................................................................................................... 154



Using the VisSim Tutor 157 Creating a VisSim Tutorial.................................................................................................... 157

The Tutorial block................................................................................................... 157

Understanding the Tutorial Control Panel............................................................... 158

Inserting and customizing a pop-up balloon.......................................................................... 158


Editing and formatting text in a pop-up balloon.................................................................... 159


Sizing, manipulating, and repositioning pop-up balloons ..................................................... 161


Organizing a Tutorial ............................................................................................................ 162

Why create new Parts and Modules ........................................................................ 162

Using the Organize Tutorial dialog box..................................................................162


Attaching a sound file to a pop-up balloon............................................................................ 164


Saving your work .................................................................................................................. 164


Before letting others run your Tutorial.................................................................................. 165


Running a Tutorial................................................................................................................. 165


Working with Other Applications 167 Exchanging data with MatLab............................................................................................... 167

Evaluating MatLab expressions .................

............................................................. 167

Setting up a MatLab expression .............................................................................. 168

Reading and writing MatLab variables ................................................................... 169

Importing Simulink models...................................................................................................170

Translating an .MDL...............................................................................................171

Improving block arrangement in VisSim diagrams................................................. 172

Setting up initial data values in VisSim .................................................................. 173

Mapping integration methods.................................................................................. 173

Setting up VisSim blocks ........................................................................................ 173

Translation Examples..............................................................................................174

Simulink Block Translations...................................................................................181


Exchanging data with Maple ................................................................................................. 195

Using the inx and outx Maple script variables......................................................... 195

Executing a Maple script with the Script block....................................................... 195

Displaying data in a Maple window........................................................................ 196


Exchanging data with Mathcad ............................................................................................. 198

Use of the inx and outx keywords ........................................................................... 198

Embedding Mathcad documents ............................................................................. 198

Editing and updating Mathcad documents .............................................................. 199

Scaling and cropping embedded Mathcad documents ............................................ 200

Examining the properties of an embedded Mathcad document............................... 201

Changing the number of connector tabs on an embedded Mathcad document ....... 201

Troubleshooting ...................................................................................................... 202


Using ActiveX to exchange data ........................................................................................... 202

Using the ActiveX read block ................................................................................. 203

Using the ActiveX write block................................................................................204

VisSim-specific functions ......................

................................................................. 206

Examples................................................................................................................. 207


Embedding objects with OLE................................................................................................ 207


Performing dynamic data exchange with DDE ..................................................................... 211

Creating an app-to-VisSim link with DDEreceive..................................................211

Creating a VisSim-to-app link with DDEsend ........................................................ 214

Creating a two-way link with DDE.........................................................................217


Creating DDE links with applications that do not support Copy Link and Paste Link220 Using look-up tables to exchange data .................................................................................. 220 Specifying the data source....................................................................................... 221 Using the Lookup Table wizard .............................................................................. 222
Block Reference
*............................................................................................................................................. 227

-X........................................................................................................................................... 229

/.............................................................................................................................................. 231

less than ................................................................................................................................. 232

less than or equal to ............................................................................................................... 233

== .......................................................................................................................................... 234

!= ........................................................................................................................................... 236

greater than............................................................................................................................237

greater than or equal to..........................................................................................................238

1/X......................................................................................................................................... 239

abs.......................................................................................................................................... 240

acos........................................................................................................................................ 241


ActiveX read.......................................................................................................................... 242

ActiveX write ........................................................................................................................ 242

and ......................................................................................................................................... 243

animate .................................................................................................................................. 243

animation3D .......................................................................................................................... 247

asin ........................................................................................................................................ 248

atan2 ...................................................................................................................................... 249

audioIn................................................................................................................................... 251

audioOut ................................................................................................................................ 254

bessel ..................................................................................................................................... 257

beta ........................................................................................................................................ 259

bezel ...................................................................................................................................... 259

buffer ..................................................................................................................................... 261

button..................................................................................................................................... 263

camera3D............................................................................................................................... 266

Perspective Based on Field of View........................................................................ 266

Perspective .............................................................................................................. 267

Perspective Off Center ............................................................................................ 268

Orthogonal .............................................................................................................. 269

Orthogonal Off Center ............................................................................................ 270

case........................................................................................................................................ 270

cauchy..................................

.................................................................................................. 273

comment ................................................................................................................................ 274

complexToReIm.................................................................................................................... 274

const ...................................................................................................................................... 275

constraint ............................................................................................................................... 276

convert................................................................................................................................... 276

cos.......................................................................................................................................... 277

cosh........................................................................................................................................ 278

cost ........................................................................................................................................ 278

crossDetect ............................................................................................................................ 278

date ........................................................................................................................................ 282

DDE....................................................................................................................................... 282

DDEreceive ........................................................................................................................... 282

DDEsend ............................................................................................................................... 282

deadband................................................................................................................................ 283

delayedSwitch ....................................................................................................................... 284


derivative............................................................................................................................... 285

diag........................................................................................................................................ 286

dialogConstant....................................................................................................................... 286

dialogTable............................................................................................................................ 287

display ...................................................................................................................................

290

dotProduct ............................................................................................................................. 292

eigenvalues ............................................................................................................................ 293

embed .................................................................................................................................... 293

erlang..................................................................................................................................... 293

error ....................................................................................................................................... 294

eventDisplay.......................................................................................................................... 294

eventLog................................................................................................................................ 297

exp ......................................................................................................................................... 298

export..................................................................................................................................... 300

expression.............................................................................................................................. 305

fft ........................................................................................................................................... 305

gain ........................................................................................................................................ 307

gamma ................................................................................................................................... 309

gaussian ................................................................................................................................. 309

globalConstraint .................................................................................................................... 310

histogram............................................................................................................................... 311

ifft.......................................................................................................................................... 312

import .................................................................................................................................... 314

index...................................................................................................................................... 317

indexedAssign ....................................................................................................................... 319

int........................................................................

................................................................... 320

integrator ............................................................................................................................... 321

invert...................................................................................................................................... 326

label ....................................................................................................................................... 327

light........................................................................................................................................ 328

light3D................................................................................................................................... 330

limit ....................................................................................................................................... 334

limitedIntegrator.................................................................................................................... 335

linearSolve............................................................................................................................. 339

lineDraw ................................................................................................................................ 339

ln............................................................................................................................................ 340

log10...................................................................................................................................... 341

magPhase............................................................................................................................... 341

map ........................................................................................................................................ 342

MatLab Expression................................................................................................................ 346

MatLab Read Variable .......................................................................................................... 346

MatLab Write Variable.......................................................................................................... 346

matrixConst ........................................................................................................................... 346

matrixIn ................................................................................................................................. 347

matrixMerge .......................................................................................................................... 347

matrixOut .............................................................................................................................. 348

matrixSize............................

.................................................................................................. 349

max ........................................................................................................................................ 349

maxElement........................................................................................................................... 349

meanSmooth.......................................................................................................................... 350

medianSmooth....................................................................................................................... 351

merge..................................................................................................................................... 352

mesh3D.................................................................................................................................. 353

meter...................................................................................................................................... 354

min......................................................................................................................................... 358

minElement ........................................................................................................................... 359


multiply ................................................................................................................................. 359

neuralNet ............................................................................................................................... 360

not.......................................................................................................................................... 360

OLEobject ............................................................................................................................. 360

or............................................................................................................................................ 360

parabola ................................................................................................................................. 361

parameterUnknown ............................................................................................................... 362

pareto..................................................................................................................................... 362

plot......................................................................................................................................... 362

plot3D.................................................................................................................................... 376

polyFit ...................................................................................................................................

395

polyRoots .............................................................................................................................. 395

pow........................................................................................................................................ 396

PRBS ..................................................................................................................................... 397

psd ......................................................................................................................................... 398

pulseTrain.............................................................................................................................. 398

quantize ................................................................................................................................. 399

ramp....................................................................................................................................... 400

rayleigh.................................................................................................................................. 401

realTime ................................................................................................................................ 402

relay....................................................................................................................................... 402

resetIntegrator........................................................................................................................ 403

reshape................................................................................................................................... 405

rt-DataIn ................................................................................................................................ 405

rt-DataOut.............................................................................................................................. 405

sampleHold............................................................................................................................ 406

sawtooth ................................................................................................................................ 406

scalarToStruct........................................................................................................................ 407

scalarToVec........................................................................................................................... 408

sign ........................................................................................................................................ 408

sin .......................................................................................................................................... 408

sinh .............................................................................

........................................................... 409

sinusoid.................................................................................................................................. 409

slider...................................................................................................................................... 411

spectrumDisplay.................................................................................................................... 412

splineFit................................................................................................................................. 414

sqrt......................................................................................................................................... 415

squareWave ........................................................................................................................... 416

stateSpace .............................................................................................................................. 416

stateTransition ....................................................................................................................... 418

step ........................................................................................................................................ 420

stop ........................................................................................................................................ 421

stripChart............................................................................................................................... 421

structToScalar........................................................................................................................ 429

summingJunction................................................................................................................... 430

tan.......................................................................................................................................... 430

tanh ........................................................................................................................................ 431

timeDelay .............................................................................................................................. 431

timeOfDay............................................................................................................................. 432

timeStamp.............................................................................................................................. 433

transferFunction..................................................................................................................... 435

transpose................................................................................................................................ 439

triangleWave ..........................

............................................................................................... 440

triangular ............................................................................................................................... 440

uniform.................................................................................................................................. 441

unitConversion ...................................................................................................................... 442


unitDelay ............................................................................................................................... 443

unknown ................................................................................................................................ 444

userFunction .......................................................................................................................... 444

variable .................................................................................................................................. 444

vectorSort .............................................................................................................................. 444

vecToScalar........................................................................................................................... 444

video...................................................................................................................................... 445

vsum ...................................................................................................................................... 445

weibull................................................................................................................................... 445

wirePositioner........................................................................................................................ 446

world3D................................................................................................................................. 446

xor.......................................................................................................................................... 448


Extending the Block Set 451 Before you begin… ............................................................................................................... 451

The big picture....................................................................................................................... 451

Criteria for writing DLLs ........................................................................................ 452

Building a DLL ....................................................................................................... 452


How VisSim talks to a DLL .................................................................................................. 452

Calling conventions..........

....................................................................................... 453

Simulation level functions....................................................................................... 453

Block level functions............................................................................................... 454

Exported functions .................................................................................................. 460


Debugging hints .................................................................................................................... 465


Using the DLL wizard........................................................................................................... 466


Accessing a custom block from VisSim................................................................................471

Adding a custom block to a VisSim menu .............................................................. 471

Binding a DLL to a userFunction block..................................................................472


Customizing VisSim 473 Customizing VisSim start up.................................................................................................473

Automatically reloading the last diagram at start up...............................................473

Starting VisSim in different modes.........................................................................473

Customizing the VisSim window..........................................................................................474

Showing or hiding scroll bars.................................................................................. 474

Showing or hiding a toolbar....................................................................................474

Showing or hiding the status bar ............................................................................. 474

Customizing the menu bar....................................................................................... 474

Creating custom toolbar buttons ............................................................................. 476


Adding VisSim addons..........................................................................................................477


Managing Your VisSim License 479 Overview of the Install program............................................................................................ 479

Installing or upgrading a single user VisSim license............................................................. 479

Installing a floating network VisSim license.........................................................................480

Activating a VisSim license key............................................................................................ 482

Activating a one year timed license....................................................................................... 483

Transferring

相关文档