diff --git a/src/controller/__pycache__/passportFormer.cpython-310.pyc b/src/controller/__pycache__/passportFormer.cpython-310.pyc index 4e1ce22..c02bade 100644 Binary files a/src/controller/__pycache__/passportFormer.cpython-310.pyc and b/src/controller/__pycache__/passportFormer.cpython-310.pyc differ diff --git a/src/controller/passportFormer.py b/src/controller/passportFormer.py index a773078..e7d4c95 100644 --- a/src/controller/passportFormer.py +++ b/src/controller/passportFormer.py @@ -56,7 +56,8 @@ class PassportFormer(BasePointPassportFormer): idx_shift = True if events[self._stages[-1]][0][0] == 0 else False else: events = None - point_quantity = 1 + key = list(self._params[0].keys())[0] + point_quantity = len(self._params[0][key]) points_pocket = [] system_settings = {key: value[0] for key, value in self._params[1].items()} diff --git a/src/gui/__pycache__/plotter.cpython-310.pyc b/src/gui/__pycache__/plotter.cpython-310.pyc index 0a61a38..5c7727a 100644 Binary files a/src/gui/__pycache__/plotter.cpython-310.pyc and b/src/gui/__pycache__/plotter.cpython-310.pyc differ diff --git a/src/gui/plotter.py b/src/gui/plotter.py index f855d4e..5d55b81 100644 --- a/src/gui/plotter.py +++ b/src/gui/plotter.py @@ -162,8 +162,11 @@ class PlotWidget(BasePlotWidget): label_layout = QHBoxLayout(label_widget) start_label = QLabel("Сокращение длительности: ") real_label = QLabel(f"фактическое = {tesla_TWC} % ") + if not tesla_TWC or not TWC_time: real_label.setVisible(False) ideal_label = QLabel(f"идеальное = {tesla_ideal} % ") + if not tesla_ideal: ideal_label.setVisible(False) 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(real_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()): plot_item, legend = self._init_plot_item(title=channel) settings = description["Settings"] - + global_shift = 0 TWC_time = 0.0 ideal_time = 0.0 worst_perf = 2 @@ -230,13 +233,14 @@ class PlotWidget(BasePlotWidget): ideal_data = copy.deepcopy(ideal_dat) 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 = {} keys = list(ideal_data.keys()) shift = 0 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 + global_shift +=ideal_data["Ideal cycle"] # TODO: проверить корректность расчетов 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) # Подсчёт производительности - if settings["performance"]and not dat_is_none: + if settings["performance"]: is_last_point = (cur_point == len(points_pocket) - 1) if is_last_point: - TWC_delta = sum([point_events[stage][1] - point_events[stage][0] for stage in ["Closing", "Squeeze", "Welding"]]) - ideal_delta = sum(ideal_data["Ideal timings"][0:3]) + if not dat_is_none: TWC_delta = sum([point_events[stage][1] - point_events[stage][0] + for stage in ["Closing", "Squeeze", "Welding"]]) + else: TWC_delta = 0 + ideal_delta = sum(ideal_data["Ideal timings"][0:3]) 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"] + TWC_time += TWC_delta ideal_time += ideal_delta curr_perf = ideal_delta/TWC_delta if TWC_delta != 0 else 1 @@ -303,6 +311,7 @@ class PlotWidget(BasePlotWidget): if curr_perf < worst_perf: worst_perf = curr_perf worst_timeframe = point_timeframe + # Считаем прогресс self._update_status(widget_steps, point_steps, widget_num, cur_point) @@ -316,7 +325,7 @@ class PlotWidget(BasePlotWidget): # Связываем остальные графики с основным графиком 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) plot_layout.addItem(plot_item, widget_num, 0)