Skip to content

Commit

Permalink
additional check of length of experimental permittivity data > 0 (#242)
Browse files Browse the repository at this point in the history
* added additional check if more than 0 permittivity points have been provided during creation of parameters

---------

Co-authored-by: LisaNeumaier <[email protected]>
  • Loading branch information
lruebli and LisaNeumaier authored May 2, 2024
1 parent b78e80a commit 2e9596e
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/epcsaft/parameters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,21 @@ impl Parameter for ElectrolytePcSaftParameters {
));
}

if !modeltypes.is_empty() && modeltypes[0] == 2 {
for permittivity_record in &permittivity_records {
if let Some(PermittivityRecord::ExperimentalData { data }) =
permittivity_record.as_ref()
{
// check if length of data is greater than 0
if data.is_empty() {
return Err(ParameterError::IncompatibleParameters(
"Experimental data for permittivity must contain at least one data point.".to_string(),
));
}
}
}
}

if !modeltypes.is_empty() && modeltypes[0] == 2 {
// order points in data by increasing temperature
let mut permittivity_records_clone = permittivity_records.clone();
Expand Down

0 comments on commit 2e9596e

Please sign in to comment.