This file contains 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
# ----------------------------------------------------------------------------- | |
# #027 - Data Structures for Civil/Structural Engineers: Pandas 101 | |
# ----------------------------------------------------------------------------- | |
''' | |
Hi everybody from the flocode newsletter 👋 | |
This is all the code from article #027 - Data Structures for Civil/Structural Engineers: | |
Pandas 101 |
This file contains 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
# ========================================================== | |
# Prepare Pseudocode for Calculating Concrete Volume | |
# ========================================================== | |
FUNCTION calculate_concrete_volume(length, width, depth) | |
# Calculate the area of the floor slab | |
area = length * width | |
# Calculate the volume of concrete required |
This file contains 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
import numpy as np | |
# Constants | |
M = 140 # Moment at the cross-section (kN.m) | |
I = 102_000_000 # Moment of inertia in mm^4 | |
y = np.array([-150, -100, -50, 0, 50, 100, 150]) # Distance from the neutral axis in mm | |
# Bending stress calculation | |
sigma = ((M * 1e6) * y) / I # Convert M from kN.m to N.mm |
This file contains 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
import numpy as np | |
import matplotlib.pyplot as plt | |
def plot_beam_diagrams(length, w): | |
""" | |
Plot the shear force and bending moment diagrams for a simply supported beam. | |
Parameters: | |
- length: Length of the beam (m) | |
- w: Magnitude of the uniformly distributed load (kN/m) |
This file contains 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
import numpy as np | |
import matplotlib.pyplot as plt | |
# Beam parameters | |
length = 10 # Length of the beam (m) | |
w = 10 # Uniformly distributed load in kN/m | |
# Functions | |
def shear_force(x): | |
return w * (length / 2 - x) # kN |