question.rb
solution.rb
playground.rb
1 require_relative "../physics" 2 3 question :a_battery_on_charge do 4 kind :numerical 5 describes "A storage battery of emf %{emf} and internal resistance %{internal} is being charged by a %{supply} dc " \ 6 "supply using a series resistor of %{series}. %{terminal}, in volts?" 7 given emf: "8.0 V" 8 given internal: "0.5 Ω" 9 given supply: "120 V" 10 given series: "15.5 Ω" 11 asks terminal: "What is the terminal voltage of the battery during charging" 12 end
1 require_relative "../questions/a_battery_on_charge" 2 require_relative "../science/current_electricity/ohms_law" 3 4 solve :a_battery_on_charge , using: OhmsLaw do 5 objects :battery , :inside , :supply , :resistor , :circuit , :terminals 6 7 take emf: battery . voltage 8 take internal: inside . resistance 9 take supply: supply . voltage 10 take series: resistor . resistance 11 12 deduce_from "is being charged by" , circuit . voltage => supply . voltage - battery . voltage 13 deduce_from "using a series resistor" , circuit . resistance => inside . resistance + resistor . resistance 14 deduce_from "a series resistor of" , inside . current => circuit . current 15 deduce_from "terminal voltage of the battery during charging" , terminals . voltage => battery . voltage + inside . voltage 16 17 terminal = terminals . voltage 18 answer terminal :, in: "V" , figures: 3 19 20 conclusion "The supply pushes current backward through the battery against its emf, so the voltage across its " \ 21 "terminals is the emf plus what the current takes to cross its internal resistance." 22 end
1 require_relative "../solutions/a_battery_on_charge" 2 3 play_with :a_battery_on_charge do 4 title "A Battery on Charge" 5 end