Module: Joule::Calculator::PeakPowerCalculator
- Included in:
- Base::Parser
- Defined in:
- lib/joule/calculator/peak_power_calculator.rb
Instance Method Summary collapse
- #calculate_peak_power_value(array, duration, total_duration) ⇒ Object
- #calculate_peak_power_values(options = {}) ⇒ Object
Instance Method Details
#calculate_peak_power_value(array, duration, total_duration) ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/joule/calculator/peak_power_calculator.rb', line 12 def calculate_peak_power_value(array, duration, total_duration) if duration > total_duration PeakPower.new(duration) else Joule::Calculator::PowerCalculator::peak_power(array, duration, (duration/@workout.properties.record_interval)) end end |
#calculate_peak_power_values(options = {}) ⇒ Object
5 6 7 8 9 10 |
# File 'lib/joule/calculator/peak_power_calculator.rb', line 5 def calculate_peak_power_values( = {}) array = @workout.data_points.collect{|v| v.power} [:durations].each { |duration| @workout.peak_powers << calculate_peak_power_value(array, duration, [:total_duration]) } end |