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:
@@ -11,7 +11,67 @@ fn test_parse_minimal_config() {
|
||||
let config = ScenarioConfig::from_json(json).unwrap();
|
||||
assert_eq!(config.fluid, "R134a");
|
||||
assert!(config.circuits.is_empty());
|
||||
assert_eq!(config.solver.strategy, "fallback");
|
||||
assert_eq!(config.solver.strategy, "newton");
|
||||
assert!(config.controls.is_empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_parse_saturated_control_loop() {
|
||||
let json = r#"
|
||||
{
|
||||
"fluid": "R134a",
|
||||
"controls": [
|
||||
{
|
||||
"type": "SaturatedController",
|
||||
"id": "lwt_capacity",
|
||||
"measure": { "component": "evap_0", "output": "capacity" },
|
||||
"actuator": {
|
||||
"component": "screw_0", "factor": "f_m",
|
||||
"initial": 1.0, "min": 0.5, "max": 1.5
|
||||
},
|
||||
"target": 350000.0,
|
||||
"gain": 0.01,
|
||||
"band": 1.0,
|
||||
"smooth_eps": 0.001
|
||||
}
|
||||
]
|
||||
}"#;
|
||||
let config = ScenarioConfig::from_json(json).unwrap();
|
||||
assert_eq!(config.controls.len(), 1);
|
||||
let c = &config.controls[0];
|
||||
assert_eq!(c.control_type, "SaturatedController");
|
||||
assert_eq!(c.id, "lwt_capacity");
|
||||
assert_eq!(c.measure.component, "evap_0");
|
||||
assert_eq!(c.measure.output, "capacity");
|
||||
assert_eq!(c.actuator.factor, "f_m");
|
||||
assert_eq!(c.actuator.min, 0.5);
|
||||
assert_eq!(c.actuator.max, 1.5);
|
||||
assert_eq!(c.target, 350000.0);
|
||||
assert_eq!(c.gain, 0.01);
|
||||
assert_eq!(c.smooth_eps, Some(0.001));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_control_defaults_apply() {
|
||||
let json = r#"
|
||||
{
|
||||
"fluid": "R134a",
|
||||
"controls": [
|
||||
{
|
||||
"id": "cap",
|
||||
"measure": { "component": "evap", "output": "capacity" },
|
||||
"actuator": { "component": "comp", "factor": "f_m", "min": 0.5, "max": 1.5 },
|
||||
"target": 1000.0
|
||||
}
|
||||
]
|
||||
}"#;
|
||||
let config = ScenarioConfig::from_json(json).unwrap();
|
||||
let c = &config.controls[0];
|
||||
assert_eq!(c.control_type, "SaturatedController");
|
||||
assert_eq!(c.gain, 1.0);
|
||||
assert_eq!(c.band, 1.0);
|
||||
assert_eq!(c.actuator.initial, 1.0);
|
||||
assert_eq!(c.smooth_eps, None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -110,7 +170,7 @@ fn test_load_config_file_not_found() {
|
||||
#[test]
|
||||
fn test_solver_config_defaults() {
|
||||
let config = SolverConfig::default();
|
||||
assert_eq!(config.strategy, "fallback");
|
||||
assert_eq!(config.strategy, "newton");
|
||||
assert_eq!(config.max_iterations, 100);
|
||||
assert_eq!(config.tolerance, 1e-6);
|
||||
assert_eq!(config.timeout_ms, 0);
|
||||
|
||||
Reference in New Issue
Block a user