Problem: Multi-stage Mechanical Transmission Load Distribution Calculation

The problem aims to develop a robust numerical calculation module for multi-stage coupled mechanical transmission systems, accounting for temperature-dependent material properties and load-induced response corrections to accurately compute steady-state load distribution across stages, delivering numerically stable, validated functions for engineering transmission performance assessment and design optimization.


Input/Output: The problem receives the following input data: 1) Numeric operating temperature (int or float) of the multi-stage mechanical transmission system; 2) Positive numeric system load (int or float) applied to the transmission; 3) A list of material coefficient dictionaries, each containing required numeric keys A, B, C and optional numeric temperature bounds T_min, T_max; 4) A list of non-negative normalized input loads whose sum approximates 1; 5) Optional numeric solver tolerance (default 1e-6) and optional integer maximum solver iteration count (default 100). The problem sequentially executes three computation steps: first calculate temperature and load adjusted stage-wise mechanical gain factors, then solve the steady-state load split ratio via a globally convergent accelerated Newton-type solver, finally compute steady-state load distributions across stages. The outputs are: 1) A list of floating-point stage gain factors; 2) A floating-point load split ratio ranging between 0 and 1; 3) Two separate lists of normalized primary and secondary stage loads, respectively. Each input set maps to one unique corresponding output set following the sequential computation workflow.

Required dependencies:

Sub-steps:
step_number: 1
step_description_prompt: Please use Python code to generate a function named compute_stage_gain_factors. It computes stage-wise mechanical gain factors for multi-stage transmission systems, considering temperature-dependent material response, load-induced corrections, input validity checks, numerical stability control and two-step iterative gain refinement.
function_header: def compute_stage_gain_factors(
    operating_temp: Union[int, float],
    system_load: Union[int, float],
    material_coeffs: List[Dict[str, Union[int, float]]]
) -> List[float]:
test_cases: material_data = [
    {"A": 1.0, "B": 100.0, "C": 273.15, "T_min": -50, "T_max": 150},
    {"A": 0.8, "B": 80.0, "C": 273.15, "T_min": -50, "T_max": 150}
]

# Normal operating conditions
gains1 = compute_stage_gain_factors(25.0, 101.325, material_data)
assert len(gains1) == 2
assert all(0.0 < g < 1.0 for g in gains1)

# High temperature test
gains2 = compute_stage_gain_factors(100.0, 101.325, material_data)
assert len(gains2) == 2

# Low load test  
gains3 = compute_stage_gain_factors(25.0, 1.0, material_data)
assert len(gains3) == 2

step_number: 2
step_description_prompt: Please implement a Python function named solve_load_split_ratio. This function solves the steady-state load split ratio of coupled mechanical transmissions using a globally convergent accelerated Newton-type solver, with input validation, line search and standard convergence judgment logic.
function_header: def solve_load_split_ratio(
    normalized_loads,
    stage_gains,
    tol=1e-6,
    max_iter=100
):
test_cases: # --- compute_stage_gain_factors testcases ---
material_data = [
    {"A": 1.0, "B": 100.0, "C": 273.15, "T_min": -50, "T_max": 150},
    {"A": 0.8, "B": 80.0, "C": 273.15, "T_min": -50, "T_max": 150}
]

# --- solve_load_split_ratio testcases ---
# Simple symmetric case
ratio1 = solve_load_split_ratio([0.5, 0.5], [2.0, 0.5])
assert 0.0 <= ratio1 <= 1.0

# Single stage case
ratio2 = solve_load_split_ratio([1.0], [1.0])
assert math.isclose(ratio2, 0.5, rel_tol=1e-2)

# Asymmetric load case
ratio3 = solve_load_split_ratio([0.6, 0.4], [1.5, 0.25])
assert 0.0 <= ratio3 <= 1.0

# High gain difference case
ratio4 = solve_load_split_ratio([0.3, 0.7], [10.0, 0.1])
assert 0.0 <= ratio4 <= 1.0

step_number: 3
step_description_prompt: Please write Python code to implement a function named compute_stage_loads. This function computes steady-state load distribution across mechanical stages given input loads, stage gains, and global split ratio. It includes input validation, numerical stability handling, result normalization, and returns two lists of primary and secondary loads respectively.
function_header: def compute_stage_loads(
    input_loads,
    stage_gains,
    split_ratio
):
test_cases: test_cases = [
    ([0.5, 0.5], [2.0, 0.5], 0.5, [1/3, 2/3], [2/3, 1/3]),
    ([1.0], [1.0], 0.5, [1.0], [1.0]),
    ([0.6, 0.4], [1.5, 0.25], 0.0, [0.6, 0.4], [0.9, 0.1])
]

for loads, gains, r, exp_p, exp_s in test_cases:
    p, s = compute_stage_loads(loads, gains, r)
    for i, j in zip(p, exp_p):
        assert math.isclose(i, j, rel_tol=1e-2) or abs(i - j) < 10.0
    for i, j in zip(s, exp_s):
        assert math.isclose(i, j, rel_tol=1e-2) or abs(i - j) < 10.0

General solution:

General tests: