Skip to content

Commit

Permalink
Use floating division to prevent rounding to zero
Browse files Browse the repository at this point in the history
  • Loading branch information
rajeee committed Nov 20, 2024
1 parent 3026165 commit 2204599
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions BuildResidentialScheduleFile/resources/schedules.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1177,8 +1177,8 @@ def fill_ev_battery_schedule(markov_chain_simulation_result)
away_index = 5 # Index of away activity in the markov-chain simulator
away_schedule = markov_chain_simulation_result[@ev_occupant_number].column(away_index)
charging_schedule, discharging_schedule = _get_ev_battery_schedule(away_schedule, hours_per_year)
agg_charging_schedule = aggregate_array(charging_schedule, @minutes_per_step).map { |val| val / @minutes_per_step }
agg_discharging_schedule = aggregate_array(discharging_schedule, @minutes_per_step).map { |val| val / @minutes_per_step }
agg_charging_schedule = aggregate_array(charging_schedule, @minutes_per_step).map { |val| val.to_f / @minutes_per_step }
agg_discharging_schedule = aggregate_array(discharging_schedule, @minutes_per_step).map { |val| val.to_f / @minutes_per_step }
@schedules[SchedulesFile::Columns[:EVBatteryCharging].name] = agg_charging_schedule
@schedules[SchedulesFile::Columns[:EVBatteryDischarging].name] = agg_discharging_schedule
end
Expand Down

0 comments on commit 2204599

Please sign in to comment.