Example Code

Automated Slope Calculation with DIAdem Script

Code and Documents

Attachment

Overview

This script programmatically calculates the average slope between two defined channel values, which may be useful for e.g. determining the Youngs Modulus using Hookes Law.
Tensile Test (the slope of the linear range is called "Youngs Modulus")

Tensile_test.png

Description

  • We iterate through the channel until a measurement exceeds a start value (e.g. y = 2). We then store this pair of numbers as [x0,y0].
  • From hereon, we iterate through the channel until the stop value has been reached (e.g. y = 17). We also store this pair of number as [x1,y1].
  • Finally, we calculate the slope which is defined as slope = (y1 - y0) / (x1 - x0).
  • As a bonus, we check if the start and stop value have ever been reached. If not, an error message is returned.

 

Hardware and Software Requirements

DIAdem Base 2011 (or compatible)

 

Steps to Implement or Execute Code

1. Unzip Slopes Thresholds - DIA2011.zip

2. Run Slopes Thresholds.VBS

 

Additional Information or References

References

Tensile Testing - Leaving Certificate Engineering Notes
https://sites.google.com/site/gobanengineeringnotes/materials-testing/tensile-testing

Eric H.
Applications Engineering
National Instruments

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

Contributors