VisSim for Model Based Embedded System Development Visual Solutions, Inc. 487 Groton Road, Westford MA 01886 USA (800) VISSIM-1 www.vissim.com Agenda • • • • Visual Solutions Introduction VisSim Product Review VisSim Demo Target-in-loop simulation + code gen demo Visual Solutions • Founded in 1989 • Headquarters in Westford, Mass • Over 350,000 licenses worldwide • EDN Magazine Hot 100 • MathSoft OEM since 2000 • TI Partner since 2000 2 Visual Solutions Markets & Major Accounts Aerospace Motion Control Power & Gas Allied-Signal General Dynamics GEC Alsthom BF Goodrich Aerospace Boeing British Aerospace Cessna Eglin AFB Kollsman Litton Lockheed-Martin NASA Northrop-Grumman Pratt & Whitney Textron Allen Bradley Danaher Motion Maxon Motor AG General Electric Drives EPH Elektronik GmbH Indramat Instron Corporation Copley Controls Kollmorgen Parker Hannifin Universal Instruments Spectra Physics Vickers Pacific Scientific Heinzinger electronic GmbH British Gas Arizona P&G Florida Light & Power Hitachi Power Manitoba Power Ontario Hydro Pacific Gas & Electric Three Mile Island Stanwell Coal Gen Tenneco Gas TVA Union Electric Virginia Power Kestrel Power Dong Energy Visual Solutions Markets & Major Accounts Industry Process Control Transportation ABB-Instrumentation Allen Bradley Carrier Corporation Corning Fuji Electronics General Electric 3M Honeywell Hughes IBM Johnson Controls Motorola Raytheon TRW Toshiba United TechnologiesPotlatch Westinghouse Alcan Rolled Products Amoco Bethlehem Steel Bayer BP Chemical Champion International Dow Chemical DuPont Foxboro General Mills Georgia Pacific International Paper Kaiser Aluminum Mead Paper Mobil Chemical ABB Bombardier British Rail Chrysler Eaton Ford GM Honda R & D Mazda Volvo Weyerhaeuser VisSim at ResMed ResMed uses VisSim in all phases of product development for CPAP human respiratory aid - Models of controller High fidelity models of human variation and pathology Run pure simulations to tune controllers Use VisSim/C-code to develop embedded system to run various virtual patients to test against final product - Use VisSim/Viewer to distribute VisSim simulation of CPAP and human for pre and post sales training VSI Relationships • Mathsoft bundled VisSim/PE and LE low end VisSim products. • TI Third-Party partner. VisSim/ECD link is included in C2000 kits. • IBM (Telelogic) resells VisSim as “Continuous Modeler”. Tight co-simulation coupling with Statemate. VisSim • Visual block diagram software for dynamic simulation and model-based embedded development. – Automatic production of high quality fixed point code – Exceptional dynamic and Hardware-in-loop simulation capabilities – Automatic programming of on-chip MCU peripherals – Intuitive, easy-to-use graphical user interface – Fast sample rates (> 500 kHz) – Low memory foot print (1.5k flash 200 bytes RAM) – Affordable More Advantages… • Royalty Free Redistributable Viewer – Allows you to send VisSim models to anyone. Models can be run but not altered. • • • Ease of use gives faster training, faster reuse of old projects. Fast interpretive execution gives quick feedback on designs Built-in C interpreter gives industry standard text based language – Allows specification of same .c init file in simulation as codegen target – Allows efficient code generation for state transition block: transition events appear in generated code exactly as they are entered. • Efficient code generation – Tight fixed point code – Usage of same variable names as in VisSim Product Line • VisSim Core Visual Simulation Tool – Interactively build, simulate and debug nonlinear models – Simulink Translator – State Transition block – Over 200 built-in blocks – Built-in C interpreter – Matlab interface – Royalty free redistributable Viewer 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 VisSim Add-ons • Comm - Physical layer data communication • Optimize Pro - Generalized Reduced Gradient method of parameter optimization • Neural nets - Neural network construction and training package • Texas Instruments MSP430 (F1x, F2x, F4x, F5x) and C2000 (LF240x, F281x, F280x, F2802x/3x(Piccolo), F2833x (Delfino), C6713 VisSim Add-ons • Motion Block Set - Preconstructed block set for motion control – – – – – Includes AC Induction Brush and brushless DC Stepper motors Controllers Rotational and translational loads. Some VisSim Examples • Simple damped harmonic – basic linear differential equation • Lorenz attractor – basic nonlinear diff. eq. • Interactive power spectral density • System ID • PID tuning • Embedded Mathcad worksheet VisSim/Real-Time • Supports National Instruments and Measurement Computing boards • Analog, digital, thermocouple, counter, PWM, encoder • 30 kHz close loop sampling straight from Windows/NT,2000, XP • Just place block and select “Run in Real-Time” from Simulations Properties dialog. 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. 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. VisSim Viewer • Free redistributable run-time version of VisSim • Allows licensed users to freely distribute models to those who do not have VisSim development licenses • Easy way to share ideas, models and simulations • Supply proof-of-concept simulations to potential customers VisSim/Embedded Controls Developer • Bundle of VisSim, C-Code, C2000 target, TI DMC block-set , fixed-point block set, TI Code Composer Studio plug-in • Supports F280x,F282x, F283x on-chip peripherals: ADC, ePWM, eCAN, QEP(encoder), event capture, UART, SPI, GPIO, I2C, interrupts, watch dog • VisSim/Motion motor simulator add-on The VisSim RTOS • VisSim provides a simple RTOS environment – Main low jitter (submicrosecond) control thread runs at time step as set in diagram “Simulation Properties…” – Unlimited number of preemptable (high jitter) background threads – (option in Compound block) • Jitter = variation in actual time step from specification – Schedule synchronous tasks from main thread – Efficient device drivers for on-chip peripherals – Handle interrupts directly in VisSim (option in Compound block) – Interrupt based soft queued I/O for serial, SPI and I2C The Code gen Dialog • • • From Tools > Code gen… Result file Select Target – Device below on right • • • • • • Include Compound names as comments On-Chip RAM (no external RAM) Target Flash (put code in flash memory) Minimize RAM Usage (uses no numerical integration) Make Callable from User App (generate 2 functions, init and rate, to be called from custom application or RTOS) Include VisSim Communication Inteface (add PC communcation task to target. Boot waits for PC handshake before starting controller) Simulate Control Subsystems • Minimize time spent in debug and test • Use high-level, predebugged blocks • Support simulation of controller at block level on PC • Allow mouse probe of every input and output to display values at any instant • Debug block-level simulation on PC Digital control of DC-DC Buck Converter • Uses PID controlled PWM power modulation to maintain ADC sensed output voltage • Control setpoint through VisSim GUI • Interactive plot of controller contributions, setpoint, and output • 8 parallel converters run at 300 kHz sample rate Hardware-in-the-Loop • Control runs on MCU, background monitor talks to PC over JTAG in background task * Code automatically generated, compiled, linked, and downloaded VisSim on PC MCU I/O Plant Under Control (PWM,GPIO, C2000 Analog, CAN, Peripherals encoder) Control Application Code* C2000 MCU JTAG JTAG VisSim Interface block downloads and monitors code running on target VisSim blocks for: • Virtual plant • Interactive gains • Plots of target response • JTAG in Real-Time Monitor mode allows interactive controller gain changes and plot of results • Rapid, diagram level, edit-compile-download-debug cycle (under 10 secs) • Test, debug, and validate the on-MCU control from VisSim using a targetInterface block • Calibrate controller gains on embedded target easily with VisSim interface Codegen for 8 DC-DC Buck Converters • • • • Uses 2.3K words flash Uses 171 words RAM Uses 80% of processor at 300KHz operation Has 100 Hz background task to read temperature sensor on ADC line, and send status to LED bank via SPI • Code uses inline read/write of I/O registers • Retains VisSim variables as C variables VisSim/ECD Benefits • Automatic code generation plus peripheral support results in quicker design time, fewer design iterations and faster time to market • Easy debug with JTAG HotLink + CPU Utilization feature means confidence that the resulting product meets design specifications • Self-documenting block diagrams make intellectual property easier to reuse 7 Embedded Target Support • Texas Instruments – MSP430 (F10xx, F2xx, F4xx, F5xx) – C2000 (LF2407, F2812, F280x, F2802x/3x/6x(Piccolo), F2833x (Defino), Concerto in development – C6713 • QNX x86 • Emulators and development boards from: TI, Spectrum Digital, Softbaugh, Olimex – XDS510, XDS100 (low cost), Blackhawk, Signum JTAGjet TI Digital Motor Control Library – – – – Core was written, tested and optimized by TI Available in VisSim/ECD as easy-to-use block set Block set coded in C++ to VisSim User Block API Supports simulation mode (pure PC based simulation with 16-bit truncation effects) – Supports code generation mode Conclusion • VisSim/Embedded Controls Developer is a valuable tool to accelerate embedded development • VisSim/ECD speeds embedded design of: – – – – – Fixed-point operations On-chip peripheral usage Motion control Industrial closed-loop control Digital power systems Next Step • Visit www.vissim.com/piccolo And download a trial copy of VisSim/Embedded Controls Developer for TI C2000 Advantages vs Simulink • Cost for Embedded MCU Development – $10,000 for VisSim – $4,800(matlab&simulink)+7,500 RTW+Embedded Coder 5,000 + JTAG target link $2,000 + FixedPoint $2,000 + DSP blocks $1,000 + stateFlow $2,800 + stateFlow Coder = $25,000 • Network floating license – VisSim = 2x = $20,000 (worldwide $20,000) – Simulink = 4x = $100,000 (worldwide $300,000)