MoonMech

    Download zip
    Version
    0.1.0
    License
    Apache-2.0
    Last updated
    10 months ago
    Downloads
    45

    No dependencies

    #MoonMech - Mechanical Engineering Calculation Library

    MoonMech is a comprehensive mechanical engineering calculation library written in Moonbit, providing functions for mechanical design, power transmission, and machine elements calculations.


    #Features

    #Power Transmission

    • Gears: Spur gears, helical gears, bevel gears, and planetary gear trains
    • Belts: Belt drives, belt ratios, contact angles, and belt length calculations
    • Chains: Chain drives, chain velocities, and chain tension calculations
    • Worm Gears: Worm gear ratios and lead angle calculations


    #Machine Elements

    • Shafts: Shaft diameter calculations, torsional strength, and equivalent bending moments
    • Bearings: Bearing life calculations, equivalent dynamic loads, and bearing preload
    • Springs: Spring stiffness, deflection, index ratios, and curvature coefficients
    • Flywheels: Flywheel moment of inertia and mass calculations


    #Connections and Fasteners

    • Keys: Key crushing and shear stress calculations
    • Threads: Thread pitch diameters, lead angles, and self-locking conditions
    • Connections: Pin connections, riveted connections, and fastener calculations


    #Mechanisms

    • Four-Bar Linkages: Transmission angles and crank existence conditions
    • Mechanisms: Linkage analysis and mechanism design calculations


    #Usage

    #Gear Calculations

    test "gear" {
    // Spur gear: m=3mm, z=20
    // d = 3*20 = 60mm
    let d = gear_pitch_diameter(3.0, 20)
    assert_eq(d, 60.0)

    // Addendum diameter: d_a = 3*(20+2*1) = 66mm
    let da = gear_addendum_diameter(3.0, 20, HA_STAR_STD)
    assert_eq(da, 66.0)

    // Center distance: a = 3*(20+40)/2 = 90mm
    let a = gear_center_distance(3.0, 20, 40)
    assert_eq(a, 90.0)

    // Gear ratio: i = 40/20 = 2
    let i = gear_ratio(20, 40)
    assert_eq(i, 2.0)

    // Tangential force: T=1000N·mm, d=60mm
    // F_t = 2*1000/60 = 33.33N
    let ft = gear_tangential_force(1000.0, 60.0)
    assert_eq(approx_equal(ft, 33.33, 0.1), true)
    }


    #Belt Drives

    test "belt" {
    // Belt drive: d1=100mm, d2=200mm, a=500mm
    // Gear ratio: i = 200/100 = 2
    let i = belt_ratio(100.0, 200.0)
    assert_eq(i, 2.0)

    // Contact angle: α ≈ 180° - 2*arcsin((200-100)/(2*500)) = 168.5°
    let alpha = belt_contact_angle(100.0, 200.0, 500.0)
    assert_eq(alpha > 160.0 && alpha < 180.0, true)

    // Belt length: L ≈ 1471mm
    let l = belt_length(100.0, 200.0, 500.0)
    assert_eq(approx_equal(l, 1471.0, 10.0), true)

    // Effective tension: P=5kW, v=10m/s
    // F_e = 1000*5/10 = 500N
    let fe = belt_effective_tension(5.0, 10.0)
    assert_eq(fe, 500.0)
    }


    #Shaft Design

    test "shaft" {
    // Minimum shaft diameter for torsion: T=10000N·mm, [τ]=30MPa
    let d = shaft_min_diameter_torsion(10000.0, 30.0)
    // d should be between 10-15mm (reasonable range)
    assert_eq(d > 0.0 && d < 0.02, true)

    // Equivalent bending moment: M=5000N·mm, T=10000N·mm, α=0.6
    // M_e = √(5000² + (0.6*10000)²) = 7810N·mm
    let me = shaft_equivalent_moment(5000.0, 10000.0, 0.6)
    assert_eq(approx_equal(me, 7810.0, 10.0), true)
    }


    #Bearing Calculations

    test "bearing" {
    // Equivalent dynamic load: X=1, F_r=1000N, Y=0, F_a=0
    // P = 1*1000 + 0*0 = 1000N
    let p = bearing_equivalent_dynamic_load(1.0, 1000.0, 0.0, 0.0)
    assert_eq(p, 1000.0)

    // Bearing life: C=10000N, P=5000N, p=3
    // L_10 = (10000/5000)³ * 10^6 = 8*10^6 revolutions
    let l10 = bearing_life(10000.0, 5000.0, 3.0)
    assert_eq(approx_equal(l10, 8000000.0, 100000.0), true)

    // Life in hours: L_10=8e6 revolutions, n=1500rpm
    // L_h = 8e6/(60*1500) = 88.9 hours
    let lh = bearing_life_hours(8000000.0, 1500.0)
    assert_eq(approx_equal(lh, 88.9, 1.0), true)
    }


    #Spring Design

    test "spring" {
    // Spring stiffness: G=79GPa, d=4mm, D=32mm, n=10
    let k = spring_stiffness(79.0, 4.0 * MM_TO_M, 32.0 * MM_TO_M, 10)
    assert_eq(k > 5000.0 && k < 10000.0, true)

    // Spring deflection: F=100N, k=7710N/m
    // δ = 100/7710 = 0.013m
    let delta = spring_deflection(100.0, k)
    assert_eq(delta > 0.0, true)

    // Spring index: D=32mm, d=4mm
    // C = 32/4 = 8
    let c = spring_index(32.0, 4.0)
    assert_eq(c, 8.0)

    // Curvature coefficient: C=8
    // K = (4*8-1)/(4*8-4) + 0.615/8 = 1.184
    let k_coeff = spring_curvature_coefficient(8.0)
    assert_eq(approx_equal(k_coeff, 1.184, 0.01), true)
    }


    #Chain Drives

    test "chain" {
    // Chain drive: z1=17, z2=34
    // Gear ratio: i = 34/17 = 2
    let i = chain_ratio(17, 34)
    assert_eq(i, 2.0)

    // Chain velocity: z=17, p=19.05mm, n=1000rpm
    // v = 17*19.05*1000/60000 = 5.4m/s
    let v = chain_velocity(17, 19.05, 1000.0)
    assert_eq(approx_equal(v, 5.4, 0.1), true)

    // Effective tension: P=10kW, v=5.4m/s
    // F = 1000*10/5.4 = 1852N
    let f = chain_effective_tension(10.0, 5.4)
    assert_eq(approx_equal(f, 1852.0, 10.0), true)
    }


    #Flywheel Design

    test "flywheel" {
    // Flywheel moment of inertia: W_max=1000J, ω=100rad/s, δ=0.05
    // J = W_max/(ω²*δ) = 1000/(100²*0.05) = 0.2 kg·m²
    let j = flywheel_moment_of_inertia(1000.0, 100.0, 0.05)
    assert_eq(j > 0.0, true)

    // Flywheel mass: J=0.2kg·m², r=0.2m
    // For solid disk: m = 2*J/r² = 2*0.2/0.04 = 10kg
    let m = flywheel_mass(0.2, 0.2)
    assert_eq(m > 8.0 && m < 12.0, true)
    }


    #Parameter Ranges

    #Valid Input Ranges

    • Gear Modules: 0.5–20 mm (gear module sizes)
    • Teeth Numbers: 10–200 (number of teeth)
    • Forces: 0–10⁶ N (mechanical forces)
    • Torques: 0–10⁵ N·m (torques and moments)
    • Speeds: 0–10⁴ rpm (rotational speeds)
    • Powers: 0–10⁴ kW (mechanical power)
    • Dimensions: 10⁻³–10² m (lengths and diameters)


    #Typical Engineering Values

    • Gear Modules: 1–8 mm (common gear sizes)
    • Shaft Diameters: 10–200 mm (typical shaft sizes)
    • Bearing Loads: 100–10⁵ N (bearing capacities)
    • Spring Rates: 1–10⁴ N/m (spring stiffness)
    • Power Transmission: 0.1–1000 kW (mechanical power)


    #Testing

    The project includes a comprehensive test suite covering all major functionalities:

    moon test

    #Test Coverage

    • Gear calculations (spur, helical, bevel, planetary gears)
    • Belt and chain drives
    • Shaft design and stress analysis
    • Bearing life and load calculations
    • Spring design and analysis
    • Mechanism analysis (four-bar linkages)
    • Flywheel design calculations
    • Connection elements (keys, threads, pins)
    • Power transmission efficiency
    • Mechanical utility functions


    #Technical Details

    #Engineering Standards

    • AGMA Standards: American Gear Manufacturers Association
    • ANSI Standards: American National Standards Institute
    • ISO Standards: International Organization for Standardization
    • Mechanical Engineering Textbooks: Standard mechanical design references


    #Mathematical Methods

    • Geometric Calculations: Trigonometric relationships for gear geometry
    • Stress Analysis: Von Mises equivalent stress, fatigue calculations
    • Dynamic Analysis: Rotational dynamics, vibration analysis
    • Empirical Formulas: Industry-standard correlation equations


    #Applications

    • Machine Design: Gearboxes, transmissions, and power trains
    • Mechanical Systems: Shafts, bearings, and rotating machinery
    • Power Transmission: Belts, chains, and gear drives
    • Automotive Engineering: Drivetrain components and vehicle systems
    • Industrial Machinery: Manufacturing equipment and industrial systems
    • Robotics: Robotic mechanisms and automation systems
    • Aerospace: Aircraft components and aerospace systems
    • Marine Engineering: Ship propulsion and marine systems


    #Notes

    1. Units: All calculations use SI units (meters, kilograms, seconds, Newtons)
    2. Safety Factors: Engineering calculations include appropriate safety margins
    3. Material Properties: Functions use standard material properties unless specified
    4. Boundary Conditions: Physical limits enforced to prevent unrealistic results
    5. Standards Compliance: Functions follow mechanical engineering standards
    6. Validation: Results should be verified against established mechanical design methods


    #Version Information

    The current version (0.1.0) implements core mechanical engineering calculation functions including:

    • Gear design and analysis (spur, helical, bevel, planetary)
    • Power transmission (belts, chains, worm gears)
    • Machine elements (shafts, bearings, springs, flywheels)
    • Connection design (keys, threads, pins, rivets)
    • Mechanism analysis (four-bar linkages)
    • Mechanical utilities (power, torque, velocity calculations)
    • Fatigue and life calculations
    • Stress and deflection analysis

    The library is actively developed and aims to provide comprehensive coverage of mechanical engineering calculations while being optimized for MoonBit.

    ALPHA_CAM_MAX

    let ALPHA_CAM_MAX : Double

    凸轮压力角限制 (度)

    C_SPRING_MAX

    let C_SPRING_MAX : Double

    C_SPRING_MIN

    let C_SPRING_MIN : Double

    弹簧旋绕比推荐范围

    C_STAR_STD

    let C_STAR_STD : Double

    顶隙系数 (标准)

    D2_COEFF

    let D2_COEFF : Double

    螺纹中径系数

    DEG_TO_RAD

    let DEG_TO_RAD : Double

    度转弧度

    DELTA_FLYWHEEL

    let DELTA_FLYWHEEL : Double

    飞轮不均匀系数

    EPSILON

    let EPSILON : Double

    浮点数比较精度

    E_ALUMINUM

    let E_ALUMINUM : Double

    铝合金弹性模量 (GPa)

    E_CAST_IRON

    let E_CAST_IRON : Double

    铸铁弹性模量 (GPa)

    E_COPPER

    let E_COPPER : Double

    铜弹性模量 (GPa)

    E_STEEL

    let E_STEEL : Double

    钢材弹性模量 (GPa)

    FP_LOAD

    let FP_LOAD : Double

    载荷系数 (平稳载荷)

    FT_TEMP

    let FT_TEMP : Double

    温度系数 (一般工作温度)

    GAMMA_MIN_LINKAGE

    let GAMMA_MIN_LINKAGE : Double

    四杆机构最小传动角 (度)

    GPA_TO_PA

    let GPA_TO_PA : Double

    GPa 转 Pa

    G_SPRING

    let G_SPRING : Double

    弹簧材料剪切模量 (GPa) - 弹簧钢

    G_STEEL

    let G_STEEL : Double

    钢材剪切模量 (GPa)

    HA_STAR_STD

    let HA_STAR_STD : Double

    齿顶高系数 (标准)

    KW_TO_W

    let KW_TO_W : Double

    kW 转 W

    K_ALPHA_V_BELT

    let K_ALPHA_V_BELT : Double

    V带包角修正系数 (简化)

    K_SPRING

    let K_SPRING : Double

    弹簧曲度系数 (简化)

    L10_BASE

    let L10_BASE : Double

    轴承基本额定寿命 (百万转)

    LAMBDA_CRANK

    let LAMBDA_CRANK : Double

    曲柄存在条件系数

    L_D_V_BELT_1000

    let L_D_V_BELT_1000 : Double

    V带基准长度系列 (mm) - 常用值

    L_D_V_BELT_1600

    let L_D_V_BELT_1600 : Double

    L_D_V_BELT_2500

    let L_D_V_BELT_2500 : Double

    MM_TO_M

    let MM_TO_M : Double

    mm 转 m

    MODULE_STD_1

    let MODULE_STD_1 : Double

    标准模数系列 (mm) - 常用值

    MODULE_STD_2

    let MODULE_STD_2 : Double

    MODULE_STD_3

    let MODULE_STD_3 : Double

    MODULE_STD_4

    let MODULE_STD_4 : Double

    MODULE_STD_5

    let MODULE_STD_5 : Double

    MPA_TO_PA

    let MPA_TO_PA : Double

    MPa 转 Pa

    MU_NUT

    let MU_NUT : Double

    螺母摩擦系数

    MU_THREAD

    let MU_THREAD : Double

    螺纹摩擦系数 (钢-钢)

    M_TO_MM

    let M_TO_MM : Double

    m 转 mm

    NMM_TO_NM

    let NMM_TO_NM : Double

    N·mm 转 N·m

    NM_TO_NMM

    let NM_TO_NMM : Double

    N·m 转 N·mm

    NU_STEEL

    let NU_STEEL : Double

    钢材泊松比

    N_AXIS

    let N_AXIS : Double

    轴安全系数
    let PI : Double

    圆周率

    POLYGON_EFFECT

    let POLYGON_EFFECT : Double

    链传动多边形效应系数

    PRESSURE_ANGLE_STD

    let PRESSURE_ANGLE_STD : Double

    标准压力角 (度) - 20°

    P_BALL_BEARING

    let P_BALL_BEARING : Double

    深沟球轴承寿命指数

    P_CHAIN_12_7

    let P_CHAIN_12_7 : Double

    滚子链节距系列 (mm) - 常用值

    P_CHAIN_15_875

    let P_CHAIN_15_875 : Double

    P_CHAIN_19_05

    let P_CHAIN_19_05 : Double

    P_CHAIN_25_4

    let P_CHAIN_25_4 : Double

    P_ROLLER_BEARING

    let P_ROLLER_BEARING : Double

    滚子轴承寿命指数

    RAD_S_TO_RPM

    let RAD_S_TO_RPM : Double

    rad/s 转 rpm

    RAD_TO_DEG

    let RAD_TO_DEG : Double

    弧度转度

    RHO_FLYWHEEL

    let RHO_FLYWHEEL : Double

    飞轮材料密度 (kg/m³) - 铸铁

    RHO_STEEL

    let RHO_STEEL : Double

    钢材密度 (kg/m³)

    RPM_TO_RAD_S

    let RPM_TO_RAD_S : Double

    rpm 转 rad/s

    R_BASE_CAM_MIN

    let R_BASE_CAM_MIN : Double

    凸轮基圆半径推荐值 (mm)

    SIGMA_B_AXIS

    let SIGMA_B_AXIS : Double

    轴材料许用弯曲应力 (MPa) - 碳钢

    SIGMA_P_KEY_DYNAMIC

    let SIGMA_P_KEY_DYNAMIC : Double

    键连接许用挤压应力 (MPa) - 动连接

    SIGMA_P_KEY_STATIC

    let SIGMA_P_KEY_STATIC : Double

    键连接许用挤压应力 (MPa) - 静连接

    SLIP_RATIO

    let SLIP_RATIO : Double

    带传动滑动率

    TAU_P_KEY

    let TAU_P_KEY : Double

    键连接许用剪切应力 (MPa)

    TAU_T_AXIS

    let TAU_T_AXIS : Double

    轴材料许用扭转应力 (MPa) - 碳钢

    THREAD_ANGLE

    let THREAD_ANGLE : Double

    标准螺纹牙型角 (度)

    W_TO_KW

    let W_TO_KW : Double

    W 转 kW

    Z_MIN_STD

    let Z_MIN_STD : Int

    最小齿数 (避免根切)

    abs

    fn abs(x : Double) -> Double

    计算绝对值

    acos

    fn acos(x : Double) -> Double

    反余弦函数 (返回弧度)

    amplitude_amplification_factor

    fn amplitude_amplification_factor(r : Double, zeta : Double) -> Double

    单自由度系统振幅放大因子 β = 1 / √((1-r²)² + (2ζr)²) 参数: r - 频率比 (ω/ω_n), zeta - 阻尼比

    angular_contact_ball_bearing_equivalent_load

    fn angular_contact_ball_bearing_equivalent_load(fr : Double, fa : Double, e : Double, y : Double) -> Double

    角接触球轴承当量动载荷 P = F_r (当 F_a/F_r ≤ e) P = 0.44F_r + YF_a (当 F_a/F_r > e)

    angular_velocity

    fn angular_velocity(n : Double) -> Double

    角速度 (从转速) ω = 2π * n / 60 参数: n - 转速 (rpm)

    approx_equal

    fn approx_equal(a : Double, b : Double, tolerance : Double) -> Bool

    判断两个浮点数是否近似相等

    asin

    fn asin(x : Double) -> Double

    反正弦函数 (返回弧度)

    atan2

    fn atan2(y : Double, x : Double) -> Double

    反正切函数 (返回弧度)

    band_brake_torque

    fn band_brake_torque(f1 : Double, f2 : Double, r : Double) -> Double

    带式制动器制动力矩 M = (F_1 - F_2) * R

    basic_deviation_hole_h

    fn basic_deviation_hole_h(it : Double) -> Double

    基本偏差 (孔, H) ES = IT (上偏差)

    basic_deviation_shaft_h

    fn basic_deviation_shaft_h() -> Double

    基本偏差 (轴, h) es = 0 (上偏差)

    bearing_adjusted_life

    fn bearing_adjusted_life(l10 : Double, a1 : Double, a2 : Double, a3 : Double) -> Double

    轴承润滑脂寿命修正 L = L_10 * a_1 * a_2 * a_3 参数: l10 - 基本寿命, a1 - 可靠性系数, a2 - 材料系数, a3 - 工作条件系数

    bearing_equivalent_dynamic_load

    fn bearing_equivalent_dynamic_load(x : Double, fr : Double, y : Double, fa : Double) -> Double

    轴承当量动载荷 P = XF_r + YF_a 参数: x - 径向系数, fr - 径向载荷, y - 轴向系数, fa - 轴向载荷

    bearing_life

    fn bearing_life(c : Double, p : Double, p_exp : Double) -> Double

    轴承寿命计算 L_10 = (C/P)^p * 10^6 参数: c - 基本额定动载荷, p - 当量动载荷, p_exp - 寿命指数

    bearing_life_hours

    fn bearing_life_hours(l10 : Double, n : Double) -> Double

    轴承寿命 (小时) L_h = L_10 / (60*n) 参数: l10 - 寿命 (转), n - 转速 (rpm)

    bearing_preload

    fn bearing_preload(fa : Double) -> Double

    轴承预紧力 (角接触球轴承) F_0 = 0.5 * F_a

    bearing_required_c

    fn bearing_required_c(p : Double, lh : Double, n : Double, p_exp : Double) -> Double

    轴承所需基本额定动载荷 C ≥ P * (L_h * 60 * n / 10^6)^(1/p)

    belt_contact_angle

    fn belt_contact_angle(d1 : Double, d2 : Double, a : Double) -> Double

    带传动包角 α = 180° - 2arcsin((d2-d1)/(2a)) 参数: d1, d2 - 带轮直径 (mm), a - 中心距 (mm)

    belt_effective_tension

    fn belt_effective_tension(p : Double, v : Double) -> Double

    带传动有效拉力 F_e = 1000*P / v 参数: p - 功率 (kW), v - 带速 (m/s)

    belt_length

    fn belt_length(d1 : Double, d2 : Double, a : Double) -> Double

    带传动带长 L ≈ 2a + π(d1+d2)/2 + (d2-d1)²/(4*a)

    belt_ratio

    fn belt_ratio(d1 : Double, d2 : Double) -> Double

    带传动传动比 i = n1 / n2 = d2 / d1

    belt_slack_side_tension

    fn belt_slack_side_tension(f1 : Double, fe : Double) -> Double

    带传动松边拉力 F_2 = F_1 - F_e

    belt_tight_side_tension

    fn belt_tight_side_tension(fe : Double, mu : Double, alpha_deg : Double) -> Double

    带传动紧边拉力 F_1 = F_e * e^(μα) / (e^(μα) - 1) 参数: fe - 有效拉力, mu - 摩擦系数, alpha_deg - 包角

    bending_stress

    fn bending_stress(moment : Double, y : Double, inertia : Double) -> Double

    弯曲应力 σ = M * y / I

    bevel_gear_equivalent_teeth

    fn bevel_gear_equivalent_teeth(z : Int, delta_deg : Double) -> Double

    锥齿轮当量齿数 z_v = z / cos(δ)

    bevel_gear_pitch_angle

    fn bevel_gear_pitch_angle(z1 : Int, z2 : Int) -> Double

    锥齿轮分度圆锥角 δ = arctan(z1/z2) (小齿轮)

    bisection

    fn bisection(f : (Double) -> Double, a : Double, b : Double, tolerance : Double) -> Double

    二分法求根

    block_brake_torque

    fn block_brake_torque(mu : Double, f : Double, r : Double) -> Double

    块式制动器制动力矩 M = μ * F * R 参数: mu - 摩擦系数, f - 制动力, r - 制动轮半径

    cam_constant_acceleration_displacement

    fn cam_constant_acceleration_displacement(h : Double, phi : Double, phi0 : Double) -> Double

    等加速等减速运动规律位移 s = 2h(φ/φ_0)² (前半段) s = h - 2h(1-φ/φ_0)² (后半段)

    cam_constant_velocity_displacement

    fn cam_constant_velocity_displacement(h : Double, phi : Double, phi0 : Double) -> Double

    等速运动规律位移 s = h * φ / φ_0 参数: h - 升程, phi - 转角, phi0 - 总转角

    cam_cycloidal_displacement

    fn cam_cycloidal_displacement(h : Double, phi : Double, phi0 : Double) -> Double

    摆线运动规律位移 s = h * (φ/φ_0 - sin(2π*φ/φ_0)/(2π))

    cam_follower_acceleration

    fn cam_follower_acceleration(d2s_dphi2 : Double, omega : Double) -> Double

    凸轮从动件加速度 a = d²s/dφ² * ω²

    cam_follower_velocity

    fn cam_follower_velocity(ds_dphi : Double, omega : Double) -> Double

    凸轮从动件速度 v = ds/dφ * dφ/dt = ds/dφ * ω

    cam_harmonic_displacement

    fn cam_harmonic_displacement(h : Double, phi : Double, phi0 : Double) -> Double

    简谐运动规律位移 s = h * (1 - cos(π*φ/φ_0)) / 2

    cam_pressure_angle

    fn cam_pressure_angle(ds_dphi : Double, e : Double, s : Double, rb : Double) -> Double

    凸轮压力角 α = arctan((ds/dφ - e) / (s + r_b)) 参数: ds_dphi - 位移对转角导数, e - 偏距, s - 位移, rb - 基圆半径

    cam_theoretical_radius

    fn cam_theoretical_radius(s : Double, rb : Double, e : Double) -> Double

    凸轮理论廓线半径 ρ = √((s + r_b)² + e²)

    cbrt

    fn cbrt(x : Double) -> Double

    立方根函数

    centripetal_acceleration

    fn centripetal_acceleration(r : Double, omega : Double) -> Double

    向心加速度 a = r * ω²

    chain_center_distance

    fn chain_center_distance(p : Double, factor : Double) -> Double

    链传动中心距 a = (30~50) * p (推荐) 参数: p - 节距 (mm)

    chain_effective_tension

    fn chain_effective_tension(p : Double, v : Double) -> Double

    链传动有效拉力 F = 1000*P / v

    chain_length

    fn chain_length(a : Double, p : Double, z1 : Int, z2 : Int) -> Double

    链节数 L_p ≈ 2a/p + (z1+z2)/2 + (z2-z1)²/(4π²*a/p)

    chain_ratio

    fn chain_ratio(z1 : Int, z2 : Int) -> Double

    链传动传动比 i = z2 / z1 = n1 / n2

    chain_velocity

    fn chain_velocity(z : Int, p : Double, n : Double) -> Double

    链速 v = z * p * n / (60*1000) 参数: z - 齿数, p - 节距 (mm), n - 转速 (rpm)

    circle_area

    fn circle_area(r : Double) -> Double

    圆形面积

    circle_inertia

    fn circle_inertia(d : Double) -> Double

    圆形截面惯性矩 I = π * d⁴ / 64

    circle_perimeter

    fn circle_perimeter(r : Double) -> Double

    圆形周长

    circle_polar_inertia

    fn circle_polar_inertia(d : Double) -> Double

    圆形截面极惯性矩 J = π * d⁴ / 32

    circle_section_modulus

    fn circle_section_modulus(d : Double) -> Double

    圆形截面抗弯模量 W = π * d³ / 32

    clamp

    fn clamp(value : Double, min_val : Double, max_val : Double) -> Double

    限制值在范围内

    cos

    fn cos(x : Double) -> Double

    余弦函数

    crank_existence_condition

    fn crank_existence_condition(a : Double, b : Double, c : Double, d : Double) -> Bool

    曲柄存在条件 a + d < b + c (最短杆 + 最长杆 < 其余两杆之和)

    cube

    fn cube(x : Double) -> Double

    计算立方

    damping_ratio_sdof

    fn damping_ratio_sdof(c : Double, k : Double, m : Double) -> Double

    单自由度系统阻尼比 ζ = c / (2*√(k*m)) 参数: c - 阻尼系数, k - 刚度, m - 质量

    deep_groove_ball_bearing_equivalent_load

    fn deep_groove_ball_bearing_equivalent_load(fr : Double, fa : Double, e : Double, y : Double) -> Double

    深沟球轴承当量动载荷 (简化) P = F_r (当 F_a/F_r ≤ e) P = 0.56F_r + YF_a (当 F_a/F_r > e)

    deg_to_rad

    fn deg_to_rad(deg : Double) -> Double

    角度转弧度

    disc_brake_torque

    fn disc_brake_torque(mu : Double, f : Double, rm : Double, n : Int) -> Double

    盘式制动器制动力矩 M = μ * F * R_m * n 参数: mu - 摩擦系数, f - 压紧力, rm - 平均半径, n - 摩擦面数

    disc_spring_load

    fn disc_spring_load(e : Double, t : Double, nu : Double, d : Double, h : Double, f : Double) -> Double

    碟形弹簧载荷 F = (4Et⁴ / ((1-ν²)D²)) * f * ((h-tf) * (h-t*f/2) + t²) 简化公式

    efficiency

    fn efficiency(p_out : Double, p_in : Double) -> Double

    计算效率 η = P_out / P_in

    extension_spring_initial_tension

    fn extension_spring_initial_tension(d : Double, d_mean : Double, tau0 : Double, k : Double) -> Double

    拉伸弹簧初拉力 F_0 = πd³τ_0 / (8DK) 参数: d - 簧丝直径, d_mean - 中径, tau0 - 初应力, k - 曲度系数

    extension_spring_stiffness

    fn extension_spring_stiffness(g : Double, d : Double, d_mean : Double, n : Int) -> Double

    拉伸弹簧刚度 k = G * d⁴ / (8 * D³ * n)

    failure_rate

    fn failure_rate(mtbf : Double) -> Double

    失效率 (指数分布) λ = 1 / MTBF 参数: mtbf - 平均故障间隔时间

    fit_clearance

    fn fit_clearance(es : Double, ei : Double) -> Double

    配合间隙 X = D_max - d_min = ES - ei 参数: es - 孔上偏差, ei - 轴下偏差

    fit_interference

    fn fit_interference(es : Double, ei : Double) -> Double

    配合过盈 Y = d_max - D_min = es - EI 参数: es - 轴上偏差, ei - 孔下偏差

    fit_type

    fn fit_type(clearance : Double, interference : Double) -> String

    配合类型判断 返回: "clearance", "interference", "transition"

    flexible_coupling_torque

    fn flexible_coupling_torque(k : Double, theta_rad : Double) -> Double

    弹性联轴器传递转矩 T = k * θ 参数: k - 扭转刚度, theta_rad - 扭转角

    flywheel_diameter

    fn flywheel_diameter(j : Double, m : Double) -> Double

    飞轮直径 (实心圆盘) D = 2 * (2J / (mπ))^(1/4)

    flywheel_mass

    fn flywheel_mass(j : Double, r : Double) -> Double

    飞轮质量 (实心圆盘) m = J / (r² / 2) 参数: j - 转动惯量, r - 半径

    flywheel_moment_of_inertia

    fn flywheel_moment_of_inertia(w_max : Double, omega : Double, delta : Double) -> Double

    飞轮转动惯量 J = W_max / (ω² * δ) 参数: w_max - 最大盈亏功, omega - 角速度, delta - 不均匀系数

    forced_convection_heat_transfer_coefficient

    fn forced_convection_heat_transfer_coefficient(nu : Double, k : Double, l : Double) -> Double

    强制对流传热系数 h = Nu * k / L 参数: nu - 努塞尔数, k - 热导率, l - 特征长度

    four_bar_transmission_angle

    fn four_bar_transmission_angle(a : Double, b : Double, c : Double, d : Double) -> Double

    四杆机构传动角 γ = arccos((b² + c² - a² - d²) / (2bc)) 参数: a, b, c, d - 四杆长度

    friction_clutch_required_force

    fn friction_clutch_required_force(t : Double, mu : Double, rm : Double, n : Int) -> Double

    摩擦离合器所需压紧力 F = T / (μ * R_m * n)

    friction_clutch_torque

    fn friction_clutch_torque(mu : Double, f : Double, rm : Double, n : Int) -> Double

    摩擦离合器传递转矩 T = μ * F * R_m * n 参数: mu - 摩擦系数, f - 压紧力, rm - 平均半径, n - 摩擦面数

    gear_addendum_diameter

    fn gear_addendum_diameter(m : Double, z : Int, ha_star : Double) -> Double

    齿轮齿顶圆直径 d_a = m * (z + 2h_a) 参数: m - 模数, z - 齿数, ha_star - 齿顶高系数

    gear_bending_stress

    fn gear_bending_stress(k : Double, ft : Double, b : Double, m : Double, y : Double) -> Double

    齿轮弯曲应力 (简化) σ_F = K * F_t / (b * m * Y) 参数: k - 系数, ft - 圆周力, b - 齿宽, m - 模数, y - 齿形系数

    gear_center_distance

    fn gear_center_distance(m : Double, z1 : Int, z2 : Int) -> Double

    齿轮中心距 a = (d1 + d2) / 2 = m * (z1 + z2) / 2

    gear_center_distance_modified

    fn gear_center_distance_modified(a : Double, alpha_deg : Double, alpha_prime_deg : Double) -> Double

    变位齿轮中心距 a' = a * cos(α) / cos(α') 参数: a - 标准中心距, alpha_deg - 标准压力角, alpha_prime_deg - 实际压力角

    gear_contact_stress

    fn gear_contact_stress(k : Double, ft : Double, b : Double, d : Double) -> Double

    齿轮接触应力 (简化) σ_H = K * √(F_t / (b * d)) 参数: k - 系数, ft - 圆周力, b - 齿宽, d - 分度圆直径

    gear_dedendum_diameter

    fn gear_dedendum_diameter(m : Double, z : Int, ha_star : Double, c_star : Double) -> Double

    齿轮齿根圆直径 d_f = m * (z - 2h_a - 2c) 参数: m - 模数, z - 齿数, ha_star - 齿顶高系数, c_star - 顶隙系数

    gear_normal_force

    fn gear_normal_force(ft : Double, alpha_deg : Double) -> Double

    齿轮法向力 F_n = F_t / cos(α)

    gear_pitch_diameter

    fn gear_pitch_diameter(m : Double, z : Int) -> Double

    齿轮分度圆直径 d = m * z 参数: m - 模数 (mm), z - 齿数

    gear_radial_force

    fn gear_radial_force(ft : Double, alpha_deg : Double) -> Double

    齿轮径向力 F_r = F_t * tan(α) 参数: ft - 圆周力 (N), alpha_deg - 压力角 (度)

    gear_ratio

    fn gear_ratio(z1 : Int, z2 : Int) -> Double

    齿轮传动比 i = z2 / z1 = n1 / n2

    gear_tangential_force

    fn gear_tangential_force(t : Double, d : Double) -> Double

    齿轮圆周力 F_t = 2*T / d 参数: t - 转矩 (N·mm), d - 分度圆直径 (mm)

    gear_total_modification_coefficient

    fn gear_total_modification_coefficient(z1 : Int, z2 : Int, alpha_deg : Double, alpha_prime_deg : Double) -> Double

    齿轮变位系数和 x_Σ = (z1+z2) * (inv(α') - inv(α)) / (2*tan(α)) 简化计算

    geneva_drive_motion_coefficient

    fn geneva_drive_motion_coefficient(z : Int) -> Double

    槽轮机构运动系数 k = (z-2) / (2*(z-1)) 参数: z - 槽数

    geneva_drive_stationary_time

    fn geneva_drive_stationary_time(k : Double, t : Double) -> Double

    槽轮机构静止时间 t_s = (1-k) * T 参数: k - 运动系数, t - 周期

    helical_gear_axial_force

    fn helical_gear_axial_force(ft : Double, beta_deg : Double) -> Double

    斜齿轮轴向力 F_a = F_t * tan(β) 参数: ft - 圆周力, beta_deg - 螺旋角

    helical_gear_normal_module

    fn helical_gear_normal_module(mt : Double, beta_deg : Double) -> Double

    斜齿轮法向模数 m_n = m_t * cos(β) 参数: mt - 端面模数, beta_deg - 螺旋角

    helical_gear_transverse_module

    fn helical_gear_transverse_module(mn : Double, beta_deg : Double) -> Double

    斜齿轮端面模数 m_t = m_n / cos(β)

    interference_fit_contact_pressure

    fn interference_fit_contact_pressure(delta : Double, d : Double, e1 : Double, e2 : Double, c1 : Double, c2 : Double) -> Double

    过盈配合接触压力 p = δ / (d * (1/E1 + 1/E2) * (C1 + C2)) 参数: delta - 过盈量, d - 配合直径, e1, e2 - 弹性模量, c1, c2 - 系数

    interference_fit_torque

    fn interference_fit_torque(d : Double, l : Double, p : Double, mu : Double) -> Double

    过盈配合传递转矩 T = π * d² * l * p * μ / 2 参数: d - 配合直径, l - 配合长度, p - 接触压力, mu - 摩擦系数

    journal_bearing_film_thickness

    fn journal_bearing_film_thickness(c : Double, epsilon : Double) -> Double

    滑动轴承油膜厚度 h_min = c * (1 - ε) 参数: c - 半径间隙, epsilon - 偏心率

    journal_bearing_friction_power

    fn journal_bearing_friction_power(mu : Double, omega : Double, r : Double, l : Double, c : Double) -> Double

    滑动轴承摩擦功率损失 P_f = μ * ω² * R² * L / c

    journal_bearing_load_capacity

    fn journal_bearing_load_capacity(mu : Double, omega : Double, r : Double, l : Double, c : Double, epsilon : Double) -> Double

    滑动轴承承载能力 (简化) W = 6μωRL / (c²) * f(ε) 参数: mu - 动力粘度, omega - 角速度, r - 半径, l - 长度, c - 半径间隙, epsilon - 偏心率

    journal_bearing_temperature_rise

    fn journal_bearing_temperature_rise(pf : Double, cp : Double, rho : Double, q : Double) -> Double

    滑动轴承温升 ΔT = P_f / (c_p * ρ * Q) 参数: pf - 摩擦功率, cp - 比热容, rho - 密度, q - 流量

    key_crushing_stress

    fn key_crushing_stress(t : Double, d : Double, k : Double, l : Double) -> Double

    键连接挤压应力 σ_p = 2*T / (d * k * l) 参数: t - 转矩, d - 轴径, k - 键高, l - 键长

    key_shear_stress

    fn key_shear_stress(t : Double, d : Double, b : Double, l : Double) -> Double

    键连接剪切应力 τ = 2*T / (d * b * l) 参数: t - 转矩, d - 轴径, b - 键宽, l - 键长

    key_strength_check

    fn key_strength_check(sigma_p : Double, tau : Double, sigma_p_allow : Double, tau_allow : Double) -> Bool

    键连接强度验算

    linear_velocity

    fn linear_velocity(r : Double, omega : Double) -> Double

    线速度 v = r * ω

    material_fatigue_limit

    fn material_fatigue_limit(sigma_b : Double) -> Double

    材料疲劳极限 (简化) σ_{-1} ≈ 0.4 * σ_b (钢) 参数: sigma_b - 抗拉强度

    material_safety_factor

    fn material_safety_factor(sigma_s : Double, sigma : Double) -> Double

    材料强度安全系数 n = σ_s / σ 参数: sigma_s - 屈服强度, sigma - 工作应力

    material_strength_from_hardness

    fn material_strength_from_hardness(hb : Double) -> Double

    材料硬度与强度关系 (简化) σ_b ≈ 3.5 * HB (钢) 参数: hb - 布氏硬度

    max

    fn max(a : Double, b : Double) -> Double

    计算最大值

    mechanical_seal_face_pressure

    fn mechanical_seal_face_pressure(f : Double, a : Double, p0 : Double) -> Double

    机械密封端面比压 p = F / A + p_0 参数: f - 弹簧力, a - 端面面积, p0 - 介质压力

    min

    fn min(a : Double, b : Double) -> Double

    计算最小值

    multi_rib_belt_effective_tension

    fn multi_rib_belt_effective_tension(p : Double, v : Double) -> Double

    多楔带有效拉力 F_e = 1000*P / v

    natural_convection_heat_transfer_coefficient

    fn natural_convection_heat_transfer_coefficient() -> Double

    自然对流传热系数 (简化) h ≈ 5~25 W/(m²·K) (一般值)

    natural_frequency_sdof

    fn natural_frequency_sdof(k : Double, m : Double) -> Double

    单自由度系统固有频率 ω_n = √(k / m) 参数: k - 刚度, m - 质量

    newton_method

    fn newton_method(f : (Double) -> Double, df : (Double) -> Double, x0 : Double, tolerance : Double) -> Double

    牛顿法求根 f: 函数, df: 导数, x0: 初始值

    normal_stress

    fn normal_stress(force : Double, area : Double) -> Double

    正应力 σ = F / A

    o_ring_compression

    fn o_ring_compression(d0 : Double, dg : Double) -> Double

    O型圈压缩量 δ = (d_0 - d_g) / d_0 参数: d0 - 原始直径, dg - 沟槽直径

    overrunning_clutch_torque

    fn overrunning_clutch_torque(f : Double, r : Double, alpha_deg : Double) -> Double

    超越离合器传递转矩 T = F * r * tan(α) 参数: f - 法向力, r - 半径, alpha_deg - 楔角

    pin_crushing_stress

    fn pin_crushing_stress(f : Double, d : Double, t : Double) -> Double

    销连接挤压应力 σ_p = F / (d * t) 参数: f - 载荷, d - 销直径, t - 被连接件厚度

    pin_shear_stress

    fn pin_shear_stress(f : Double, d : Double) -> Double

    销连接剪切应力 τ = 4F / (πd²) 参数: f - 载荷, d - 销直径

    planetary_gear_ratio_sun_fixed

    fn planetary_gear_ratio_sun_fixed(z1 : Int, z3 : Int) -> Double

    行星齿轮传动比 i = 1 + z3/z1 (当太阳轮固定时) 参数: z1 - 太阳轮齿数, z3 - 内齿圈齿数

    pow

    fn pow(x : Double, y : Double) -> Double

    幂函数 (简化,仅用于正数)

    pow4

    fn pow4(x : Double) -> Double

    计算四次方

    power_from_torque

    fn power_from_torque(t : Double, omega : Double) -> Double

    计算功率 P = T * ω 参数: t - 转矩 (N·m), omega - 角速度 (rad/s)

    power_loss

    fn power_loss(p_in : Double, p_out : Double) -> Double

    计算损失功率 P_loss = P_in - P_out

    rad_to_deg

    fn rad_to_deg(rad : Double) -> Double

    弧度转角度

    rect_area

    fn rect_area(width : Double, height : Double) -> Double

    矩形面积

    rect_inertia

    fn rect_inertia(b : Double, h : Double) -> Double

    矩形截面惯性矩 I = b * h³ / 12

    rect_section_modulus

    fn rect_section_modulus(b : Double, h : Double) -> Double

    矩形截面抗弯模量 W = b * h² / 6

    reducer_efficiency

    fn reducer_efficiency(efficiencies : Array[Double]) -> Double

    减速器效率 η = η1 * η2 * ... (各级效率乘积)

    reducer_output_torque

    fn reducer_output_torque(t_in : Double, i : Double, eta : Double) -> Double

    减速器输出转矩 T_out = T_in * i * η

    reliability_exponential

    fn reliability_exponential(lambda : Double, t : Double) -> Double

    可靠性 (指数分布) R(t) = e^(-λ*t)

    resonance_frequency_sdof

    fn resonance_frequency_sdof(omega_n : Double, zeta : Double) -> Double

    单自由度系统共振频率 ω_r = ω_n * √(1 - 2*ζ²)

    rigid_coupling_torque

    fn rigid_coupling_torque(f : Double, r : Double) -> Double

    刚性联轴器传递转矩 T = F * r 参数: f - 切向力, r - 半径

    ring_area

    fn ring_area(r_outer : Double, r_inner : Double) -> Double

    圆环面积

    rivet_crushing_stress

    fn rivet_crushing_stress(f : Double, n : Int, d : Double, t : Double) -> Double

    铆接挤压强度 σ_p = F / (n * d * t)

    rivet_shear_stress

    fn rivet_shear_stress(f : Double, n : Int, d : Double) -> Double

    铆接剪切强度 τ = F / (n * π*d²/4) 参数: f - 载荷, n - 铆钉数, d - 铆钉直径

    rpm_from_angular_velocity

    fn rpm_from_angular_velocity(omega : Double) -> Double

    转速 (从角速度) n = ω * 60 / (2π)

    safe_div

    fn safe_div(num : Double, den : Double, fallback : Double) -> Double

    安全除法,分母为零时返回默认值

    shaft_bending_stiffness

    fn shaft_bending_stiffness(e : Double, i : Double, l : Double) -> Double

    轴弯曲刚度 k = 48EI / L³ 参数: e - 弹性模量, i - 惯性矩, l - 长度

    shaft_combined_safety_factor

    fn shaft_combined_safety_factor(n_sigma : Double, n_tau : Double) -> Double

    轴综合安全系数 n = n_σ * n_τ / √(n_σ² + n_τ²)

    shaft_critical_speed

    fn shaft_critical_speed(l : Double, e : Double, i : Double, rho : Double, a : Double) -> Double

    轴临界转速 (简化) n_cr = 30π / L² * √(EI / (ρ*A)) 参数: l - 轴长, e - 弹性模量, i - 惯性矩, rho - 密度, a - 截面积

    shaft_equivalent_moment

    fn shaft_equivalent_moment(m : Double, t : Double, alpha : Double) -> Double

    轴当量弯矩 M_e = √(M² + (α*T)²) 参数: m - 弯矩, t - 转矩, alpha - 折算系数

    shaft_equivalent_stress

    fn shaft_equivalent_stress(me : Double, w : Double) -> Double

    轴当量应力 σ_e = M_e / W 参数: me - 当量弯矩, w - 抗弯模量

    shaft_fatigue_safety_factor

    fn shaft_fatigue_safety_factor(sigma_minus1 : Double, k_sigma : Double, sigma_a : Double, psi_sigma : Double, sigma_m : Double) -> Double

    轴疲劳强度安全系数 n = σ_{-1} / (K_σ * σ_a + ψ_σ * σ_m) 参数: sigma_minus1 - 对称循环疲劳极限, k_sigma - 有效应力集中系数, sigma_a - 应力幅, psi_sigma - 平均应力影响系数, sigma_m - 平均应力

    shaft_first_critical_speed

    fn shaft_first_critical_speed(l : Double, e : Double, i : Double, rho : Double, a : Double) -> Double

    轴一阶临界转速 (简支梁) n_cr1 = (π² / L²) * √(EI / (ρA)) * 60 / (2π)

    shaft_min_diameter_torsion

    fn shaft_min_diameter_torsion(t : Double, tau_allow : Double) -> Double

    轴最小直径估算 (扭转强度) d ≥ (16T/(π[τ]))^(1/3) 参数: t - 转矩 (N·mm), tau_allow - 许用扭转应力 (MPa) 返回: 直径 (m)

    shaft_torsional_angle

    fn shaft_torsional_angle(t : Double, l : Double, g : Double, j : Double) -> Double

    轴扭转角 φ = T * L / (G * J) 参数: t - 转矩, l - 长度, g - 剪切模量, j - 极惯性矩

    shaft_torsional_fatigue_safety_factor

    fn shaft_torsional_fatigue_safety_factor(tau_minus1 : Double, k_tau : Double, tau_a : Double, psi_tau : Double, tau_m : Double) -> Double

    轴扭转疲劳强度 n_τ = τ_{-1} / (K_τ * τ_a + ψ_τ * τ_m)

    shear_stress

    fn shear_stress(force : Double, area : Double) -> Double

    剪应力 τ = F / A

    sin

    fn sin(x : Double) -> Double

    正弦函数

    single_stage_reducer_ratio

    fn single_stage_reducer_ratio(z1 : Int, z2 : Int) -> Double

    单级圆柱齿轮减速器传动比 i = z2 / z1

    slider_crank_acceleration

    fn slider_crank_acceleration(r : Double, omega : Double, theta_deg : Double) -> Double

    滑块机构加速度 a = r * ω² * cos(θ)

    slider_crank_displacement

    fn slider_crank_displacement(r : Double, theta_deg : Double) -> Double

    滑块机构位移 s = r * (1 - cos(θ)) 参数: r - 曲柄长度, theta_deg - 曲柄转角

    slider_crank_velocity

    fn slider_crank_velocity(r : Double, omega : Double, theta_deg : Double) -> Double

    滑块机构速度 v = r * ω * sin(θ)

    spring_curvature_coefficient

    fn spring_curvature_coefficient(c : Double) -> Double

    弹簧曲度系数 K = (4C - 1) / (4C - 4) + 0.615/C

    spring_deflection

    fn spring_deflection(f : Double, k : Double) -> Double

    压缩弹簧变形量 δ = F / k

    spring_index

    fn spring_index(d_mean : Double, d : Double) -> Double

    弹簧旋绕比 C = D / d

    spring_max_stress

    fn spring_max_stress(k : Double, f : Double, d_mean : Double, d : Double) -> Double

    压缩弹簧最大应力 τ_max = K * 8FD / (π*d³) 参数: k - 曲度系数, f - 载荷, d_mean - 中径, d - 簧丝直径

    spring_stiffness

    fn spring_stiffness(g : Double, d : Double, d_mean : Double, n : Int) -> Double

    压缩弹簧刚度 k = G * d⁴ / (8 * D³ * n) 参数: g - 剪切模量, d - 簧丝直径, d_mean - 中径, n - 有效圈数

    square

    fn square(x : Double) -> Double

    计算平方

    system_parallel_reliability

    fn system_parallel_reliability(reliabilities : Array[Double]) -> Double

    系统并联可靠性 R_s = 1 - (1-R1) * (1-R2) * ... * (1-Rn)

    system_series_reliability

    fn system_series_reliability(reliabilities : Array[Double]) -> Double

    系统串联可靠性 R_s = R1 * R2 * ... * Rn

    tan

    fn tan(x : Double) -> Double

    正切函数

    tapered_roller_bearing_equivalent_load

    fn tapered_roller_bearing_equivalent_load(fr : Double, fa : Double, e : Double, y : Double) -> Double

    圆锥滚子轴承当量动载荷 P = F_r (当 F_a/F_r ≤ e) P = 0.4F_r + YF_a (当 F_a/F_r > e)

    thermal_equilibrium_temperature

    fn thermal_equilibrium_temperature(t0 : Double, ploss : Double, h : Double, a : Double) -> Double

    热平衡温度 T = T_0 + P_loss / (h * A) 参数: t0 - 环境温度, ploss - 损失功率, h - 传热系数, a - 散热面积

    thread_lead_angle

    fn thread_lead_angle(p : Double, d2 : Double) -> Double

    螺纹升角 λ = arctan(P / (π*d_2)) 参数: p - 螺距, d2 - 中径

    thread_pitch_diameter

    fn thread_pitch_diameter(d : Double) -> Double

    螺纹中径 d_2 ≈ 0.85 * d 参数: d - 公称直径

    thread_preload

    fn thread_preload(sigma_s : Double, area_s : Double) -> Double

    螺纹预紧力 (简化) F_0 = 0.6 * σ_s * A_s 参数: sigma_s - 屈服强度, area_s - 螺纹应力截面积

    thread_self_locking

    fn thread_self_locking(lambda_deg : Double, phi_deg : Double) -> Bool

    螺纹自锁条件 λ ≤ φ 参数: lambda_deg - 升角, phi_deg - 摩擦角

    timing_belt_center_distance

    fn timing_belt_center_distance(d1 : Double, d2 : Double, factor : Double) -> Double

    同步带中心距 (推荐) a = (0.7~2) * (d1+d2)

    timing_belt_length

    fn timing_belt_length(d1 : Double, d2 : Double, a : Double) -> Double

    同步带带长 L = 2a + π(d1+d2)/2 + (d2-d1)²/(4*a)

    timing_belt_pitch

    fn timing_belt_pitch(d : Double, z : Int) -> Double

    同步带节距 p = π * d / z

    torque_from_power

    fn torque_from_power(p : Double, omega : Double) -> Double

    计算转矩 T = P / ω

    torsion_spring_max_stress

    fn torsion_spring_max_stress(t : Double, d : Double) -> Double

    扭转弹簧最大应力 σ_max = 32T / (πd³)

    torsion_spring_stiffness

    fn torsion_spring_stiffness(e : Double, d : Double, d_mean : Double, n : Int) -> Double

    扭转弹簧刚度 k_t = E * d⁴ / (64 * D * n) 参数: e - 弹性模量, d - 簧丝直径, d_mean - 中径, n - 圈数

    torsional_stress

    fn torsional_stress(torque : Double, r : Double, polar_inertia : Double) -> Double

    扭转剪应力 τ = T * r / J

    two_stage_reducer_ratio

    fn two_stage_reducer_ratio(i1 : Double, i2 : Double) -> Double

    二级圆柱齿轮减速器总传动比 i_total = i1 * i2

    universal_joint_ratio

    fn universal_joint_ratio(beta_deg : Double, phi_deg : Double) -> Double

    万向联轴器传动比 (单万向节) i = cos(β) / (1 - sin²(β)*cos²(φ)) 参数: beta_deg - 轴间夹角, phi_deg - 主动轴转角

    worm_efficiency

    fn worm_efficiency(gamma_deg : Double, phi_v_deg : Double) -> Double

    蜗杆传动效率 (简化) η = tan(γ) / tan(γ + φ_v) 参数: gamma_deg - 导程角, phi_v_deg - 当量摩擦角

    worm_lead_angle

    fn worm_lead_angle(z1 : Int, m : Double, d1 : Double) -> Double

    蜗杆导程角 γ = arctan(z1 * m / d1) 参数: z1 - 头数, m - 模数, d1 - 蜗杆分度圆直径

    worm_ratio

    fn worm_ratio(z1 : Int, z2 : Int) -> Double

    蜗杆传动比 i = z2 / z1 参数: z1 - 蜗杆头数, z2 - 蜗轮齿数