kokokozhina

Untitled

Dec 9th, 2016
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.44 KB | None | 0 0
  1. class MyConditioner < Conditioner
  2.  
  3. end
  4.  
  5.  
  6. class MyHeater < Heater
  7. def set_tact new_tact
  8. @tact = new_tact
  9. end
  10.  
  11. def tact #для проверки
  12. @tact
  13. end
  14. end
  15.  
  16.  
  17. class MyClimateControl < ClimateControl
  18. def check_heater
  19. if @home.temperature > @heater_start # если превышен темп. барьер
  20. @home.heater[0].set_off # не уверена, что будет работать
  21. @home.heater[1].set_off # не уверена, что будет работать
  22. else
  23. # @home.heater.set_on # перевести в режим работы
  24. if @home.temperature + 4 < @heater_start
  25. @home.heater[1].set_on
  26. else
  27. @home.heater[0].set_on
  28. end
  29. end
  30. end
  31. end
  32.  
  33.  
  34. class MyReporter < Reporter
  35. def heater_status_s
  36. "heater 1: " + bool_to_on_off_s(@home.heater[0].status)
  37. "heater 2: " + bool_to_on_off_s(@home.heater[1].status)
  38. end
  39. end
  40.  
  41.  
  42. class MyWeather < Weather
  43.  
  44. end
  45.  
  46. class MyCyclon < Cyclon
  47. MyCyclons = Cyclons + [[-2.8, -2.1, -1.4, -0.7, 0, 0.7, 1.4, 2.1]]
  48. end
  49.  
  50. class MyGlasshouse < Glasshouse
  51. def set_glasshouse
  52. @conditioner = MyConditioner.new self
  53. @heater = [MyHeater.new(self), MyHeater.new(self)]
  54. @heater[0] = @heater[0].set_tact(0.4)
  55. @heater[1] = @heater[1].set_tact(0.2)
  56. @climate_control = MyClimateControl.new(self, 15, 25)
  57. @reporter = MyReporter.new self
  58. end
  59.  
  60. end
Add Comment
Please, Sign In to add comment