Introduction To SIMULINK

2y ago
50 Views
2 Downloads
1.36 MB
26 Pages
Last View : 2d ago
Last Download : 3m ago
Upload by : Adalynn Cowell
Transcription

Systems and Control TheoryMaster Degree Course in ELECTRONICS ENGINEERINGhttp://www.dii.unimore.it/ lbiagiotti/SystemsControlTheory.htmlIntroduction to SIMULINKLuigi Biagiottie-mail: t/ lbiagiotti

Simulink introduction Simulink (Simulation and Link) is an extension of MATLABthat offers modeling, simulation, and analysis of dynamicalsystems under a graphical user interface (GUI) environment. Simulink is based on block diagrams of Dynamic Systems The construction of a model is simplified with click-and-dragmouse operations. Simulink includes a comprehensive blocklibrary of toolboxes for both linear and nonlinear analyses. As Simulink is an integral part of MATLAB, it is easy to switchback and forth during the analysis process and thus, the usermay take full advantage of features offered in bothenvironments.Luigi BiagiottiSystems and Control TheoryIntroduction to Simulink-- 2

Starting Simulink From Matlab command window enter simulink, or alternately,click on the Simulink icon located on the toolbarSimulink's library browserLibraryLuigi BiagiottiBlock setSystems and Control TheoryIntroduction to Simulink-- 3

Simulink library The block library is organized intofunctional groups. For instance Sources: Blocks for thegeneration of input signals(steps, sinusoids etc.) Sinks: Blocks for the graphicalvisualization of signals Math: Blocks for themathematical elaboration ofsignals Continuous: Blocks for thedefinition of (continuous)transfer functionsLuigi BiagiottiSystems and Control TheoryIntroduction to Simulink-- 4

Simulink – Sources Library I The most used blocks are:Luigi Biagiotti Constant: for generating a constantvalue Step: for generating a step function Ramp: for generating a rampfunction Sine wave: for generating asinusoidal function From workspace: the referencesignal, previously generated in theMATLAB workspace, is passed as[time, value], where timeand value are two columnvectors with the same length Clock: it outputs the currentsimulation time at each simulationstepSystems and Control TheoryIntroduction to Simulink-- 5

Simulink – Sinks LibraryLuigi Biagiotti Set of tools for displaying the output of thesimulations The most used blocks are: Scope: it displays the input signal as afunction of time (take care to the optionlimit data points to ) XYGraph: it produce a graphics of thesignal y (on the second input) as afunction of the signal x (on the first input). To Workspace: it saves the samples ofthe input signal in a MATLAB variable(N.B.: save format array).Systems and Control TheoryIntroduction to Simulink-- 6

Simulink – Transfer functions In order to insert a transfer function in a Simulink scheme the blocks ofthe library Continuous can be used: Transfer Fcn: it allows to define a transfer function by specifyingthe vectors containing the coefficient of numerator anddenominator. Zero-Pole: it defines a transfer function by specifying the vectorscontaining polse and zeros of the transfer function.The library Discrete contains the corresponding blocks for thedefinition of discrete-time transfer functions.Luigi BiagiottiSystems and Control TheoryIntroduction to Simulink-- 7

Simulink and the Control System Toolbox The Control system Toolboxprovides a Simulink block fordirectly using a transferfunction defined in theMATLAB workspace (seecommand tf) or a state spacemodelDouble clickLuigi BiagiottiSystems and Control TheoryIntroduction to Simulink-- 8

Simulink – Simulation parameters Simulink solves ordinary differential equations (e.g. defined bymeans of transfer functions) by using techniques fornumerical integration Simulating a dynamic system means computing the evolutionof the state and output variables for a given time periodThe state and the output values are computed at given timeinstants (called time steps) which are separeted by integrationintervals (called step sizes) Computation of x(t), y(t)Step sizeX(0)0 t0t2t1t3t4Time stepLuigi BiagiottiSystems and Control TheoryIntroduction to Simulink-- 9

Simulink – Methods for numerical integrationSeveral methods (the so-called solvers) for the numericalintegration of differential equations exist: Integration methods with fixed step size (useful for thesimulation of discrete-time systems) The smaller the step size is, the more accurate thesimulation results. On the other hand, the duration of thesimulation grows. Integration methods with variable step size the solver determines the optimal step size during thesimulation (for instance if the system is characterized by fastdynamics, the step size must be reduced accordingly) ODE45 is the default solverLuigi BiagiottiSystems and Control TheoryIntroduction to Simulink-- 10

Simulation parameters Initial and final simulation time-instantsSolver type (e.g. variable step, ODE45)Max step size (maximum size of theinterval beetwen two successivetime-steps)Must be chosen: Smaller than the fastest time-constantof the systemSmaller than the period of the fastestperiodic signal acting on the system(e.g. 1/10 smaller)Min step size (minimum size of the interval beetwen two successivetime-steps)Can be used to reduce the simulation time (at the expense of the accuracy) Relative/absolute tollerance Accuracy of the simulation output (set“auto” or values smaller enough, e.g. 1e-4)Luigi BiagiottiSystems and Control TheoryIntroduction to Simulink-- 11

Steps for constructing a Simulink model Open a new model from the Matlab menu fileor from the icon in the Simulink Library browserSimulink workspaceLuigi BiagiottiSystems and Control TheoryIntroduction to Simulink-- 12

Steps for constructing a Simulink model Import blocks in the Simulink workspaceDrag block to workspace window Connect blocksLuigi BiagiottiSystems and Control TheoryIntroduction to Simulink-- 13

Steps for constructing a Simulink model Action on blocksActionsCopying a block from a libraryDuplicating blocks in a modelKeystrokes or Mouse ActionsDrag the block to the model window with the leftbutton on the mouse OR use select the COPY andPASTE from EDIT menu.Hold down the CTRL key, select the block with theleft mouse button and drag the block to a newlocation.Display block's parametersDouble click on the blockFlip a blockCTRL‐IRotate a block (clockwise 90 deg @ each keystroke) CTRL‐RChanging blocks' namesLuigi BiagiottiClick on block's label and position the cursor todesired place.Systems and Control TheoryIntroduction to Simulink-- 14

Steps for constructing a Simulink model Save and run the simulation from the workspace windowor directly from MATLAB sim(‘SimulinkModel’,EndTime) Display the resultsLuigi BiagiottiSystems and Control TheoryIntroduction to Simulink-- 15

Guidelines for a good simulation Matlab-Simulink models are usually structured in two main files:Simulink ModelM-fileLuigi BiagiottiSystems and Control TheoryIntroduction to Simulink-- 16

Simulation of a feedback system - problemWith reference to the scheme of figure1. Simulate the step response of the system with the continuoustime transfer functionsIn a unique figure plot the system's responsesuperimposed to the reference signaland the controlvariable(two distinct subplots)Luigi BiagiottiSystems and Control TheoryIntroduction to Simulink-- 17

Simulation of a feedback system - problem2. Simulate the step response of the feedback system with thediscrete-time transfer functionsandobtained fromby discretization with samplingtime Ts 0.1 s. Make the same plots of point 1.3. Simulate the step response of the feedback system with thediscrete-time transfer functions R(z) and the continuous-timeplant G(s). Make the same plots of point 1.4. Simulate the response of the system considered in theprevious point, by considering a reference signal computedwith the MATLAB function [q t] TrjPoly3(q0,q1,T,dt),with q0 0, q1 1, T 2, dt Ts.Luigi BiagiottiSystems and Control TheoryIntroduction to Simulink-- 18

Simulation of a differential equation A Simulink scheme allows the simulation of any differentialequation, even nonlinear or time-varying, if it is possible torewrite it an explicit form, i.e. The correpsonding block-scheme (to be designed in Simulink) isLuigi BiagiottiSystems and Control TheoryIntroduction to Simulink-- 19

Simulation of the simple pendulumLuigi Biagiotti The dynamics of the system is described bythe nonlinear differential equation In order to represent the equation with blockschemes, it is convenient to rewrite it asSystems and Control TheoryIntroduction to Simulink-- 20

Simple pendulum – Simulink scheme From the equationthe Simulink scheme descendswTo Workspace3CmConstant1/(M*l 2)Manual Switch01s1sqIntegratorIntegrator1To WorkspaceGainConstant1ScopeCiTo Workspace1tM*g*lGain1Parameters and initial conditions ona separate m-fileLuigi BiagiottisinClockTo Workspace2TrigonometricFunctionandSystems and Control Theorymust be defined inIntroduction to Simulink-- 21

Simple pendulum – Simulink scheme From the equationthe Simulink scheme descendswTo Workspace3CmConstant1/(M*l 2)Manual Switch01s1sqIntegratorIntegrator1To WorkspaceGainConstant1ScopeCiTo Workspace1tM*g*lGain1sinClockTo Workspace2TrigonometricFunctionIn order to define the functionit is possible to use other Simulinkblocks, in particular the blocks that allow the insertion of user-definedfunctionsLuigi BiagiottiSystems and Control TheoryIntroduction to Simulink-- 22

Blocks for inserting user-defined functionsFunction directlydefined in the SimulinkblockExternal functiondefined as m-functionLuigi BiagiottiSystems and Control TheoryIntroduction to Simulink-- 23

Simple pendulum – alternatives schemeswTo Workspace3CmConstant1s1sqIntegratorIntegrator1To Workspace1/(M*l 2)Manual Switch0GainConstant1ScopeCiFcn1To Workspace1tM*g*l*sin(u)ClockTo Workspace2wTo Workspace3CmConstant1s1sqIntegratorIntegrator1To Workspace1/(M*l 2)Manual Switch0GainConstant1ScopeCiTo Workspace1MATLAB FcnMATLABFunctionfunction [Out] PendFun(q)global M g l;Out M*g*l*sin(q);Luigi BiagiottitClockTo Workspace2Global parameters in order to make them visible tothe function (the same statement is present in them-file where the parameters are assigned)Systems and Control TheoryIntroduction to Simulink-- 24

Simple pendulum - problem Design a Simulink system for solving the equation of a simplependulum with friction, i.e. By assuming the parameters' valuessimulate the free response from initial conditions the forced response to a constant input the complete response of the systemPlot in a unique figure (3 distinct subplots) the evolution ofin the three cases.Luigi BiagiottiSystems and Control TheoryIntroduction to Simulink-- 25

Systems and Control TheoryMaster Degree Course in ELECTRONICS ENGINEERINGhttp://www.dii.unimore.it/ lbiagiotti/SystemsControlTheory.htmlIntroduction to SIMULINKLuigi Biagiottie-mail: t/ lbiagiotti

Luigi Biagiotti Systems and Control Theory Introduction to Simulink-- 2 Simulink introduction Simulink (Simulation and Link) is an extension of MATLAB that offers modeling, simulation, and analysis of dynamical systems under a graphical user interface (GUI) environment. Simulink is based on block diagrams of Dynamic SystemsFile Size: 1MB

Related Documents:

ES360 Introduction to Controls Engineering MATLAB and SIMULINK Help Page 2 of 6 Starting SIMULINK SIMULINK can be started by: 1) Opening a SIMULINK model file (model files use the .mdl extension). 2) Starting MATLAB and clicking on the icon in the tool bar. The SIMULINK Library Browser SIMULINK

Introduction to Simulink Todd Atkins tatkins@mathworks.com. 4 Outline What is Simulink? Working with Simulink. How Simulink works. Continuous and discrete models Componentizing models. 5 Simulink Applications. 6 Simulink

Test Driven Development powered by MATLAB and Simulink 45 Model-Based Design –Simulink and Stateflow Manage Requirements –Simulink Requirements Author and Execute Tests –Simulink Test Measure Test Completeness –Simulink Coverage Refactor and Verify Compliance –Simulink Check

Simulink and LEGO MINDSTORMS EV3 9 P a g e Project 1: Explore Simulink and LEGO MINDSTORMS EV3 P1.1 Get Started: Program EV3 Status Light with Simulink Motivation At the end of this project you will be able to program an EV3 brick from Simulink. Objective Create first model in Simulink Check hardware and software installation

Introduction to Simulink 1.1 Objective The objective of Experiment #1 is to familiarize the students with simulation of power electronic circuits in Matlab/Simulink environment. Please follow the instructions in the laboratory manual. 1.2 Simulink Basics Tutorial Simulink is a graphical e

4) Simulink . Simulink is a program for simulating signals and dynamic systems. As an extension of Matlab, Simulink adds many features specific to the simulation of dynamic systems while retaining all of Matlab’s general purpose functionality. Simulink has two phases of use: mode

Engineering POLYTECHNIC UNIVERSITY OF BARI Why Simulink? Simulink Real-Time (formerly known as xPC Target), together with x86-based real-time systems, is an environment for simulating and testing Simulink and Stateflow models in real-time on the physical system. Simulink easily allows to de

ABR ¼ American Board of Radiology; ARRS ¼ American Roentgen Ray Society; RSNA ¼ Radiological Society of North America. Table 2 Designing an emergency radiology facility for today Determine location of radiology in the emergency department Review imaging statistics and trends to determine type and volume of examinations in emergency radiology Prepare a comprehensive architectural program .