1 / 59

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

Engr/Math/Physics 25. Chp10: 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

robbin
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 Chp10: 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 10.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 10.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 10.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. SSR Digression • The SSR fcn is BUILT into SimuLink • An quick Example • The Result • For This Problem We’ll Build our OWNSSR plot(tout, Yin, tout, Yssr, 'LineWidth', 3), xlabel('t'), ylabel('9sin(t); SSR(10sin(t))'), grid, legend('sint', 'SSR')

  7. The Tank Flows Problem 10.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)

  8. Now the OutFlows in Terms of the Fluid-Flow Resistances Problem 10.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)

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

  10. Using 1/R = Cv in the ODE Problem 10.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

  11. 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 10.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

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

  13. Now have 3-port Tank Model Problem 10.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

  14. Final Model

  15. Result for 1hr Simulation

  16. ½ 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

  17. All Done for Today Hoke DV1DiaphramValve

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

  19. 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 = +-| Prob10.30 (1)

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

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

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

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

  24. 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 Prob10.30 (6) • Integrator Parameters

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

  26. 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 Prob10.30 (8)

  27. Test the model with some realistic Values taken from Work Space Need to apply SOURCES to the Inputs Prob10.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>> P10_30_Model_Input_Parameters_1111.m

  28. Prob10.30 (9a) • Parameters for STEP-Block are CRITICALLY important to obtaining the Correct Answer in the Tank-Model Test

  29. The Result from the Scope Prob10.30 (10) • Looks OK … can forge ahead

  30. Make the Model into a SUBSYSTEM Select All Components with Bounding Box Prob10.30 (11)

  31. Use Menus: EDIT → CREATE SUBSYTEM Prob10.30 (12)

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

  33. Copy & Paste TWICE the SubSys Block into file Prob10_30_Cascade_Tank.mdl Prob10.30 (14) • The Cascade Model after the Pastes

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

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

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

  37. Convert Pb1 to q1 using Cv1 = 1/R1 Connect q1 to InFlow Port on Tank2 subsys Prob10.30 (18)

  38. Now Use STEP block for qmi Step  Generate a step function Library → Sources The Parameters for the step blok Prob10.30 (19)

  39. 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 Prob10.30 (20) • Scope Block • Scope, Floating Scope, Signal Viewer Scope  Display signals generated during a simulation • Library → Sinks

  40. InterConnects Completed Prob10.30 (21) • Now Need to Edit INSIDE SubSys block for new Variable Names

  41. Edit Values in Tank1 SubSys Prob10.30 (22)

  42. Edit Values in Tank1 SubSys Prob10.30 (23)

  43. Edit Values in Tank1 SubSys Be Sure to Change the INITIAL CONDITION Somewhat Hidden in the 1/s block Prob10.30 (24)

  44. Edit Values in Tank2 SubSys Prob10.30 (25)

  45. Edit Values in Tank2 SubSys Prob10.30 (26)

  46. Edit Values in Tank2 SubSys Be Sure to Change the INITIAL CONDITION Somewhat Hidden in the 1/s block Prob10.30 (27)

  47. Prob10.30 (28) • Simulate for 1hr = 3600 seconds • Simulate for 1hr = 3600 seconds

  48. Prob9_30_Cascade_Tank_ToWorkSpace.mdl Prob10.30 (29) To WorkSpace • Note: SimOut Sends Tank Heights ONLY to WorkSpace • tout is AutoMatically sent to WorkSpace by SimuLink

  49. 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 P10_30_Model_Input_Parameters_1111.m

  50. MALAB 2010 has Built in SSR

More Related