Section Properties Workflow Tutorial

This tutorial demonstrates how to chain calculators together for integrated structural analysis workflows using StructEngine-v2.

Problem Statement

Analyze a steel beam using calculated section properties:

  1. Get section properties for ISHB 300 (Indian Standard H-Beam)

  2. Use properties in beam analysis to calculate deflections and stresses

  3. Demonstrate calculator chaining and workflow integration

Scenario: - Beam section: ISHB 300 - Span: 6000 mm (simply supported) - Loading: Uniformly distributed load (UDL) = 50 kN/m

Workflow Overview

Step 1: Section Properties Calculator
   ↓
Extract: Ixx, Iyy, Zxx, Zyy, Area, E
   ↓
Step 2: Beam Analysis Calculator
   ↓
Results: Deflection, Moments, Shear, Stresses

Step 1: Get Section Properties

### 1.1 Input Construction

from api.app.calculators.analysis.section_properties import SectionPropertiesInput
import requests

# Request ISHB 300 section properties
section_input = SectionPropertiesInput(
    section_type="standard",
    standard_section="ISHB300",
    material="steel"  # E = 200,000 N/mm²
)

print(f"Requesting properties for: {section_input.standard_section}")

### 1.2 API Call

# API endpoint for section properties
url_section = "http://localhost:8000/api/calculators/section_properties/calculate"

# Send request
response_section = requests.post(
    url_section,
    json=section_input.dict(),
    headers={"Content-Type": "application/json"}
)

if response_section.status_code == 200:
    section_props = response_section.json()
    print("Section properties retrieved successfully!")
else:
    print(f"Error: {response_section.status_code}")
    exit(1)

### 1.3 Extract Properties

# Extract key properties for beam analysis
properties = {
    "section_name": section_props["section_name"],  # "ISHB300"
    "area": section_props["area"],                  # mm²
    "depth": section_props["depth"],                # mm
    "width": section_props["width"],                # mm
    "Ixx": section_props["Ixx"],                    # mm⁴ (major axis)
    "Iyy": section_props["Iyy"],                    # mm⁴ (minor axis)
    "Zxx": section_props["Zxx"],                    # mm³ (section modulus)
    "Zyy": section_props["Zyy"],                    # mm³
    "E": section_props["elastic_modulus"],          # N/mm² (200,000 for steel)
}

print(f"Section: {properties['section_name']}")
print(f"Depth: {properties['depth']}mm")
print(f"Ixx: {properties['Ixx']:.2e} mm⁴")
print(f"Zxx: {properties['Zxx']:.2e} mm³")

Expected Output (ISHB 300):

Section: ISHB300
Depth: 300mm
Width: 250mm
Area: 7214 mm²
Ixx: 1.18e+08 mm⁴
Iyy: 2.69e+07 mm⁴
Zxx: 7.87e+05 mm³
E: 200,000 N/mm²

Step 2: Beam Analysis

### 2.1 Input Construction

Use the extracted section properties in beam analysis:

from api.app.calculators.analysis.beam_analysis import BeamAnalysisInput

# Beam analysis input using section properties
beam_input = BeamAnalysisInput(
    span=6000,                      # mm
    support_type="simply_supported",

    # Section properties from Step 1
    section_depth=properties["depth"],
    section_Ixx=properties["Ixx"],
    section_Zxx=properties["Zxx"],
    elastic_modulus=properties["E"],

    # Loading
    udl=50,                         # kN/m
    point_loads=[],                 # No point loads

    # Material
    material_type="steel",
    yield_strength=250              # N/mm² (E250 grade)
)

print(f"Analyzing {properties['section_name']} beam")
print(f"Span: {beam_input.span}mm, UDL: {beam_input.udl}kN/m")

### 2.2 API Call

# API endpoint for beam analysis
url_beam = "http://localhost:8000/api/calculators/beam_analysis/calculate"

# Send request
response_beam = requests.post(
    url_beam,
    json=beam_input.dict(),
    headers={"Content-Type": "application/json"}
)

if response_beam.status_code == 200:
    beam_results = response_beam.json()
    print("Beam analysis completed successfully!")
else:
    print(f"Error: {response_beam.status_code}")
    exit(1)

### 2.3 Interpret Results

# Extract analysis results
results = {
    "max_moment": beam_results["max_bending_moment"],      # kN-m
    "max_shear": beam_results["max_shear_force"],          # kN
    "max_deflection": beam_results["max_deflection"],      # mm
    "max_stress": beam_results["max_bending_stress"],      # N/mm²
    "deflection_limit": beam_results["deflection_limit"],  # mm (span/250)
    "deflection_check": beam_results["deflection_check"],  # PASS/FAIL
    "stress_check": beam_results["stress_check"],          # PASS/FAIL
}

print("\n" + "="*60)
print("BEAM ANALYSIS RESULTS")
print("="*60)
print(f"Max moment: {results['max_moment']}kN-m")
print(f"Max shear: {results['max_shear']}kN")
print(f"Max deflection: {results['max_deflection']:.2f}mm")
print(f"Deflection limit: {results['deflection_limit']:.2f}mm")
print(f"Max stress: {results['max_stress']:.2f}N/mm²")
print(f"Yield strength: {beam_input.yield_strength}N/mm²")
print()
print(f"Deflection check: {results['deflection_check']}")
print(f"Stress check: {results['stress_check']}")
print("="*60)

Step 3: Manual Verification

### 3.1 Maximum Moment

# For simply supported beam with UDL
# M_max = w × L² / 8

w = 50  # kN/m
L = 6   # m

M_max = w * L**2 / 8
M_max = 50 * 36 / 8
M_max = 225 kN-m  

### 3.2 Maximum Deflection

# For simply supported beam with UDL
# δ_max = (5 × w × L⁴) / (384 × E × I)

w = 50 * 1000 / 1000  # N/mm (convert kN/m to N/mm)
L = 6000              # mm
E = 200000            # N/mm²
I = 1.18e8            # mm⁴ (Ixx from section properties)

δ_max = (5 * w * L**4) / (384 * E * I)
δ_max = (5 * 50 * 6000**4) / (384 * 200000 * 1.18e8)
δ_max  17.8 mm

# Deflection limit (IS 800 Clause 5.6.1)
δ_limit = L / 250 = 6000 / 250 = 24 mm

# Check: 17.8 < 24  ✓

### 3.3 Maximum Bending Stress

# σ_max = M / Z

M = 225 * 1e6        # N-mm (convert kN-m)
Z = 7.87e5           # mm³ (Zxx from section properties)

σ_max = M / Z
σ_max = 225e6 / 7.87e5
σ_max  286 N/mm²

# Check against yield strength
fy = 250 N/mm²

# Note: σ_max (286) > fy (250) → FAIL
# Section is overstressed, need larger section or reduce load

Step 4: Complete Workflow Script

Full Python script demonstrating calculator chaining:

import requests
import json

def analyze_beam_workflow():
    """
    Complete workflow: Section properties → Beam analysis.
    Demonstrates calculator chaining in StructEngine-v2.
    """

    print("="*70)
    print("INTEGRATED WORKFLOW: SECTION PROPERTIES → BEAM ANALYSIS")
    print("="*70)

    # ===== STEP 1: GET SECTION PROPERTIES =====
    print("\nSTEP 1: Retrieving section properties for ISHB300...")

    section_payload = {
        "section_type": "standard",
        "standard_section": "ISHB300",
        "material": "steel"
    }

    response_section = requests.post(
        "http://localhost:8000/api/calculators/section_properties/calculate",
        json=section_payload
    )

    if response_section.status_code != 200:
        print(f"Error in section properties: {response_section.status_code}")
        return None

    section_props = response_section.json()

    print(f"  Section: {section_props['section_name']}")
    print(f"  Depth: {section_props['depth']}mm")
    print(f"  Ixx: {section_props['Ixx']:.2e} mm⁴")
    print(f"  Zxx: {section_props['Zxx']:.2e} mm³")
    print(f"  E: {section_props['elastic_modulus']} N/mm²")

    # ===== STEP 2: BEAM ANALYSIS =====
    print("\nSTEP 2: Analyzing beam with UDL = 50 kN/m, Span = 6m...")

    beam_payload = {
        "span": 6000,
        "support_type": "simply_supported",
        "section_depth": section_props["depth"],
        "section_Ixx": section_props["Ixx"],
        "section_Zxx": section_props["Zxx"],
        "elastic_modulus": section_props["elastic_modulus"],
        "udl": 50,
        "point_loads": [],
        "material_type": "steel",
        "yield_strength": 250
    }

    response_beam = requests.post(
        "http://localhost:8000/api/calculators/beam_analysis/calculate",
        json=beam_payload
    )

    if response_beam.status_code != 200:
        print(f"Error in beam analysis: {response_beam.status_code}")
        return None

    beam_results = response_beam.json()

    # ===== STEP 3: DISPLAY RESULTS =====
    print("\nRESULTS:")
    print("-" * 70)
    print(f"  Max moment: {beam_results['max_bending_moment']} kN-m")
    print(f"  Max shear: {beam_results['max_shear_force']} kN")
    print(f"  Max deflection: {beam_results['max_deflection']:.2f} mm")
    print(f"  Deflection limit: {beam_results['deflection_limit']:.2f} mm")
    print(f"  Max stress: {beam_results['max_bending_stress']:.2f} N/mm²")
    print(f"  Yield strength: {beam_payload['yield_strength']} N/mm²")
    print()
    print(f"  Deflection check: {beam_results['deflection_check']}")
    print(f"  Stress check: {beam_results['stress_check']}")
    print()

    # ===== STEP 4: RECOMMENDATIONS =====
    if beam_results['stress_check'] == 'FAIL':
        print("RECOMMENDATION:")
        print("  Section is overstressed. Consider:")
        print("  - Using larger section (e.g., ISHB350, ISHB400)")
        print("  - Reducing load")
        print("  - Reducing span")
    elif beam_results['deflection_check'] == 'FAIL':
        print("RECOMMENDATION:")
        print("  Deflection exceeds limit. Consider:")
        print("  - Using stiffer section (higher Ixx)")
        print("  - Reducing span")
    else:
        print("RESULT: Design is adequate ✓")

    print("="*70)

    return {
        "section_properties": section_props,
        "beam_analysis": beam_results
    }

if __name__ == "__main__":
    analyze_beam_workflow()

Workflow Best Practices

### 1. Error Handling

Always check response status codes:

if response.status_code != 200:
    print(f"Error: {response.status_code}")
    print(response.text)
    return None

### 2. Data Validation

Verify extracted properties before using:

assert section_props["Ixx"] > 0, "Invalid Ixx value"
assert section_props["E"] > 0, "Invalid elastic modulus"

### 3. Unit Consistency

Ensure units match across calculators:

  • Lengths: mm

  • Forces: kN

  • Stresses: N/mm²

  • Moments: kN-m

### 4. Result Interpretation

Always validate against IS codes:

  • Deflection: IS 800 Clause 5.6.1 (span/250)

  • Stress: Compare against yield strength

  • Safety factors: Apply as per IS code requirements

Advanced: Three-Calculator Chain

Extend the workflow to include design:

Section Properties → Beam Analysis → Beam Design
      ↓                    ↓                ↓
Ixx, Zxx, E      Moments, Shear    Steel reinforcement

Example use case: Analyze steel beam, then design concrete beam with equivalent capacity.

Common Pitfalls

  1. Unit mismatch: Always verify units between calculators

  2. Missing properties: Check all required fields are extracted

  3. API errors: Handle non-200 responses gracefully

  4. Null values: Validate extracted data before use

  5. Workflow order: Ensure dependencies are calculated first

See Also