函数源码

services/calculate 注册表白名单内函数
def calculate_fvb(params):
    """剪切许用应力 Fvb:FER→5/24 Su,AUS→1/8 Su。"""
    try:
        steel_type = params['steel_type']
        Su = float(params['su_value'])

        coefficients = {
            "FER": 5 / 24,
            "AUS": 1 / 8,
        }
        coefficient = coefficients.get(steel_type)
        if coefficient is None:
            return None  # Handle invalid steel type
        return coefficient * Su
    except KeyError as e:
        print(f"Error: Missing parameter '{e}' in input dictionary.")
        return None