添加test_mql pneumatic_96局部参考RHS候选

This commit is contained in:
huojiarong committed 2026-07-29 08:38:37 +00:00
1 parent 71da73ef70
commit a8a68f6dd4
5 files changed
+162 -2

No files matched your search

@@ -658,6 +658,10 @@ class TestMqlPneumatic96InletLineDiagnostic:
python_reference_amesim_storage_pressure_derivative_temperature_component_pa_s: float
python_reference_amesim_storage_pressure_derivative_eos_sum_pa_s: float
python_reference_amesim_storage_pressure_derivative_eos_error_pa_s: float
python_active_temperature_derivative_k_s: float
python_active_temperature_derivative_error_k_s: float
python_active_pressure_derivative_eos_sum_pa_s: float
python_active_pressure_derivative_eos_error_pa_s: float
python_chamber_pressure_error_pa: float
python_chamber_temperature_error_k: float
@@ -755,6 +759,7 @@ class TestMqlFullStateComparisonExecutionConfig:
resistance_boundary_pressure_pa: float = 15.29e6
inlet_node_temperature_k: float = 293.15
resistance_boundary_temperature_k: float = 293.15
use_pneumatic_96_reference_rhs: bool = False
@dataclass(frozen=True)
@@ -795,6 +800,9 @@ def run_test_mql_full_state_comparison(
resistance_boundary_temperature_k=(
config.execution.resistance_boundary_temperature_k
),
use_pneumatic_96_reference_rhs=(
config.execution.use_pneumatic_96_reference_rhs
),
config=config.execution.solver,
t_eval=list(config.execution.t_eval) if config.execution.t_eval is not None else None,
data_paths=selected_paths,
@@ -809,6 +817,9 @@ def run_test_mql_full_state_comparison(
resistance_boundary_temperature_k=(
config.execution.resistance_boundary_temperature_k
),
use_pneumatic_96_reference_rhs=(
config.execution.use_pneumatic_96_reference_rhs
),
)
series_by_data_path = {
data_path: result.series[data_path]
@@ -885,6 +896,9 @@ def run_test_mql_pnvo_event_boundary_diagnostic(
"resistance_boundary_temperature_k": (
config.execution.resistance_boundary_temperature_k
),
"use_pneumatic_96_reference_rhs": (
config.execution.use_pneumatic_96_reference_rhs
),
}
solution = system.simulate_full_state_from_spec(
spec,
@@ -2846,6 +2860,12 @@ def _pneumatic_96_inlet_line_diagnostic(
+ python_reference_amesim_storage_mass_offset_dtemp
+ python_heat_dtemp
)
use_reference_rhs = bool(
getattr(closure.pneumatic_closure, "use_inlet_line_reference_rhs", False)
)
python_active_dtemp = (
python_reference_dtemp if use_reference_rhs else python_current_dtemp
)
(
python_reference_amesim_storage_pressure_mass_component,
python_reference_amesim_storage_pressure_temperature_component,
@@ -3029,6 +3049,19 @@ def _pneumatic_96_inlet_line_diagnostic(
python_reference_amesim_storage_pressure_derivative_eos_error_pa_s=(
python_reference_amesim_storage_pressure_eos_sum - amesim_line_pressure_fd
),
python_active_temperature_derivative_k_s=python_active_dtemp,
python_active_temperature_derivative_error_k_s=(
python_active_dtemp - amesim_line_temperature_fd
),
python_active_pressure_derivative_eos_sum_pa_s=(
python_reference_pressure_eos_sum
if use_reference_rhs
else python_pressure_eos_sum
),
python_active_pressure_derivative_eos_error_pa_s=(
(python_reference_pressure_eos_sum if use_reference_rhs else python_pressure_eos_sum)
- amesim_line_pressure_fd
),
python_chamber_pressure_error_pa=(
snapshot.chamber.p - amesim_chamber_pressure
),
@@ -3228,6 +3261,9 @@ def run_test_mql_pnvo_event_window_diagnostic(
"resistance_boundary_temperature_k": (
config.execution.resistance_boundary_temperature_k
),
"use_pneumatic_96_reference_rhs": (
config.execution.use_pneumatic_96_reference_rhs
),
}
closure = system.full_state_closure_from_spec(spec, **closure_kwargs)
state_vector = closure.initial_state_vector()
@@ -3750,6 +3786,10 @@ def format_test_mql_pnvo_event_window_summary(
f"python_ref_amesim_storage_dP_T={inlet_line.python_reference_amesim_storage_pressure_derivative_temperature_component_pa_s}, "
f"python_ref_amesim_storage_dP_sum={inlet_line.python_reference_amesim_storage_pressure_derivative_eos_sum_pa_s}, "
f"python_ref_amesim_storage_dP_error={inlet_line.python_reference_amesim_storage_pressure_derivative_eos_error_pa_s}, "
f"python_active_dT={inlet_line.python_active_temperature_derivative_k_s}, "
f"python_active_dT_error={inlet_line.python_active_temperature_derivative_error_k_s}, "
f"python_active_dP_sum={inlet_line.python_active_pressure_derivative_eos_sum_pa_s}, "
f"python_active_dP_error={inlet_line.python_active_pressure_derivative_eos_error_pa_s}, "
f"python_chamber_p_error={inlet_line.python_chamber_pressure_error_pa}, "
f"python_chamber_t_error={inlet_line.python_chamber_temperature_error_k}"
)
@@ -4216,13 +4256,21 @@ def main() -> None:
type=Path,
help="read AMESim observations from a separate .ame results package",
)
parser.add_argument(
"--pneumatic-96-reference-rhs",
action="store_true",
help="enable the local reference/mass-offset RHS candidate for pneumatic_96",
)
args = parser.parse_args()
config = None
if args.amesim_results_archive is not None:
if args.amesim_results_archive is not None or args.pneumatic_96_reference_rhs:
config = TestMqlFullStateComparisonScriptConfig(
paths=TestMqlFullStateComparisonPathConfig(
amesim_results_archive_path=args.amesim_results_archive,
)
),
execution=TestMqlFullStateComparisonExecutionConfig(
use_pneumatic_96_reference_rhs=args.pneumatic_96_reference_rhs,
),
)
if args.pnvo_event_boundary:
diagnostic = run_test_mql_pnvo_event_boundary_diagnostic(config)