Files
Entropyk/crates/cli/tests/embeddings_reject_control_z.rs
sepehr 5425685a48
Some checks failed
CI / check (push) Has been cancelled
Add model embeddings for Z-factor DoF, separate from SaturatedController.
Fixed/Free Probe calibration now emits embeddings[] (unknown + equation) instead of controls[], keeping SaturatedController for physical regulation only.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-19 22:42:31 +02:00

41 lines
1.2 KiB
Rust

//! Z-factors must use embeddings[], not controls[]/SaturatedController.
use entropyk_cli::run::{run_simulation, SimulationStatus};
use tempfile::tempdir;
#[test]
fn controls_with_z_ua_are_rejected() {
// Minimal config — reject happens before component graph build.
let json = r#"
{
"fluid": "R134a",
"fluid_backend": "Test",
"circuits": [],
"controls": [
{
"type": "SaturatedController",
"id": "bad_calib",
"measure": { "component": "sst", "output": "saturationTemperature" },
"actuator": { "component": "evap", "factor": "z_ua", "initial": 1, "min": 0.05, "max": 3 },
"target": 278.15
}
],
"solver": { "strategy": "newton", "max_iterations": 10, "tolerance": 1e-6 }
}
"#;
let dir = tempdir().unwrap();
let path = dir.path().join("bad.json");
std::fs::write(&path, json).unwrap();
let result = run_simulation(&path, None, false).unwrap();
assert!(
matches!(result.status, SimulationStatus::Error),
"expected Error, got {:?}",
result.status
);
let err = result.error.unwrap_or_default();
assert!(
err.contains("embeddings") && err.contains("z_ua"),
"error should point to embeddings[], got: {err}"
);
}