Exemplo n.º 1
0
    def compute(self):
        """

        :return:
        """

        self.tower_driver.tower.frequency = self.ui.frequency_doubleSpinBox.value()
        self.tower_driver.tower.earth_resistivity = self.ui.rho_doubleSpinBox.value()

        # heck the wires configuration
        logs = Logger()
        all_ok = self.tower_driver.tower.check(logs)

        if not all_ok:
            logger_diag = LogsDialogue(name='Tower computation', logs=logs)
            logger_diag.exec_()
        else:
            try:
                # compute the matrices
                self.tower_driver.tower.compute()

                # Impedances in Ohm/km
                cols = ['Phase' + str(i) for i in self.tower_driver.tower.z_phases_abcn]
                z_df = pd.DataFrame(data=self.tower_driver.tower.z_abcn, columns=cols, index=cols)
                self.ui.z_tableView_abcn.setModel(PandasModel(z_df))

                cols = ['Phase' + str(i) for i in self.tower_driver.tower.z_phases_abc]
                z_df = pd.DataFrame(data=self.tower_driver.tower.z_abc, columns=cols, index=cols)
                self.ui.z_tableView_abc.setModel(PandasModel(z_df))

                cols = ['Sequence ' + str(i) for i in range(3)]
                z_df = pd.DataFrame(data=self.tower_driver.tower.z_seq, columns=cols, index=cols)
                self.ui.z_tableView_seq.setModel(PandasModel(z_df))

                # Admittances in uS/km
                cols = ['Phase' + str(i) for i in self.tower_driver.tower.y_phases_abcn]
                z_df = pd.DataFrame(data=self.tower_driver.tower.y_abcn * 1e6, columns=cols, index=cols)
                self.ui.y_tableView_abcn.setModel(PandasModel(z_df))

                cols = ['Phase' + str(i) for i in self.tower_driver.tower.y_phases_abc]
                z_df = pd.DataFrame(data=self.tower_driver.tower.y_abc * 1e6, columns=cols, index=cols)
                self.ui.y_tableView_abc.setModel(PandasModel(z_df))

                cols = ['Sequence ' + str(i) for i in range(3)]
                z_df = pd.DataFrame(data=self.tower_driver.tower.y_seq * 1e6, columns=cols, index=cols)
                self.ui.y_tableView_seq.setModel(PandasModel(z_df))

                # plot
                self.plot()

            except:
                exc_type, exc_value, exc_traceback = sys.exc_info()
                self.msg(str(exc_traceback) + '\n' + str(exc_value), 'Tower calculation')
Exemplo n.º 2
0
 def display_profiles(self):
     # set the loaded data_frame to the GUI
     model = PandasModel(self.original_data_frame)
     self.ui.tableView.setModel(model)
     self.ui.sources_list.setModel(get_list_model(self.profile_names))