Download presentation
Presentation is loading. Please wait.
Published byEmmeline Hicken Modified over 9 years ago
1
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-1.ppt 1 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Bruce Mayer, PE Licensed Electrical & Mechanical Engineer BMayer@ChabotCollege.edu Engr/Math/Physics 25 Chp10: SimuLink-1
2
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-1.ppt 2 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Learning Goals Implement Mathematical Operations in MATLAB using SimuLink InterConnected 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
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-1.ppt 3 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods 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
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-1.ppt 4 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods 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 3 rd year courses on Electrical, or Dynamic Mechanical, Systems-Control
5
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-1.ppt 5 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods 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
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-1.ppt 6 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Prob 10.2 Solution (book typo) Use FEEDBACK to Find y(t) for ODE
7
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-1.ppt 7 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods SimuLink-1 Fire Up Simulink Library Browser
8
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-1.ppt 8 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods SimuLink-2 Open “Model” Window/File
9
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-1.ppt 9 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods SimuLink-3 The “Untitled” Model” Window
10
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-1.ppt 10 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods SimuLink-4 Select “Sources” Library Drag SineWave icon to Model Window
11
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-1.ppt 11 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods SimuLink-5 DoubleClick SineWave icon to Open Block- Parameters Dialog Box No Changes Needed
12
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-1.ppt 12 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods SimuLink-6 Select “Math Ops” Library Drag Gain icon to Model Window
13
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-1.ppt 13 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods SimuLink-7 DoubleClick Gain icon to Open Block-Parameters Dialog Box Set Gain to 10
14
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-1.ppt 14 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods SimuLink-8 Set IC to Zero Select Continous Library Drag Integrator Block to Model Window 2X-Click the Icon to Open the DiaLog Box Set the IC to Zero
15
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-1.ppt 15 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods SimuLink-9 Select “Sinks”Library Drag Scope Block to Model Window
16
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-1.ppt 16 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods SimuLink-10 CConnect The Block OutPuts & InPuts Turns to Cross when Clik’d
17
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-1.ppt 17 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods SimuLink-11 Open the Config Parameters Dialog Box Set 13s Stop-Time
18
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-1.ppt 18 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods SimuLink-12 Start Simulation Opens the Scope Display Wait for “Bell” to Sound 2X Click Scope Clik Binoc’s to AutoScale
19
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-1.ppt 19 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods SimuLink-13 Simulation Result
20
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-1.ppt 20 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods EX 10.2-1 (1) Export Simulation to WorkSpace for Plotting Add/Subtract icons 2X-Clik “To WorkSpace” icon SINKS Library SOURCES Library SIGNAL ROUTING
21
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-1.ppt 21 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods EX 10.2-1 (2) Export Result Plot the Result >> plot(y(:,1),y(:,2)), xlabel('t'), ylabel('y'), grid
22
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-1.ppt 22 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods EX 10.2-3 (1) (with a few mods) SimuLink Model for Thus Simulate Integrating, Find Note that the variables are NOT Separable y is on BOTH sides Then The Model
23
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-1.ppt 23 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods EX 10.2-3 (2) → Model Parameters Chg to 2
24
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-1.ppt 24 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods 10.2-3 (3) → Scope Result (IC=2)
25
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-1.ppt 25 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods 10.2-3 (4) → Scope Result (IC=0)
26
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-1.ppt 26 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods EX 10.2-3 (5) → OutPut Summary plot(y_of_t(:,1), y_of_t(:,2)),grid ODE Parameters Changed
27
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-1.ppt 27 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods EX 10.2-3 (6) → Misc
28
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-1.ppt 28 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods SimuLink Help
29
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-1.ppt 29 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods SimuLink Help 3 Choices
30
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-1.ppt 30 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Naming SimuLink Blocks Double-Click on the BlockName PlaceHolder Type in a DESCRIPTIVE Name
31
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-1.ppt 31 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods EX 10.4-1 (1) 10s Simulation 100s Simulation The SimuLink Model
32
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-1.ppt 32 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Caveat: Hidden Functions Many math Functions do NOT have their own block. Instead they “Hide” in a PullDown menu in another icon. Examine Some of These.
33
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-1.ppt 33 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods 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
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-1.ppt 34 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Sin to Cos by PullDown 2X clik the “sin” icon to Reveal PullDown
35
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-1.ppt 35 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Sin to Cos by PullDown Clik on Cos Changes Icon to the Cos Function That was easy Run Sin & Cos
36
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-1.ppt 36 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods All Done for Today Running a House Furnace OOne THERM is a unit of heating equal to 100,000 BTU.
37
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-1.ppt 37 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Bruce Mayer, PE Licensed Electrical & Mechanical Engineer BMayer@ChabotCollege.edu Engr/Math/Physics 25 Appendix
38
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-1.ppt 38 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Problem 10.15 ThermoStat Control of Bldg Temp TThe Governing ODE AAlso Solve-For, and Plot, T(t) for Given Parameters WWhere did this Eqn Come from?
39
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-1.ppt 39 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Prob 10.15 (1) RELAY Block Relay Switch output between two constants Library → Discontinuities Relay Parameters
40
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-1.ppt 40 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Prob 10.15 (2) T-Stat Temp Gain Gain Multiply the input by a constant Library → Math Operations For Case-2 will change Gain to 40 Fnce Gain Parameter for Case-1
41
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-1.ppt 41 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Prob 10.15 (3) Ambient Temperature Model Sine Wave Generate a sine wave Library → Sources The Input Parameters for Bias Amplitude Frequency
42
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-1.ppt 42 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Prob 10.15 (4) Sin Fcn Parameters The Summing Node Sum Add or subtract inputs Library → Math Operations
43
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-1.ppt 43 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Prob 10.15 (6) Sum Parameters 1/RC Gain Block 0.5 per HR COPY the R*qm Gain Block in Model Space and change Parameters
44
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-1.ppt 44 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Prob 10.15 (7) Now the LaPlace Integrator Integrator Integrate a signal Library → Continuous Integ Parameters
45
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-1.ppt 45 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Prob 10.15 (8) MUX (Many-to-One) for Ta and T Mux Combine several input signals into a vector or bus output signal Library → Signal Routing MUX Parameters for
46
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-1.ppt 46 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Prob 10.15 (9) Use ToWorkSpace to Send Ta & T to WorkSpace for Plotting To Workspace Write data to the workspace Library → Sinks The ToWorkSpace Parameters
47
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-1.ppt 47 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Prob 10.15 (10) Connect the Dots Be sure to Include FeedBack Link to the ThermoStat Scope Added for Diagnostic PurposesBack Link to the ThermoStat
48
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-1.ppt 48 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Prob 10.15 (11) Compare Cases Small Furnace Large Furnace
49
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-1.ppt 49 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Prob 10.15a (12) – Small Fnce % plot(tout, simout), xlabel('t (Hr)'), ylabel('T (°F)'), grid Unstable Inside Temp
50
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-1.ppt 50 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Prob 10.15a (13) – Large Fnce STABLE Inside Temp
51
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-1.ppt 51 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Prob 10.15b (14) Part (B) → For Stable Temp Control Find Energy Used The Modify Previous Model Separate Gain Blok R*qm to gain Access to qm Scale qm to get scale comparable to T(t) Copy & Modify Bloks Gain Integrator
52
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-1.ppt 52 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Prob 10.15b (15) The Energy Integrator Model
53
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-1.ppt 53 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Prob 10.15b (16) – Energy Use Daily Use = 12400 BTU/Day = 0.124 Therm/Day → 21.7 ¢/Day But This Fnce is Microscopic; My Fnce rating is 80 kBTU/Hr
54
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-1.ppt 54 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods 10.2
55
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-1.ppt 55 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods 10.2
56
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-1.ppt 56 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods 10.2
57
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-1.ppt 57 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Prob 10.2
58
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-1.ppt 58 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods SimuLink ↔ ODE45
59
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-1.ppt 59 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods
60
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-1.ppt 60 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods SimuLink ↔ ODE45
61
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-1.ppt 61 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Problem 10.2-1
62
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-1.ppt 62 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Problem 10.2-1
63
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-1.ppt 63 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Problem 10.2-1
64
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-1.ppt 64 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods
65
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-1.ppt 65 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods P10.2 with various forcing fcns
66
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-1.ppt 66 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods mck Exmpl (1) 2X Mass, Spring, Damper System HHow Do x 1 & x 2 respond to the SUDDEN Application of a UNIT Pull (1lb or 1N)? C1C1 C2C2 x1x1 x2x2 f (Pull Force) k1k1 k2k2
67
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-1.ppt 67 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods EX mck (2) m 1 = 5 m 2 = 3 c 1 = 4 c 2 = 8 k 1 = 1 k 2 = 2 C1C1 C2C2 x1x1 x2x2 f (Pull Force) k1k1 k2k2
68
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-1.ppt 68 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods EX mck (3) 2X Mass, Spring, Damper System Set Simulation Time and check by 2X click Scope
69
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-1.ppt 69 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods EX mck (4) Simulation Time = 10s Auto Scaling the Axes Positions have NOT Yet Stabilized Try 100s StopTime
70
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-1.ppt 70 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods EX mck (5) StopTime = 100s Stabilizes after about 25s Use 25s for Stop Final Offsets x 1 = 1.0 x 2 = 1.25
71
BMayer@ChabotCollege.edu ENGR-25_Lec-25_SimuLink-1.ppt 71 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods P10.2 with various forcing fcns
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.