System Modeling 2012 Laboratory 1 System Modeling Laboratory 1 Model Based Design: Model based design is a mathematical and visual method of addressing problems associated with designing complex control, signal processing and communication systems. A system model position is at the center of the development process, from requirements development, through design, implementation, and testing. The model is an executable specification that you continually refine throughout the development process. After model development, simulation shows whether the model works correctly. Simulink: Simulink® is an environment for multi-domain Model-Based Design and simulation for dynamic embedded systems. With the help of its interactive graphical environment and set of block libraries we can design and simulate a variety of time varying systems of various domains. A system modeled in Simulink can be simulated and analyzed in MATLAB. Once the analysis approves the simulation results (as according to the requirements), Simulink allows the model to be translated in VHDL or C code. Goals and objectives: The goal of 1st lab work in Simulink is to get familiar with its environment and to learn the basic techniques to model a system. In this lab you will model a very simple system but similar techniques can be used to model the complex systems. After this lab you should be familiarized with some basic tools, libraries, and workspace and using blocks (from library) in modeling a system. You will also learn modeling of simple real world systems with Simulink. Starting Simulink: Start MATLAB and write simulink in command window or click over Muhammad Amir Yousaf System Modeling 2012 Laboratory 1 The Simulink Library browser will open as Simulink Library Browser The Simulink Library Browser displays the block libraries installed on your computer. Muhammad Amir Yousaf System Modeling 2012 Laboratory 1 When using the Library Browser: • View the blocks in a library — In the left pane, select a library name, or in the right pane, doubleclick a library icon. • Get information on a block — Select the block, and then from the menu, select Help > Help for the Selected Block. The Help browser opens with the reference page for the block. • View block parameters — Right-click a block, and then select Block parameters. • Search for a specific block — In the block search field, enter the name of a block, and then click the find block icon. Creating New Project: From the Simulink Library Browser menu, select File > New > Model. An empty model opens in the Simulink editor window as: Muhammad Amir Yousaf System Modeling 2012 Laboratory 1 Muhammad Amir Yousaf System Modeling 2012 Laboratory 1 Standard Block Libraries Muhammad Amir Yousaf System Modeling 2012 Laboratory 1 Task 1: Study the provided reading material and briefly describe Model-Based Design Process and steps involved in modeling a system. Task2: Model a system that converts temperature in Celsius to Fahrenheit. Use Simulink as system modeling tool. You can use the built-in blocks from Simulink Library. Task3: In the MATLAB Command Window, create time and temperature data by entering the following commands: x = (0:0.01:4*pi)'; y = 32 + (5*sin(x)); z = linspace(0,48,1257)'; y is a vector of outdoor temperature sensor. z is a time vector from 0 to 48. Both vectors contain 1257 values. Model a system in Simulink that reads the temperature and time data from MATLAB workspace, process the data and generate a signal 1 on a numeric display if the temperature ever rises above 36 degree. Task4: A simple electrical circuit consists of electric current I (in amperes), a resistance R (in ohms), an inductance L (in henrys), and a constant electromotive force E (in volts), as shown in Figure. According to Kirchhoff’s Second Law, if the switch S is closed, the applied electromotive force (voltage) is equal to the sum of the voltage drops in the rest of the circuit. This in turn means that the current I satisfies the differential equation. Model the above differential equation for current I as a function of time. Suppose inductor L and resistor R has the constant values 1mH and 5o ohms. Use scope block to display the result and justify the result with proper explanation. Demonstration and Report: Each group must demonstrate their working system models. Labs can only be demonstrated during the lab session. After you perform in the labs and complete the required tasks you must submit the reports to your lab teachers. Please give the good explanation of the blocks you use in you model along with their parameters. The reports will be graded from A to E. A better graded report would show the clear understanding of the performed tasks. Muhammad Amir Yousaf amir.yousaf@miun.se Muhammad Amir Yousaf System Modeling 2012 Laboratory 1 Deadlines: The reports must be submitted before the deadline. The last day to submit report for Lab 1 is April 10th, 2012. The delayed report will be graded with lesser grades. References and Useful Readings: http://www.mathworks.com/help/toolbox/simulink/gs/gs_intropage.html “Simulink Getting Started Guide” Appendix Libraries used in this lab: i. ii. iii. iv. v. Simulink -> Sources Simulink -> Sinks Simulink -> Continuous Simulink -> Commonly used blocks Simulink -> Ports and Subsystems Muhammad Amir Yousaf