diff --git a/params/operator_params.json b/params/operator_params.json index f1666e2..6b33d31 100644 --- a/params/operator_params.json +++ b/params/operator_params.json @@ -128,20 +128,20 @@ 0.005 ], "time_wielding": [ - 1.0, - 1.0, - 1.0, - 1.0, - 1.0, - 1.0, - 1.0, - 1.0, - 1.0, - 1.0, - 1.0, - 1.0, - 1.0, - 1.0 + 1.332, + 1.644, + 1.644, + 1.428, + 1.284, + 1.308, + 1.272, + 1.38, + 1.416, + 1.392, + 1.38, + 1.404, + 1.452, + 1.452 ], "time_command": [ 0.0, @@ -192,7 +192,7 @@ 0.0045 ], "force_target": [ - 4000.0, + 5000.0, 5000.0, 5000.0, 5000.0, @@ -222,5 +222,126 @@ 500.0, 500.0, 500.0 + ], + "Tesla closing": [ + 0.216, + + 0.228, + + 0.252, + + 0.216, + + 0.228, + + 0.216, + + 0.228, + + 0.228, + + 0.228, + + 0.216, + + 0.228, + + 0.216, + + 0.216, + + 0.216 + + ], + "Tesla squeeze": [ + 0.276, + + 0.288, + + 0.264, + + 0.264, + + 0.276, + + 0.276, + + 0.312, + + 0.276, + + 0.240, + + 0.240, + + 0.240, + + 0.240, + + 0.240, + + 0.240 + + ], + "Tesla welding": [ + 1.332, + + 1.644, + + 1.644, + + 1.428, + + 1.284, + + 1.308, + + 1.272, + + 1.380, + + 1.416, + + 1.392, + + 1.380, + + 1.404, + + 1.452, + + 1.452 + + ], + "Tesla oncomming_relief": [ + 0.528, + + 0.528, + + 0.540, + + 0.636, + + 0.504, + + 0.468, + + 0.492, + + 0.540, + + 0.563, + + 0.588, + + 0.541, + + 0.564, + + 0.576, + + 0.507 + ] + } \ No newline at end of file diff --git a/src/controller/__pycache__/passportFormer.cpython-310.pyc b/src/controller/__pycache__/passportFormer.cpython-310.pyc index 66f156d..b341e53 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 f90279f..f6b05c9 100644 --- a/src/controller/passportFormer.py +++ b/src/controller/passportFormer.py @@ -36,8 +36,8 @@ class PassportFormer(BasePointPassportFormer): def _build_passports_pocket(self, dataframe: pd.DataFrame) -> list[pd.DataFrame, dict, list]: passports_pocket = [] events, point_quantity = self._filter_events(dataframe["time"], dataframe) + system_settings = {key: value[0] for key, value in self._params[1].items()} - for i in range(0, point_quantity): if not dataframe["time"].isna().all(): operator_settings = {} @@ -56,7 +56,8 @@ class PassportFormer(BasePointPassportFormer): else: frame = dataframe point_events = {key: [value[0][i], value[1][i]] for key, value in events.items()} - passports_pocket.append([frame, ideal_data, point_events]) + tesla_events = sum([operator_settings[key] for key in self._tesla_stages]) + passports_pocket.append([frame, ideal_data, point_events, tesla_events]) return passports_pocket def update_settings(self, params: list[dict, dict]): diff --git a/src/gui/__pycache__/plotter.cpython-310.pyc b/src/gui/__pycache__/plotter.cpython-310.pyc index ed41dee..d729126 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/__pycache__/settings_window.cpython-310.pyc b/src/gui/__pycache__/settings_window.cpython-310.pyc index 76e27e9..eae86b7 100644 Binary files a/src/gui/__pycache__/settings_window.cpython-310.pyc and b/src/gui/__pycache__/settings_window.cpython-310.pyc differ diff --git a/src/gui/plotter.py b/src/gui/plotter.py index fb53772..a692411 100644 --- a/src/gui/plotter.py +++ b/src/gui/plotter.py @@ -1,5 +1,5 @@ import pandas as pd -from PyQt5.QtWidgets import QWidget, QVBoxLayout, QLabel +from PyQt5.QtWidgets import QWidget, QVBoxLayout, QLabel, QGraphicsRectItem import pyqtgraph as pg import numpy as np from numpy import floating @@ -63,7 +63,7 @@ class PlotWidget(BasePlotWidget): return ProcessStage(mean_value=mean, start_index=int(start), finish_index=int(finish)) return None - def _build_widget(self, data: list[pd.DataFrame, dict, list]) -> QWidget: + def _build_widget(self, data: list[pd.DataFrame, dict, dict, list]) -> QWidget: widget = QWidget() layout = QVBoxLayout() @@ -72,8 +72,8 @@ class PlotWidget(BasePlotWidget): df_continuous = pd.DataFrame({}) plot_widget, legend = self._init_plot_widget(title=channel) settings = description["Settings"] - - for dataframe, ideal_data, events in data: + + for dataframe, ideal_data, events, tesla_data in data: df_continuous = pd.concat([df_continuous, dataframe], axis=0) dataframe_headers = dataframe.columns.tolist() stages = events.keys() @@ -149,7 +149,24 @@ class PlotWidget(BasePlotWidget): if settings["performance"]: performance_list = np.array(performance_list) performance_label = QLabel(f"""Performance: best = {round(performance_list.max(),2)} %, worse = {round(performance_list.min(),2)} %, average = {round(performance_list.mean(),2)}%""") + + TWC_start = 0 + TWC_len = df_continuous["time"].max() + TWC_region = QGraphicsRectItem(TWC_start, -1000, TWC_start+TWC_len, 100) + TWC_region.setBrush(pg.mkBrush(0, 255, 0, 255)) + + tesla_start = 0 + tesla_len = 35.488 + tesla_reginon = QGraphicsRectItem(tesla_start, -1100, tesla_start+tesla_len ,100) + tesla_reginon.setBrush(pg.mkBrush(255, 0, 0, 255)) + + time_reduction = round((1 - TWC_len/tesla_len)*100, 2) + time_reduction_label = QLabel(f"Time reduction: {time_reduction} %") + layout.addWidget(performance_label) + layout.addWidget(time_reduction_label) + plot_widget.addItem(TWC_region) + plot_widget.addItem(tesla_reginon) layout.addWidget(plot_widget) diff --git a/src/gui/settings_window.py b/src/gui/settings_window.py index cdda08e..f0576b2 100644 --- a/src/gui/settings_window.py +++ b/src/gui/settings_window.py @@ -78,8 +78,9 @@ class settingsWindow(QWidget): def _restore(self) -> None: self._param_table.setRowCount(len(self._data)) - self._param_table.setColumnCount(len(self._data[self._data.keys()[0]])) + self._param_table.setColumnCount(len(self._data)+1) for i, (key, items) in enumerate(self._data.items()): + self._param_table.setColumnCount(len(self._data[key])+1) self._param_table.setItem(i, 0, QTableWidgetItem(key)) for j, item in enumerate(items): self._param_table.setItem(i, j+1, QTableWidgetItem(str(item))) diff --git a/src/utils/base/__pycache__/base.cpython-310.pyc b/src/utils/base/__pycache__/base.cpython-310.pyc index 12a9215..fdf72ef 100644 Binary files a/src/utils/base/__pycache__/base.cpython-310.pyc and b/src/utils/base/__pycache__/base.cpython-310.pyc differ diff --git a/src/utils/base/base.py b/src/utils/base/base.py index da61e93..9459004 100644 --- a/src/utils/base/base.py +++ b/src/utils/base/base.py @@ -147,27 +147,31 @@ class BasePlotWidget: } ] }, - "Electrode Force, N": { + "Electrode Posicion, mm": { "Settings": { - "zoom": True, - "stages": False, + "zoom": False, + "stages": True, "performance": False, "ideals": True }, "Real_signals": [ { - "name": "Electrode Force, N ME", + "name": "Rotor Position, mm ME", "pen": 'r', }, { - "name": "Electrode Force, N FE", + "name": "Rotor Position, mm FE", "pen": 'w', } ], "Ideal_signals": [ { - "name": "Force", - "pen": {'color': 'r', 'width':3}, + "name": "Posicion ME", + "pen": {'color': 'g', 'width':3}, + }, + { + "name": "Posicion ME", + "pen": {'color': 'b', 'width':3}, } ] }, @@ -341,6 +345,12 @@ class BasePointPassportFormer: "Relief", "Oncomming" ] + self._tesla_stages = [ + "Tesla squeeze", + "Tesla closing", + "Tesla welding", + "Tesla oncomming_relief" + ] def _find_indexes(self, signal: str,