Add charge timer

This commit is contained in:
SimonovaMI 2025-06-21 16:49:18 +03:00
parent 30fb37fc30
commit 3eae4295e2
4 changed files with 70 additions and 30 deletions

View File

@ -302,7 +302,7 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>140</x> <x>140</x>
<y>670</y> <y>700</y>
<width>111</width> <width>111</width>
<height>16</height> <height>16</height>
</rect> </rect>
@ -321,7 +321,7 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>670</y> <y>700</y>
<width>141</width> <width>141</width>
<height>22</height> <height>22</height>
</rect> </rect>
@ -337,7 +337,7 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>-10</x> <x>-10</x>
<y>610</y> <y>640</y>
<width>131</width> <width>131</width>
<height>21</height> <height>21</height>
</rect> </rect>
@ -353,7 +353,7 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>10</x> <x>10</x>
<y>260</y> <y>290</y>
<width>121</width> <width>121</width>
<height>20</height> <height>20</height>
</rect> </rect>
@ -385,7 +385,7 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>10</x> <x>10</x>
<y>230</y> <y>260</y>
<width>121</width> <width>121</width>
<height>21</height> <height>21</height>
</rect> </rect>
@ -417,7 +417,7 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>480</y> <y>510</y>
<width>101</width> <width>101</width>
<height>20</height> <height>20</height>
</rect> </rect>
@ -446,7 +446,7 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>140</x> <x>140</x>
<y>640</y> <y>670</y>
<width>111</width> <width>111</width>
<height>16</height> <height>16</height>
</rect> </rect>
@ -465,7 +465,7 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>640</y> <y>670</y>
<width>111</width> <width>111</width>
<height>22</height> <height>22</height>
</rect> </rect>
@ -481,7 +481,7 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>10</x> <x>10</x>
<y>510</y> <y>540</y>
<width>81</width> <width>81</width>
<height>21</height> <height>21</height>
</rect> </rect>
@ -497,7 +497,7 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>140</x> <x>140</x>
<y>610</y> <y>640</y>
<width>111</width> <width>111</width>
<height>16</height> <height>16</height>
</rect> </rect>
@ -516,7 +516,7 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>100</x> <x>100</x>
<y>480</y> <y>510</y>
<width>111</width> <width>111</width>
<height>16</height> <height>16</height>
</rect> </rect>
@ -548,7 +548,7 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>140</x> <x>140</x>
<y>260</y> <y>290</y>
<width>61</width> <width>61</width>
<height>16</height> <height>16</height>
</rect> </rect>
@ -567,7 +567,7 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>100</x> <x>100</x>
<y>510</y> <y>540</y>
<width>111</width> <width>111</width>
<height>16</height> <height>16</height>
</rect> </rect>
@ -586,7 +586,7 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>140</x> <x>140</x>
<y>230</y> <y>260</y>
<width>51</width> <width>51</width>
<height>16</height> <height>16</height>
</rect> </rect>
@ -715,7 +715,7 @@
<rect> <rect>
<x>10</x> <x>10</x>
<y>10</y> <y>10</y>
<width>271</width> <width>251</width>
<height>21</height> <height>21</height>
</rect> </rect>
</property> </property>
@ -737,7 +737,7 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>10</x> <x>10</x>
<y>300</y> <y>330</y>
<width>231</width> <width>231</width>
<height>141</height> <height>141</height>
</rect> </rect>
@ -916,7 +916,7 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>100</x> <x>100</x>
<y>540</y> <y>570</y>
<width>111</width> <width>111</width>
<height>16</height> <height>16</height>
</rect> </rect>
@ -935,7 +935,7 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>10</x> <x>10</x>
<y>540</y> <y>570</y>
<width>81</width> <width>81</width>
<height>21</height> <height>21</height>
</rect> </rect>
@ -951,7 +951,7 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>10</x> <x>10</x>
<y>200</y> <y>230</y>
<width>81</width> <width>81</width>
<height>21</height> <height>21</height>
</rect> </rect>
@ -974,7 +974,7 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>450</y> <y>480</y>
<width>151</width> <width>151</width>
<height>16</height> <height>16</height>
</rect> </rect>
@ -997,7 +997,7 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>580</y> <y>610</y>
<width>311</width> <width>311</width>
<height>20</height> <height>20</height>
</rect> </rect>
@ -1016,12 +1016,47 @@
<set>Qt::AlignCenter</set> <set>Qt::AlignCenter</set>
</property> </property>
</widget> </widget>
<widget class="QLabel" name="charge_timer_label">
<property name="geometry">
<rect>
<x>190</x>
<y>190</y>
<width>61</width>
<height>22</height>
</rect>
</property>
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
<widget class="QLabel" name="charge_timer_l">
<property name="geometry">
<rect>
<x>20</x>
<y>190</y>
<width>171</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>Время зарядки конденсатора, с</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</widget> </widget>
<widget class="PlotWidget" name="graph_1"> <widget class="PlotWidget" name="graph_1">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>10</x> <x>10</x>
<y>10</y> <y>40</y>
<width>1521</width> <width>1521</width>
<height>111</height> <height>111</height>
</rect> </rect>

View File

@ -5,10 +5,8 @@
управелние перезагрузкой управелние перезагрузкой
2. чтение данных из файла и отображение 2. чтение данных из файла и отображение
""" """
import project.view import project.view
app = project.view.app app = project.view.app
window = project.view.Ui() window = project.view.Ui()
window.show() window.show()

View File

@ -46,6 +46,10 @@ class Ui(QtWidgets.QMainWindow):
self.point = 0 # координата, откуда начинать отрисовку, если используется полоса прокрутки?? self.point = 0 # координата, откуда начинать отрисовку, если используется полоса прокрутки??
self.file = "" # файл self.file = "" # файл
self.file_name = "" # наименование файла self.file_name = "" # наименование файла
self.sub_mode_previous = -1 # предыдущее значение подрежима, для вывода времени зарядки конденсатора
self.start_time_charging = 0 # начало подчета времени зарядки конденсатора
self.end_time_charging = 0 # конец подчета времени зарядки конденсатора
self.charging_time = 0 # время зарядки конденсатора
# Создание графиков # Создание графиков
self.graph_init() self.graph_init()
@ -289,7 +293,7 @@ class Ui(QtWidgets.QMainWindow):
self.Vn_cnt_label.setText(str(data_in.Vn_cnt)) self.Vn_cnt_label.setText(str(data_in.Vn_cnt))
self.U_batt_label.setText(str(float(data_in.bat_volt / 1000))) self.U_batt_label.setText(str(float(data_in.bat_volt / 1000)))
self.U_batt_p_label.setText(str(data_in.bat_pers)) self.U_batt_p_label.setText(str(data_in.bat_pers))
self.U_cap_label.setText(str(float(data_in.hv_volt / 100))) self.U_cap_label.setText(str(float(data_in.hv_volt / 10)))
self.now_energy_label.setText(str(data_in.now_energy)) self.now_energy_label.setText(str(data_in.now_energy))
self.filt_period_label.setText(str(data_in.filt_period)) self.filt_period_label.setText(str(data_in.filt_period))
self.last_period_label.setText(str(data_in.last_period_stat)) self.last_period_label.setText(str(data_in.last_period_stat))
@ -333,6 +337,14 @@ class Ui(QtWidgets.QMainWindow):
self.sub_modeB.setStyleSheet('background-color: grey; color: black') self.sub_modeB.setStyleSheet('background-color: grey; color: black')
self.sub_modeB.setText("Терапия не сработала") self.sub_modeB.setText("Терапия не сработала")
# Вывод времени зарядки конденсатора
if data_in.sub_mode == 1 and self.sub_mode_previous != 1:
self.start_time_charging = time.time()
if data_in.sub_mode == 1 and self.sub_mode_previous == 1:
self.end_time_charging = time.time()
self.sub_mode_previous = data_in.sub_mode
self.charge_timer_label.setText(f"{(self.end_time_charging - self.start_time_charging):.2f}")
# так удаляются элементы # так удаляются элементы
# стирание элементов спереди # стирание элементов спереди
all_items = self.graph_1.items() # Получаем все элементы all_items = self.graph_1.items() # Получаем все элементы

View File

@ -1,5 +0,0 @@
# python12
PyQt5~=5.15.11
pyqtgraph~=0.13.7
numpy~=2.2.3