Method: Joules.power_efficiency
- Defined in:
- lib/joules/energy_work_power.rb
.power_efficiency(useful_power_output, power_input) ⇒ Float
Calculates the power efficiency given useful power output and power input.
134 135 136 137 138 139 140 |
# File 'lib/joules/energy_work_power.rb', line 134 def power_efficiency(useful_power_output, power_input) if power_input.zero? raise ZeroDivisionError.new('divided by 0') else return (useful_power_output / power_input.to_f) * 100 end end |