use crate::EntityId;
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct PumpingStation {
pub id: EntityId,
pub name: String,
pub bus_id: EntityId,
pub source_hydro_id: EntityId,
pub destination_hydro_id: EntityId,
pub entry_stage_id: Option<i32>,
pub exit_stage_id: Option<i32>,
pub consumption_mw_per_m3s: f64,
pub min_flow_m3s: f64,
pub max_flow_m3s: f64,
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_pumping_station_construction() {
let station = PumpingStation {
id: EntityId::from(1),
name: "Bombeamento Serra da Mesa".to_string(),
bus_id: EntityId::from(10),
source_hydro_id: EntityId::from(3),
destination_hydro_id: EntityId::from(5),
entry_stage_id: None,
exit_stage_id: None,
consumption_mw_per_m3s: 0.5,
min_flow_m3s: 0.0,
max_flow_m3s: 150.0,
};
assert_eq!(station.id, EntityId::from(1));
assert_eq!(station.name, "Bombeamento Serra da Mesa");
assert_eq!(station.bus_id, EntityId::from(10));
assert_eq!(station.source_hydro_id, EntityId::from(3));
assert_eq!(station.destination_hydro_id, EntityId::from(5));
assert_eq!(station.entry_stage_id, None);
assert_eq!(station.exit_stage_id, None);
assert!((station.consumption_mw_per_m3s - 0.5).abs() < f64::EPSILON);
assert!((station.min_flow_m3s - 0.0).abs() < f64::EPSILON);
assert!((station.max_flow_m3s - 150.0).abs() < f64::EPSILON);
}
}