Example Code

Block on an Inclined Plane with Friction - Physics Demo using LabVIEW

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW

Code and Documents

Attachment

Overview

An example piece of code which allows a demonstration of the net forces and acceleration acting on a block resting on an inclined plane.

 

Description

The Front Panel of the VI allows the user to change the properties of the VI:

  1. Angle of incline
  2. Mass of block
  3. Coefficient of friction

The user can then Play the VI and watch the net forces act on the block, if the downhill force is greater than the frictional forces it will accelerate downhill. The user can also adjust the values as the block is moving or refresh the demo.

Coding concepts

An Event Based State Machine architecture is implemented in the code with an Event Structure which transition to different code based on the user input. The VI uses the Picture Functions from the Picture Control Toolkit to draw lines with the start and end points calculated using trigonometric functions based on the angle of incline and the block velocity/position. These Picture Functions can be seen in the individual SubVIs which are used to draw the incline, block and arrows.

 

Requirement

  1. LabVIEW2013 (or compatible)

 

Steps to Implement or Execute Code

  1. Open project file
  2. Open Main.vi
  3. Run the VI
  4. Adjust values
  5. Select the Play Button

 

Additional Information or References

Block Diagram

247.JPG 

 **This document has been updated to meet the current required format for the NI Code Exchange.**

James V.

NI UK Applications Engineer

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.