Advertisement
Guest User

Untitled

a guest
May 20th, 2022
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.41 KB | None | 0 0
  1. def kettle_variables():
  2.     diameter = float(input("Diameter centimeters: "))
  3.     volume = float(input("Volume in liters: "))
  4.     temp = float(input("Temperature in celsius: "))
  5.     density = float(input("Density: "))
  6.     mass = volume * density
  7.     radius = diameter/2
  8.  
  9.     # height in cm
  10.     height = (volume * 1000) / (math.pi * math.pow(radius, 2))
  11.  
  12.     # surface in m^2
  13.     surface = (2 * math.pi * math.pow(radius, 2) + 2 * math.pi * radius * height) / 10000
  14.  
  15.     return diameter,volume,temp,density,height,surface,mass
  16.  
  17. def kettle_heat(THERMAL_CONDUCTIVITY_STEEL,surface,temp):
  18.     duration = float(input("Duration: "))
  19.     ambient_temp = float(input("The ambient temperature in degree celsius: "))
  20.     heat_loss_factor = float(input("Increase or decrease the heat loss by aspecified factor: "))
  21.  
  22.     # Q = k_w * A * (T_kettle - T_ambient)
  23.     # P = Q / t
  24.     power = ((THERMAL_CONDUCTIVITY_STEEL * surface
  25.                  * (temp - ambient_temp)) / duration)
  26.  
  27.     # W to kW
  28.     power /= 1000
  29.     temp -= get_deltaT(power, duration) * heat_loss_factor
  30.     return temp
  31.  
  32. def get_deltaT(power, duration,SPECIFIC_HEAT_CAP_WATER,mass):
  33.     # P = Q / t
  34.     # Q = c * m * delta T
  35.     # => delta(T) = (P * t) / (c * m)
  36.         return ((power * duration) / (SPECIFIC_HEAT_CAP_WATER * mass))
  37.  
  38. if __name__ == '__main__':
  39.     kettle_variables()
  40.     kettle_heat(surface,THERMAL_CONDUCTIVITY_STEEL,temp)
  41.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement