1 / 71

Bruce Mayer, PE Licensed Electrical & Mechanical Engineer BMayer@ChabotCollege

Engr/Math/Physics 25. Chp10: SimuLink-1. Bruce Mayer, PE Licensed Electrical & Mechanical Engineer BMayer@ChabotCollege.edu. Learning Goals. Implement Mathematical Operations in MATLAB using SimuLink InterConnected Functional Blocks

laird
Télécharger la présentation

Bruce Mayer, PE Licensed Electrical & Mechanical Engineer BMayer@ChabotCollege

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. Engr/Math/Physics 25 Chp10: SimuLink-1 Bruce Mayer, PE Licensed Electrical & Mechanical EngineerBMayer@ChabotCollege.edu

  2. Learning Goals • Implement Mathematical Operations in MATLAB using SimuLinkInterConnected Functional Blocks • Employ FeedBack in the SimuLink Environment to numerically Solve ODEs • Create Simulations of Dynamic Control Systems using SimuLink Block Models • Export Simulation result to MATLAB WorkSpace for Further Analysis

  3. What is SIMULINK? • SIMULINK is a tool for modeling, analyzing, and simulating a wide variety of physical & mathematical systems, including those with nonlinear elements and those which make use of continuous and discrete time • Applications Can be found in Dynamic Control Systems, Signal Processing, Communications, and other time-varying systems.

  4. More on SimuLink • SimuLink is a Graphical Environment where Math Operations are represented by BLOCK Icons • Allows for FEEDBACK of Control Vars • Since SimuLink is used to Analyze Dynamic (time-varying) Systems, there are many References to the Variable, ‘s‘ • s follows from LaPlace Transforms • Studied in 3rd year courses on Electrical, or Dynamic Mechanical, Systems-Control

  5. SimuLink Some More • Since LaPlace Transforms, and Dynamic-System Control Theory are beyond the scope of this Class, we will learn SimuLink by example • The Least intuitive Concept Employed will be FEEDBACK The LaPlace Transform

  6. Prob 10.2 Solution (book typo) • Use FEEDBACK to Find y(t) for ODE Time For WhtBd Demo

  7. Fire Up Simulink Library Browser SimuLink-1

  8. Open “Model” Window/File SimuLink-2

  9. The “Untitled” Model” Window SimuLink-3

  10. SimuLink-4 Select “Sources” Library Drag SineWave icon to Model Window

  11. SimuLink-5 No ChangesNeeded DoubleClick SineWave icon to Open Block-Parameters Dialog Box

  12. SimuLink-6 Select “Math Ops” Library Drag Gain icon to Model Window

  13. SimuLink-7 Set Gainto 10 DoubleClick Gain icon to Open Block-Parameters Dialog Box

  14. SimuLink-8 • Select Continous Library • Drag Integrator Block to Model Window • 2X-Click the Icon to Open the DiaLog Box • Set the IC to Zero Set IC to Zero

  15. SimuLink-9 • Select “Sinks”Library • Drag Scope Block to Model Window

  16. SimuLink-10 Turns to Cross when Clik’d • Connect The Block OutPuts & InPuts

  17. SimuLink-11 • Open the Config Parameters Dialog Box • Set 13s Stop-Time

  18. SimuLink-12 • Start Simulation • Opens the Scope Display • Wait for “Bell” to Sound • 2X Click Scope • Clik Binoc’s to AutoScale

  19. SimuLink-13 • Simulation Result

  20. Export Simulation to WorkSpace for Plotting Add/Subtract icons EX 10.2-1 (1) • 2X-Clik “To WorkSpace” icon SIGNALROUTING SOURCES Library SINKS Library

  21. Export Result EX 10.2-1 (2) • Plot the Result >> plot(y(:,1),y(:,2)), xlabel('t'), ylabel('y'), grid

  22. SimuLink Model for EX 10.2-3 (1) (with a few mods) • Thus Simulate • Integrating, Find • Then The Model • Note that the variables are NOT Separable • y is on BOTH sides

  23. EX 10.2-3 (2) → Model Parameters Chg to 2

  24. 10.2-3 (3) → Scope Result (IC=2)

  25. 10.2-3 (4) → Scope Result (IC=0)

  26. EX 10.2-3 (5) → OutPut Summary ODE Parameters Changed plot(y_of_t(:,1), y_of_t(:,2)),grid

  27. EX 10.2-3 (6) → Misc

  28. SimuLinkHelp

  29. SimuLinkHelp  3 Choices

  30. Naming SimuLink Blocks • Double-Click on the BlockName PlaceHolder • Type in a DESCRIPTIVE Name

  31. EX 10.4-1 (1) • The SimuLink Model • 10s Simulation • 100s Simulation

  32. Caveat: Hidden Functions • Many math Functions do NOT have their own block. Instead they “Hide” in a PullDown menu in another icon. • ExamineSome of These. Time For Live Demo

  33. TRIG Function Pull Down Box • On MATH OPRERATIONS can find SIN but not COS or TAN • They are HIDDEN in the “TRIG” icon which just happens to have the label SIN • All the other Major Trig Function reside in this block on a pull Down menu • Start with • Change the Lower Function to COS

  34. Sin to Cos by PullDown • 2X clik the “sin” icon to Reveal PullDown

  35. Sin to Cos by PullDown • Clik on Cos • Changes Icon to the Cos Function • That was easy • Run Sin & Cos

  36. All Done for Today Running aHouseFurnace • One THERM is a unit of heating equal to 100,000 BTU.

  37. Engr/Math/Physics 25 Appendix Time For Live Demo Bruce Mayer, PE Licensed Electrical & Mechanical EngineerBMayer@ChabotCollege.edu

  38. ThermoStat Control of Bldg Temp Problem 10.15 • The Governing ODE • Also Solve-For, and Plot, T(t) for Given Parameters • Where did this Eqn Come from?

  39. RELAY Block Relay  Switch output between two constants Library → Discontinuities Prob 10.15 (1) • Relay Parameters

  40. T-Stat Temp Gain Gain  Multiply the input by a constant Library → Math Operations Prob 10.15 (2) • Parameter for Case-1 • For Case-2 will change Gain to 40 • Fnce Gain

  41. Ambient Temperature Model Sine Wave  Generate a sine wave Library → Sources Prob 10.15 (3) • The Input Parameters for Bias Amplitude Frequency

  42. Sin Fcn Parameters Prob 10.15 (4) • The Summing Node • Sum  Add or subtract inputs • Library → Math Operations

  43. Sum Parameters Prob 10.15 (6) • COPY the R*qm Gain Block in Model Space and change Parameters • 1/RC Gain Block • 0.5 per HR

  44. Now the LaPlace Integrator Integrator  Integrate a signal Library → Continuous Prob 10.15 (7) • Integ Parameters

  45. MUX (Many-to-One) for Ta and T Mux  Combine several input signals into a vector or bus output signal Library → Signal Routing Prob 10.15 (8) • MUX Parameters for

  46. Use ToWorkSpace to Send Ta & T to WorkSpace for Plotting To Workspace  Write data to the workspace Library → Sinks Prob 10.15 (9) • The ToWorkSpace Parameters

  47. Connect the Dots Be sure to Include FeedBack Link to the ThermoStat Prob 10.15 (10) • Scope Added for Diagnostic PurposesBack Link to the ThermoStat

  48. Compare Cases Prob 10.15 (11) • Small Furnace • Large Furnace

  49. Prob 10.15a (12) – Small Fnce % plot(tout, simout), xlabel('t (Hr)'), ylabel('T (°F)'), grid Unstable Inside Temp

  50. Prob 10.15a (13) – Large Fnce STABLEInsideTemp

More Related