Created
May 29, 2018 11:56
-
-
Save clamytoe/91a10676613fc75b3b25ddd320d10280 to your computer and use it in GitHub Desktop.
beam.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| Beam calculations | |
| My attempt at converting mathematical formulas | |
| into Python code. | |
| Mu =1.35 G + 1.5 Q =1.35*0.5+1.5*0.15=0.9 | |
| µ=Mu / ( bw x d² x Fcd )=0.9/(0.3*(0.9*0.65)²*20)=0.438 | |
| Fcd=30/1.5=20 | |
| α =1.25 x ( 1 - ( 1 - ( 2 x µ ))^ 1/2)= 1.25 x ( 1 - ( 1 - ( 2 x0.438 ))^ 1/2)=0.81 | |
| Z= d x ( 1 - ( 0.4 x α ))= (0.9*0.65)*(1-(0.4*0.81))=0.395 | |
| As1=Mu / ( Z x Fsu )= 0.9/0.395*500=45.56cm² | |
| """ | |
| def calc_As1(Mu, Z): | |
| Fsu = 500 | |
| return round((Mu / (Z * Fsu)) * 10000, 2) | |
| def calc_a(u): | |
| val = 1.25 * (1 - (1 - (2 * u)) ** 0.5) | |
| return round(val, 3) | |
| def calc_Fcd(y): | |
| return 30 / y | |
| def calc_Mu(x, y): | |
| G = 0.5 | |
| Q = 0.15 | |
| return x * G + y * Q | |
| def calc_u(Mu, Fcd): | |
| bw = 0.3 | |
| d2 = (0.9 * 0.65) ** 2 | |
| Fcd = 20 | |
| return round(Mu / (bw * d2 * Fcd), 3) | |
| def calc_Z(a): | |
| d = 0.9 * 0.65 | |
| return round(d * (1 - (0.4 * a)), 3) | |
| def main(x, y): | |
| Mu = calc_Mu(x, y) | |
| Fcd = calc_Fcd(y) | |
| u = calc_u(Mu, Fcd) | |
| a = calc_a(u) | |
| Z = calc_Z(a) | |
| As1 = calc_As1(Mu, Z) | |
| result = f"{As1}cm^2" | |
| assert Mu == 0.9 | |
| assert Fcd == 20.0 | |
| assert u == 0.438 | |
| assert a == 0.81 | |
| assert Z == 0.395 | |
| assert As1 == 45.57 | |
| assert result == "45.57cm^2" | |
| print(f" Mu: {Mu}") | |
| print(f"Fcd: {Fcd}") | |
| print(f" u: {u}") | |
| print(f" a: {a}") | |
| print(f" Z: {Z}") | |
| print(f"As1: {As1}") | |
| print("-" * (len(result) + 4)) | |
| print(f" {As1}cm^2 ") | |
| print("-" * (len(result) + 4)) | |
| if __name__ == '__main__': | |
| x = 1.35 | |
| y = 1.5 | |
| main(x, y) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment