Spaces:
Sleeping
Sleeping
| import streamlit as st | |
| from utils.plot_utils import plot_beam_shape, plot_sfd, plot_bmd | |
| def main(): | |
| # Title of the app | |
| st.title("Beam Analysis App") | |
| from utils.beam_analysis import analyze_beam | |
| # User Input Section | |
| beam_type = st.selectbox("Select beam type", ("Simply Supported", "Continuous")) | |
| num_spans = st.number_input("Number of spans", min_value=1, max_value=5, value=2) | |
| span_lengths = [] | |
| for i in range(num_spans): | |
| length = st.number_input(f"Length of span {i+1} (ft)", min_value=1.0, value=10.0) | |
| span_lengths.append(length) | |
| load_type = st.selectbox("Select load type", ("Uniformly Distributed Load (UDL)", "Point Load", "Uniformly Varying Load (UVL)")) | |
| supports = [] | |
| for i in range(num_spans + 1): # One extra support for continuous beams | |
| support_type = st.selectbox(f"Support type at span {i+1}", ("Fixed", "Roller", "Hinge", "Pin")) | |
| supports.append(support_type) | |
| # Analyze Beam button | |
| if st.button("Analyze Beam"): | |
| results = analyze_beam(beam_type, span_lengths, supports, load_type) | |
| # Display Results | |
| st.subheader("Shear Force Diagram (SFD)") | |
| plot_sfd(results['shear_forces'], span_lengths) | |
| st.subheader("Bending Moment Diagram (BMD)") | |
| plot_bmd(results['bending_moments'], span_lengths) | |
| st.subheader("Beam Shape and Supports") | |
| plot_beam_shape(span_lengths, supports, load_type) | |
| if __name__ == "__main__": | |
| main() | |