1 / 79

Agenda

VisSim for Dynamic Simulation and Control Design Visual Solutions, Inc. 487 Groton Road, Westford MA 01886 USA (800) VISSIM-1 www.vissim.com. Agenda. Morning VisSim product line review VisSim basics Dynamic systems with feedback Building hierarchical systems Data import/export

jaimin
Download Presentation

Agenda

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. VisSim for Dynamic Simulation and Control DesignVisual Solutions, Inc.487 Groton Road, Westford MA 01886 USA(800) VISSIM-1www.vissim.com

  2. Agenda Morning VisSim product line review VisSim basics Dynamic systems with feedback Building hierarchical systems Data import/export System tuning with auto restart Afternoon Optimization PID Tuning 3D plotting & animation UML State Charts

  3. VisSim Overview Visual block diagram software for dynamic system simulation and embedded system development. Automatic production of high quality fixed point code Exceptional dynamic and DSP-in-loop simulation capabilities Automatic programming of on-chip DSP peripherals

  4. Product Line VisSim Core Visual Simulation Tool - build, simulate and debug dynamic systems Simulink Translator State Transition block Over 100 built-in blocks Built-in C interpreter Matlab interface Royalty free redistributable Viewer

  5. VisSim Viewer Free redistributable run-time version of VisSim Download from www.vissim.com/downloads/demos.html Allows free distribution of models to anyone Easy way to share ideas, models and simulations Supply proof-of-concept simulations to potential customers

  6. VisSim Add-ons Real-Time - Allows up to 30 kHz closed loop sampling from VisSim on PC C-Code - Generates ANSI C from diagram Analyze - Frequency domain analysis of linearized non-linear subsystem Fixed-point - Block set of bit true scaled integer operations for simulation and code generation

  7. VisSim Add-ons (cont.) Comm - Physical layer data communication Optimize Pro - Generalized Reduced Gradient method of parameter optimization Neural nets - Neural network construction and training package DSP Targets - F243,LF2407, F2812, C30,C40,C67

  8. VisSim/Real-Time Supports National Instruments and Measurement Computing Analog (12-16 bit), digital, thermocouple, counter, PWM, encoder Devices can be PCI, PCMCIA, USB, ISA 30 kHz closed loop sampling straight from Windows/NT,XP – (Jitter ~1-5ms) Just place block and select “Run in Real-Time” from Simulations Properties dialog.

  9. VisSim/CAN VisSim driver for USB device that connects to Controller Area Network (CAN) bus Can read and write CAN packets up to 1 kHz rate. Packets configurable as to: data length number and types of data elements in the packet Byte sex (bigendian vs little endian) Enable pin on write, data ready pin on read

  10. VisSim/Motion Extensive block set for simulation of electric motor systems Supports AC induction, brush and brushless DC motors Stepper motors Low level PWM switching simulation level Selection of Sensors, Loads, Controllers, Transforms

  11. VisSim/OPC OLE for Process Control VisSim OPC block set has server connection block, OPC read and OPC write block Connects to any server (Kepware, Matrikon etc.) Supports all major DCS, PLC vendors (Honeywell, Allen Bradley, Foxboro, GE Fanuc, Siemens, etc)

  12. VisSim Plays Well with Others OLE interface- allows inclusion of any OLE compliant software VisSim - Mathcad OLE interface allows graphics plus data exchange VisSim - Matlab Integration allows matrix data exchange and Matlab expression evaluation Simulink Translator brings Simulink diagrams into VisSim workspace.

  13. VisSim Custom Block API MSVC Wizard creates project for custom block. Just drop in code. API allows: Menu positioning Block & connector naming and data typing Code generation Simulation info on integration method, integration step, time step, current time etc.

  14. VisSim Co-simulation API VisSim co-simulation API allows fast, efficient interprocess communication for co-simulation interfacing. Based on NT shared memory and Events In use by iLogix Statemate General purpose API

  15. Large Model Support Load 300,000 block model in under 2 minutes Embed blocks insert separate component model files as subsystems Path aliases allow macro expansion to remove file system dependencies Tags allow quick navigation in large system

  16. Diagram Construction Insert block by clicking toolbar icon or Block menu Change parameter by double or right mouse click on block Connect by mouse-down on connector, drag, mouse up on or near target connector Must have consumer to execute (Plot, display, export etc.)

  17. Exercise: Plot sin Insert sin and plot blocks Connect sin to plot and run Right click sin, change to 1 Hz, and run Double click plot title bar to enlarge Double click again to restore

  18. Block manipulation Select blocks by left-mouse+drag background Right click to operate on selected blocks Edit menu also operates on selected blocks Left-mouse+drag on any selected block moves group Left click background to remove selection

  19. Exercise: Add triangle wave Insert triangle wave to existing sin plot Connect triangle to plot and run Select sin and triangle blocks Right click one, select “align outputs” Try and keep wires short and straight if possible

  20. System Properties System/System Properties… Sets start time/stop time for simulation Sets step interval for both simulation and code gen Auto-restart puts sim in continuous mode for Monte Carlo or parametric investigation “Retain states”: states not initialized on restart “Run in real-time” for real-time response “RT Scale Factor” to run at some multiple faster or slower than real-time

  21. Exercise: Change Time Range Select System Properties… Enable run in real time Run diagram again. Now it takes 10 real secs. Useful for monitoring embedded target > 1 kHz Data acquisition and control Change End Time to 1 sec, rerun

  22. Simulation Debug Single step button (click single “shoe”) Right click on connector to see value Stop block allows user controlled stop point Error block allows user controlled error alert Interactive plots Display blocks

  23. Exercise: Basic 2nd order system Create new diagram Insert and connect const “1” to two 1/S integrators and a plot. Input is acceleration, output is position, intermediate pin is velocity. Run (what is expected output?)

  24. Exercise: More 2nd order system Put summing junction between const and 1/S Output of 1st 1/S is velocity, 2nd is position Put feedback gain from “position” to summer Change sign on sum feedback (ctrl+right+click) Run (what is expected output?) x” = 1 + -kx

  25. VisSim Variables VisSim variables allow data exchange by name instead of by wire Create variables “u” and “y” to represent input and output to filter and wire to diagram. Use variable “find” operation. Note “Find definition only” option Variable Scoping “:” prefixed variables are scoped to current level “::” prefixed variables are scoped to definition level and down

  26. Usage of Variables Built-in variables: pi, $timeStart, $timeStep, $timeEnd, $runCount, $firstPass, $lastPass, $randomSeed Variable block Can use in many blocks as parameters: 1/S, gain, transferFunction, const etc. Expression block Constants Scoping (:prefix local, ::definition scope)

  27. Exercise: More 2nd order system Change feedback gain to “k” Insert Annotation >Variable block Right+click and name “K” Insert Signal Producer > slider block, cx to var Right+click and change bounds to 0 to 10 Run

  28. Finding Blocks or Variables Edit/Find… dialog lets you search for variables or blocks Can look only for definitions Case sensitivity Partial match Match on block type

  29. Plot Options • Right click to configure -> • Most options obvious • Plot averaging filters datapoints over multiple runs • Marker count of -1 marks all points • Multiple XY traces uses pairs of inputs for each trace • Line type controls paint style of data points • Max plotted points limits total # of points in sim range (0 plots all points)

  30. Plot Options(cont) • “External Trigger” placesenable pin on plot and onlyplots when pin is 1 • “Read Coordinates” enablesinteractive coordinate readout • “Snap to Data” restrict readoutto actual data points • “Over Plot” retains data run to run • “Save Data to File” saves current plot data to a file

  31. Exercise: Add damping term to 2nd order system Add pin to sum input (Edit > Add Connector, then click next to existing connector when grey bar appears) and ctrl+right+click to toggle sign Add new gain called kDamp Copy/paste slider and “k” var rename var to “kDamp” and reconnect

  32. Numerical Integration Change time step for 2nd order system Notice instability at large step relative to system frequency Euler is simplest fastest, least accurate Adaptive step are most accurate Stiff good for solving “stiff” sets of equations (hi freq component that has small amplitude)

  33. Exercise: Change integration step and method for 2nd order system Change time step to .5 Run, and see divergence due to numerical instability Change integration method to adaptive step and see that system is now stable Adaptive step tries smaller steps to see if it improves results Gives good answer but is slow

  34. Limited and Reset Integral Limited Integrator lets you specify upper and lower limits for the internal state. Avoids “windup” of limit block and plain integrator Wire slider->limited integrator->plot Connect const 50 to u, and 0 to l of limited integ Set to “run in real-time”, click 'go' and play with slider Add 1/s in parallel and plot both outputs. Notice “windup” Reset Integrator allows you to reset internal state on the fly. (See bounce.vsm)

  35. Plot Axis Settings • Bounds set here for“fixed bounds” option • Scaling is applied to x axis • Sub Plot Count gives multiple y-axis windows • Axis divisions fixes tick count manually • Retrace options restricts plot to given interval and sets x-axis interval (used for eye-diagrams)

  36. View Options Presentation Mode: Prettier diagrams Display Mode: for front panels and animation Data Types: colors connectors based on data type. Green=integer, yellow=scaled integer, red=floating point, purple=matrix Fat wires=Matrix, thin wire=scalar Block labels appear under block Connector labels appear on compound block or user function block

  37. Hierarchy Edit/Create Compound… creates container for selection Edit/Add Connector.. gets “Add” cursor. Click cursor on block to add connectors. Click left side to add on left edge, right side to add right. Edit/Remove Connector… gets “Remove” cursor. Click cursor on block to remove connectors. Click left side to remove on left edge, right side to remove from right. Ctrl+Right-Mouse on Compound to edit subsystem properties Click Right-Mouse on Compound to enter compound Click Right-Mouse on background to leave compound Double-Left click on connector to add label

  38. Subsystem Properties Local Time – allows running at slower rate than main sim. Must be multiple of base clock for DSP targeting. External Trigger – Use external logic to control execution of subsystem. Name – Applies name to face of block Bitmap- Applies bitmap image to face of block Password protection – Use password to control access to compound contents Create dialog box from contained dialog constants

  39. User Dialog Box Insert “Dialog Constant” blocks into compound contents for each dialog item. Dialog constants can be numeric, integer list, or boolean. Check “Create dialog box from contained dialog constants” option in compound block. User selections are saved to .vsm file. Nice way to encapsulate complexity.

  40. Exercise: Create compound from 2nd order system Select 2nd order system, right click on a selected block and create compound Insert dialog constants for feedback gains Ks (spring const) Kd (damping factor) Label input and output pins Enable “create dialog from contained dialog constants” in compound properties Right click compound to see user dialog Run

  41. Labeling Use label block to insert label anywhere in diagram Label can be hyperlink to doc or URL Doc can link to .vsm label Double left click Compound connector to give a label Use Comment block to put large body of scrollable rich text into diagram

  42. System Setup: Preferences Checkpoint state: saves integrator, delay states and plot contents to file Useful for restarting from known state Notify Sim End: gives message box on sim end Warn nonintegral clock: gives warning at sim start if requested time step for periodic signal like pulseTrain, squareWave etc. is not integral multiple of sim timeStep. Warn nonintegral delay: warn if continuous delay is given time delay that is not integral multiple of timeStep Checkpoint during sim: saves checkpointed diagram to file with name suffixed with current time at specified checkpoint intervals. Check Connections: warns of unconnected inputs at sim start. Warn numeric overflow: warn if conversion causes numeric truncation Startup Script file: Specify .m or .c file to run before starting sim Random Seed: specify starting random seed for random variables. Frequency Units: specify units for filter design wizards in transfer function

  43. Conditionals (“if-then”) • Relational expressions can be used anywhere • Merge and case use a selector input to produce an output from several possible inputs • Create new diagram with button, merge, 2 consts and display

  44. Dialog Table Inserts parametric data from an external data set or spread sheet. User selects item from 1st column via dropdown combo. See Diagrams > examples > blocks > signalProducer > dialogTable.vsm

  45. Exercise: Build IIR Filter 1 Place step, xfer, and plot blocks in workspace Connect & run Change sim rate to .001, end time to .1 Design 2nd order 100Hz Butterworth lowpass filter run

  46. Build filter 2 Ctrl-Rt quick dup xfer, convert copy from S->Z domain run enable fixed point precision run change to 2 bits magnitude run - zoom plot

  47. FIR filter Rt-click xfer, check “discrete”, click FIR Filter button For each band, enter start, end freq, weight & gain Be sure to leave room between end of one band and start of next Click “Calc Filter” FIR requires large state count (>10) for good operation

  48. Discrete systems 1/Z sampled delay - clock input Discrete transfer function Sample hold Other blocks work with both continuous and discrete systems Compound block can be enabled, or run at different sampling rate Work with scaled fixed-point data

  49. Data Import/Export/Lookup Table • Import block • Can import text data, .mat, .wav • Optional header supplies time start/stop/step info • Export block • Can export text, .mat, .wav • Can control data flush interval, inclusion of import header • Map block • 1D, 2D, 3D lookup tables

  50. Import Export Usage How to use... Place sin block and export in work space, configure export for file name “test.dat”, wire sin to export and run. Note possibility for decimation, data flush interval, and suppression of header information. Place import block in diagram, configure for “test.dat”, connect to plot, and run. Note possibility for interpolation and extrapolation.

More Related