chore: remove deprecated flow_boundary and update docs to match new architecture
This commit is contained in:
@@ -16,6 +16,9 @@ pub struct ScenarioConfig {
|
||||
pub name: Option<String>,
|
||||
/// Fluid name (e.g., "R134a", "R410A", "R744").
|
||||
pub fluid: String,
|
||||
/// Fluid backend to use (e.g., "CoolProp", "Test"). Defaults to "Test".
|
||||
#[serde(default)]
|
||||
pub fluid_backend: Option<String>,
|
||||
/// Circuit configurations.
|
||||
#[serde(default)]
|
||||
pub circuits: Vec<CircuitConfig>,
|
||||
@@ -72,11 +75,42 @@ pub struct ComponentConfig {
|
||||
pub component_type: String,
|
||||
/// Component name for referencing in edges.
|
||||
pub name: String,
|
||||
/// Component-specific parameters.
|
||||
|
||||
// --- MchxCondenserCoil Specific Fields ---
|
||||
/// Nominal UA value (kW/K). Maps to ua_nominal_kw_k.
|
||||
#[serde(default)]
|
||||
pub ua_nominal_kw_k: Option<f64>,
|
||||
/// Fan speed ratio (0.0 to 1.0).
|
||||
#[serde(default)]
|
||||
pub fan_speed: Option<f64>,
|
||||
/// Air inlet temperature in Celsius.
|
||||
#[serde(default)]
|
||||
pub air_inlet_temp_c: Option<f64>,
|
||||
/// Air mass flow rate in kg/s.
|
||||
#[serde(default)]
|
||||
pub air_mass_flow_kg_s: Option<f64>,
|
||||
/// Air side heat transfer exponent.
|
||||
#[serde(default)]
|
||||
pub n_air_exponent: Option<f64>,
|
||||
/// Condenser bank spec identifier (used for creating multiple instances).
|
||||
#[serde(default)]
|
||||
pub condenser_bank: Option<CondenserBankConfig>,
|
||||
// -----------------------------------------
|
||||
|
||||
/// Component-specific parameters (catch-all).
|
||||
#[serde(flatten)]
|
||||
pub params: HashMap<String, serde_json::Value>,
|
||||
}
|
||||
|
||||
/// Configuration for a condenser bank (multi-circuit, multi-coil).
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct CondenserBankConfig {
|
||||
/// Number of circuits.
|
||||
pub circuits: usize,
|
||||
/// Number of coils per circuit.
|
||||
pub coils_per_circuit: usize,
|
||||
}
|
||||
|
||||
/// Side conditions for a heat exchanger (hot or cold fluid).
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct SideConditionsConfig {
|
||||
@@ -284,9 +318,17 @@ mod tests {
|
||||
let json = r#"{ "fluid": "R134a" }"#;
|
||||
let config = ScenarioConfig::from_json(json).unwrap();
|
||||
assert_eq!(config.fluid, "R134a");
|
||||
assert_eq!(config.fluid_backend, None);
|
||||
assert!(config.circuits.is_empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_parse_config_with_backend() {
|
||||
let json = r#"{ "fluid": "R134a", "fluid_backend": "CoolProp" }"#;
|
||||
let config = ScenarioConfig::from_json(json).unwrap();
|
||||
assert_eq!(config.fluid_backend.as_deref(), Some("CoolProp"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_parse_full_config() {
|
||||
let json = r#"
|
||||
@@ -342,4 +384,38 @@ mod tests {
|
||||
let result = ScenarioConfig::from_json(json);
|
||||
assert!(result.is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_parse_mchx_condenser_coil() {
|
||||
let json = r#"
|
||||
{
|
||||
"fluid": "R134a",
|
||||
"circuits": [{
|
||||
"id": 0,
|
||||
"components": [{
|
||||
"type": "MchxCondenserCoil",
|
||||
"name": "mchx_coil",
|
||||
"ua_nominal_kw_k": 25.5,
|
||||
"fan_speed": 0.8,
|
||||
"air_inlet_temp_c": 35.0,
|
||||
"condenser_bank": {
|
||||
"circuits": 2,
|
||||
"coils_per_circuit": 3
|
||||
}
|
||||
}],
|
||||
"edges": []
|
||||
}]
|
||||
}"#;
|
||||
let config = ScenarioConfig::from_json(json).unwrap();
|
||||
let comp = &config.circuits[0].components[0];
|
||||
|
||||
assert_eq!(comp.component_type, "MchxCondenserCoil");
|
||||
assert_eq!(comp.ua_nominal_kw_k, Some(25.5));
|
||||
assert_eq!(comp.fan_speed, Some(0.8));
|
||||
assert_eq!(comp.air_inlet_temp_c, Some(35.0));
|
||||
|
||||
let bank = comp.condenser_bank.as_ref().unwrap();
|
||||
assert_eq!(bank.circuits, 2);
|
||||
assert_eq!(bank.coils_per_circuit, 3);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user