Area and Volume Calculation in LabVIEW

Hello friends! I hope you all will be absolutely and having fun. Today, I am going to share my knowledge with all of you on Area and Volume Calculation of different shapes with the given radius in NI LABVIEW. First of all I want to tell you that the area basically shows the space inside an object having two dimensions. Where as, Volume is the parameter which shows the space occupied by a three dimensional object. So, we can roughly say that the volume is the area of a three dimensional object. For example you want to go for a trip and you have to pack your bags. So, in this case you have to make some space in your bag to put the clothes inside it. The space that you make for the clothes is basically an application of volume. We can also called it as a capacity of an object. Area is usually measured in and volume is measured in according to their System International (SI) units. In this tutorial we will do the area and volume Calculation of two different shapes, and they are circle and cylinder. Its just a simple LabView Project and the sole purpose of this project is to let you guys know how to do simple calculations in LabView. I hope you guys are gonna enjoy it. So, let's get started with Area and Volume Calculations in LabView:

Area and Volume Calculation in LabVIEW

Here I am going to elaborate you about the different formulas to calculate the area and volume of the different shapes e.g. circle, cylinder, square, triangle etc. I will focus to calculate the area and volume of two different shapes with the given radius. The basic formulas for the area and volume of the square or rectangle are given below.
  • Area = length × width
  • Volume = length × width × height
But we will find the area and volume of circle and cylinder with the given radius. You can use the formulas given below for the area and volume calculation with the given radius.
  • Area of circle = pr²
  • Area of cylinder = 4pr²
  • Volume of cylinder = (4/3)pr³

Youn can download a complete NI LabVIEW simulation here.

Download LabVIEW Simulation

I am using above formulas to calculate these parameters using NI LabVIEW. I will make a very simple program in NI LabVIEW which will take radius as an input and calculates the area and volume of circle and cylinder after manipulating the given area. You can also select the maximum limit of the radius. When the radius approaches its maximum limit an LED will glow showing the notification reduce the radius. So, let's start with the NI LabVIEW to make this program for Area and Volume Calculation.
Steps to Follow
  • Go to the Front Panel and Right Click on it.
  • Go to Controls-> Silver-> Numeric, you can see different numeric blocks here e.g. numeric control, numeric indicator etc.
  • Choose the encircled block shown in the below.
  • Select and place the encircled block on the Front Panel and change its name to Set the radius limit.
  • Similarly select another Numeric Indicator and change its name to Radius.
  • Now, go to Controls-> Silver-> Numeric-> Indicator, select this block and place it on the Front Panel.
  • Copy this block and paste it two time on the Front Panel.
  • Change their names to Area of Circle, Area of Cylinder and Volume of Cylinder respectively.
  • The figure shown below describes all of the above steps.
  • Set the radius limit block will help you to set the maximum value of the radius.
  • You can enter the required radius the Radius block and the other three blocks will show the desired results depending upon the radius.
  • Now go to Controls-> Silver-> Boolean, you can see different Boolean blocks here.
  • Choose the encircled block as shown in the figure below.
  • Select the encircled block and place it on the Front Panel.
  • LED is used to show the indication when the radius reaches its maximum limit.
  • Here is the screenshot of the updated Front Panel.
  • Now, go to the Block Diagram window, here you can that the blocks are automatically placed there.
  • Here is the screenshot of the Block Diagram window.
  • Now, let's make the logic to find the area of the circle.
  • Go to Functions-> Programming-> Numeric, you can see different numeric blocks here.
  • Choose the encircled block as shown in the figure below.
  • Select the Multiply block and place it on the Block Diagram window.
  • Now go to Functions-> Programming-> Numeric-> Math Constants, you can see different types of numeric constants here.
  • Choose the encircled math constant as shown in the figure below.
  • Select the encircled Field Programmable Gate Array (FPGA) block and place it on the Block Diagram window.
  • Now, make a simple logic to find the area of the circle by adjusting the radius.
  • Algorithm is shown in the figure below.
  • I have set the value the radius as and run the program, you can see the area calculated by NI LabVIEW there.
  • The calculated area with the given radius is shown in the figure below.
  • Now, go to the Block Diagram window.
  • Go to Functions-> Programming-> Comparison, you can see different comparison blocks here.
  • Choose the encircled block as shown in the figure below.
  • Now make a simple logic for the indication when the radius reaches its maximum limits.
  • The logic for this particular purpose is shown in the figure below.
  • Now, go to the Front Panel you can see, I have adjusted the maximum limit of the radius as 5, you can see when radius approaches its maximum limit LED shows indication.
  • The above step is elaborated in the figure below.
  • Now, put your cursor on the LED and right click on it.
  • Go to the properties and make the changes shown in the figure below.
  • Updated indication is shown in the figure below.
  • Now, I will make an algorithm to find the area and volume of the cylinder according to the formulas written at the start of this tutorial.
  • The virtual instrument (VI) for the desired algorithm is shown in the figure below.
  • Now, go to the Functions-> Programming-> Structures, here you can see different structures blocks.
  • Choose the encircled block only, as shown in the figure below.
  • Select the For Loop and place it on the Block Diagram window.
  • Place the whole program inside the For Loop as shown in the figure below.
  • Now go Red button at the bottom of the For Loop and click on it.
  • Go to Create-> Constant, and make a connection between them, it helps to terminate program.
  • The updated Block Diagram window is shown in the figure below.
Adding Background Image
  • Go to the scroll bar at right side of the Front Panel and right click on it.
  •  Go to the Properties-> Background, as shown in the figure below.
  • Go to the background and here you can easily browse any image at the background image of  your program.
  • I have added the image shown in the figure below.
  • You can see the area of circle, area and volume of cylinder for the adjusted value of Radius. So, the complete output is shown in above figure.
  • In the below video, I have explained how to use this LabView VI:
That all from the tutorial Area and volume calculation with the radius in LabVIEW. I hope you enjoyed this tutorial. If you face any sort of problem you can ask me anytime without feeling any kind of hesitation. I will further explore NI LabVIEW in my later tutorials. Till then, Take care :)
Syed Zain Nasir

I am Syed Zain Nasir, the founder of <a href=https://www.TheEngineeringProjects.com/>The Engineering Projects</a> (TEP). I am a programmer since 2009 before that I just search things, make small projects and now I am sharing my knowledge through this platform.I also work as a freelancer and did many projects related to programming and electrical circuitry. <a href=https://plus.google.com/+SyedZainNasir/>My Google Profile+</a>

Share
Published by
Syed Zain Nasir