home.py 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419
  1. #!/usr/bin/env python
  2. # -*- encoding: utf-8 -*-
  3. '''
  4. @文件 :home.py
  5. @时间 :2022/01/22 09:53:31
  6. @作者 :None
  7. @版本 :1.0
  8. @说明 :主页面
  9. '''
  10. from ui.own.frame_theme import MyFrame
  11. from ui.own.switch_button import SwitchButton
  12. from ui.own.led import Led
  13. from ui.own.palette_theme import set_my_palette
  14. from utils.qt import Qt, QWidget, QVBoxLayout, QHBoxLayout, QGridLayout, QLabel, QGroupBox, QLineEdit, QPushButton, QSizePolicy, QComboBox, QSize, QCoreApplication, QMetaObject
  15. class UiPcsHomePage(object):
  16. def setupUi(self, main):
  17. main.resize(650, 780)
  18. main.setMinimumSize(650, 780)
  19. set_my_palette(main)
  20. self.central_widget = QWidget(main)
  21. self.main_layout = QHBoxLayout(self.central_widget)
  22. self.main_layout.setContentsMargins(0, 0, 0, 0)
  23. self.main_layout.setSpacing(0)
  24. # 主窗口左侧布局
  25. self.left_widget = QWidget(self.central_widget)
  26. # 主窗口左侧采用垂直布局
  27. self.left_layout = QVBoxLayout(self.left_widget)
  28. self.left_layout.setContentsMargins(0, 0, 0, 0)
  29. self.left_layout.setSpacing(0)
  30. # 数据接口
  31. self.interface_widget = MyFrame(self.left_widget)
  32. self.interface_hlayout = QHBoxLayout(self.interface_widget)
  33. self.interface_hlayout.setContentsMargins(0, 0, 0, 0)
  34. self.interface_hlayout.setSpacing(0)
  35. self.groupbox_interface = QGroupBox(self.interface_widget)
  36. self.interface_vlayout = QVBoxLayout(self.groupbox_interface)
  37. self.cb_interface = QComboBox(self.groupbox_interface)
  38. self.cb_interface.addItems(["CAN通讯", "串口通讯"])
  39. self.interface_vlayout.addWidget(self.cb_interface)
  40. self.interface_hlayout.addWidget(self.groupbox_interface)
  41. self.left_layout.addWidget(self.interface_widget)
  42. # CAN通讯配置
  43. self.can_interface_widget = MyFrame(self.left_widget)
  44. self.can_interface_hlayout = QHBoxLayout(self.can_interface_widget)
  45. self.can_interface_hlayout.setContentsMargins(0, 0, 0, 0)
  46. self.can_interface_hlayout.setSpacing(0)
  47. self.groupbox_can_interface = QGroupBox(self.interface_widget)
  48. self.can_interface_glayout = QGridLayout(self.groupbox_can_interface)
  49. self.lb_can_interface_channel = QLabel(self.groupbox_can_interface)
  50. self.lb_can_interface_channel.setText("设备索引号:")
  51. self.can_interface_glayout.addWidget(self.lb_can_interface_channel, 0, 0)
  52. self.cb_can_interface_channel = QComboBox(self.groupbox_can_interface)
  53. self.cb_can_interface_channel.addItems([str(i) for i in range(9)])
  54. self.can_interface_glayout.addWidget(self.cb_can_interface_channel, 0, 1)
  55. self.lb_can_interface_index = QLabel(self.groupbox_can_interface)
  56. self.lb_can_interface_index.setText("设备通道号:")
  57. self.can_interface_glayout.addWidget(self.lb_can_interface_index, 1, 0)
  58. self.cb_can_interface_index = QComboBox(self.groupbox_can_interface)
  59. self.cb_can_interface_index.addItems(["0", "1"])
  60. self.can_interface_glayout.addWidget(self.cb_can_interface_index, 1, 1)
  61. self.lb_can_interface_baudrate = QLabel(self.groupbox_can_interface)
  62. self.lb_can_interface_baudrate.setText("CAN波特率:")
  63. self.can_interface_glayout.addWidget(self.lb_can_interface_baudrate, 2, 0)
  64. self.cb_can_interface_baudrate = QComboBox(self.groupbox_can_interface)
  65. self.cb_can_interface_baudrate.addItems(["125Kbps", "250Kbps", "500Kbps"])
  66. self.cb_can_interface_baudrate.setCurrentText("250Kbps")
  67. self.can_interface_glayout.addWidget(self.cb_can_interface_baudrate, 2, 1)
  68. self.can_interface_hlayout.addWidget(self.groupbox_can_interface)
  69. self.left_layout.addWidget(self.can_interface_widget)
  70. # 串口通讯配置
  71. self.com_interface_widget = MyFrame(self.left_widget)
  72. self.com_interface_hlayout = QHBoxLayout(self.com_interface_widget)
  73. self.com_interface_hlayout.setContentsMargins(0, 0, 0, 0)
  74. self.com_interface_hlayout.setSpacing(0)
  75. self.groupbox_com_interface = QGroupBox(self.interface_widget)
  76. self.com_interface_glayout = QGridLayout(self.groupbox_com_interface)
  77. self.lb_com_interface_port = QLabel(self.groupbox_com_interface)
  78. self.lb_com_interface_port.setText("端口号:")
  79. self.com_interface_glayout.addWidget(self.lb_com_interface_port, 0, 0)
  80. self.cb_com_interface_port = QComboBox(self.groupbox_com_interface)
  81. self.cb_com_interface_port.addItems([str(i + 1) for i in range(9)])
  82. self.com_interface_glayout.addWidget(self.cb_com_interface_port, 0, 1)
  83. self.lb_com_interface_baudrate = QLabel(self.groupbox_com_interface)
  84. self.lb_com_interface_baudrate.setText("波特率:")
  85. self.com_interface_glayout.addWidget(self.lb_com_interface_baudrate, 1, 0)
  86. self.cb_com_interface_baudrate = QComboBox(self.groupbox_com_interface)
  87. self.cb_com_interface_baudrate.addItems(["9600", "115200"])
  88. self.com_interface_glayout.addWidget(self.cb_com_interface_baudrate, 1, 1)
  89. self.lb_com_interface_parity = QLabel(self.groupbox_com_interface)
  90. self.lb_com_interface_parity.setText("校验位:")
  91. self.com_interface_glayout.addWidget(self.lb_com_interface_parity, 2, 0)
  92. self.cb_com_interface_parity = QComboBox(self.groupbox_com_interface)
  93. self.cb_com_interface_parity.addItems(["无校验", "偶校验", "奇校验"])
  94. self.com_interface_glayout.addWidget(self.cb_com_interface_parity, 2, 1)
  95. self.lb_com_interface_word_length = QLabel(self.groupbox_com_interface)
  96. self.lb_com_interface_word_length.setText("数据位:")
  97. self.com_interface_glayout.addWidget(self.lb_com_interface_word_length, 3, 0)
  98. self.cb_com_interface_word_length = QComboBox(self.groupbox_com_interface)
  99. self.cb_com_interface_word_length.addItems(["8", "9"])
  100. self.com_interface_glayout.addWidget(self.cb_com_interface_word_length, 3, 1)
  101. self.lb_com_interface_stop = QLabel(self.groupbox_com_interface)
  102. self.lb_com_interface_stop.setText("停止位:")
  103. self.com_interface_glayout.addWidget(self.lb_com_interface_stop, 4, 0)
  104. self.cb_com_interface_stop = QComboBox(self.groupbox_com_interface)
  105. self.cb_com_interface_stop.addItems(["1", "1.5", "2"])
  106. self.com_interface_glayout.addWidget(self.cb_com_interface_stop, 4, 1)
  107. self.groupbox_com_interface.hide()
  108. self.com_interface_hlayout.addWidget(self.groupbox_com_interface)
  109. self.left_layout.addWidget(self.com_interface_widget)
  110. # BMS连接开关
  111. self.pcs_connect_widget = MyFrame(self.left_widget)
  112. self.pcs_connect_layout = QHBoxLayout(self.pcs_connect_widget)
  113. self.pcs_connect_layout.setContentsMargins(0, 0, 0, 0)
  114. self.pcs_connect_layout.setSpacing(0)
  115. self.groupbox_pcs_connect = QGroupBox(self.pcs_connect_widget)
  116. self.bms_connect_hlayout = QHBoxLayout(self.groupbox_pcs_connect)
  117. self.pcs_switch = SwitchButton(self.groupbox_pcs_connect)
  118. size_policy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
  119. size_policy.setHorizontalStretch(0)
  120. size_policy.setVerticalStretch(0)
  121. size_policy.setHeightForWidth(self.pcs_switch.sizePolicy().hasHeightForWidth())
  122. self.pcs_switch.setSizePolicy(size_policy)
  123. self.pcs_switch.setMinimumSize(QSize(70, 30))
  124. self.bms_connect_hlayout.addWidget(self.pcs_switch)
  125. self.pcs_connect_layout.addWidget(self.groupbox_pcs_connect)
  126. self.left_layout.addWidget(self.pcs_connect_widget)
  127. # 其他信息
  128. self.other_widget = MyFrame(self.left_widget)
  129. self.other_layout = QHBoxLayout(self.other_widget)
  130. self.other_layout.setContentsMargins(0, 0, 0, 0)
  131. self.other_layout.setSpacing(0)
  132. self.groupbox_other = QGroupBox(self.other_widget)
  133. size_policy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Expanding)
  134. size_policy.setHorizontalStretch(0)
  135. size_policy.setVerticalStretch(0)
  136. size_policy.setHeightForWidth(self.groupbox_other.sizePolicy().hasHeightForWidth())
  137. self.groupbox_other.setSizePolicy(size_policy)
  138. self.other_layout.addWidget(self.groupbox_other)
  139. self.left_layout.addWidget(self.other_widget)
  140. self.main_layout.addWidget(self.left_widget, stretch=1)
  141. self.right_widget = QWidget(self.central_widget)
  142. # 主窗口右侧采用垂直布局
  143. self.right_layout = QVBoxLayout(self.right_widget)
  144. self.right_layout.setContentsMargins(0, 0, 0, 0)
  145. self.right_layout.setSpacing(0)
  146. # 数据接口
  147. self.important_data_widget = MyFrame(self.right_widget)
  148. self.important_data_hlayout = QHBoxLayout(self.important_data_widget)
  149. self.important_data_hlayout.setContentsMargins(0, 0, 0, 0)
  150. self.important_data_hlayout.setSpacing(0)
  151. self.groupbox_important_data = QGroupBox(self.important_data_widget)
  152. self.groupbox_important_data.setTitle("实时数据")
  153. self.important_data_glayout = QGridLayout(self.groupbox_important_data)
  154. self.lb_param = QLabel(self.groupbox_important_data)
  155. self.lb_param.setText("参数")
  156. self.important_data_glayout.addWidget(self.lb_param, 0, 0, 1, 1, Qt.AlignCenter)
  157. # self.lb_param_address = QLabel(self.groupbox_important_data)
  158. # self.lb_param_address.setText("地址")
  159. # self.important_data_glayout.addWidget(self.lb_param_address, 0, 1, 1, 1, Qt.AlignCenter)
  160. self.lb_param_value = QLabel(self.groupbox_important_data)
  161. self.lb_param_value.setText("值")
  162. self.important_data_glayout.addWidget(self.lb_param_value, 0, 2, 1, 1, Qt.AlignCenter)
  163. # 当前荷电状态(SOC)
  164. self.lb_soc = QLabel(self.groupbox_important_data)
  165. self.lb_soc.setText("当前荷电状态 [%]")
  166. self.important_data_glayout.addWidget(self.lb_soc, 1, 0, 1, 1, Qt.AlignCenter)
  167. # self.edt_soc_address = QLineEdit(self.groupbox_important_data)
  168. # self.edt_soc_address.setText("1800")
  169. # self.important_data_glayout.addWidget(self.edt_soc_address, 1, 1, 1, 1, Qt.AlignCenter)
  170. self.edt_soc = QLineEdit(self.groupbox_important_data)
  171. self.edt_soc.setReadOnly(True)
  172. self.important_data_glayout.addWidget(self.edt_soc, 1, 2, 1, 1, Qt.AlignCenter)
  173. # BMS是否已准备好
  174. self.lb_bms_ready = QLabel(self.groupbox_important_data)
  175. self.lb_bms_ready.setText("BMS就绪状态")
  176. self.important_data_glayout.addWidget(self.lb_bms_ready, 2, 0, 1, 1, Qt.AlignCenter)
  177. # self.edt_bms_ready_address = QLineEdit(self.groupbox_important_data)
  178. # self.edt_bms_ready_address.setText("1801")
  179. # self.important_data_glayout.addWidget(self.edt_bms_ready_address, 2, 1, 1, 1, Qt.AlignCenter)
  180. self.led_bms_ready = Led(self.groupbox_important_data)
  181. self.important_data_glayout.addWidget(self.led_bms_ready, 2, 2, 1, 1, Qt.AlignCenter)
  182. # 充放电使能标志
  183. self.lb_bms_chg_enabled = QLabel(self.groupbox_important_data)
  184. self.lb_bms_chg_enabled.setText("充放电使能标志")
  185. self.important_data_glayout.addWidget(self.lb_bms_chg_enabled, 3, 0, 1, 1, Qt.AlignCenter)
  186. # self.edt_bms_chg_enabled_address = QLineEdit(self.groupbox_important_data)
  187. # self.edt_bms_chg_enabled_address.setText("1802")
  188. # self.important_data_glayout.addWidget(self.edt_bms_chg_enabled_address, 3, 1, 1, 1, Qt.AlignCenter)
  189. self.edt_bms_chg_enabled = QLineEdit(self.groupbox_important_data)
  190. self.edt_bms_chg_enabled.setReadOnly(True)
  191. self.important_data_glayout.addWidget(self.edt_bms_chg_enabled, 3, 2, 1, 1, Qt.AlignCenter)
  192. # BMS停机指令
  193. self.lb_bms_stop = QLabel(self.groupbox_important_data)
  194. self.lb_bms_stop.setText("BMS停机指令")
  195. self.important_data_glayout.addWidget(self.lb_bms_stop, 4, 0, 1, 1, Qt.AlignCenter)
  196. # self.edt_bms_stop_address = QLineEdit(self.groupbox_important_data)
  197. # self.edt_bms_stop_address.setText("1803")
  198. # self.important_data_glayout.addWidget(self.edt_bms_stop_address, 4, 1, 1, 1, Qt.AlignCenter)
  199. self.edt_bms_stop = QLineEdit(self.groupbox_important_data)
  200. self.edt_bms_stop.setReadOnly(True)
  201. self.important_data_glayout.addWidget(self.edt_bms_stop, 4, 2, 1, 1, Qt.AlignCenter)
  202. # BMS故障标志
  203. self.lb_bms_fault = QLabel(self.groupbox_important_data)
  204. self.lb_bms_fault.setText("BMS故障标志")
  205. self.important_data_glayout.addWidget(self.lb_bms_fault, 5, 0, 1, 1, Qt.AlignCenter)
  206. # self.edt_bms_fault_address = QLineEdit(self.groupbox_important_data)
  207. # self.important_data_glayout.addWidget(self.edt_bms_fault_address, 5, 1, 1, 1, Qt.AlignCenter)
  208. self.led_bms_fault = Led(self.groupbox_important_data)
  209. self.important_data_glayout.addWidget(self.led_bms_fault, 5, 2, 1, 1, Qt.AlignCenter)
  210. # 电池堆SOH
  211. self.lb_bms_soh = QLabel(self.groupbox_important_data)
  212. self.lb_bms_soh.setText("电池堆SOH [%]")
  213. self.important_data_glayout.addWidget(self.lb_bms_soh, 6, 0, 1, 1, Qt.AlignCenter)
  214. # self.edt_bms_soh_address = QLineEdit(self.groupbox_important_data)
  215. # self.important_data_glayout.addWidget(self.edt_bms_soh_address, 6, 1, 1, 1, Qt.AlignCenter)
  216. self.edt_bms_soh = QLineEdit(self.groupbox_important_data)
  217. self.edt_bms_soh.setReadOnly(True)
  218. self.important_data_glayout.addWidget(self.edt_bms_soh, 6, 2, 1, 1, Qt.AlignCenter)
  219. # 最高单体温度值
  220. self.lb_bms_high_temp = QLabel(self.groupbox_important_data)
  221. self.lb_bms_high_temp.setText("最高单体温度值 [℃]")
  222. self.important_data_glayout.addWidget(self.lb_bms_high_temp, 7, 0, 1, 1, Qt.AlignCenter)
  223. # self.edt_bms_high_temp_address = QLineEdit(self.groupbox_important_data)
  224. # self.important_data_glayout.addWidget(self.edt_bms_high_temp_address, 7, 1, 1, 1, Qt.AlignCenter)
  225. self.edt_bms_high_temp = QLineEdit(self.groupbox_important_data)
  226. self.edt_bms_high_temp.setReadOnly(True)
  227. self.important_data_glayout.addWidget(self.edt_bms_high_temp, 7, 2, 1, 1, Qt.AlignCenter)
  228. # 最低单体温度值
  229. self.lb_bms_low_temp = QLabel(self.groupbox_important_data)
  230. self.lb_bms_low_temp.setText("最低单体温度值 [℃]")
  231. self.important_data_glayout.addWidget(self.lb_bms_low_temp, 8, 0, 1, 1, Qt.AlignCenter)
  232. # self.edt_bms_low_temp_address = QLineEdit(self.groupbox_important_data)
  233. # self.important_data_glayout.addWidget(self.edt_bms_low_temp_address, 8, 1, 1, 1, Qt.AlignCenter)
  234. self.edt_bms_low_temp = QLineEdit(self.groupbox_important_data)
  235. self.edt_bms_low_temp.setReadOnly(True)
  236. self.important_data_glayout.addWidget(self.edt_bms_low_temp, 8, 2, 1, 1, Qt.AlignCenter)
  237. # 重要信息2 BAMS->EMS(上位机)
  238. # 当前最大允许放电功率
  239. self.lb_bms_dischg_power_max = QLabel(self.groupbox_important_data)
  240. self.lb_bms_dischg_power_max.setText("当前最大允许放电功率 [kW]")
  241. self.important_data_glayout.addWidget(self.lb_bms_dischg_power_max, 9, 0, 1, 1, Qt.AlignCenter)
  242. # self.edt_bms_dischg_power_max_address = QLineEdit(self.groupbox_important_data)
  243. # self.important_data_glayout.addWidget(self.edt_bms_dischg_power_max_address, 9, 1, 1, 1, Qt.AlignCenter)
  244. self.edt_bms_dischg_power_max = QLineEdit(self.groupbox_important_data)
  245. self.edt_bms_dischg_power_max.setReadOnly(True)
  246. self.important_data_glayout.addWidget(self.edt_bms_dischg_power_max, 9, 2, 1, 1, Qt.AlignCenter)
  247. # 当前最大允许充电功率
  248. self.lb_bms_chg_power_max = QLabel(self.groupbox_important_data)
  249. self.lb_bms_chg_power_max.setText("当前最大允许充电功率 [kW]")
  250. self.important_data_glayout.addWidget(self.lb_bms_chg_power_max, 10, 0, 1, 1, Qt.AlignCenter)
  251. # self.edt_bms_chg_power_max_address = QLineEdit(self.groupbox_important_data)
  252. # self.important_data_glayout.addWidget(self.edt_bms_chg_power_max_address, 10, 1, 1, 1, Qt.AlignCenter)
  253. self.edt_bms_chg_power_max = QLineEdit(self.groupbox_important_data)
  254. self.edt_bms_chg_power_max.setReadOnly(True)
  255. self.important_data_glayout.addWidget(self.edt_bms_chg_power_max, 10, 2, 1, 1, Qt.AlignCenter)
  256. # 当前最大允许充电电流
  257. self.lb_bms_chg_cur_max = QLabel(self.groupbox_important_data)
  258. self.lb_bms_chg_cur_max.setText("当前最大允许充电电流 [A]")
  259. self.important_data_glayout.addWidget(self.lb_bms_chg_cur_max, 11, 0, 1, 1, Qt.AlignCenter)
  260. # self.edt_bms_chg_cur_max_address = QLineEdit(self.groupbox_important_data)
  261. # self.important_data_glayout.addWidget(self.edt_bms_chg_cur_max_address, 11, 1, 1, 1, Qt.AlignCenter)
  262. self.edt_bms_chg_cur_max = QLineEdit(self.groupbox_important_data)
  263. self.edt_bms_chg_cur_max.setReadOnly(True)
  264. self.important_data_glayout.addWidget(self.edt_bms_chg_cur_max, 11, 2, 1, 1, Qt.AlignCenter)
  265. # 当前最大允许放电电流
  266. self.lb_bms_dischg_cur_max = QLabel(self.groupbox_important_data)
  267. self.lb_bms_dischg_cur_max.setText("当前最大允许放电电流 [A]")
  268. self.important_data_glayout.addWidget(self.lb_bms_dischg_cur_max, 12, 0, 1, 1, Qt.AlignCenter)
  269. # self.edt_bms_dischg_cur_max_address = QLineEdit(self.groupbox_important_data)
  270. # self.important_data_glayout.addWidget(self.edt_bms_dischg_cur_max_address, 12, 1, 1, 1, Qt.AlignCenter)
  271. self.edt_bms_dischg_cur_max = QLineEdit(self.groupbox_important_data)
  272. self.edt_bms_dischg_cur_max.setReadOnly(True)
  273. self.important_data_glayout.addWidget(self.edt_bms_dischg_cur_max, 12, 2, 1, 1, Qt.AlignCenter)
  274. # 重要信息3 BAMS->EMS(上位机)
  275. # 最高单体电压值
  276. self.lb_bms_high_volt = QLabel(self.groupbox_important_data)
  277. self.lb_bms_high_volt.setText("最高单体电压值 [V]")
  278. self.important_data_glayout.addWidget(self.lb_bms_high_volt, 13, 0, 1, 1, Qt.AlignCenter)
  279. # self.edt_bms_high_volt_address = QLineEdit(self.groupbox_important_data)
  280. # self.important_data_glayout.addWidget(self.edt_bms_high_volt_address, 13, 1, 1, 1, Qt.AlignCenter)
  281. self.edt_bms_high_volt = QLineEdit(self.groupbox_important_data)
  282. self.edt_bms_high_volt.setReadOnly(True)
  283. self.important_data_glayout.addWidget(self.edt_bms_high_volt, 13, 2, 1, 1, Qt.AlignCenter)
  284. # 最低单体电压值
  285. self.lb_bms_low_volt = QLabel(self.groupbox_important_data)
  286. self.lb_bms_low_volt.setText("最低单体电压值 [V]")
  287. self.important_data_glayout.addWidget(self.lb_bms_low_volt, 14, 0, 1, 1, Qt.AlignCenter)
  288. # self.edt_bms_low_volt_address = QLineEdit(self.groupbox_important_data)
  289. # self.important_data_glayout.addWidget(self.edt_bms_low_volt_address, 14, 1, 1, 1, Qt.AlignCenter)
  290. self.edt_bms_low_volt = QLineEdit(self.groupbox_important_data)
  291. self.edt_bms_low_volt.setReadOnly(True)
  292. self.important_data_glayout.addWidget(self.edt_bms_low_volt, 14, 2, 1, 1, Qt.AlignCenter)
  293. # 最大允许充电电压
  294. self.lb_bms_chg_volt_high = QLabel(self.groupbox_important_data)
  295. self.lb_bms_chg_volt_high.setText("最大允许充电电压 [V]")
  296. self.important_data_glayout.addWidget(self.lb_bms_chg_volt_high, 15, 0, 1, 1, Qt.AlignCenter)
  297. # self.edt_bms_chg_volt_high_address = QLineEdit(self.groupbox_important_data)
  298. # self.important_data_glayout.addWidget(self.edt_bms_chg_volt_high_address, 15, 1, 1, 1, Qt.AlignCenter)
  299. self.edt_bms_chg_volt_high = QLineEdit(self.groupbox_important_data)
  300. self.edt_bms_chg_volt_high.setReadOnly(True)
  301. self.important_data_glayout.addWidget(self.edt_bms_chg_volt_high, 15, 2, 1, 1, Qt.AlignCenter)
  302. # 最大允许放电电压
  303. self.lb_bms_dischg_volt_high = QLabel(self.groupbox_important_data)
  304. self.lb_bms_dischg_volt_high.setText("最大允许放电电压 [V]")
  305. self.important_data_glayout.addWidget(self.lb_bms_dischg_volt_high, 16, 0, 1, 1, Qt.AlignCenter)
  306. # self.edt_bms_dischg_volt_high_address = QLineEdit(self.groupbox_important_data)
  307. # self.important_data_glayout.addWidget(self.edt_bms_dischg_volt_high_address, 16, 1, 1, 1, Qt.AlignCenter)
  308. self.edt_bms_dischg_volt_high = QLineEdit(self.groupbox_important_data)
  309. self.edt_bms_dischg_volt_high.setReadOnly(True)
  310. self.important_data_glayout.addWidget(self.edt_bms_dischg_volt_high, 16, 2, 1, 1, Qt.AlignCenter)
  311. # 重要信息4 BAMS->EMS(上位机)
  312. # 电池堆实时总电压
  313. self.lb_bms_volt = QLabel(self.groupbox_important_data)
  314. self.lb_bms_volt.setText("电池堆实时总电压 [V]")
  315. self.important_data_glayout.addWidget(self.lb_bms_volt, 17, 0, 1, 1, Qt.AlignCenter)
  316. # self.edt_bms_volt_address = QLineEdit(self.groupbox_important_data)
  317. # self.important_data_glayout.addWidget(self.edt_bms_volt_address, 17, 1, 1, 1, Qt.AlignCenter)
  318. self.edt_bms_volt = QLineEdit(self.groupbox_important_data)
  319. self.edt_bms_volt.setReadOnly(True)
  320. self.important_data_glayout.addWidget(self.edt_bms_volt, 17, 2, 1, 1, Qt.AlignCenter)
  321. # 电池堆实时总电流
  322. self.lb_bms_cur = QLabel(self.groupbox_important_data)
  323. self.lb_bms_cur.setText("电池堆实时总电流 [A]")
  324. self.important_data_glayout.addWidget(self.lb_bms_cur, 18, 0, 1, 1, Qt.AlignCenter)
  325. # self.edt_bms_cur_address = QLineEdit(self.groupbox_important_data)
  326. # self.important_data_glayout.addWidget(self.edt_bms_cur_address, 18, 1, 1, 1, Qt.AlignCenter)
  327. self.edt_bms_cur = QLineEdit(self.groupbox_important_data)
  328. self.edt_bms_cur.setReadOnly(True)
  329. self.important_data_glayout.addWidget(self.edt_bms_cur, 18, 2, 1, 1, Qt.AlignCenter)
  330. # 当前可充电能量
  331. self.lb_bms_chg_power_real = QLabel(self.groupbox_important_data)
  332. self.lb_bms_chg_power_real.setText("当前可充电能量 [kWh]")
  333. self.important_data_glayout.addWidget(self.lb_bms_chg_power_real, 19, 0, 1, 1, Qt.AlignCenter)
  334. # self.edt_bms_chg_power_real_address = QLineEdit(self.groupbox_important_data)
  335. # self.important_data_glayout.addWidget(self.edt_bms_chg_power_real_address, 19, 1, 1, 1, Qt.AlignCenter)
  336. self.edt_bms_chg_power_real = QLineEdit(self.groupbox_important_data)
  337. self.edt_bms_chg_power_real.setReadOnly(True)
  338. self.important_data_glayout.addWidget(self.edt_bms_chg_power_real, 19, 2, 1, 1, Qt.AlignCenter)
  339. # 当前可放电能量
  340. self.lb_bms_dischg_power_real = QLabel(self.groupbox_important_data)
  341. self.lb_bms_dischg_power_real.setText("当前可放电能量 [kWh]")
  342. self.important_data_glayout.addWidget(self.lb_bms_dischg_power_real, 20, 0, 1, 1, Qt.AlignCenter)
  343. # self.edt_bms_dischg_power_real_address = QLineEdit(self.groupbox_important_data)
  344. # self.important_data_glayout.addWidget(self.edt_bms_dischg_power_real_address, 20, 1, 1, 1, Qt.AlignCenter)
  345. self.edt_bms_dischg_power_real = QLineEdit(self.groupbox_important_data)
  346. self.edt_bms_dischg_power_real.setReadOnly(True)
  347. self.important_data_glayout.addWidget(self.edt_bms_dischg_power_real, 20, 2, 1, 1, Qt.AlignCenter)
  348. self.important_data_hlayout.addWidget(self.groupbox_important_data)
  349. self.right_layout.addWidget(self.important_data_widget)
  350. # 数据接口
  351. self.relay_widget = MyFrame(self.right_widget)
  352. self.relay_vlayout = QVBoxLayout(self.relay_widget)
  353. self.relay_vlayout.setContentsMargins(0, 0, 0, 0)
  354. self.relay_vlayout.setSpacing(0)
  355. self.groupbox_relay = QGroupBox(self.relay_widget)
  356. self.groupbox_relay.setTitle("PCS 控制指令")
  357. self.relay_glayout = QGridLayout(self.groupbox_relay)
  358. self.btn_all_on = QPushButton(self.groupbox_relay)
  359. self.btn_all_on.setText("一键闭合")
  360. self.relay_glayout.addWidget(self.btn_all_on, 0, 2, 1, 1, Qt.AlignCenter)
  361. self.btn_all_off = QPushButton(self.groupbox_relay)
  362. self.btn_all_off.setText("一键断开")
  363. self.relay_glayout.addWidget(self.btn_all_off, 1, 2, 1, 1, Qt.AlignCenter)
  364. self.lb_cls = QLabel(self.groupbox_relay)
  365. self.lb_cls.setText("簇号:")
  366. self.relay_glayout.addWidget(self.lb_cls, 0, 0, 1, 1, Qt.AlignCenter)
  367. self.cb_cls = QComboBox(self.groupbox_relay)
  368. self.cb_cls.addItems([str(i + 1) for i in range(16)])
  369. self.relay_glayout.addWidget(self.cb_cls, 0, 1, 1, 1)
  370. self.btn_cls_on = QPushButton(self.groupbox_relay)
  371. self.btn_cls_on.setText("闭合")
  372. self.relay_glayout.addWidget(self.btn_cls_on, 1, 0, 1, 1, Qt.AlignCenter)
  373. self.btn_cls_off = QPushButton(self.groupbox_relay)
  374. self.btn_cls_off.setText("断开")
  375. self.relay_glayout.addWidget(self.btn_cls_off, 1, 1, 1, 1, Qt.AlignCenter)
  376. self.relay_vlayout.addWidget(self.groupbox_relay)
  377. self.right_layout.addWidget(self.relay_widget)
  378. self.main_layout.addWidget(self.right_widget, stretch=2)
  379. main.setCentralWidget(self.central_widget)
  380. self.retranslateUi(main)
  381. QMetaObject.connectSlotsByName(main)
  382. def retranslateUi(self, MainWindow):
  383. _translate = QCoreApplication.translate
  384. MainWindow.setWindowTitle(_translate("MainWindow", "PCS模拟器"))
  385. self.groupbox_interface.setTitle(_translate("MainWindow", "数据接口"))
  386. # self.groupbox_pcs_connect.setTitle(_translate("MainWindow", "BMS开关"))