record_model.py 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  1. #!/usr/bin/env python
  2. # -*- encoding: utf-8 -*-
  3. class Singleton(object):
  4. def __new__(cls, *args, **kw):
  5. if not hasattr(cls, '_instance'):
  6. orig = super(Singleton, cls)
  7. cls._instance = orig.__new__(cls, *args, **kw)
  8. return cls._instance
  9. class RecordModel(Singleton):
  10. def __init__(self):
  11. # 时间戳 簇号 故障等级 簇电压 簇电流 簇SOC 簇SOH
  12. self.__now_time = ""
  13. self.__ccu_id = 0
  14. self.__fault_level = 0
  15. self.__volt = 0
  16. self.__cur = 0
  17. self.__soc = 0
  18. self.__soh = 0
  19. # 簇单体V平均 簇单体Vmax单体号 簇单体Vmax 簇单体Vmin单体号 簇单体Vmin 簇单体T平均 簇单体Tmax单体号 簇单体Tmax 簇单体Tmin单体号 簇单体Tmin
  20. self.__avg_cell_volt = 0
  21. self.__max_cell_volt_id = 0
  22. self.__max_cell_volt = 0
  23. self.__min_cell_volt_id = 0
  24. self.__min_cell_volt = 0
  25. self.__avg_cell_temp = 0
  26. self.__max_cell_temp_id = 0
  27. self.__max_cell_temp = 0
  28. self.__min_cell_temp_id = 0
  29. self.__min_cell_temp = 0
  30. # 主正接触器 主负接触器 预充接触器 断路器 干接点1 干接点2 最高单体SOC 最低单体SOC 平均单体SOC
  31. self.__p = 0
  32. self.__n = 0
  33. self.__pre = 0
  34. self.__dlq = 0
  35. self.__gjd_first = 0
  36. self.__gjd_second = 0
  37. self.__max_soc = 0
  38. self.__min_soc = 0
  39. self.__avg_soc = 0
  40. self.__cell_volt = [0 for i in range(396)]
  41. self.__cell_temp = [0 for i in range(360)]
  42. @property
  43. def now_time(self):
  44. return self.__now_time
  45. @now_time.setter
  46. def now_time(self, value):
  47. self.__now_time = value
  48. @property
  49. def ccu_id(self):
  50. return self.__ccu_id
  51. @ccu_id.setter
  52. def ccu_id(self, value):
  53. self.__ccu_id = value
  54. @property
  55. def fault_level(self):
  56. return self.__fault_level
  57. @fault_level.setter
  58. def fault_level(self, value):
  59. self.__fault_level = value
  60. @property
  61. def volt(self):
  62. return self.__volt
  63. @volt.setter
  64. def volt(self, value):
  65. self.__volt = value
  66. @property
  67. def cur(self):
  68. return self.__cur
  69. @cur.setter
  70. def cur(self, value):
  71. self.__cur = value
  72. @property
  73. def soc(self):
  74. return self.__soc
  75. @soc.setter
  76. def soc(self, value):
  77. self.__soc = value
  78. @property
  79. def soh(self):
  80. return self.__soh
  81. @soh.setter
  82. def soh(self, value):
  83. self.__soh = value
  84. @property
  85. def avg_cell_volt(self):
  86. return self.__avg_cell_volt
  87. @avg_cell_volt.setter
  88. def avg_cell_volt(self, value):
  89. self.__avg_cell_volt = value
  90. @property
  91. def max_cell_volt_id(self):
  92. return self.__max_cell_volt_id
  93. @max_cell_volt_id.setter
  94. def max_cell_volt_id(self, value):
  95. self.__max_cell_volt_id = value
  96. @property
  97. def max_cell_volt(self):
  98. return self.__max_cell_volt
  99. @max_cell_volt.setter
  100. def max_cell_volt(self, value):
  101. self.__max_cell_volt = value
  102. @property
  103. def min_cell_volt_id(self):
  104. return self.__min_cell_volt_id
  105. @min_cell_volt_id.setter
  106. def min_cell_volt_id(self, value):
  107. self.__min_cell_volt_id = value
  108. @property
  109. def min_cell_volt(self):
  110. return self.__min_cell_volt
  111. @min_cell_volt.setter
  112. def min_cell_volt(self, value):
  113. self.__min_cell_volt = value
  114. @property
  115. def avg_cell_temp(self):
  116. return self.__avg_cell_temp
  117. @avg_cell_temp.setter
  118. def avg_cell_temp(self, value):
  119. self.__avg_cell_temp = value
  120. @property
  121. def max_cell_temp_id(self):
  122. return self.__max_cell_temp_id
  123. @max_cell_temp_id.setter
  124. def max_cell_temp_id(self, value):
  125. self.__max_cell_temp_id = value
  126. @property
  127. def max_cell_temp(self):
  128. return self.__max_cell_temp
  129. @max_cell_temp.setter
  130. def max_cell_temp(self, value):
  131. self.__max_cell_temp = value
  132. @property
  133. def min_cell_temp_id(self):
  134. return self.__min_cell_temp_id
  135. @min_cell_temp_id.setter
  136. def min_cell_temp_id(self, value):
  137. self.__min_cell_temp_id = value
  138. @property
  139. def min_cell_temp(self):
  140. return self.__min_cell_temp
  141. @min_cell_temp.setter
  142. def min_cell_temp(self, value):
  143. self.__min_cell_temp = value
  144. @property
  145. def p(self):
  146. return self.__p
  147. @p.setter
  148. def p(self, value):
  149. self.__p = value
  150. @property
  151. def n(self):
  152. return self.__n
  153. @n.setter
  154. def n(self, value):
  155. self.__n = value
  156. @property
  157. def pre(self):
  158. return self.__pre
  159. @pre.setter
  160. def pre(self, value):
  161. self.__pre = value
  162. @property
  163. def dlq(self):
  164. return self.__dlq
  165. @dlq.setter
  166. def dlq(self, value):
  167. self.__dlq = value
  168. @property
  169. def gjd_first(self):
  170. return self.__gjd_first
  171. @gjd_first.setter
  172. def gjd_first(self, value):
  173. self.__gjd_first = value
  174. @property
  175. def gjd_second(self):
  176. return self.__gjd_second
  177. @gjd_second.setter
  178. def gjd_second(self, value):
  179. self.__gjd_second = value
  180. @property
  181. def max_soc(self):
  182. return self.__max_soc
  183. @max_soc.setter
  184. def max_soc(self, value):
  185. self.__max_soc = value
  186. @property
  187. def min_soc(self):
  188. return self.__min_soc
  189. @min_soc.setter
  190. def min_soc(self, value):
  191. self.__min_soc = value
  192. @property
  193. def avg_soc(self):
  194. return self.__avg_soc
  195. @avg_soc.setter
  196. def avg_soc(self, value):
  197. self.__avg_soc = value
  198. @property
  199. def cell_volt(self):
  200. return self.__cell_volt
  201. @cell_volt.setter
  202. def cell_volt(self, value):
  203. self.__cell_volt = value
  204. @property
  205. def cell_temp(self):
  206. return self.__cell_temp
  207. @cell_temp.setter
  208. def cell_temp(self, value):
  209. self.__cell_temp = value