Skip to content

Commit 6b940d8

Browse files
Merge branch 'develop' into fix-thermo-test-fail
2 parents a5ab8a0 + cb6d50d commit 6b940d8

2 files changed

Lines changed: 17 additions & 4 deletions

File tree

oscps-lib/src/blocks.rs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,20 @@ use uom::si::f64::Mass;
1414
use uom::si::mass::kilogram;
1515

1616
#[allow(dead_code)]
17-
/// Minimum error allowed for energy difference. TODO: Change this to a
18-
/// relative scale instead of an absolute scale.
17+
/// Minimum error allowed for energy difference.
18+
/// TODO: Change this to a relative scale instead of an absolute scale.
1919
pub static TOLERENCE_ENERGY: Lazy<Energy> =
2020
Lazy::new(|| Energy::new::<joule>(5.0));
2121

2222
#[allow(dead_code)]
23-
/// Minimum error allowed for mass difference. TODO: Change this to a relative
24-
/// scale instead of an absolute scale.
23+
/// Minimum error allowed for mass difference.
24+
/// TODO: Change this to a relative scale instead of an absolute scale.
2525
pub static TOLERENCE_MASS: Lazy<Mass> =
2626
Lazy::new(|| Mass::new::<kilogram>(5.0));
2727

2828
#[allow(dead_code)]
29+
/// # MassBalance
30+
///
2931
/// Trait for ensuring the overall mass balance is maintained in a flowsheet.
3032
///
3133
/// This trait can be implemented by any block that needs to ensure mass
@@ -169,6 +171,9 @@ impl Mixer {
169171
fn compute_outlet_pressure(&self) {}
170172
}
171173

174+
/// # Block Tests
175+
///
176+
/// The following module holds all the unit test cases for the blocks module
172177
#[cfg(test)]
173178
mod block_tests {
174179
use crate::connector::{Econnector, Mconnector};
@@ -179,6 +184,7 @@ mod block_tests {
179184
use uom::si::mass::pound;
180185

181186
#[test]
187+
/// checks whether the mass balance check function was implemented properly
182188
fn test_mass_balance_check_steady_state_for_mixer() {
183189
// here you will need to check that the mass into the mixer = mass out of mixer
184190

@@ -197,6 +203,7 @@ mod block_tests {
197203
}
198204

199205
#[test]
206+
/// checks if the 'energy_balance_check' function was implemented properly
200207
fn test_energy_balance_check_steady_state_for_mixer() {
201208
// energy into mixer = energy out of mixer
202209
let mixer_test_obj = Mixer {
@@ -214,6 +221,7 @@ mod block_tests {
214221
}
215222

216223
#[test]
224+
/// checking functionality of 'compute_total_outlet_mass_flow'
217225
fn test_compute_total_outlet_mass_flow() {
218226
let in_streams_mass = vec![
219227
Mconnector {
@@ -231,6 +239,7 @@ mod block_tests {
231239
}
232240

233241
#[test]
242+
/// checking functionality of 'compute_outlet_energy_flows'
234243
fn test_compute_outlet_energy_flows() {
235244
let in_streams_energy = vec![
236245
Econnector {

oscps-lib/src/thermodynamics.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ pub struct SpeciesListPair {
8181

8282
#[allow(dead_code)]
8383
/// Implementation of ThermoState
84+
/// This struct holds the functionality to perform thermodynamic calculations for a stream or for
85+
/// an individual species
8486
impl ThermoState {
8587
/// Constructor for creating a ThermoState
8688
pub fn new(
@@ -132,6 +134,7 @@ mod thermo_tests {
132134
use uom::si::thermodynamic_temperature::kelvin;
133135

134136
#[test]
137+
///Test case generates an instance of the 'ThermoState' struct
135138
fn test_create_thermo_state() {
136139
// Create some test data for ThermoMoleFrac (mole fractions)
137140
let water = Chemical {
@@ -175,6 +178,7 @@ mod thermo_tests {
175178
}
176179

177180
#[test]
181+
///Tests the mass fraction function within the 'ThermoState struct'
178182
fn test_mass_fraction_calculation() {
179183
let water = Chemical {
180184
pubchem_obj: pubchem::Compound::new(962),

0 commit comments

Comments
 (0)