Mainly focusing on part 2. the programming language is C. I do not even know how
ID: 3919671 • Letter: M
Question
Mainly focusing on part 2. the programming language is C. I do not even know how to do the options for Part 2 on paper.
Explanation / Answer
Please adjust variables according to your part 1, This is basic programming in c for Tolerance Analysis in Computer Aided Engineering. Your part 1 is a program that will load a tolerance table and estimate gap sizes and tolerances. And part 2 suggest options for changing tolerances and dimensions to meet the design specification. I have written functions of Part2 with a code which we had learned at our engineering school.
int adjust_parts(){
double gap_tolerance, gap_tolerance_min, gap_tolerance_max;
int variable_part_cnt;
double wiggle_room;
int i, j;
printf(" Adjusting parts values ");
// getting numbers first
gap_tolerance = (gap_max - gap_min) / 2.0;
gap_tolerance_min = gap_tolerance_max = 0.0;
variable_part_cnt = 0;
srand(time(NULL)); // changing the seed
for( i = 0; i < part_cnt; i++ ){
// gap_nominal += part_nominal[i] * part_sign[i];
gap_tolerance_max += part_tolerance[i];
if( part_variability[i] == 'F' ){
gap_tolerance_min += part_tolerance[i];
} else {
variable_part_cnt++;
}
}
if( gap_tolerance_min > gap_tolerance ){
printf("Error: The tolerance sum of the fixed parts is too large to work ");
return ERROR;
}
// Adjust the tolerances
wiggle_room = (gap_tolerance_max - gap_tolerance) / variable_part_cnt;
for( i = 0; i < part_cnt; i++ ){
if( part_variability[i] == 'V' ) part_tolerance[i] -= wiggle_room;;
}
// now that the tolerances are adjusted, time for the dimensions
wiggle_room = ((gap_max - gap_min)/2.0 - gap_mean) / variable_part_cnt;
for( i = 0; i < part_cnt; i++ ){
if( part_variability[i] == 'V' ) part_nominal[i] += wiggle_room * part_sign[i];
}
update_gap();
return NO_ERROR;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.