Files
MCM/A题/数值分析检验/Prompt/2.md
2026-02-16 21:52:26 +08:00

1.7 KiB

TASK: Write a deterministic, language-agnostic specification for TTE computation.

INPUT DATA:

  • MODEL_SPEC.events and MODEL_SPEC.tte_definition from Prompt 1
  • A simulated time grid t_k = t0 + k*dt, k=0..K
  • Arrays sampled at each grid point: V_term[k], z[k], Δ[k]

METHODOLOGY:

  1. Define event signals: gV[k] = V_term[k] - V_cut gz[k] = z[k] - 0 gΔ[k] = Δ[k] - 0
  2. Crossing rule: A crossing occurs for event e when g_e[k-1] > 0 and g_e[k] ≤ 0.
  3. Interpolated crossing time for event e: t_e* = t[k-1] + (0 - g_e[k-1])(t[k]-t[k-1])/(g_e[k]-g_e[k-1]) (If denominator = 0, set t_e = t[k].)
  4. Multi-event tie-breaking: If multiple events cross in the same step, compute each t_e* and choose the smallest. If equal within 1e-9, prioritize in this order: DELTA_ZERO > V_CUTOFF > SOC_ZERO
  5. Output:
    • TTE_seconds = t* - t0
    • termination_reason
    • termination_step_index k
    • termination_values at t* using linear interpolation for (V_term, z, Δ)

DELIVERABLES: A) “TTE_SPEC” section: the above as precise pseudocode with no ambiguity. B) A minimal test suite (exact numeric arrays) containing 3 tests: Test 1: voltage cutoff triggers Test 2: SOC hits zero first Test 3: Δ hits zero first (power infeasible) For each test, provide expected outputs exactly (TTE_seconds, reason, t*).

VALIDATION:

  • Must detect the correct earliest event (by construction of tests).
  • Must reproduce expected t* to within absolute error ≤ 1e-9 in the tests.
  • Must never take sqrt of negative Δ during event evaluation (use sampled Δ).

OUTPUT FORMAT (strict):

  1. Header line: "TTE_SPEC_v1"
  2. Pseudocode block
  3. "TESTS_v1" as JSON with {tests:[...]} including expected outputs No additional text.