1 / 58

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

Engr/Math/Physics 25. Chp9: SimuLink-2. Bruce Mayer, PE Licensed Electrical & Mechanical Engineer BMayer@ChabotCollege.edu. Learning Goals. Implement Mathematical Operations in MATLAB using SimuLink Functional Blocks Employ FeedBack in the SimuLink Environment to numerically Solve ODEs

hoang
Download Presentation

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 Chp9: SimuLink-2 Bruce Mayer, PE Licensed Electrical & Mechanical EngineerBMayer@ChabotCollege.edu

  2. Learning Goals • Implement Mathematical Operations in MATLAB using SimuLink 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. Make A subsystem Block for Problem 9.30 (1) • It has been found that for many Valves the Flow Thru the valve is Related to the Pressure Drop • Inputs • q (kg/s) • Pl & Pr (Pa) • Rl & Rr ([ΔP]/[kg/s]) • Using the Industry Constant of Proportionality, Cv

  4. Cv is essentially the NonLinear Valve CONDUCTANCE Problem 9.30 (2) • The Valve RESISTANCE then is simply the inverse of the Cv • Then the Flow Thru a typical On/Off Valve

  5. To Account for potential BACK Flow under NEGATIVE ΔP Conditions use the SignedSquare-Root Relation; the “SSR” Problem 9.30 (3) • Where the SSR Fcn • Back to the Tank; ID the In-Flows Assuming Pr & Pl are Less than Pbot • i.e., There is OUTFLOW at the Left & Right

  6. The Tank Flows Problem 9.30 (4) • Next the Time-Rate-of-Change of mT is just the difference between INflow & OUTflow; Mathematically • Now the Tank mass • mT Tank Mass (kg) • V  Tank Volume (m3) • ρ = Fluid Density (kg/m3)

  7. Now the OutFlows in Terms of the Fluid-Flow Resistances Problem 9.30 (5) • Next, Sub into the dmT/dt eqn • p  Pressure at the BOTTOM of the Tank (Pa) • And From Fluid Mechanics • A NONlinear ODE in h(t)

  8. Put the ODE into Integrable Form Problem 9.30 (6) • If the Pressure in the Tank is greater than Outside the ODE simplifies to

  9. Using 1/R = Cv in the ODE Problem 9.30 (6a) • Use the SimuLink Integrator (1/s) on the Complicated Integrand to Find h(t) • Note that h(0) is a ParaMeter (i.e., a number) within the Integrator Block

  10. Now Make a SimuLink Model To Determine h(t) In This Case The Parameters will be VARIABLES with values Taken from the WORKSPACE The Parameter List: Problem 9.30 (7) • A  Tank Cross-Section Area • Assumed Circular (Cylindrical Tank) • Rl,r Hydraulic Resistances of the LEFT & RIGHT Valves • ρ Liquid Density • q  Liquid InFlow • h(0)  Liquid Height at t = 0

  11. Problem 9.30 (8) • Design a SimuLink Model to Solve for h(t) Given Time For Live Demo

  12. Now have 3-port Tank Model Problem 9.30 (9) • Need to Properly MAP the I/O to use SubSys Mdl • Use this SubSystem Model To Analyze a CASCADING Tank System Time For WhtBd Demo

  13. Final Model

  14. Result for 1hr Simulation

  15. ½ Hour Simulation h2final = 6.4 ft h1final = 3.6 ft >> plot(tout,simout), xlabel('time (sec)'), ylabel('Liquid Height, h (ft)'),... grid • Dip Due to • q2(t=0) =0 • Normal Time Lag

  16. All Done for Today Hoke DV1DiaphramValve

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

  18. INPORT Block for Rt & Lt Pressure Values Inport  Create an input port for a subsystem or an external input Library → Ports & Subsystems, Sources Chg Label, No Parameters Summing Bloks for Rt & Lt ΔP’s = P-Pl,r Sum  Add or subtract inputs Library → Math Operations Painful RePosition of “+” & “-” connection Locations Top Node = |-+ Bot Node = +-| Prob 9.30 (1)

  19. Fcn Blok for SSR Fcn  Apply a specified expression to the input Library → User-Defined Functions Need to Implement for u = ΔP Prob 9.30 (2) • Parameters for Fcn

  20. Gain Bloks for Hydraulic Resistances Gain  Multiply the input by a constant Library → Math Operations Resistance Values will come from Variables Defined in WORKSPACE Prob 9.30 (3)

  21. Now Prob 9.30 (4) • INport Blok for Inflow • Click on Block, and Use FORMAT to Flip & Twist Block • Sum the OUTflow = ql + qr |−+ +|+ +−|

  22. Then the NET INflow = q - (ql + qr) Prob 9.30 (5) • Parameters for Scaling Gain-Blok • Now Scale Net InFlow by 1/ρA • ρ & A values set in WorkSpace • GainBlok OutPut is the INTEGRAND

  23. Integrate using 1/s Block to Find h(t) Integrator  Integrate a signal Library → Continuous The Integrator Parameters Set IC, H(t=0) as VARIABLE h0 assigned in WorkSpace Prob 9.30 (6) • Integrator Parameters

  24. Scale h(t) to Determine Pressure at the Bottom of the Tank, P Prob 9.30 (7) • FeedBack P to Pl & Pr to find the ΔP’s

  25. Use OUTPORTs To pick off h(t) & P Outport  Create an output port for a subsystem or an external output Library → Ports & Subsystems, Sinks The Final Model Prob 9.30 (8)

  26. Test the model with some realistic Values taken from Work Space Need to apply SOURCES to the Inputs Prob 9.30 (9) >> A = 3; %sf >> q_in = 0.7; % slug/sec >> rho = 1.94; % slug/cu-ft >> h_0 = 4.3; % ft >> g = 32.2; %ft/sq-sec >> R_l = 47; R_r = 71; % valve resistances>> P9_30_TankBLK_Model_Test_Input_Parameters_0905.m

  27. Prob 9.30 (9a) • Parameters for STEP-Block are CRITICALLY important to obtaining the Correct Answer in the Tank-Model Test

  28. The Result from the Scope Prob 9.30 (10) • Looks OK … can forge ahead

  29. Make the Model into a SUBSYSTEM Select All Components with Bounding Box Prob 9.30 (11)

  30. Use Menus: EDIT → CREATE SUBSYTEM Prob 9.30 (12)

  31. ReSize SubSys Blok for Readability Prob 9.30 (13) • Move Blok w/ Mouse & Cursor Keys • Flip & Twist InFlow Blok • Increase Font Size using Format Menu

  32. Copy & Paste TWICE the SubSys Block into file Prob9_30_Cascade_Tank.mdl Prob 9.30 (14) • The Cascade Model after the Pastes

  33. Use CONSTANT blok to set Atmospheric pressures to ZERO Constant  Generate a constant value Library → Sources The Parameters For CONSTANT Blok Prob 9.30 (15)

  34. Delete Pressure INPORTS and replace w/ Patm = 0 Prob 9.30 (16) • 2x Click the SubSys block to expose its contents • COPY the SSR and R Gain-Blok from the SubSys Window

  35. PASTE the SSR and R Gain-Blok in Cascade-Tank Mdl Prob 9.30 (17) • Flip the SSR & Gain Blocks • Reset the Gain to 1/R1

  36. Convert Pb1 to q1 using Cv1 = 1/R1 Connect q1 to InFlow Port on Tank2 subsys Prob 9.30 (18)

  37. Now Use STEP block for qmi Step  Generate a step function Library → Sources The Parameters for the step blok Prob 9.30 (19)

  38. Document Heights by MUXing height Outputs to Scope MUX Block Mux  Combine several input signals into a vector or bus output signal Library → Signal Routing Prob 9.30 (20) • Scope Block • Scope, Floating Scope, Signal Viewer Scope  Display signals generated during a simulation • Library → Sinks

  39. InterConnects Completed Prob 9.30 (21) • Now Need to Edit INSIDE SubSys block for new Variable Names

  40. Edit Values in Tank1 SubSys Prob 9.30 (22)

  41. Edit Values in Tank1 SubSys Prob 9.30 (23)

  42. Edit Values in Tank1 SubSys Be Sure to Change the INITIAL CONDITION Somewhat Hidden in the 1/s block Prob 9.30 (24)

  43. Edit Values in Tank2 SubSys Prob 9.30 (25)

  44. Edit Values in Tank2 SubSys Prob 9.30 (26)

  45. Edit Values in Tank2 SubSys Be Sure to Change the INITIAL CONDITION Somewhat Hidden in the 1/s block Prob 9.30 (27)

  46. Prob 9.30 (28) • Simulate for 1hr = 3600 seconds • Simulate for 1hr = 3600 seconds

  47. Prob9_30_Cascade_Tank_ToWorkSpace.mdl Prob 9.30 (29) To WorkSpace • Note: SimOut Sends Tank Heights ONLY to WorkSpace • tout is AutoMatically sent to WorkSpace by SimuLink

  48. Test Values to paste into WkSpc • For Model Test • For Cascade Test A = 3 q_in = .7 rho = 1.94 h_0 = 4.3 g = 32.2 R_l = 47 R_r = 71 A1 = 3; % sq-ft A2 = 5; % sq-ft g = 32.2; %ft/sq-sec R1 = 30; R2 = 40; rho = 1.94; % slug/cu-ft q_mi = 0.5; % slug/sec h1_0 = 2; % ft h2_0 = 5; % ft P9_30_TankSYS_Model_Input_Parameters_0712.m

  49. MALAB 2010 has Built in SSR

  50. Tank Model & Test

More Related