Update project structure and configurations
This commit is contained in:
@@ -238,6 +238,30 @@ impl Fan<Disconnected> {
|
||||
}
|
||||
|
||||
impl Fan<Connected> {
|
||||
/// Creates a new connected fan from pre-connected ports.
|
||||
pub(crate) fn from_connected_parts(
|
||||
curves: FanCurves,
|
||||
port_inlet: Port<Connected>,
|
||||
port_outlet: Port<Connected>,
|
||||
air_density: f64,
|
||||
) -> Result<Self, ComponentError> {
|
||||
if air_density <= 0.0 {
|
||||
return Err(ComponentError::InvalidState(
|
||||
"Air density must be positive".to_string(),
|
||||
));
|
||||
}
|
||||
Ok(Self {
|
||||
curves,
|
||||
port_inlet,
|
||||
port_outlet,
|
||||
air_density_kg_per_m3: air_density,
|
||||
speed_ratio: 1.0,
|
||||
circuit_id: CircuitId::default(),
|
||||
operational_state: OperationalState::default(),
|
||||
_state: PhantomData,
|
||||
})
|
||||
}
|
||||
|
||||
/// Returns the inlet port.
|
||||
pub fn port_inlet(&self) -> &Port<Connected> {
|
||||
&self.port_inlet
|
||||
@@ -528,6 +552,17 @@ impl Component for Fan<Connected> {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn signature(&self) -> String {
|
||||
format!("Fan(circuit={})", self.circuit_id.0)
|
||||
}
|
||||
|
||||
fn to_params(&self) -> crate::ComponentParams {
|
||||
crate::ComponentParams::new("Fan")
|
||||
.with_param("circuitId", self.circuit_id.0)
|
||||
.with_param("airDensityKgPerM3", self.air_density_kg_per_m3)
|
||||
.with_param("speedRatio", self.speed_ratio)
|
||||
}
|
||||
}
|
||||
|
||||
impl StateManageable for Fan<Connected> {
|
||||
|
||||
Reference in New Issue
Block a user