dev: добавлено отображение идеальной производительности при построении только идеального цикла

This commit is contained in:
Andrew 2024-12-25 16:47:35 +03:00
parent 4a90b4aaa4
commit 05177a90b9
4 changed files with 19 additions and 9 deletions

View File

@ -56,7 +56,8 @@ class PassportFormer(BasePointPassportFormer):
idx_shift = True if events[self._stages[-1]][0][0] == 0 else False idx_shift = True if events[self._stages[-1]][0][0] == 0 else False
else: else:
events = None events = None
point_quantity = 1 key = list(self._params[0].keys())[0]
point_quantity = len(self._params[0][key])
points_pocket = [] points_pocket = []
system_settings = {key: value[0] for key, value in self._params[1].items()} system_settings = {key: value[0] for key, value in self._params[1].items()}

View File

@ -162,8 +162,11 @@ class PlotWidget(BasePlotWidget):
label_layout = QHBoxLayout(label_widget) label_layout = QHBoxLayout(label_widget)
start_label = QLabel("Сокращение длительности: ") start_label = QLabel("Сокращение длительности: ")
real_label = QLabel(f"фактическое = {tesla_TWC} % ") real_label = QLabel(f"фактическое = {tesla_TWC} % ")
if not tesla_TWC or not TWC_time: real_label.setVisible(False)
ideal_label = QLabel(f"идеальное = {tesla_ideal} % ") ideal_label = QLabel(f"идеальное = {tesla_ideal} % ")
if not tesla_ideal: ideal_label.setVisible(False)
kdip_label = QLabel(f"КДИП = {TWC_ideal}% ") kdip_label = QLabel(f"КДИП = {TWC_ideal}% ")
if not TWC_ideal: kdip_label.setVisible(False)
label_layout.addWidget(start_label, alignment=Qt.AlignLeft) label_layout.addWidget(start_label, alignment=Qt.AlignLeft)
label_layout.addWidget(real_label, alignment=Qt.AlignLeft) label_layout.addWidget(real_label, alignment=Qt.AlignLeft)
label_layout.addWidget(ideal_label, alignment=Qt.AlignLeft) label_layout.addWidget(ideal_label, alignment=Qt.AlignLeft)
@ -209,7 +212,7 @@ class PlotWidget(BasePlotWidget):
for widget_num, (channel, description) in enumerate(self._plt_channels.items()): for widget_num, (channel, description) in enumerate(self._plt_channels.items()):
plot_item, legend = self._init_plot_item(title=channel) plot_item, legend = self._init_plot_item(title=channel)
settings = description["Settings"] settings = description["Settings"]
global_shift = 0
TWC_time = 0.0 TWC_time = 0.0
ideal_time = 0.0 ideal_time = 0.0
worst_perf = 2 worst_perf = 2
@ -230,13 +233,14 @@ class PlotWidget(BasePlotWidget):
ideal_data = copy.deepcopy(ideal_dat) ideal_data = copy.deepcopy(ideal_dat)
if dat_is_none: if dat_is_none:
worst_timeframe = point_timeframe = [0, ideal_data["Ideal cycle"]] worst_timeframe = point_timeframe = [global_shift, global_shift+ ideal_data["Ideal cycle"]]
point_events = {} point_events = {}
keys = list(ideal_data.keys()) keys = list(ideal_data.keys())
shift = 0 shift = 0
for i, time in enumerate(ideal_data["Ideal timings"]): for i, time in enumerate(ideal_data["Ideal timings"]):
point_events[keys[i]] = [shift, time+shift] point_events[keys[i]] = [global_shift+shift, global_shift+time+shift]
shift += time shift += time
global_shift +=ideal_data["Ideal cycle"]
# TODO: проверить корректность расчетов # TODO: проверить корректность расчетов
if settings["force compensation FE"] and not dat_is_none: if settings["force compensation FE"] and not dat_is_none:
@ -288,14 +292,18 @@ class PlotWidget(BasePlotWidget):
self._add_ideal_signals(plot_item, ideal_data, point_events, description["Ideal_signals"], curve_items) self._add_ideal_signals(plot_item, ideal_data, point_events, description["Ideal_signals"], curve_items)
# Подсчёт производительности # Подсчёт производительности
if settings["performance"]and not dat_is_none: if settings["performance"]:
is_last_point = (cur_point == len(points_pocket) - 1) is_last_point = (cur_point == len(points_pocket) - 1)
if is_last_point: if is_last_point:
TWC_delta = sum([point_events[stage][1] - point_events[stage][0] for stage in ["Closing", "Squeeze", "Welding"]]) if not dat_is_none: TWC_delta = sum([point_events[stage][1] - point_events[stage][0]
ideal_delta = sum(ideal_data["Ideal timings"][0:3]) for stage in ["Closing", "Squeeze", "Welding"]])
else: TWC_delta = 0
ideal_delta = sum(ideal_data["Ideal timings"][0:3])
else: else:
TWC_delta = point_timeframe[1] - point_timeframe[0] if not dat_is_none: TWC_delta = point_timeframe[1] - point_timeframe[0]
else: TWC_delta = 0
ideal_delta = ideal_data["Ideal cycle"] ideal_delta = ideal_data["Ideal cycle"]
TWC_time += TWC_delta TWC_time += TWC_delta
ideal_time += ideal_delta ideal_time += ideal_delta
curr_perf = ideal_delta/TWC_delta if TWC_delta != 0 else 1 curr_perf = ideal_delta/TWC_delta if TWC_delta != 0 else 1
@ -304,6 +312,7 @@ class PlotWidget(BasePlotWidget):
worst_perf = curr_perf worst_perf = curr_perf
worst_timeframe = point_timeframe worst_timeframe = point_timeframe
# Считаем прогресс # Считаем прогресс
self._update_status(widget_steps, point_steps, widget_num, cur_point) self._update_status(widget_steps, point_steps, widget_num, cur_point)
@ -316,7 +325,7 @@ class PlotWidget(BasePlotWidget):
# Связываем остальные графики с основным графиком # Связываем остальные графики с основным графиком
plot_item.setXLink(main_plot) plot_item.setXLink(main_plot)
if settings["performance"] and not dat_is_none: if settings["performance"]:
self._add_performance_label(result_layout, TWC_time, ideal_time, tesla_time, qt_items) self._add_performance_label(result_layout, TWC_time, ideal_time, tesla_time, qt_items)
plot_layout.addItem(plot_item, widget_num, 0) plot_layout.addItem(plot_item, widget_num, 0)