Telemark University College Department of Electrical Engineering, Information Technology and Cybernetics Simulink Example – Bacteria Population In this example we will simulate a simple model of a bacteria population in a jar. The model is as follows: birth rate=bx death rate = px2 Then the total rate of change of bacteria population is: Set b=1/hour and p=0.5 bacteria-hour We will simulate the number of bacteria in the jar after 1 hour, assuming that initially there are 100 bacteria present. Procedure: 1. 2. 3. 4. 5. 6. 7. Create the block diagram for the system using “pen & paper” Start Simulink and create a New Model Drag in the necessary blocks from the Simulink Library Browser Configure the different blocks (double-click/right-click depending on what you need). Some blocks need to be “flipped” (Right-click → Format → Flip Block), while in other blocks you need to set a value (double-click) Draw lines between the different blocks using the mouse Set Simulation Settings (Simulation → Configuration Parameters). The simulation Time (Stop Time) should be set to 1 (hour) Use a Scope to see the Simulated Result You will need the following blocks: Integrator block To solve the differential equation. Note! Initial value x0=100 Two Gain blocks For p (=0.5) and b (=1) Product block Sum block Scope block 2 To compute x Note! One plus (+) must be changed to minus (-) To show the simulated result. Note! Set to Autoscale Faculty of Technology, Postboks 203, Kjølnes ring 56, N-3901 Porsgrunn, Norway. Tel: +47 35 57 50 00 Fax: +47 35 57 54 01 Solution: Block Diagram using “pen and paper”: Block Diagram in Simulink: Simulation Result: