beam_analysis / app.py
sikandarciv101's picture
Update app.py
2f51ace verified
import streamlit as st
import numpy as np
import matplotlib.pyplot as plt
from PIL import Image
from utils.beam_analysis import analyze_beam, plot_beam_diagrams
# Load the logo image
def load_logo():
img = Image.open("assets/logo.png")
st.image(img, width=100)
# Main Streamlit app
def main():
# Display logo
load_logo()
st.title("Beam Analysis for Roof Design")
st.write("""
This app helps in analyzing two types of beam configurations for a basement roof design:
1. **Statically Indeterminate** (Continuous Steel Beams over Interior Columns)
2. **Statically Determinate** (Simply Supported Beams)
Use the options below to select and analyze each beam configuration.
""")
# Select beam configuration
beam_type = st.selectbox("Select Beam Configuration", ["Simply Supported Beams", "Continuous Beams"])
length = 30 # Beam length in feet
width = 50 # Beam width in feet (if needed)
load = 1500 # Example uniform load in pounds (modify as per actual project specs)
# Perform beam analysis
if beam_type == "Simply Supported Beams":
# Analysis for Simply Supported Beam
st.subheader("Simply Supported Beam Analysis")
results = analyze_beam(length, load, "simply_supported")
st.write(f"Maximum Shear Force: {results['max_shear']} lb")
st.write(f"Maximum Bending Moment: {results['max_bending_moment']} lb-ft")
st.write(f"Deflection: {results['deflection']} inches")
elif beam_type == "Continuous Beams":
# Analysis for Continuous Beam
st.subheader("Continuous Beam Analysis")
results = analyze_beam(length, load, "continuous")
st.write(f"Maximum Shear Force: {results['max_shear']} lb")
st.write(f"Maximum Bending Moment: {results['max_bending_moment']} lb-ft")
st.write(f"Deflection: {results['deflection']} inches")
# Plot the diagrams (SFD, BMD)
st.subheader("Shear Force and Bending Moment Diagrams")
plot_beam_diagrams(beam_type, length, load)
if __name__ == "__main__":
main()