Add diagram workbench UI with Modelica DoF coaching and ISO glyphs.
Ship the Next.js cycle editor with CAD chrome, technical HX symbols, Fixed/Free boundary guidance, and secondary water/air pressure drop support in the solver stack. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -264,12 +264,24 @@ fn test_thermal_couplings_preserved_in_round_trip() {
|
||||
let snapshot: entropyk_solver::SystemSnapshot =
|
||||
serde_json::from_str(&json_str).expect("snapshot parse");
|
||||
assert_eq!(snapshot.topology.thermal_couplings.len(), 1);
|
||||
assert_eq!(snapshot.topology.thermal_couplings[0].hot_circuit, CircuitId(0));
|
||||
assert_eq!(snapshot.topology.thermal_couplings[0].cold_circuit, CircuitId(0));
|
||||
assert_eq!(
|
||||
snapshot.topology.thermal_couplings[0].hot_circuit,
|
||||
CircuitId(0)
|
||||
);
|
||||
assert_eq!(
|
||||
snapshot.topology.thermal_couplings[0].cold_circuit,
|
||||
CircuitId(0)
|
||||
);
|
||||
|
||||
// Verify ua value round-trip
|
||||
let ua_val = snapshot.topology.thermal_couplings[0].ua.to_watts_per_kelvin();
|
||||
assert!((ua_val - 500.0).abs() < 1e-6, "UA value mismatch: {}", ua_val);
|
||||
let ua_val = snapshot.topology.thermal_couplings[0]
|
||||
.ua
|
||||
.to_watts_per_kelvin();
|
||||
assert!(
|
||||
(ua_val - 500.0).abs() < 1e-6,
|
||||
"UA value mismatch: {}",
|
||||
ua_val
|
||||
);
|
||||
}
|
||||
|
||||
// ────────────────────────────────────────────────────────────────────────
|
||||
@@ -324,7 +336,10 @@ fn test_missing_backend_returns_error() {
|
||||
.to_string();
|
||||
|
||||
let result = System::from_json_string(&json_with_unknown_backend);
|
||||
assert!(result.is_err(), "Should fail with BackendUnavailable for unknown backend");
|
||||
assert!(
|
||||
result.is_err(),
|
||||
"Should fail with BackendUnavailable for unknown backend"
|
||||
);
|
||||
}
|
||||
|
||||
// ────────────────────────────────────────────────────────────────────────
|
||||
@@ -392,7 +407,10 @@ fn test_deterministic_serialization() {
|
||||
|
||||
let val1: Value = serde_json::from_str(&json1).expect("parse json1");
|
||||
let val2: Value = serde_json::from_str(&json2).expect("parse json2");
|
||||
assert_eq!(val1, val2, "Same system should produce identical JSON (structurally)");
|
||||
assert_eq!(
|
||||
val1, val2,
|
||||
"Same system should produce identical JSON (structurally)"
|
||||
);
|
||||
}
|
||||
|
||||
// ────────────────────────────────────────────────────────────────────────
|
||||
@@ -405,15 +423,22 @@ fn test_bounded_variables_in_snapshot() {
|
||||
|
||||
let mut system = build_single_compressor_system();
|
||||
|
||||
let valve =
|
||||
BoundedVariable::with_component(BoundedVariableId::new("valve"), "compressor", 0.5, 0.0, 1.0)
|
||||
.expect("create bounded var");
|
||||
let valve = BoundedVariable::with_component(
|
||||
BoundedVariableId::new("valve"),
|
||||
"compressor",
|
||||
0.5,
|
||||
0.0,
|
||||
1.0,
|
||||
)
|
||||
.expect("create bounded var");
|
||||
system.add_bounded_variable(valve).expect("add bounded var");
|
||||
|
||||
let json_str = system.to_json_string().expect("Serialization failed");
|
||||
let parsed: Value = serde_json::from_str(&json_str).expect("JSON parse");
|
||||
|
||||
let bounded = parsed.get("boundedVariables").expect("boundedVariables field");
|
||||
let bounded = parsed
|
||||
.get("boundedVariables")
|
||||
.expect("boundedVariables field");
|
||||
assert!(bounded.is_array());
|
||||
assert_eq!(bounded.as_array().unwrap().len(), 1);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user