Skip to content

Commit

Permalink
pulled in changes from PS repo
Browse files Browse the repository at this point in the history
  • Loading branch information
calbaker committed Aug 28, 2024
1 parent b92b60d commit 4173773
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions rust/altrios-core/src/consist/consist_model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,11 +179,19 @@ impl Consist {
}

pub fn force_max(&self) -> anyhow::Result<si::Force> {
self.loco_vec
.iter()
.try_fold(0. * uc::N, |f_sum, loco| -> anyhow::Result<si::Force> {
Ok(loco.force_max().with_context(|| format_dbg!())? + f_sum)
})
self.loco_vec.iter().enumerate().try_fold(
0. * uc::N,
|f_sum, (i, loco)| -> anyhow::Result<si::Force> {
Ok(loco.force_max().with_context(|| {
format!(
"{}\nloco #: {}\nloco type: {}",
format_dbg!(),
i,
loco.loco_type.get_pt_type()
)
})? + f_sum)
},
)
}

pub fn get_loco_vec(&self) -> Vec<Locomotive> {
Expand Down

0 comments on commit 4173773

Please sign in to comment.