From 6c931c7bd4f8384b1241c3951ab39500017c899e Mon Sep 17 00:00:00 2001 From: buddyd16 Date: Fri, 25 Jan 2019 11:53:50 -0500 Subject: [PATCH] clelanup - file cleanup - removed the compression at slices function as the results were outside an acceptable level of error - 2-3% --- Concrete/concrete_common.py | 313 +----------------------------------- 1 file changed, 1 insertion(+), 312 deletions(-) diff --git a/Concrete/concrete_common.py b/Concrete/concrete_common.py index 59786ca..18f74a5 100644 --- a/Concrete/concrete_common.py +++ b/Concrete/concrete_common.py @@ -109,315 +109,4 @@ def polygon_center(x,y): x_bar = x_bar / (6*area) y_bar = y_bar/(6*area) - return (x_bar,y_bar) - -def length_by_two_points(ax,ay,bx,by): - dx = abs(bx - ax) - dy = abs(by - ay) - - length = (dx*dx + dy*dy)**0.5 - - return length - -def x_point_on_line_by_two_points(ax,ay,bx,by,y): - - if ax == bx: - return ax - else: - l = (y-ay) - - c = (by-ay) / (bx-ax) - - r = c*ax - - return (l + r) / c - -class Line: - def __init__(self, start=[0,0], end=[1,1]): - self.error_string = '' - - if start == end: - self.error_string = 'Not Valid - Start Point = End Point' - - else: - self.start = start - self.end = end - self.startx = start[0] - self.starty = start[1] - self.endx = end[0] - self.endy = end[1] - -def compression_forces_locations_general_poly_collins(lines,fprimec,eu,na_depth): - ''' - given an list of lines that form a closed polygon - return a list of compression forces and (x,y) application points - - assumptions - section is oriented such that the neutral axis is horizontal - this may require the cross section to be transformed to the neutral axis angle - - Method: - determine the peak coordinate - max y value NA depth is from this point down - at each slice get the strain and parabolic stress distribution - determine the edge intersection points at the slice elevation - at each slice determine the width of the member - force @ slice = width*stress - (x,y) application point is slice width/2 + slice left coord y is slice elevation - ''' - - # Loop thru the lines and find the max y coordinate - y = [] - for line in lines: - y.extend([line.start[1],line.end[1]]) - - top = max(y) - - na_y = top - na_depth - - # create the slices and determine the strains and stresse at each slice - slices = [] - - num_slices = 100 - - step = na_depth / num_slices - - for i in range(0,num_slices+1): - slices.append(0+step*i) - - strains = [] - - for s in slices: - strains.append(strain_at_depth_from_top(eu,na_depth,s)) - - stresses = [] - for strain in strains: - stresses.append(stress_strain_collins_et_all(fc_psi,eu,strain)) - - # correct slice elevations to be on the cross section and not start at 0 - - slices_global = [x+na_y for x in slices] - - # at each slice determine what lines are intersected - # for polygons with holes determine left and right pairs - # a left intersection is where the line start point is above the slice - # a right intersection is where the line end point is above the slice - - slice_forces = [] - - s = 0 - - for loc in slices_global: - - pts = [] - for line in lines: - if line.start[1] < loc < line.end[1] or line.end[1] < loc < line.start[1]: - int_point_x = x_point_on_line_by_two_points(line.start[0],line.start[1],line.end[0],line.end[1],loc) - - if line.start[1] > loc: - side = 'left' - - else: - side = 'right' - - pts.append([int_point_x,side]) - - elif line.start[1] == loc and line.end[1] == loc: - - left = min(line.start[0],line.end[0]) - right = max(line.start[0],line.end[0]) - pts.extend([[left,'left'],[right,'right']]) - - else: - pass - - # sort the list of pts by x coord - # this should result in pairs of left and right pieces - pts.sort(key=lambda x:x[0]) - - i=0 - for point in pts: - - if point[1] == 'left': - - if pts[i+1][1] == 'right': - - width = length_by_two_points(point[0],loc,pts[i+1][0],loc) - - f = stresses[s]*width*step - - slice_forces.append([f,[(point[0]+width/2.0),loc]]) - else: - pass - else: - pass - i+=1 - - s+=1 - - return [slices_global, strains, stresses, slice_forces] - - - - -eu = 0.003 -fc_psi = 3000 - -na_depth_in = 2.03 - -num_pts = 100 - -x = [] -step = na_depth_in / num_pts - -for i in range(0,num_pts+1): - x.append(0+step*i) - -strains = [] - -for i in x: - strains.append(strain_at_depth_from_top(eu,na_depth_in,i)) - -stresses = [] - -for strain in strains: - stresses.append(stress_strain_desayi_krishnan(fc_psi,eu,0.85,strain)) - -stresses_collins = [] -for strain in strains: - stresses_collins.append(stress_strain_collins_et_all(fc_psi,eu,strain)) - - -area_desayi = simps(stresses,x) -area_collins = simps(stresses_collins,x) - -# add points to make a closed polygon - -stresses.extend([0,0]) -stresses_collins.extend([0,0]) -x.extend([na_depth_in,0]) - -center_desayi = polygon_center(x,stresses) -center_collins = polygon_center(x,stresses_collins) - -NA_moment_desayi = area_desayi * center_desayi[0] -NA_moment_collins = area_collins * center_collins[0] - -print area_desayi, polygon_area(x,stresses) -print area_collins, polygon_area(x,stresses_collins) -print center_desayi[0] -print center_collins[0] - - -# concrete beam Mn test -# 12x24 f'c = 3000 fy=60 ksi w/ (2)#6 bottom - -Ts = 2*60000*0.44 -sect_b = 12 - -# find NA depth so Cc = Ts - desayi -a=0 -b=21.75 -c=0 -pna = 0 - -loop_max = 10000 -tol = 0.0000000000001 -loop = 0 - -while loop Ts: - b = c - else: - a = c - loop+=1 - -na_desayi = na_depth_in -center_desayi = polygon_center(x,stresses) - -while loop Ts: - b = c - else: - a = c - loop+=1 - -na_collins = na_depth_in -center_collins = polygon_center(x,stresses) - -#plt.plot(x,stresses) -#plt.plot(center_desayi[0],center_desayi[1],'b+') -#plt.plot(center_collins[0],center_collins[1],'go') -# -#plt.show() - -shape = [Line([0,0],[12,0]),Line([12,0],[12,24]),Line([12,24],[0,24]),Line([0,24],[0,0])] - - -res = compression_forces_locations_general_poly_collins(shape,fc_psi,eu,na_collins) - -comp_c = sum(x[0] for x in res[3]) - -cs = [sc[0] for sc in res[3]] -xs = res[0][:] - -plt.plot(xs, cs) -plt.show() \ No newline at end of file + return (x_bar,y_bar) \ No newline at end of file