File tree Expand file tree Collapse file tree
fastsim-core/src/simdrive Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -154,13 +154,21 @@ impl SimDrive {
154154 err
155155 ) )
156156 } ) ?;
157+ // final SOC, to use as starting SOC for next iteration (if needed)
157158 let soc_final = self
158159 . veh
159160 . res ( )
160161 . with_context ( || format_dbg ! ( ) ) ?
161162 . state
162163 . soc
163164 . clone ( ) ;
165+ // current iteration number, to use as counter for next iteration (if needed)
166+ let soc_bal_iters = self
167+ . veh
168+ . hev ( )
169+ . with_context ( || format_dbg ! ( ) ) ?
170+ . soc_bal_iters
171+ . clone ( ) ;
164172 let res_per_fuel = * self
165173 . veh
166174 . res ( )
@@ -232,6 +240,11 @@ impl SimDrive {
232240 self . veh = veh_init. clone ( ) ;
233241 // start SOC at previous final value
234242 self . veh . res_mut ( ) . with_context ( || format_dbg ! ( ) ) ?. state . soc = soc_final;
243+ // keep soc_bal_iters value from previous iteration
244+ self . veh
245+ . hev_mut ( )
246+ . with_context ( || format_dbg ! ( ) ) ?
247+ . soc_bal_iters = soc_bal_iters;
235248 }
236249 }
237250 }
You can’t perform that action at this time.
0 commit comments