SPRING, 2017 A3: STRESS AND STRAIN CALCULATIONS (using input/output files, if st
ID: 3791601 • Letter: S
Question
SPRING, 2017 A3: STRESS AND STRAIN CALCULATIONS (using input/output files, if structures, and a for loop INTRODUCTION: the task an engineer working for a company that provides material tensile lesting. Specifically, you have been given The of determining the deformation beha of an aluminum rod. Using a tensile testing machine, test specimen was stretched at a steady rate, and the force and length data were recorded the test.tst. input file, tensile test, is a comma in a file called tensile delimited file. You have for the customer (see the chart below, however you need to compute the stress and strain values, and determine the yield point to report. Stress vs Strain oot ca o des 007 The two definitions for stress and strain are either engineering or true. Since you will be computing the true stress and the true strain values, the equations for computing the values are: where a is the stress in lbin Fis the applied force in lbs A is the cross sectional area in in E is the strain in inin lis the rod length during testing in inches la is the original rod length in inches In is the natural logarithm to the base e ASSIGNMENT:Explanation / Answer
Below code is written in C Language
#define M_PI 3.14159265358979323846
#include<conio.h>
#include<stdio.h>
#include<math.h>
int main() {
float r, cur_len ,F ,orr_len ,area ,stress ,strain, deform_force;
int i;
FILE *input_fp, *output_fp;
r = cur_len = F = orr_len = area = stress = strain = 0;
input_fp = fopen ("tensile_test.txt", "r+");
output_fp = fopen ("test_results.txt", "w+");
printf(" TENSILE TESTING DATA ");
fprintf(output_fp, " TENSILE TESTING DATA ");
if(input_fp == NULL)
perror(input_fp);
while (fscanf(input_fp, "%f,%f,%f", &r, &cur_len, &F) != EOF) {
area = M_PI * r * r;
if(orr_len == 0){
printf("Aluminum rod radius = %.4f inches ", r);
fprintf(output_fp, "Aluminum rod radius = %.4f inches ", r);
printf("Aluminum rod original length = %.1f inches ", cur_len);
fprintf(output_fp, "Aluminum rod original length = %.1f inches ", cur_len);
printf("Aluminum rod cross sectional area = %.4f in^2 ", area);
fprintf(output_fp, "Aluminum rod cross sectional area = %.4f in^2 ", area);
printf("Force Length Stress Strain ");
fprintf(output_fp, "Force Length Stress Strain ");
printf("(lbs) (in) (psi) (in/in) ");
fprintf(output_fp, "(lbs) (in) (psi) (in/in) ");
orr_len = cur_len;
}
//for(i=0; i< N; i++){
stress = (F / area) * (cur_len / orr_len);
strain = log(cur_len / orr_len);
if(strain <= 0.010)
deform_force = F;
printf(" %.1f %.3f %.1f %.4f ", F, cur_len, stress, strain);
fprintf(output_fp, " %.1f %.3f %.1f %.4f ", F, cur_len, stress, strain);
//}
}
printf(" Deformation occured at %.1f pounds of force", deform_force);
fprintf(output_fp, " Deformation occured at %.1f pounds of force", deform_force);
fclose(output_fp);
fclose(input_fp);
getch();
return 0;
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.