Geschrieben von Student*innen, die bestanden haben Sofort verfügbar nach Zahlung Online lesen oder als PDF Falsches Dokument? Kostenlos tauschen 4,6 TrustPilot
logo-home
Notizen

Programming in Civil engineering

Bewertung
-
Verkauft
-
seiten
16
Hochgeladen auf
20-07-2025
geschrieben in
2024/2025

By reading and practice these documents you will get very interested information

Hochschule
Kurs

Inhaltsvorschau

In [1]: import numpy as np
import matplotlib.pyplot as plt

print("Simply Supported Beam")
print("\nType 1 for point load, Type 2 for UDL")
Type = int(input("Load case = "))

L = float(input("\nLength of beam in meter = "))

if Type == 1:
P = float(input("\nLoad applied in kN = "))
a = float(input("Location of Load from left end of the beam in meter = "))
c = L - a

R1 = P * (L - a) / L
R2 = P * a / L
else:
W = float(input("\nUniformly distributed load in kN/m = "))
b = float(input("Length of UDL in meter = "))
cg = float(input("C.G of UDL from left end of the beam in meter = "))
a = cg - b / 2
c = L - a - b

R1 = W * b * (b + 2 * c) / (2 * L)
R2 = W * b * (b + 2 * a) / (2 * L)

# Discretization
n = 1000
delta_x = L / n
x = np.linspace(0, L, n + 1)

V = np.zeros_like(x)
M = np.zeros_like(x)

# Calculation
if Type == 1:
for i in range(n + 1):
if x[i] < a:
V[i] = R1
M[i] = R1 * x[i]
else:
V[i] = R1 - P
M[i] = R1 * x[i] - P * (x[i] - a)
x1 = a
Mmax = P * a * (L - a) / L
else:
for i in range(n + 1):
if x[i] < a:
V[i] = R1
M[i] = R1 * x[i]
elif a <= x[i] < a + b:
V[i] = R1 - W * (x[i] - a)
M[i] = R1 * x[i] - W * ((x[i] - a) ** 2) / 2
else:
V[i] = -R2
M[i] = R2 * (L - x[i])
x1 = a + b * (b + 2 * c) / (2 * L)
Mmax = W * b * (b + 2 * c) * (4 * a * L + 2 * b * c + b ** 2) / (8 * L ** 2)

,# Results
print(f"\nLeft support Reaction = {R1:.2f} kN")
print(f"Right support Reaction = {R2:.2f} kN")
print(f"Maximum bending moment = {Mmax:.2f} kNm")

# Plotting
plt.figure(figsize=(10, 8))

# SFD
plt.subplot(2, 1, 1)
plt.plot(x, V, 'r', linewidth=1.5)
plt.axhline(0, color='k')
plt.axvline(0, color='r', linewidth=1.5)
plt.axvline(L, color='r', linewidth=1.5)
plt.title('Shear Force Diagram', fontsize=16)
plt.text(a / 2, V[0], f'{V[0]:.2f}', ha='center', fontweight='bold', fontsize=12)
plt.text(L - c / 2, V[-1], f'{V[-1]:.2f}', ha='center', fontweight='bold', fontsize=12
plt.grid(True)

# BMD
plt.subplot(2, 1, 2)
plt.plot(x, M, 'r', linewidth=1.5)
plt.axhline(0, color='k')
plt.axvline(x1, linestyle='--', color='b')
plt.title('Bending Moment Diagram', fontsize=16)
plt.text(x1 + 1 / L, Mmax / 2, f'{round(Mmax, 2):.2f}', ha='center', fontweight='bold'
plt.text(x1, 0, f'{round(x1, 2)} m', ha='center', fontweight='bold', fontsize=12)
plt.grid(True)

plt.tight_layout()
plt.show()

Simply Supported Beam

Type 1 for point load, Type 2 for UDL
Load case = 2

Length of beam in meter = 10

Uniformly distributed load in kN/m = 3
Length of UDL in meter = 10
C.G of UDL from left end of the beam in meter = 5

Left support Reaction = 15.00 kN
Right support Reaction = 15.00 kN
Maximum bending moment = 37.50 kNm

, In [2]: import numpy as np
import matplotlib.pyplot as plt

def get_input():
print("Simply Supported Beam Analysis\n")
load_type = int(input("Enter 1 for Point Load or 2 for UDL: "))
length = float(input("Enter beam length (m): "))

if load_type == 1:
P = float(input("Enter Point Load (kN): "))
a = float(input("Enter location of load from left support (m): "))
return load_type, length, {'P': P, 'a': a}

else:
W = float(input("Enter Uniformly Distributed Load (kN/m): "))
b = float(input("Enter length of UDL (m): "))
cg = float(input("Enter C.G. of UDL from left support (m): "))
return load_type, length, {'W': W, 'b': b, 'cg': cg}

def calculate_reactions(load_type, L, data):
if load_type == 1:
a = data['a']
c = L - a
P = data['P']
R1 = P * (L - a) / L
R2 = P * a / L
return R1, R2, a, c
else:

Schule, Studium & Fach

Kurs

Dokument Information

Hochgeladen auf
20. juli 2025
Anzahl der Seiten
16
geschrieben in
2024/2025
Typ
Notizen
Professor(en)
Sir ali
Enthält
Alle klassen

Themen

$8.49
Vollständigen Zugriff auf das Dokument erhalten:

Falsches Dokument? Kostenlos tauschen Innerhalb von 14 Tagen nach dem Kauf und vor dem Herunterladen kannst du ein anderes Dokument wählen. Du kannst den Betrag einfach neu ausgeben.
Geschrieben von Student*innen, die bestanden haben
Sofort verfügbar nach Zahlung
Online lesen oder als PDF

Lerne den Verkäufer kennen
Seller avatar
adilrazaq14

Lerne den Verkäufer kennen

Seller avatar
adilrazaq14 Punjab college
Folgen Sie müssen sich einloggen, um Studenten oder Kursen zu folgen.
Verkauft
-
Mitglied seit
2 Jahren
Anzahl der Follower
0
Dokumente
10
Zuletzt verkauft
-

0.0

0 rezensionen

5
0
4
0
3
0
2
0
1
0

Beliebte Dokumente

Kürzlich von dir angesehen.

Warum sich Studierende für Stuvia entscheiden

on Mitstudent*innen erstellt, durch Bewertungen verifiziert

Geschrieben von Student*innen, die bestanden haben und bewertet von anderen, die diese Studiendokumente verwendet haben.

Nicht zufrieden? Wähle ein anderes Dokument

Kein Problem! Du kannst direkt ein anderes Dokument wählen, das besser zu dem passt, was du suchst.

Bezahle wie du möchtest, fange sofort an zu lernen

Kein Abonnement, keine Verpflichtungen. Bezahle wie gewohnt per Kreditkarte oder Sofort und lade dein PDF-Dokument sofort herunter.

Student with book image

“Gekauft, heruntergeladen und bestanden. So einfach kann es sein.”

Alisha Student

Häufig gestellte Fragen