In this task you will learn how to use the Simulation palette in LabVIEW.
You need the “LabVIEW Control Design and Simulation Module” for this Task.
Below we see the Simulation palette in LabVIEW:
It is recommended that you watch the video “ Simulation Palette Overview ” (about 15 minutes) by Finn Haugen before you start with the exercises.
In this task we will use LabVIEW and the LabVIEW Control Design and Simulation Module to simulate a simple model of a bacteria population in a jar.
The model is as follows: birth rate=bx death rate = px 2
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
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.
Draw Block Diagram for the system using “pen and paper”.
Solution:
Block diagram for the system:
2
Simulate the system in LabVIEW, where you follow these steps:
1.
Start LabVIEW and use the Control and Simulation Loop from Control Design and Simulation
Palette in LabVIEW
2.
Drag in the necessary Blocks from the palette (including the plot).
3.
Use the “ Connection Wire ” from the Tools palette and draw the necessary wires.
4.
Configure Simulation Parameters (right-βclick on the Control and Simulation Loop border)
5.
Start the Simulation. The Simulation result should be present in a plot.
EE4107 -β Cybernetics Advanced
Solution:
Below you see the “Control and Simulation Loop” and different blocks that may be used in this simulation:
3
We can may also use the “Multiplication” blocks instead of the “Gain” blocks:
The simulation results should look like this:
EE4107 -β Cybernetics Advanced
The Simulation parameters are used:
Use “LabVIEW Control Design and Simulation Module” and the “ Control and Simulation Loop ” in order to create a simulation of a spring-βmass damper system.
The differential equation for the system is as follows: π₯ =
1 π
( πΉ − π π₯ − ππ₯ )
Where.
πΉ is an external force applied to the system
EE4107 -β Cybernetics Advanced
4
π is the damping constant of the spring π is the stiffness of the spring π is a mass π₯ is the position of the mass π₯ is the first derivative of the position, which equals the velocity of the mass π₯ is the second derivative of the position, which equals the acceleration of the mass
Draw Block Diagram for the system using “pen and paper”.
Solution:
Block Diagram:
5
Note!
π = π = damping constant of the spring in the figures.
You may also use this notation:
EE4107 -β Cybernetics Advanced
Implement and simulate the system in LabVIEW.
Simulate and plot the position ( π₯ ), the velocity ( π₯ ), and the acceleration ( π₯ ) in 3 different plots.
In the simulations you may set πΉ = − 9 .
8 , π = 1 , π = 1 πππ π = 100
Then try to set π = 10 ππ and see the difference. Try also different values for π and π and see what happens. Try to explain the results.
Solution:
Block Diagram:
6
The Simulation Parameters are used:
EE4107 -β Cybernetics Advanced
7
Front Panel and Simulation results: π = 1 ππ : π = 10 ππ :
In this task you will use the example “ General PID Simulator.vi
” as a base for your simulation. Use the “NI Example Finder” (Help → Find Examples… in the LabVIEW menu) in order to find the VI in
LabVIEW.
Run the example and see how it is implemented and how it works.
EE4107 -β Cybernetics Advanced
Replace the function “PID.vi” with the more advanced function “ PID Advance.vi
” instead.
Note!
Make sure to save it with another name!
Change π
!
and π
!
so the unit is seconds instead of minutes on your Front Panel (User Interface).
The functions “PID.vi” and “PID Advanced.vi” requires that π
!
and π
!
is in minutes, while it’s normal to use seconds as the unit for these parameters. You can use the following piece of code in order to transform them:
8
Run simulations and find proper values for πΎ
!
π
!
and π
!
.
Solutions:
Front Panel:
EE4107 -β Cybernetics Advanced
Block Diagram:
The following PI(D) parameters are used in the simulations:
πΎ
!
= 20
π
!
= 0 .
48 π
π
!
= 0 π
Basic LabVIEW programming:
•
Tutorial: Introduction to LabVIEW: http://home.hit.no/~hansha/?tutorial=labview
•
LabVIEW Starter: http://home.hit.no/~hansha/training/labview/starter
Control and Simulation:
• http://home.hit.no/~hansha/?lab=control_simulation
Here you will find additional tasks, tutorials and other resources.
Videos:
•
Simulation Palette Overview (about 15 minutes) by Finn Haugen.
EE4107 -β Cybernetics Advanced
9