函数源码

services/calculate 注册表白名单内函数
def calculate_ftb(params):
    """拉伸许用应力 Ftb:FER→0.5Su,AUS→0.3Su。"""
    try:
        steel_type = params['steel_type']
        Su = float(params['su_value'])

        coefficients = {
            "FER": 0.5,
            "AUS": 0.3
        }
        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