77//! MassBalance trait but not the EnergyBalance.
88//!
99
10-
11- use uom:: si:: f64:: { Energy } ;
12- use uom:: si:: f64:: { Mass } ;
10+ use uom:: si:: f64:: Energy ;
11+ use uom:: si:: f64:: Mass ;
1312use uom:: si:: mass:: kilogram;
1413use uom:: si:: energy:: joule;
15- use crate :: component:: ChemicalIdentifier ;
16- use crate :: { component, connector} ;
14+ use crate :: connector;
1715use once_cell:: sync:: Lazy ;
1816
1917//Initiallizing a global variable for the tolerance for the energy balance
18+ #[ allow( dead_code) ]
2019static TOLERENCE_ENERGY : Lazy < Energy > = Lazy :: new ( || Energy :: new :: < joule > ( 5.0 ) ) ;
2120
2221//Initiallizing a global variable for the tolerance for the mass balance
22+ #[ allow( dead_code) ]
2323static TOLERENCE_MASS : Lazy < Mass > = Lazy :: new ( || Mass :: new :: < kilogram > ( 5.0 ) ) ;
2424
2525//Initiallizing a global variable for the tolerance for the element balance
2626
2727/// Trait for ensuring the overall mass balance is maintained in a flowsheet.
2828///
2929/// This trait can be implemented by any block that needs to ensure mass conservation.
30+ #[ allow( dead_code) ]
3031pub trait MassBalance {
3132 // total mass in - total mass out < tolerance
3233 fn mass_balance_check ( & self , mass_in : Mass , mass_out : Mass ) -> bool {
@@ -44,6 +45,7 @@ pub trait MassBalance {
4445/// This trait ensures that blocks in the flowsheet adhere to energy conservation principles.
4546///
4647/// This is useful for distinguishing between "dynamic" and "steady state" simulations.
48+ #[ allow( dead_code) ]
4749pub trait EnergyBalance {
4850
4951 // total energy in - total energy out < tolerance
@@ -63,12 +65,12 @@ pub trait EnergyBalance {
6365 }
6466}
6567
66-
6768/// # Mixer Block
6869///
6970/// A block used for simple stream mixing operations.
7071///
7172/// This struct requires the implementation of both EnergyBalance and MassBalance traits to ensure proper conservation principles are followed.
73+ #[ allow( dead_code) ]
7274pub struct Mixer {
7375 pub block_id : String ,
7476 pub x_cord : i32 ,
@@ -86,12 +88,13 @@ impl MassBalance for Mixer {}
8688// Applying the energy balance trait to the Mixer Block
8789impl EnergyBalance for Mixer { }
8890
91+ #[ allow( dead_code) ]
8992impl Mixer {
9093 pub fn new ( id : String , x_cord : i32 , y_cord : i32 , in_streams_mass : Vec < connector:: Mconnector > , in_streams_energy : Vec < connector:: Econnector > ) -> Mixer {
9194 return Mixer {
9295 block_id : id,
93- x_cord : x_cord ,
94- y_cord : y_cord ,
96+ x_cord,
97+ y_cord,
9598 input_streams_mass : in_streams_mass,
9699 input_streams_energy : in_streams_energy,
97100 outlet_stream_mass : None ,
@@ -115,7 +118,7 @@ impl Mixer {
115118 ///
116119 /// A Mass quantity (uom object) that holds the outlet mass flow
117120 fn compute_total_outlet_mass_flow ( & self ) -> Option < f64 > {
118- // steps to implement function:
121+ // TODO: steps to implement function:
119122 // Need to loop through each of the connector structures and add up the mass flows
120123 // During this process, need to make sure that all the mass flows are in the same units
121124 // Use the UOM package to help with this part...
@@ -138,7 +141,6 @@ impl Mixer {
138141 return Some ( energy_flow_sum) ;
139142 }
140143
141-
142144 fn compute_outlet_phase_fractions ( & self ) {
143145
144146 }
@@ -158,7 +160,7 @@ mod block_tests {
158160 use crate :: connector:: { Mconnector , Econnector } ;
159161
160162 use super :: * ;
161- use std:: io;
163+ // use std::io;
162164 use uom:: si:: f64:: Energy ;
163165 use uom:: si:: energy:: kilojoule;
164166 use uom:: si:: mass:: pound;
0 commit comments