Source code for api.app.calculators.steel.purlin_profiles

"""
Purlin Profile Database

This module contains standardized cold-formed steel purlin profiles (Z and C sections)
as per IS 801:1975 standards.

Profile data structure (all units standardized to mm system):
- name: Profile identifier (e.g., 'Z15010')
- designation: Full designation with mass (e.g., 'Z15010_2.36Kg/m')
- profile_type: Section type ('Z45', 'Z90', 'C')
- depth: Section depth in mm
- flange_width_tp: Top flange width in mm
- flange_width_bt: Bottom flange width in mm
- thickness: Material thickness in mm
- lip_depth: Lip depth in mm
- lip_angle: Lip angle in degrees
- rad: Corner radius in mm
- mass_per_meter: Mass per meter in kg/m
- area: Cross-sectional area in mm²
- Ixx: Major axis moment of inertia in mm⁴
- Zxx_tp: Top fiber section modulus in mm³
- Zxx_bt: Bottom fiber section modulus in mm³
- Rx: Radius of gyration about x-axis in mm
- Iyy: Minor axis moment of inertia in mm⁴
- Zyy: Section modulus about y-axis in mm³
- Ry: Radius of gyration about y-axis in mm
- Yb: Distance to centroid in mm

All units are consistent with IS 801:1975 calculations (mm-based system).
"""

from collections import namedtuple
from typing import Dict, List, Optional, Union

# Z sections with 45° lip angle
Z45_PROFILES = [
    (
        "Z15010",
        "Z15010_2.36Kg/m",
        "Z45",
        152,
        60,
        60,
        1.0,
        16,
        45,
        5,
        2.36,
        296,
        1087300,
        14310,
        14310,
        60.61,
        270600,
        3820,
        30.23,
        76,
    ),
    (
        "Z15012",
        "Z15012_2.86Kg/m",
        "Z45",
        152,
        60,
        60,
        1.2,
        17,
        45,
        5,
        2.86,
        357,
        1307600,
        17210,
        17210,
        60.54,
        334200,
        4680,
        30.61,
        76,
    ),
    (
        "Z15015",
        "Z15015_3.56Kg/m",
        "Z45",
        152,
        60,
        60,
        1.5,
        18,
        45,
        5,
        3.56,
        447,
        1633400,
        21490,
        21490,
        60.42,
        428400,
        5950,
        30.94,
        76,
    ),
    (
        "Z15019",
        "Z15019_4.49Kg/m",
        "Z45",
        152,
        60,
        60,
        1.9,
        19,
        45,
        5,
        4.49,
        568,
        2061900,
        27130,
        27130,
        60.24,
        554300,
        7650,
        31.23,
        76,
    ),
    (
        "Z15024",
        "Z15024_5.64Kg/m",
        "Z45",
        152,
        60,
        60,
        2.4,
        20,
        45,
        5,
        5.64,
        718,
        2588200,
        34060,
        34060,
        60.02,
        712300,
        9760,
        31.49,
        76,
    ),
    (
        "Z20015",
        "Z20015_4.46Kg/m",
        "Z45",
        200,
        70,
        70,
        1.5,
        19.8,
        45,
        5,
        4.46,
        555,
        3432900,
        34330,
        34330,
        78.66,
        661200,
        7940,
        34.52,
        100,
    ),
    (
        "Z20019",
        "Z20019_5.7Kg/m",
        "Z45",
        200,
        70,
        70,
        1.9,
        23,
        45,
        5,
        5.7,
        713,
        4398000,
        43980,
        43980,
        78.57,
        911900,
        10690,
        35.78,
        100,
    ),
    (
        "Z20020",
        "Z20020_6Kg/m",
        "Z45",
        200,
        70,
        70,
        2.0,
        23,
        45,
        5,
        6.0,
        749,
        4619800,
        46200,
        46200,
        78.52,
        957000,
        11220,
        35.74,
        100,
    ),
    (
        "Z20024",
        "Z20024_7.17Kg/m",
        "Z45",
        200,
        70,
        70,
        2.4,
        23.8,
        45,
        5,
        7.17,
        900,
        5523900,
        55240,
        55240,
        78.55,
        1161900,
        13570,
        35.93,
        100,
    ),
    (
        "Z20030",
        "Z20030_9.1Kg/m",
        "Z45",
        200,
        70,
        70,
        3.0,
        24.8,
        45,
        5,
        9.1,
        1125,
        6858900,
        68590,
        68590,
        78.08,
        1469100,
        17080,
        36.14,
        100,
    ),
    (
        "Z24015",
        "Z24015_5.13Kg/m",
        "Z45",
        240,
        70,
        70,
        1.5,
        27.3,
        45,
        5,
        5.13,
        637,
        5496200,
        45800,
        45800,
        92.86,
        825300,
        9320,
        35.98,
        120,
    ),
    (
        "Z24019",
        "Z24019_6.46Kg/m",
        "Z45",
        240,
        70,
        70,
        1.9,
        28,
        45,
        5,
        6.46,
        808,
        6937600,
        57810,
        57810,
        92.69,
        1053800,
        11860,
        36.13,
        120,
    ),
    (
        "Z24024",
        "Z24024_8.13Kg/m",
        "Z45",
        240,
        70,
        70,
        2.4,
        28.8,
        45,
        5,
        8.13,
        1020,
        8721300,
        72680,
        72680,
        92.47,
        1341700,
        15050,
        36.27,
        120,
    ),
    (
        "Z24030",
        "Z24030_10.28Kg/m",
        "Z45",
        240,
        70,
        70,
        3.0,
        29.8,
        45,
        5,
        10.28,
        1275,
        10840500,
        90340,
        90340,
        92.21,
        1695000,
        18920,
        36.46,
        120,
    ),
    (
        "Z30019",
        "Z30019_7.98Kg/m",
        "Z45",
        300,
        95,
        95,
        1.9,
        23,
        45,
        5,
        7.98,
        994,
        13413200,
        89420,
        89420,
        116.18,
        1850300,
        17110,
        43.15,
        150,
    ),
    (
        "Z30024",
        "Z30024_10.04Kg/m",
        "Z45",
        300,
        95,
        95,
        2.4,
        23.8,
        45,
        5,
        10.04,
        1256,
        16899200,
        112660,
        112660,
        115.99,
        2364700,
        21770,
        43.39,
        150,
    ),
    (
        "Z30030",
        "Z30030_12.52Kg/m",
        "Z45",
        300,
        95,
        95,
        3.0,
        24.8,
        45,
        5,
        12.52,
        1570,
        21037400,
        140250,
        140250,
        115.75,
        2983100,
        27370,
        43.59,
        150,
    ),
]

# Z sections with 90° lip angle
Z90_PROFILES = [
    (
        "Z15010",
        "Z15010_2.36Kg/m",
        "Z90",
        152,
        65,
        61,
        1.0,
        13,
        90,
        5,
        2.36,
        291,
        1058600,
        14120,
        13740,
        60.36,
        236600,
        3730,
        28.54,
        77.04,
    ),
    (
        "Z15012",
        "Z15012_2.86Kg/m",
        "Z90",
        152,
        65,
        61,
        1.2,
        16,
        90,
        5,
        2.86,
        355,
        1288800,
        17190,
        16730,
        60.28,
        307700,
        4860,
        29.45,
        77.02,
    ),
    (
        "Z15015",
        "Z15015_3.56Kg/m",
        "Z90",
        152,
        65,
        61,
        1.5,
        17,
        90,
        5,
        3.56,
        444,
        1605400,
        21410,
        20840,
        60.12,
        388700,
        6150,
        29.58,
        77.02,
    ),
    (
        "Z15019",
        "Z15019_4.49Kg/m",
        "Z90",
        152,
        65,
        61,
        1.9,
        18,
        90,
        5,
        4.49,
        563,
        2019200,
        26930,
        26220,
        59.9,
        494200,
        7840,
        29.64,
        77.01,
    ),
    (
        "Z15024",
        "Z15024_5.64Kg/m",
        "Z90",
        152,
        65,
        61,
        2.4,
        20,
        90,
        5,
        5.64,
        715,
        2539000,
        33860,
        33970,
        59.61,
        640200,
        10200,
        29.93,
        77.01,
    ),
    (
        "Z20015",
        "Z20015_4.46Kg/m",
        "Z90",
        203,
        79,
        74,
        1.5,
        16,
        90,
        5,
        4.46,
        558,
        3550300,
        35450,
        34520,
        79.75,
        637600,
        8270,
        33.8,
        102.85,
    ),
    (
        "Z20019",
        "Z20019_5.7Kg/m",
        "Z90",
        203,
        79,
        74,
        1.9,
        20,
        90,
        5,
        5.7,
        719,
        4555000,
        44470,
        44300,
        79.62,
        874800,
        11380,
        34.89,
        102.83,
    ),
    (
        "Z20024",
        "Z20024_7.17Kg/m",
        "Z90",
        203,
        79,
        74,
        2.4,
        22,
        90,
        5,
        7.17,
        911,
        5740400,
        57300,
        55830,
        79.36,
        1129200,
        14740,
        35.2,
        102.82,
    ),
    (
        "Z25015",
        "Z25015_5.13Kg/m",
        "Z90",
        254,
        79,
        74,
        1.5,
        18,
        90,
        5,
        5.13,
        641,
        6075300,
        48400,
        47290,
        97.38,
        671400,
        8700,
        32.37,
        128.48,
    ),
    (
        "Z25019",
        "Z25019_6.46Kg/m",
        "Z90",
        254,
        79,
        74,
        1.9,
        19,
        90,
        5,
        6.46,
        812,
        7667900,
        61090,
        59680,
        97.2,
        853800,
        11090,
        32.43,
        128.48,
    ),
    (
        "Z25024",
        "Z25024_8.13Kg/m",
        "Z90",
        254,
        79,
        74,
        2.4,
        21,
        90,
        5,
        8.13,
        1029,
        9682300,
        77130,
        75370,
        97,
        1103000,
        14380,
        32.74,
        128.47,
    ),
    (
        "Z30019",
        "Z30019_7.98Kg/m",
        "Z90",
        300,
        100,
        93,
        1.9,
        27,
        90,
        5,
        7.98,
        1005,
        13577700,
        91720,
        89340,
        116.21,
        1873100,
        19210,
        43.16,
        151.97,
    ),
    (
        "Z30024",
        "Z30024_10.04Kg/m",
        "Z90",
        300,
        100,
        93,
        2.4,
        28,
        90,
        5,
        10.04,
        1269,
        17061600,
        115260,
        112270,
        115.95,
        2361400,
        24290,
        43.14,
        151.97,
    ),
    (
        "Z30030",
        "Z30030_12.52Kg/m",
        "Z90",
        300,
        100,
        93,
        3.0,
        30,
        90,
        5,
        12.52,
        1589,
        21262400,
        143630,
        139920,
        115.66,
        2986500,
        30810,
        43.35,
        151.96,
    ),
]

# C sections
C_PROFILES = [
    (
        "C10010",
        "C10010_1.75Kg/m",
        "C",
        102,
        51,
        51,
        1.0,
        12.5,
        90,
        5,
        1.75,
        216,
        363800,
        7130,
        7130,
        41.08,
        75500,
        2190,
        18.71,
        51,
    ),
    (
        "C10012",
        "C10012_2.09Kg/m",
        "C",
        102,
        51,
        51,
        1.2,
        12.5,
        90,
        5,
        2.09,
        258,
        432500,
        8480,
        8480,
        40.98,
        89200,
        2590,
        18.61,
        51,
    ),
    (
        "C10015",
        "C10015_2.59Kg/m",
        "C",
        102,
        51,
        51,
        1.5,
        13.5,
        90,
        5,
        2.59,
        322,
        537400,
        10540,
        10540,
        40.81,
        112400,
        3290,
        18.67,
        51,
    ),
    (
        "C10019",
        "C10019_3.27Kg/m",
        "C",
        102,
        51,
        51,
        1.9,
        14.5,
        90,
        5,
        3.27,
        409,
        673200,
        13200,
        13200,
        40.58,
        142400,
        4210,
        18.66,
        51,
    ),
    (
        "C10024",
        "C10024_4.11Kg/m",
        "C",
        102,
        51,
        51,
        2.4,
        16.0,
        90,
        5,
        4.11,
        518,
        839800,
        16470,
        16470,
        40.27,
        180500,
        5460,
        18.69,
        51,
    ),
    (
        "C15010",
        "C15010_2.36Kg/m",
        "C",
        152,
        64,
        64,
        1.0,
        14.0,
        90,
        5,
        2.36,
        295,
        1078100,
        14190,
        14190,
        60.5,
        156600,
        3460,
        23.06,
        76,
    ),
    (
        "C15012",
        "C15012_2.86Kg/m",
        "C",
        152,
        64,
        64,
        1.2,
        14.5,
        90,
        5,
        2.86,
        353,
        1289600,
        16970,
        16970,
        60.4,
        188100,
        4170,
        23.07,
        76,
    ),
    (
        "C15015",
        "C15015_3.56Kg/m",
        "C",
        152,
        64,
        64,
        1.5,
        15.5,
        90,
        5,
        3.56,
        443,
        1606800,
        21140,
        21140,
        60.25,
        236800,
        5290,
        23.13,
        76,
    ),
    (
        "C15019",
        "C15019_4.49Kg/m",
        "C",
        152,
        64,
        64,
        1.9,
        16.5,
        90,
        5,
        4.49,
        561,
        2021500,
        26600,
        26600,
        60.04,
        300300,
        6750,
        23.14,
        76,
    ),
    (
        "C15024",
        "C15024_5.64Kg/m",
        "C",
        152,
        64,
        64,
        2.4,
        18.5,
        90,
        5,
        5.64,
        712,
        2543400,
        33470,
        33470,
        59.76,
        386100,
        8790,
        23.28,
        76,
    ),
    (
        "C20015",
        "C20015_4.46Kg/m",
        "C",
        200,
        76,
        76,
        1.5,
        16.9,
        90,
        5,
        4.46,
        555,
        3434700,
        34350,
        34350,
        78.68,
        406900,
        7430,
        27.08,
        100,
    ),
    (
        "C20019",
        "C20019_5.7Kg/m",
        "C",
        200,
        76,
        76,
        1.9,
        20.4,
        90,
        5,
        5.7,
        712,
        4391900,
        43920,
        43920,
        78.51,
        543000,
        10110,
        27.61,
        100,
    ),
    (
        "C20024",
        "C20024_7.17Kg/m",
        "C",
        200,
        76,
        76,
        2.4,
        21.6,
        90,
        5,
        7.17,
        900,
        5510300,
        55100,
        55100,
        78.25,
        685300,
        12840,
        27.6,
        100,
    ),
    (
        "C20030",
        "C20030_9.1Kg/m",
        "C",
        200,
        76,
        76,
        3.0,
        23.1,
        90,
        5,
        9.1,
        1125,
        6833000,
        68330,
        68330,
        77.93,
        856500,
        16170,
        27.59,
        100,
    ),
    (
        "C24015",
        "C24015_5.13Kg/m",
        "C",
        240,
        76,
        76,
        1.5,
        24.4,
        90,
        5,
        5.13,
        637,
        5482600,
        45690,
        45690,
        92.74,
        497800,
        9090,
        27.94,
        120,
    ),
    (
        "C24019",
        "C24019_6.46Kg/m",
        "C",
        240,
        76,
        76,
        1.9,
        25.4,
        90,
        5,
        6.46,
        807,
        6914100,
        57620,
        57620,
        92.53,
        630000,
        11560,
        27.93,
        120,
    ),
    (
        "C24024",
        "C24024_8.13Kg/m",
        "C",
        240,
        76,
        76,
        2.4,
        26.6,
        90,
        5,
        8.13,
        1020,
        8682300,
        72350,
        72350,
        92.27,
        794100,
        14660,
        27.9,
        120,
    ),
    (
        "C24030",
        "C24030_10.28Kg/m",
        "C",
        240,
        76,
        76,
        3.0,
        28.1,
        90,
        5,
        10.28,
        1275,
        10778100,
        89820,
        89820,
        91.94,
        990800,
        18420,
        27.88,
        120,
    ),
    (
        "C25015",
        "C25015_5.13Kg/m",
        "C",
        252,
        76,
        76,
        1.5,
        16.5,
        90,
        5,
        5.13,
        632,
        5887500,
        46730,
        46730,
        96.74,
        431900,
        7530,
        26.15,
        126,
    ),
    (
        "C25019",
        "C25019_6.46Kg/m",
        "C",
        252,
        76,
        76,
        1.9,
        18.1,
        90,
        5,
        6.46,
        802,
        7458300,
        59190,
        59190,
        96.4,
        555300,
        9760,
        26.31,
        126,
    ),
    (
        "C25024",
        "C25024_8.13Kg/m",
        "C",
        252,
        76,
        76,
        2.4,
        19.1,
        90,
        5,
        8.13,
        1018,
        9419100,
        74760,
        74760,
        96.21,
        713900,
        12660,
        26.49,
        126,
    ),
    (
        "C25030",
        "C25030_10.28Kg/m",
        "C",
        252,
        76,
        76,
        3.0,
        22.5,
        90,
        5,
        10.28,
        1278,
        11765600,
        93380,
        93380,
        95.97,
        909500,
        16320,
        26.68,
        126,
    ),
    (
        "C30019",
        "C30019_7.98Kg/m",
        "C",
        300,
        96,
        96,
        1.9,
        24.1,
        90,
        5,
        7.98,
        992,
        13368700,
        89130,
        89130,
        116.06,
        1157600,
        16380,
        34.15,
        150,
    ),
    (
        "C30024",
        "C30024_10.04Kg/m",
        "C",
        300,
        96,
        96,
        2.4,
        26.1,
        90,
        5,
        10.04,
        1258,
        16875600,
        112500,
        112500,
        115.84,
        1480600,
        21110,
        34.31,
        150,
    ),
    (
        "C30030",
        "C30030_12.52Kg/m",
        "C",
        300,
        96,
        96,
        3.0,
        28.5,
        90,
        5,
        12.52,
        1578,
        21071200,
        140470,
        140470,
        115.57,
        1876500,
        27000,
        34.49,
        150,
    ),
]

# For easy access, we can create named tuples to make the data more readable

# Update the Profile namedtuple to include 'rad' and 'Yb'
Profile = namedtuple(
    "Profile",
    [
        "name",
        "designation",
        "profile_type",
        "depth",
        "flange_width_tp",
        "flange_width_bt",
        "thickness",
        "lip_depth",
        "lip_angle",
        "rad",
        "mass_per_meter",
        "area",
        "Ixx",
        "Zxx_tp",
        "Zxx_bt",
        "Rx",
        "Iyy",
        "Zyy",
        "Ry",
        "Yb",
    ],
)

# Convert lists to named tuples for easier access
Z45_PROFILES = [Profile(*p) for p in Z45_PROFILES]
Z90_PROFILES = [Profile(*p) for p in Z90_PROFILES]
C_PROFILES = [Profile(*p) for p in C_PROFILES]

# Combined dictionary of all profiles for easy access
ALL_PROFILES: Dict[str, List[Profile]] = {"Z45": Z45_PROFILES, "Z90": Z90_PROFILES, "C": C_PROFILES}  # type: ignore[dict-item]


[docs] def get_profile_properties( section_name: str, profile_type: str ) -> Optional[Dict[str, Union[str, float]]]: """Get section properties for a given profile name and type.""" # Select appropriate profile list profiles: List[Profile] if profile_type == "Z45": profiles = Z45_PROFILES # type: ignore[assignment] elif profile_type == "Z90": profiles = Z90_PROFILES # type: ignore[assignment] elif profile_type == "C": profiles = C_PROFILES # type: ignore[assignment] else: return None # Find matching profile profile = next((p for p in profiles if p.name == section_name), None) if not profile: return None # Convert tuple to dictionary with named properties return { "name": str(profile.name), "designation": str(profile.designation), "profile_type": str(profile.profile_type), "depth": float(profile.depth), "flange_width_tp": float(profile.flange_width_tp), "flange_width_bt": float(profile.flange_width_bt), "thickness": float(profile.thickness), "lip_depth": float(profile.lip_depth), "lip_angle": float(profile.lip_angle), "Rad": float(profile.rad), "mass": float(profile.mass_per_meter), "area": float(profile.area), "Ixx": float(profile.Ixx), "Zxx_tp": float(profile.Zxx_tp), "Zxx_bt": float(profile.Zxx_bt), "Rx": float(profile.Rx), "Iyy": float(profile.Iyy), "Zyy": float(profile.Zyy), "Ry": float(profile.Ry), "Yb": float(profile.Yb), }